1 --- desktop-file-utils-0.6/src/menu-process.c.directory-mtime 2004-05-03 23:09:03.888792776 -0400
2 +++ desktop-file-utils-0.6/src/menu-process.c 2004-05-03 23:09:03.934785784 -0400
4 /* make a shorter name */
5 typedef struct DesktopEntryTreeNode TreeNode;
7 +/* FIXME modification time is kept on the tree right now,
8 + * but should really be kept on the individual Entries and
9 + * subdirs themselves.
11 struct DesktopEntryTree
16 MenuNode *resolved_node;
19 GSList *monitored_dirs;
22 @@ -1039,6 +1044,12 @@
23 return tree->menu_file;
26 +const time_t desktop_entry_tree_get_mtime (DesktopEntryTree *tree)
28 + g_return_val_if_fail (tree != NULL, 0);
34 desktop_entry_tree_load (const char *filename,
36 tree->orig_node = orig_node;
37 tree->resolved_node = resolved_node;
39 + tree->mtime = time (NULL); /* Initial modification time of now */
40 tree->monitored_dirs = NULL;
43 @@ -1193,6 +1205,11 @@
44 tree->root = new_node;
45 process_only_unallocated (tree->root, allocated);
46 remove_empty_submenus (tree->root);
48 + /* Update the modification time for the tree, so the
49 + * panel knows to reload the VFS directory.
51 + tree->mtime = time (NULL);
54 g_hash_table_destroy (allocated);
55 --- desktop-file-utils-0.6/src/menu-process.h.directory-mtime 2004-05-03 23:09:03.891792320 -0400
56 +++ desktop-file-utils-0.6/src/menu-process.h 2004-05-03 23:09:03.937785328 -0400
58 #define MENU_PROCESS_H
62 #include "desktop_file.h"
64 typedef struct DesktopEntryTree DesktopEntryTree;
67 const char *desktop_entry_tree_get_menu_file_name (DesktopEntryTree *tree);
69 +const time_t desktop_entry_tree_get_mtime (DesktopEntryTree *tree);
71 /* Callback for each .desktop directory added */
72 typedef void (*DesktopEntryTreeDirAddCallback)(DesktopEntryTree * tree, const char *path);
73 void desktop_entry_tree_diradd_callback_set (DesktopEntryTreeDirAddCallback proc);
74 --- desktop-file-utils-0.6/src/menu-method.c.directory-mtime 2004-05-03 23:09:03.912789128 -0400
75 +++ desktop-file-utils-0.6/src/menu-method.c 2004-05-03 23:42:05.910479680 -0400
78 /* Fill in dir info that's true for all dirs in the vfs */
80 -fill_in_generic_dir_info (GnomeVFSFileInfo *info,
81 - GnomeVFSFileInfoOptions options)
82 +fill_in_generic_dir_info (GnomeVFSFileInfo *info,
83 + GnomeVFSFileInfoOptions options,
84 + DesktopEntryTree *tree)
86 info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
88 @@ -1048,10 +1049,16 @@
89 /* We always own it */
90 info->uid = getuid ();
91 info->gid = getgid ();
94 + /* FIXME mtime is currently taken from the tree itself,
95 + * and is not stored on the actual VFS objects themselves.
97 + info->mtime = desktop_entry_tree_get_mtime (tree);
100 GNOME_VFS_FILE_INFO_FIELDS_TYPE |
101 - GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
102 + GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS |
103 + GNOME_VFS_FILE_INFO_FIELDS_MTIME;
107 @@ -1064,13 +1071,14 @@
108 g_assert (node != NULL);
109 g_assert (file_info != NULL);
111 - fill_in_generic_dir_info (file_info, options);
112 + fill_in_generic_dir_info (file_info, options, tree);
115 /* Fill in file info that's true for all .desktop files */
117 fill_in_generic_file_info (GnomeVFSFileInfo *info,
118 - GnomeVFSFileInfoOptions options)
119 + GnomeVFSFileInfoOptions options,
120 + DesktopEntryTree *tree)
122 info->type = GNOME_VFS_FILE_TYPE_REGULAR;
124 @@ -1097,8 +1105,14 @@
125 info->uid = getuid ();
126 info->gid = getgid ();
128 + /* FIXME mtime is currently taken from the tree itself,
129 + * and is not stored on the actual VFS objects themselves.
131 + info->mtime = desktop_entry_tree_get_mtime (tree);
133 info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE |
134 - GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
135 + GNOME_VFS_FILE_INFO_FIELDS_MTIME |
136 + GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
140 @@ -1113,7 +1127,7 @@
141 g_assert (path != NULL);
142 g_assert (file_info != NULL);
144 - fill_in_generic_file_info (file_info, options);
145 + fill_in_generic_file_info (file_info, options, tree);
148 static GnomeVFSResult
149 @@ -1452,9 +1466,9 @@
150 handle->current += 1;
152 if (handle->current <= handle->n_entries_that_are_subdirs) {
153 - fill_in_generic_dir_info (info, handle->options);
154 + fill_in_generic_dir_info (info, handle->options, handle->tree);
156 - fill_in_generic_file_info (info, handle->options);
157 + fill_in_generic_file_info (info, handle->options, handle->tree);
160 info->valid_fields &= ~ UNSUPPORTED_INFO_FIELDS;