[gvfs] recent: Set G_FILE_ATTRIBUTE_RECENT_MODIFED attribute
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] recent: Set G_FILE_ATTRIBUTE_RECENT_MODIFED attribute
- Date: Mon, 13 Feb 2017 13:29:15 +0000 (UTC)
commit febe35c3f538cb01916c0b8e3b006fda3dedb7b4
Author: Ondrej Holy <oholy redhat com>
Date: Thu Jan 19 16:11:26 2017 +0100
recent: Set G_FILE_ATTRIBUTE_RECENT_MODIFED attribute
G_FILE_ATTRIBUTE_TIME_ACCESS is used for sorting currently, however,
it causes troubles, because some daemons (i.e. dropbox) access
files and updates its timestamps itself. This attribute propagates
time when the metadata was last changed, which is what we need for
sorting in client applications.
https://bugzilla.gnome.org/show_bug.cgi?id=777507
daemon/gvfsbackendrecent.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsbackendrecent.c b/daemon/gvfsbackendrecent.c
index ad75e2a..14706d4 100644
--- a/daemon/gvfsbackendrecent.c
+++ b/daemon/gvfsbackendrecent.c
@@ -31,6 +31,7 @@ typedef struct {
char *uri;
char *display_name;
GFile *file;
+ time_t modified;
} RecentItem;
struct OPAQUE_TYPE__GVfsBackendRecent
@@ -318,6 +319,9 @@ recent_backend_add_info (RecentItem *item,
g_file_info_set_attribute_boolean (info,
G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE,
TRUE);
+
+ /* G_FILE_ATTRIBUTE_RECENT_MODIFIED */
+ g_file_info_set_attribute_int64 (info, "recent::modified", item->modified);
}
static gboolean
@@ -376,6 +380,7 @@ recent_item_update (RecentItem *item,
gboolean changed = FALSE;
const char *uri;
const char *display_name;
+ time_t modified;
uri = gtk_recent_info_get_uri (info);
if (g_strcmp0 (item->uri, uri) != 0)
@@ -396,6 +401,13 @@ recent_item_update (RecentItem *item,
item->display_name = g_strdup (display_name);
}
+ modified = gtk_recent_info_get_modified (info);
+ if (item->modified != modified)
+ {
+ changed = TRUE;
+ item->modified = modified;
+ }
+
return changed;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]