[gnome-control-center] background: Add "needs-download" property



commit f77d23f35ac1f2ac46c7f1ccb7a9cb1b916c3d00
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 14 17:47:01 2011 +0000

    background: Add "needs-download" property
    
    Rather than relying on source-url being NULL, which would mean
    we can't then save it.

 panels/background/cc-background-item.c |   34 +++++++++++++++++++++++++++++++-
 panels/background/cc-background-item.h |    1 +
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index 288955e..35780d7 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -50,6 +50,7 @@ struct CcBackgroundItemPrivate
         char            *source_url; /* Used by the Flickr source */
         char            *source_xml; /* Used by the Wallpapers source */
         gboolean         is_deleted;
+        gboolean         needs_download;
         CcBackgroundItemFlags flags;
 
         /* internal */
@@ -71,7 +72,8 @@ enum {
         PROP_SOURCE_URL,
         PROP_SOURCE_XML,
         PROP_FLAGS,
-        PROP_SIZE
+        PROP_SIZE,
+        PROP_NEEDS_DOWNLOAD
 };
 
 static void     cc_background_item_class_init     (CcBackgroundItemClass *klass);
@@ -463,6 +465,21 @@ cc_background_item_get_size (CcBackgroundItem *item)
 }
 
 static void
+_set_needs_download (CcBackgroundItem *item,
+		     gboolean          value)
+{
+	item->priv->needs_download = value;
+}
+
+gboolean
+cc_background_item_get_needs_download (CcBackgroundItem *item)
+{
+	g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), 0);
+
+	return item->priv->needs_download;
+}
+
+static void
 cc_background_item_set_property (GObject      *object,
                                  guint         prop_id,
                                  const GValue *value,
@@ -503,6 +520,9 @@ cc_background_item_set_property (GObject      *object,
 	case PROP_FLAGS:
 		_set_flags (self, g_value_get_flags (value));
 		break;
+	case PROP_NEEDS_DOWNLOAD:
+		_set_needs_download (self, g_value_get_boolean (value));
+		break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                 break;
@@ -553,6 +573,9 @@ cc_background_item_get_property (GObject    *object,
 	case PROP_SIZE:
 		g_value_set_string (value, self->priv->size);
 		break;
+	case PROP_NEEDS_DOWNLOAD:
+		g_value_set_boolean (value, self->priv->needs_download);
+		break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                 break;
@@ -670,6 +693,14 @@ cc_background_item_class_init (CcBackgroundItemClass *klass)
                                                               NULL,
                                                               G_PARAM_READABLE));
 
+        g_object_class_install_property (object_class,
+                                         PROP_NEEDS_DOWNLOAD,
+                                         g_param_spec_boolean ("needs-download",
+                                                               NULL,
+                                                               NULL,
+                                                               TRUE,
+                                                               G_PARAM_READWRITE));
+
 
         g_type_class_add_private (klass, sizeof (CcBackgroundItemPrivate));
 }
@@ -685,6 +716,7 @@ cc_background_item_init (CcBackgroundItem *item)
         item->priv->placement = G_DESKTOP_BACKGROUND_STYLE_SCALED;
         item->priv->primary_color = g_strdup ("#000000000000");
         item->priv->secondary_color = g_strdup ("#000000000000");
+        item->priv->needs_download = TRUE;
         item->priv->flags = 0;
 }
 
diff --git a/panels/background/cc-background-item.h b/panels/background/cc-background-item.h
index 1840dd9..943d0d4 100644
--- a/panels/background/cc-background-item.h
+++ b/panels/background/cc-background-item.h
@@ -91,6 +91,7 @@ const char *              cc_background_item_get_pcolor     (CcBackgroundItem *i
 const char *              cc_background_item_get_scolor     (CcBackgroundItem *item);
 const char *              cc_background_item_get_name       (CcBackgroundItem *item);
 const char *              cc_background_item_get_size       (CcBackgroundItem *item);
+gboolean                  cc_background_item_get_needs_download (CcBackgroundItem *item);
 
 gboolean                  cc_background_item_compare        (CcBackgroundItem *saved,
 							     CcBackgroundItem *configured);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]