summaryrefslogtreecommitdiff
path: root/panels/background/cc-background-item.c
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2013-01-25 11:56:58 +0000
committerBastien Nocera <hadess@hadess.net>2013-01-31 11:46:07 +0100
commitc3446cccdcf3c3ae3a321d1f65536e6e97a98a71 (patch)
tree492f4978eb68f944452ec9f928f5a09fee922ae6 /panels/background/cc-background-item.c
parent3c0af77abb741608c9d1032b1c4cb288ce697113 (diff)
downloadgnome-control-center-c3446cccdcf3c3ae3a321d1f65536e6e97a98a71.tar.gz
background: Sort Pictures in order of most recently modified
In the picture browser you see the most recently modified pictures first. https://bugzilla.gnome.org/show_bug.cgi?id=691800
Diffstat (limited to 'panels/background/cc-background-item.c')
-rw-r--r--panels/background/cc-background-item.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index a29a12651..d61aa0e53 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -50,6 +50,7 @@ struct CcBackgroundItemPrivate
gboolean is_deleted;
gboolean needs_download;
CcBackgroundItemFlags flags;
+ guint64 modified;
/* internal */
GnomeBG *bg;
@@ -71,7 +72,8 @@ enum {
PROP_SOURCE_XML,
PROP_FLAGS,
PROP_SIZE,
- PROP_NEEDS_DOWNLOAD
+ PROP_NEEDS_DOWNLOAD,
+ PROP_MODIFIED
};
static void cc_background_item_class_init (CcBackgroundItemClass *klass);
@@ -285,6 +287,7 @@ update_info (CcBackgroundItem *item,
item->priv->name = g_strdup (g_file_info_get_display_name (info));
item->priv->mime_type = g_strdup (g_file_info_get_content_type (info));
+ item->priv->modified = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
}
if (info != NULL)
@@ -503,6 +506,14 @@ cc_background_item_get_needs_download (CcBackgroundItem *item)
return item->priv->needs_download;
}
+guint64
+cc_background_item_get_modified (CcBackgroundItem *item)
+{
+ g_return_val_if_fail (CC_IS_BACKGROUND_ITEM (item), 0);
+
+ return item->priv->modified;
+}
+
static void
cc_background_item_set_property (GObject *object,
guint prop_id,
@@ -600,6 +611,9 @@ cc_background_item_get_property (GObject *object,
case PROP_NEEDS_DOWNLOAD:
g_value_set_boolean (value, self->priv->needs_download);
break;
+ case PROP_MODIFIED:
+ g_value_set_uint64 (value, self->priv->modified);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -725,6 +739,16 @@ cc_background_item_class_init (CcBackgroundItemClass *klass)
TRUE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_MODIFIED,
+ g_param_spec_uint64 ("modified",
+ "modified",
+ NULL,
+ 0,
+ G_MAXUINT64,
+ 0,
+ G_PARAM_READABLE));
+
g_type_class_add_private (klass, sizeof (CcBackgroundItemPrivate));
}
@@ -742,6 +766,7 @@ cc_background_item_init (CcBackgroundItem *item)
item->priv->secondary_color = g_strdup ("#000000000000");
item->priv->needs_download = TRUE;
item->priv->flags = 0;
+ item->priv->modified = 0;
}
static void
@@ -871,6 +896,7 @@ cc_background_item_dump (CcBackgroundItem *item)
if (priv->mime_type)
g_debug ("mime-type:\t\t%s", priv->mime_type);
g_debug ("dimensions:\t\t%d x %d", priv->width, priv->height);
+ g_debug ("modified: %u", priv->modified);
g_debug (" ");
}