]> git.pld-linux.org Git - packages/desktop-file-utils.git/blob - desktop-file-utils-directory_mtime.patch
- added nodisplay and noshowin patches (support for NoDisplay and NoShowIn
[packages/desktop-file-utils.git] / desktop-file-utils-directory_mtime.patch
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
3 @@ -1005,6 +1005,10 @@
4  /* make a shorter name */
5  typedef struct DesktopEntryTreeNode TreeNode;
6  
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.
10 + */
11  struct DesktopEntryTree
12  {
13    int refcount;
14 @@ -1015,6 +1019,7 @@
15    MenuNode   *orig_node;
16    MenuNode   *resolved_node;
17    TreeNode   *root;
18 +  time_t     mtime;
19    GSList     *monitored_dirs;    
20  };
21  
22 @@ -1039,6 +1044,12 @@
23    return tree->menu_file;
24  }
25  
26 +const time_t desktop_entry_tree_get_mtime (DesktopEntryTree *tree)
27 +{
28 +  g_return_val_if_fail (tree != NULL, 0);
29 +
30 +  return tree->mtime;
31 +}
32  
33  DesktopEntryTree*
34  desktop_entry_tree_load (const char  *filename,
35 @@ -1107,6 +1118,7 @@
36    tree->orig_node = orig_node;
37    tree->resolved_node = resolved_node;
38    tree->root = NULL;
39 +  tree->mtime = time (NULL);   /* Initial modification time of now */
40    tree->monitored_dirs = NULL;
41    
42    return tree;
43 @@ -1193,6 +1205,11 @@
44      tree->root = new_node;
45      process_only_unallocated (tree->root, allocated);
46      remove_empty_submenus (tree->root);
47 +
48 +    /* Update the modification time for the tree, so the
49 +     * panel knows to reload the VFS directory.
50 +     */
51 +    tree->mtime = time (NULL);
52    }
53  
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
57 @@ -23,6 +23,7 @@
58  #define MENU_PROCESS_H
59  
60  #include <glib.h>
61 +#include <time.h>
62  #include "desktop_file.h"
63  
64  typedef struct DesktopEntryTree     DesktopEntryTree;
65 @@ -137,6 +138,8 @@
66                                       GError          **error);
67  const char *desktop_entry_tree_get_menu_file_name (DesktopEntryTree *tree);
68  
69 +const time_t desktop_entry_tree_get_mtime (DesktopEntryTree *tree);
70 +
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
76 @@ -1024,8 +1024,9 @@
77  
78  /* Fill in dir info that's true for all dirs in the vfs */
79  static void
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)
85  {
86         info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
87         
88 @@ -1048,10 +1049,16 @@
89         /* We always own it */
90         info->uid = getuid ();
91         info->gid = getgid ();
92 -       
93 +
94 +     /* FIXME  mtime is currently taken from the tree itself,
95 +      * and is not stored on the actual VFS objects themselves.
96 +      */
97 +     info->mtime = desktop_entry_tree_get_mtime (tree);
98 +
99         info->valid_fields |=
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;
104  }
105  
106  static void
107 @@ -1064,13 +1071,14 @@
108         g_assert (node != NULL);
109         g_assert (file_info != NULL);
110  
111 -       fill_in_generic_dir_info (file_info, options);
112 +       fill_in_generic_dir_info (file_info, options, tree);
113  }
114  
115  /* Fill in file info that's true for all .desktop files */
116  static void
117  fill_in_generic_file_info (GnomeVFSFileInfo         *info,
118 -                          GnomeVFSFileInfoOptions   options)
119 +                           GnomeVFSFileInfoOptions   options,
120 +                           DesktopEntryTree         *tree)
121  {
122         info->type = GNOME_VFS_FILE_TYPE_REGULAR;
123         
124 @@ -1097,8 +1105,14 @@
125         info->uid = getuid ();
126         info->gid = getgid ();
127         
128 +     /* FIXME  mtime is currently taken from the tree itself,
129 +      * and is not stored on the actual VFS objects themselves.
130 +      */
131 +     info->mtime = desktop_entry_tree_get_mtime (tree);
132 +
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;
137  }
138  
139  static void
140 @@ -1113,7 +1127,7 @@
141         g_assert (path != NULL);
142         g_assert (file_info != NULL);
143         
144 -       fill_in_generic_file_info (file_info, options);
145 +       fill_in_generic_file_info (file_info, options, tree);
146  }
147  
148  static GnomeVFSResult
149 @@ -1452,9 +1466,9 @@
150          handle->current += 1;
151  
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);
155         } else {
156 -               fill_in_generic_file_info (info, handle->options);
157 +               fill_in_generic_file_info (info, handle->options, handle->tree);
158         }
159  
160          info->valid_fields &= ~ UNSUPPORTED_INFO_FIELDS;
This page took 0.042664 seconds and 3 git commands to generate.