+++ /dev/null
---- desktop-file-utils-0.6/src/menu-process.c.directory-change-notify 2004-05-03 23:46:00.074881280 -0400
-+++ desktop-file-utils-0.6/src/menu-process.c 2004-05-03 23:47:09.124384160 -0400
-@@ -41,8 +41,16 @@
- const char *name,
- gboolean create_if_not_found);
-
-+static DesktopEntryTreeDirAddCallback dir_add_callback = NULL;
-+void desktop_entry_tree_dir_add_notify (void *element, void *user_data);
-
-
-+void
-+desktop_entry_tree_diradd_callback_set (DesktopEntryTreeDirAddCallback proc)
-+{
-+ dir_add_callback = proc;
-+}
-+
- static MenuNode*
- find_menu_child (MenuNode *node)
- {
-@@ -1005,6 +1013,7 @@
- MenuNode *orig_node;
- MenuNode *resolved_node;
- TreeNode *root;
-+ GSList *monitored_dirs;
- };
-
- static void build_tree (DesktopEntryTree *tree);
-@@ -1015,6 +1024,21 @@
- static char* localized_path_for_entry (TreeNode *parent,
- Entry *entry);
- static char* localized_path_for_node (TreeNode *node);
-+static TreeNode* tree_node_from_menu_node (TreeNode *parent,
-+ MenuNode *menu_node,
-+ GHashTable *allocated,
-+ const DesktopEntryTree *tree);
-+static void remove_empty_submenus (TreeNode * node);
-+static void process_only_unallocated (TreeNode *node,
-+ GHashTable *allocated);
-+
-+const char *desktop_entry_tree_get_menu_file_name (DesktopEntryTree *tree)
-+{
-+ g_return_val_if_fail (tree != NULL, NULL);
-+
-+ return tree->menu_file;
-+}
-+
-
- DesktopEntryTree*
- desktop_entry_tree_load (const char *filename,
-@@ -1083,6 +1107,7 @@
- tree->orig_node = orig_node;
- tree->resolved_node = resolved_node;
- tree->root = NULL;
-+ tree->monitored_dirs = NULL;
-
- return tree;
- }
-@@ -1096,6 +1121,14 @@
- tree->refcount += 1;
- }
-
-+static void
-+monitored_dir_list_clear (void *element,
-+ void *user_data)
-+{
-+ GSList *list = element;
-+ g_free (list->data);
-+}
-+
- void
- desktop_entry_tree_unref (DesktopEntryTree *tree)
- {
-@@ -1111,10 +1144,15 @@
- menu_node_unref (tree->orig_node);
- menu_node_unref (tree->resolved_node);
- if (tree->root)
-+ {
- tree_node_free (tree->root);
-+ tree->root = NULL;
-+ }
-+ g_slist_foreach (tree->monitored_dirs, monitored_dir_list_clear, NULL);
-+ g_slist_free (tree->monitored_dirs);
- entry_cache_unref (tree->entry_cache);
- menu_cache_unref (tree->menu_cache);
--#if 1
-+#if 0
- /* debugging, to make memory stuff fail */
- memset (tree, 0xff, sizeof (*tree));
- tree->refcount = -5;
-@@ -1125,12 +1163,42 @@
-
- void
- desktop_entry_tree_invalidate (DesktopEntryTree *tree,
-- const char *dirname)
-+ const char *menu_file,
-+ const char *entry_path)
- {
-- menu_cache_invalidate (tree->menu_cache, dirname);
-+ GHashTable *allocated;
-+ TreeNode *new_node;
-+ char *dirname;
-+
-+ /* menu_file: the actual .menu file to reload */
-+ /* entry_dir: actual FS directory of .desktop files to reload */
-+ menu_cache_invalidate (tree->menu_cache, menu_file);
-+ dirname = g_path_get_dirname (entry_path);
- entry_cache_invalidate (tree->entry_cache, dirname);
-+ g_free (dirname);
-+
-+ /* FIXME For the actual DesktopEntryTree itself, there aren't really
-+ * invalidation functions yet (FIXME). Therefore, we blow away the root
-+ * and rebuild it every time.
-+ */
-+ allocated = g_hash_table_new (NULL, NULL);
-+
-+ new_node = tree_node_from_menu_node (NULL,
-+ find_menu_child (tree->resolved_node),
-+ allocated,
-+ tree);
-+ if (new_node)
-+ {
-+ tree_node_free (tree->root);
-+ tree->root = new_node;
-+ process_only_unallocated (tree->root, allocated);
-+ remove_empty_submenus (tree->root);
-+ }
-+
-+ g_hash_table_destroy (allocated);
- }
-
-+
- static TreeNode*
- find_subdir (TreeNode *parent,
- const char *subdir)
-@@ -1634,7 +1702,11 @@
- {
- GSList *tmp;
-
-+ if (!node)
-+ return;
-+
- g_free (node->name);
-+ node->name = NULL;
-
- tmp = node->subdirs;
- while (tmp != NULL)
-@@ -1812,10 +1884,39 @@
- }
- #endif
-
-+/* Called from an entry_directory_list_foreach()... */
-+void
-+desktop_entry_tree_dir_add_notify (void *element, void *user_data)
-+{
-+ EntryDirectory *dir = element;
-+ DesktopEntryTree *tree = user_data;
-+ GSList *tmp;
-+ const char *path;
-+
-+ g_return_if_fail (dir != NULL);
-+ path = entry_directory_get_absolute_path (dir);
-+
-+ /* Ensure we haven't already set a callback for this directory with
-+ * this tree.
-+ */
-+ tmp = tree->monitored_dirs;
-+ while (tmp != NULL)
-+ {
-+ if (strcmp (tmp->data, path) == 0)
-+ return;
-+ tmp = tmp->next;
-+ }
-+
-+ tree->monitored_dirs = g_slist_append (tree->monitored_dirs, g_strdup (path));
-+ if (dir_add_callback)
-+ (*dir_add_callback) (tree, path);
-+}
-+
- static TreeNode*
- tree_node_from_menu_node (TreeNode *parent,
- MenuNode *menu_node,
-- GHashTable *allocated)
-+ GHashTable *allocated,
-+ const DesktopEntryTree *tree)
- {
- MenuNode *child;
- EntryDirectoryList *app_dirs;
-@@ -1854,7 +1955,8 @@
-
- child_tree = tree_node_from_menu_node (tree_node,
- child,
-- allocated);
-+ allocated,
-+ tree);
- if (child_tree)
- tree_node->subdirs = g_slist_prepend (tree_node->subdirs,
- child_tree);
-@@ -2012,7 +2114,12 @@
- if (tree_node_free_if_broken (tree_node))
- return NULL;
- else
-+ {
-+ /* Monitor directories containing .desktop & .directory files for changes */
-+ entry_directory_list_foreach (app_dirs, desktop_entry_tree_dir_add_notify, tree);
-+ entry_directory_list_foreach (dir_dirs, desktop_entry_tree_dir_add_notify, tree);
- return tree_node;
-+ }
- }
-
- static void
-@@ -2102,7 +2209,8 @@
-
- tree->root = tree_node_from_menu_node (NULL,
- find_menu_child (tree->resolved_node),
-- allocated);
-+ allocated,
-+ tree);
- if (tree->root)
- process_only_unallocated (tree->root, allocated);
-
---- desktop-file-utils-0.6/src/menu-process.h.directory-change-notify 2004-03-21 23:46:20.000000000 -0500
-+++ desktop-file-utils-0.6/src/menu-process.h 2004-05-03 23:46:00.403831272 -0400
-@@ -67,7 +67,8 @@
-
- /* after calling this, the tree is out-of-date vs. what's on disk */
- void desktop_entry_tree_invalidate (DesktopEntryTree *tree,
-- const char *dirname);
-+ const char *menu_file,
-+ const char *entry_path);
-
- /* These don't return references; the DesktopEntryTree is just immutable. */
- gboolean desktop_entry_tree_get_node (DesktopEntryTree *tree,
-@@ -134,6 +135,11 @@
- const char *menu_path_basename,
- const char *override_fs_dirname_dest,
- GError **error);
-+const char *desktop_entry_tree_get_menu_file_name (DesktopEntryTree *tree);
-+
-+/* Callback for each .desktop directory added */
-+typedef void (*DesktopEntryTreeDirAddCallback)(DesktopEntryTree * tree, const char *path);
-+void desktop_entry_tree_diradd_callback_set (DesktopEntryTreeDirAddCallback proc);
-
-
- /* Diff */
---- desktop-file-utils-0.6/src/menu-tree-cache.c.directory-change-notify 2004-05-03 23:45:59.753930072 -0400
-+++ desktop-file-utils-0.6/src/menu-tree-cache.c 2004-05-03 23:46:00.407830664 -0400
-@@ -491,7 +491,7 @@
- /* tell the tree that it needs to reload the .desktop file
- * cache
- */
-- desktop_entry_tree_invalidate (tree, override_dir);
-+ desktop_entry_tree_invalidate (tree, override_dir, override_dir);
-
- /* Now include the .desktop file in the .menu file */
- if (!desktop_entry_tree_include (tree,
-@@ -583,7 +583,7 @@
- /* tell the tree that it needs to reload the .desktop file
- * cache
- */
-- desktop_entry_tree_invalidate (tree, override_dir);
-+ desktop_entry_tree_invalidate (tree, override_dir, override_dir);
-
- /* Now include the .desktop file in the .menu file */
- if (!desktop_entry_tree_exclude (tree,
---- desktop-file-utils-0.6/src/menu-entries.c.directory-change-notify 2004-03-21 23:46:20.000000000 -0500
-+++ desktop-file-utils-0.6/src/menu-entries.c 2004-05-03 23:46:00.413829752 -0400
-@@ -247,32 +247,29 @@
- const char *path)
- {
- CachedDir* dir;
-- char *dirname;
- char *basename;
-+ char *dirname;
- char *canonical;
- Entry *retval;
-
- retval = NULL;
-- dirname = g_path_get_basename (path);
--
-- canonical = g_canonicalize_file_name (dirname, FALSE);
-+ canonical = g_canonicalize_file_name (path, FALSE);
- if (canonical == NULL)
- {
- menu_verbose ("Error %d getting entry \"%s\": %s\n", errno, path,
- g_strerror (errno));
-- g_free (dirname);
- return NULL;
- }
-
-- basename = g_path_get_dirname (path);
--
-+ dirname = g_path_get_dirname (path);
- dir = cached_dir_load (cache, dirname, 0, NULL);
--
- if (dir != NULL)
-- retval = cached_dir_find_entry (dir, basename);
--
-+ {
-+ basename = g_path_get_basename (path);
-+ retval = cached_dir_find_entry (dir, basename);
-+ g_free (basename);
-+ }
- g_free (dirname);
-- g_free (basename);
-
- if (retval)
- entry_ref (retval);
-@@ -344,6 +341,12 @@
- }
- }
-
-+const char*
-+entry_directory_get_absolute_path (EntryDirectory *dir)
-+{
-+ return dir->absolute_path;
-+}
-+
- static Entry*
- entry_from_cached_entry (EntryDirectory *ed,
- Entry *src,
-@@ -681,6 +684,12 @@
- }
-
- void
-+entry_directory_list_foreach (EntryDirectoryList *list, EntryDirectoryListForeachProc proc, DesktopEntryTree *tree)
-+{
-+ g_slist_foreach (list->dirs, proc, tree);
-+}
-+
-+void
- entry_directory_list_prepend (EntryDirectoryList *list,
- EntryDirectory *dir)
- {
-@@ -1501,6 +1510,7 @@
- while (tmp != NULL)
- {
- g_string_append (str, tmp->data);
-+ g_string_append (str, "/");
-
- tmp = tmp->next;
- }
-@@ -2173,6 +2183,10 @@
- static EntryCache*
- cached_dir_get_cache (CachedDir *dir)
- {
-+ if (!dir->have_read_entries)
-+ {
-+ cached_dir_scan_recursive (dir, NULL);
-+ }
- return dir->cache;
- }
-
---- desktop-file-utils-0.6/src/menu-entries.h.directory-change-notify 2004-03-21 23:46:20.000000000 -0500
-+++ desktop-file-utils-0.6/src/menu-entries.h 2004-05-03 23:46:00.416829296 -0400
-@@ -24,6 +24,7 @@
-
- #include <glib.h>
- #include "menu-layout.h"
-+#include "menu-process.h"
-
- /* This API is about actually loading directories full of .desktop
- * files and the .desktop/.directory files themselves. It also has
-@@ -84,12 +85,19 @@
- void entry_directory_get_by_category (EntryDirectory *dir,
- const char *category,
- EntrySet *add_to_set);
-+const char* entry_directory_get_absolute_path (EntryDirectory *dir);
-+
-+typedef void (*EntryDirectoryListForeachProc)(void *element, void *user_data);
-
- EntryDirectoryList* entry_directory_list_new (void);
-
- void entry_directory_list_ref (EntryDirectoryList *list);
- void entry_directory_list_unref (EntryDirectoryList *list);
- void entry_directory_list_clear (EntryDirectoryList *list);
-+void entry_directory_list_foreach (EntryDirectoryList *list,
-+ EntryDirectoryListForeachProc proc,
-+ DesktopEntryTree *tree);
-+
- /* prepended dirs are searched first */
- void entry_directory_list_prepend (EntryDirectoryList *list,
- EntryDirectory *dir);
---- desktop-file-utils-0.6/src/menu-method.c.directory-change-notify 2004-05-03 23:45:59.440977648 -0400
-+++ desktop-file-utils-0.6/src/menu-method.c 2004-05-03 23:46:00.423828232 -0400
-@@ -29,9 +29,11 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <errno.h>
-+#include <stdio.h>
-
- #include <config.h>
-
-+#include <libgnomevfs/gnome-vfs-ops.h>
- #include <libgnomevfs/gnome-vfs-method.h>
- #include <libgnomevfs/gnome-vfs-module-shared.h>
- #include <libgnomevfs/gnome-vfs-module.h>
-@@ -46,6 +48,8 @@
-
- #include "menu-tree-cache.h"
- #include "menu-util.h"
-+#include "menu-entries.h"
-+#include "menu-process.h"
-
- /* FIXME - we have a gettext domain problem while not included in libgnomevfs */
- #define _(x) x
-@@ -151,6 +155,14 @@
- static void monitor_handle_ref (MonitorHandle *handle);
- static void monitor_handle_unref (MonitorHandle *handle);
-
-+
-+static void directory_add_callback (DesktopEntryTree * tree, const char * path);
-+void directory_monitor_callback (GnomeVFSMonitorHandle *handle,
-+ const gchar *monitor_uri,
-+ const gchar *info_uri,
-+ GnomeVFSMonitorEventType event_type,
-+ gpointer user_data);
-+
- struct {
- const char *scheme;
- const char *menu_file;
-@@ -737,6 +749,7 @@
- GnomeVFSMethod *
- vfs_module_init (const char *method_name, const char *args)
- {
-+ desktop_entry_tree_diradd_callback_set (directory_add_callback);
- return &vtable;
- }
-
-@@ -1988,3 +2001,33 @@
- g_free (handle);
- }
- }
-+
-+static void
-+directory_add_callback (DesktopEntryTree * tree, const char * path)
-+{
-+ GnomeVFSMonitorHandle* handle;
-+
-+ gnome_vfs_monitor_add (&handle, path,
-+ GNOME_VFS_MONITOR_DIRECTORY,
-+ directory_monitor_callback, tree);
-+}
-+
-+
-+void directory_monitor_callback (GnomeVFSMonitorHandle *handle,
-+ const gchar *monitor_uri,
-+ const gchar *info_uri,
-+ GnomeVFSMonitorEventType event_type,
-+ gpointer user_data)
-+{
-+ MenuMethod * method;
-+ DesktopEntryTree * tree = user_data;
-+
-+ method = method_checkout ();
-+
-+ if (tree)
-+ desktop_entry_tree_invalidate( tree,
-+ desktop_entry_tree_get_menu_file_name (tree),
-+ gnome_vfs_get_local_path_from_uri (info_uri));
-+
-+ method_return (method);
-+}
+++ /dev/null
---- desktop-file-utils-0.6/src/menu-process.c.directory-mtime 2004-05-03 23:09:03.888792776 -0400
-+++ desktop-file-utils-0.6/src/menu-process.c 2004-05-03 23:09:03.934785784 -0400
-@@ -1005,6 +1005,10 @@
- /* make a shorter name */
- typedef struct DesktopEntryTreeNode TreeNode;
-
-+/* FIXME modification time is kept on the tree right now,
-+ * but should really be kept on the individual Entries and
-+ * subdirs themselves.
-+ */
- struct DesktopEntryTree
- {
- int refcount;
-@@ -1015,6 +1019,7 @@
- MenuNode *orig_node;
- MenuNode *resolved_node;
- TreeNode *root;
-+ time_t mtime;
- GSList *monitored_dirs;
- };
-
-@@ -1039,6 +1044,12 @@
- return tree->menu_file;
- }
-
-+const time_t desktop_entry_tree_get_mtime (DesktopEntryTree *tree)
-+{
-+ g_return_val_if_fail (tree != NULL, 0);
-+
-+ return tree->mtime;
-+}
-
- DesktopEntryTree*
- desktop_entry_tree_load (const char *filename,
-@@ -1107,6 +1118,7 @@
- tree->orig_node = orig_node;
- tree->resolved_node = resolved_node;
- tree->root = NULL;
-+ tree->mtime = time (NULL); /* Initial modification time of now */
- tree->monitored_dirs = NULL;
-
- return tree;
-@@ -1193,6 +1205,11 @@
- tree->root = new_node;
- process_only_unallocated (tree->root, allocated);
- remove_empty_submenus (tree->root);
-+
-+ /* Update the modification time for the tree, so the
-+ * panel knows to reload the VFS directory.
-+ */
-+ tree->mtime = time (NULL);
- }
-
- g_hash_table_destroy (allocated);
---- desktop-file-utils-0.6/src/menu-process.h.directory-mtime 2004-05-03 23:09:03.891792320 -0400
-+++ desktop-file-utils-0.6/src/menu-process.h 2004-05-03 23:09:03.937785328 -0400
-@@ -23,6 +23,7 @@
- #define MENU_PROCESS_H
-
- #include <glib.h>
-+#include <time.h>
- #include "desktop_file.h"
-
- typedef struct DesktopEntryTree DesktopEntryTree;
-@@ -137,6 +138,8 @@
- GError **error);
- const char *desktop_entry_tree_get_menu_file_name (DesktopEntryTree *tree);
-
-+const time_t desktop_entry_tree_get_mtime (DesktopEntryTree *tree);
-+
- /* Callback for each .desktop directory added */
- typedef void (*DesktopEntryTreeDirAddCallback)(DesktopEntryTree * tree, const char *path);
- void desktop_entry_tree_diradd_callback_set (DesktopEntryTreeDirAddCallback proc);
---- desktop-file-utils-0.6/src/menu-method.c.directory-mtime 2004-05-03 23:09:03.912789128 -0400
-+++ desktop-file-utils-0.6/src/menu-method.c 2004-05-03 23:42:05.910479680 -0400
-@@ -1024,8 +1024,9 @@
-
- /* Fill in dir info that's true for all dirs in the vfs */
- static void
--fill_in_generic_dir_info (GnomeVFSFileInfo *info,
-- GnomeVFSFileInfoOptions options)
-+fill_in_generic_dir_info (GnomeVFSFileInfo *info,
-+ GnomeVFSFileInfoOptions options,
-+ DesktopEntryTree *tree)
- {
- info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
-
-@@ -1048,10 +1049,16 @@
- /* We always own it */
- info->uid = getuid ();
- info->gid = getgid ();
--
-+
-+ /* FIXME mtime is currently taken from the tree itself,
-+ * and is not stored on the actual VFS objects themselves.
-+ */
-+ info->mtime = desktop_entry_tree_get_mtime (tree);
-+
- info->valid_fields |=
- GNOME_VFS_FILE_INFO_FIELDS_TYPE |
-- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
-+ GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS |
-+ GNOME_VFS_FILE_INFO_FIELDS_MTIME;
- }
-
- static void
-@@ -1064,13 +1071,14 @@
- g_assert (node != NULL);
- g_assert (file_info != NULL);
-
-- fill_in_generic_dir_info (file_info, options);
-+ fill_in_generic_dir_info (file_info, options, tree);
- }
-
- /* Fill in file info that's true for all .desktop files */
- static void
- fill_in_generic_file_info (GnomeVFSFileInfo *info,
-- GnomeVFSFileInfoOptions options)
-+ GnomeVFSFileInfoOptions options,
-+ DesktopEntryTree *tree)
- {
- info->type = GNOME_VFS_FILE_TYPE_REGULAR;
-
-@@ -1097,8 +1105,14 @@
- info->uid = getuid ();
- info->gid = getgid ();
-
-+ /* FIXME mtime is currently taken from the tree itself,
-+ * and is not stored on the actual VFS objects themselves.
-+ */
-+ info->mtime = desktop_entry_tree_get_mtime (tree);
-+
- info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE |
-- GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
-+ GNOME_VFS_FILE_INFO_FIELDS_MTIME |
-+ GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
- }
-
- static void
-@@ -1113,7 +1127,7 @@
- g_assert (path != NULL);
- g_assert (file_info != NULL);
-
-- fill_in_generic_file_info (file_info, options);
-+ fill_in_generic_file_info (file_info, options, tree);
- }
-
- static GnomeVFSResult
-@@ -1452,9 +1466,9 @@
- handle->current += 1;
-
- if (handle->current <= handle->n_entries_that_are_subdirs) {
-- fill_in_generic_dir_info (info, handle->options);
-+ fill_in_generic_dir_info (info, handle->options, handle->tree);
- } else {
-- fill_in_generic_file_info (info, handle->options);
-+ fill_in_generic_file_info (info, handle->options, handle->tree);
- }
-
- info->valid_fields &= ~ UNSUPPORTED_INFO_FIELDS;
+++ /dev/null
-diff -urN aa/desktop-file-utils-0.7/src/menu-entries.c desktop-file-utils-0.7/src/menu-entries.c
---- aa/desktop-file-utils-0.7/src/menu-entries.c 2004-07-28 15:19:30.490876392 +0200
-+++ desktop-file-utils-0.7/src/menu-entries.c 2004-07-28 21:28:13.552659792 +0200
-@@ -42,6 +42,7 @@
- char *absolute_path;
-
- unsigned int *categories; /* 0-terminated array of atoms */
-+ gboolean show;
-
- guint type : 4;
- guint refcount : 24;
-@@ -82,7 +83,8 @@
- static Entry*
- entry_new (EntryType type,
- const char *relative_path,
-- const char *absolute_path)
-+ const char *absolute_path,
-+ gboolean show)
- {
- Entry *e;
-
-@@ -93,6 +95,7 @@
- e->relative_path = g_strdup (relative_path);
- e->absolute_path = g_strdup (absolute_path);
- e->refcount = 1;
-+ e->show=show;
-
- return e;
- }
-@@ -150,6 +153,11 @@
- return entry->relative_path;
- }
-
-+gboolean entry_get_show (Entry *entry)
-+{
-+ return entry->show;
-+}
-+
- gboolean
- entry_has_category (Entry *entry,
- EntryCache *cache,
-@@ -371,7 +379,7 @@
- return src;
- }
-
-- e = entry_new (src->type, relative_path, src->absolute_path);
-+ e = entry_new (src->type, relative_path, src->absolute_path, src->show);
-
- n_categories_to_copy = 0;
- if (src->categories)
-@@ -441,7 +449,7 @@
- if (src->type != ENTRY_DIRECTORY)
- return NULL;
-
-- e = entry_new (src->type, relative_path, src->absolute_path);
-+ e = entry_new (src->type, relative_path, src->absolute_path, src->show);
-
- return e;
- }
-@@ -1874,7 +1882,7 @@
- }
- }
-
-- e = entry_new (ENTRY_DESKTOP, basename, filename);
-+ e = entry_new (ENTRY_DESKTOP, basename, filename, TRUE);
-
- categories = find_value (str, "Categories");
- if (categories != NULL)
-@@ -1893,7 +1901,48 @@
- entry_new_directory_from_file (const char *filename,
- const char *basename)
- {
-- return entry_new (ENTRY_DIRECTORY, basename, filename);
-+ char *str;
-+ gsize len;
-+ GError *err;
-+ Entry *e;
-+ gboolean show;
-+
-+ str = NULL;
-+ len = 0;
-+ err = NULL;
-+
-+ if (!g_file_get_contents (filename, &str, &len, &err))
-+ {
-+ menu_verbose ("Could not get contents of \"%s\": %s\n",
-+ filename, err->message);
-+ g_error_free (err);
-+ return NULL;
-+ }
-+
-+ /* Check for NoDisplay */
-+ char *nodisplay;
-+
-+ show = TRUE;
-+
-+ nodisplay = find_value (str, "NoDisplay");
-+
-+ if (nodisplay != NULL)
-+ if (strcasecmp (nodisplay, "True") == 0)
-+ show = FALSE;
-+
-+ if (!show)
-+ menu_verbose ("Not showing \"%s\" due to NoDisplay=%s\n",
-+ filename, nodisplay);
-+
-+ g_free (nodisplay);
-+
-+ /* End checking for NoDisplay */
-+
-+ e = entry_new (ENTRY_DIRECTORY, basename, filename, show);
-+
-+ g_free (str);
-+
-+ return e;
- }
-
- static void
-diff -urN aa/desktop-file-utils-0.7/src/menu-entries.h desktop-file-utils-0.7/src/menu-entries.h
---- aa/desktop-file-utils-0.7/src/menu-entries.h 2004-07-28 15:19:30.491876240 +0200
-+++ desktop-file-utils-0.7/src/menu-entries.h 2004-07-28 20:09:57.515565944 +0200
-@@ -131,6 +131,7 @@
- const char* entry_get_absolute_path (Entry *entry);
- const char* entry_get_relative_path (Entry *entry);
- const char* entry_get_name (Entry *entry);
-+gboolean entry_get_show (Entry *entry);
- gboolean entry_has_category (Entry *entry,
- EntryCache *cache,
- const char *category);
-diff -urN aa/desktop-file-utils-0.7/src/menu-process.c desktop-file-utils-0.7/src/menu-process.c
---- aa/desktop-file-utils-0.7/src/menu-process.c 2004-07-28 15:19:30.501874720 +0200
-+++ desktop-file-utils-0.7/src/menu-process.c 2004-07-28 21:42:52.369059392 +0200
-@@ -1062,6 +1062,7 @@
- GHashTable *allocated,
- const DesktopEntryTree *tree);
- static void remove_empty_submenus (TreeNode * node);
-+static void remove_no_display_submenus (TreeNode * node);
- static void process_only_unallocated (TreeNode *node,
- GHashTable *allocated);
-
-@@ -1238,6 +1239,7 @@
- tree->root = new_node;
- process_only_unallocated (tree->root, allocated);
- remove_empty_submenus (tree->root);
-+ remove_no_display_submenus(tree->root);
-
- /* Update the modification time for the tree, so the
- * panel knows to reload the VFS directory.
-@@ -2254,6 +2256,30 @@
- }
- }
-
-+static void remove_no_display_submenus (TreeNode * node)
-+{
-+ GSList *subdir;
-+
-+ subdir = node->subdirs;
-+ while (subdir != NULL)
-+ {
-+ TreeNode *subdir_node = subdir->data;
-+ GSList *next = subdir->next;
-+
-+ if (subdir_node->dir_entry &&
-+ entry_get_show (subdir_node->dir_entry) == FALSE)
-+ {
-+ node->subdirs = g_slist_remove_link (node->subdirs, subdir);
-+ tree_node_free (subdir_node);
-+ }
-+ else
-+ remove_no_display_submenus (subdir_node);
-+
-+ subdir = next;
-+ }
-+}
-+
-+
- static void
- build_tree (DesktopEntryTree *tree)
- {
-@@ -2271,8 +2297,10 @@
- if (tree->root)
- process_only_unallocated (tree->root, allocated);
-
-- if (tree->root)
-+ if (tree->root){
- remove_empty_submenus (tree->root);
-+ remove_no_display_submenus (tree->root);
-+ }
-
- g_hash_table_destroy (allocated);
-
+++ /dev/null
-diff -urN aa/desktop-file-utils-0.7/src/menu-entries.c desktop-file-utils-0.7/src/menu-entries.c
---- aa/desktop-file-utils-0.7/src/menu-entries.c 2004-07-28 22:11:07.960290344 +0200
-+++ desktop-file-utils-0.7/src/menu-entries.c 2004-07-28 22:13:30.869564832 +0200
-@@ -1980,6 +1980,47 @@
- g_free (onlyshowin);
- }
- /* End checking for OnlyShowIn */
-+
-+ if (!show)
-+ {
-+ e = entry_new (ENTRY_DIRECTORY, basename, filename, show);
-+ g_free (str);
-+ return e;
-+ }
-+
-+ /* Check for NoShowIn */
-+ char *noshowin;
-+
-+ show = TRUE;
-+
-+ noshowin = find_value (str, "NoShowIn");
-+
-+ if (noshowin != NULL)
-+ {
-+ char **split;
-+ int i;
-+
-+ split = string_list_from_desktop_value (noshowin);
-+ i = 0;
-+ while (split[i] != NULL)
-+ {
-+ if (strcmp (split[i], "GNOME") == 0)
-+ {
-+ show = FALSE;
-+ break;
-+ }
-+
-+ ++i;
-+ }
-+
-+ if (!show)
-+ menu_verbose ("Not showing \"%s\" due to NoShowIn=%s\n",
-+ filename, noshowin);
-+
-+ g_strfreev (split);
-+ g_free (noshowin);
-+ }
-+ /* End checking for NoShowIn */
-
- if (!show)
- {
+++ /dev/null
---- desktop-file-utils-0.6/src/menu-process.c.hide-empty-submenus 2004-03-05 13:23:23.139062728 -0500
-+++ desktop-file-utils-0.6/src/menu-process.c 2004-03-05 15:27:01.639279272 -0500
-@@ -2041,6 +2041,30 @@
- }
- }
-
-+static void remove_empty_submenus (TreeNode * node)
-+{
-+ GSList *subdir;
-+
-+ subdir = node->subdirs;
-+ while (subdir != NULL)
-+ {
-+ TreeNode *subdir_node = subdir->data;
-+ GSList *next = subdir->next;
-+
-+ remove_empty_submenus (subdir_node);
-+
-+ /* If after removing empty children of this submenu, the submenu
-+ * itself is empty, remove it from the parent menu (which is 'node')
-+ */
-+ if (subdir_node->subdirs == NULL && subdir_node->entries == NULL)
-+ {
-+ node->subdirs = g_slist_remove_link (node->subdirs, subdir);
-+ tree_node_free (subdir_node);
-+ }
-+ subdir = next;
-+ }
-+}
-+
- static void
- build_tree (DesktopEntryTree *tree)
- {
-@@ -2057,6 +2081,9 @@
- if (tree->root)
- process_only_unallocated (tree->root, allocated);
-
-+ if (tree->root)
-+ remove_empty_submenus (tree->root);
-+
- g_hash_table_destroy (allocated);
-
- if (tree->root == NULL)
+++ /dev/null
-diff -urN aa/desktop-file-utils-0.6/src/menu-entries.c desktop-file-utils-0.6/src/menu-entries.c
---- aa/desktop-file-utils-0.6/src/menu-entries.c 2004-07-22 01:22:36.741865272 +0200
-+++ desktop-file-utils-0.6/src/menu-entries.c 2004-07-22 01:37:57.796843632 +0200
-@@ -1753,6 +1753,7 @@
- GError *err;
- char *categories;
- Entry *e;
-+ gboolean show;
-
- str = NULL;
- len = 0;
-@@ -1765,10 +1766,32 @@
- return NULL;
- }
-
-+ /* Check for NoDisplay */
-+ char *nodisplay;
-+
-+ show = TRUE;
-+
-+ nodisplay = find_value (str, "NoDisplay");
-+
-+ if (nodisplay != NULL)
-+ if (strcasecmp (nodisplay, "True") == 0)
-+ show = FALSE;
-+
-+ if (!show)
-+ menu_verbose ("Not showing \"%s\" due to NoDisplay=%s\n",
-+ filename, nodisplay);
-+
-+ g_free (nodisplay);
-+
-+ if (!show){
-+ g_free (str);
-+ return NULL;
-+ }
-+ /* End checking for NoDisplay */
-+
- if (cache->only_show_in_name)
- {
- char *onlyshowin;
-- gboolean show;
-
- show = TRUE;
-
-diff -urN aa/desktop-file-utils-0.6/src/menu-layout.c desktop-file-utils-0.6/src/menu-layout.c
---- aa/desktop-file-utils-0.6/src/menu-layout.c 2004-07-22 01:22:36.741865272 +0200
-+++ desktop-file-utils-0.6/src/menu-layout.c 2004-07-22 01:43:43.405303160 +0200
-@@ -1645,6 +1645,9 @@
- case MENU_NODE_MENU_ONLY_SHOW_IN:
- append_simple (node, depth, "OnlyShowIn", str);
- break;
-+ case MENU_NODE_MENU_NO_DISPLAY:
-+ append_simple (node, depth, "NoDisplay", str);
-+ break;
- case MENU_NODE_APP_DIR:
- append_simple (node, depth, "AppDir", str);
- break;
-diff -urN aa/desktop-file-utils-0.6/src/menu-layout.h desktop-file-utils-0.6/src/menu-layout.h
---- aa/desktop-file-utils-0.6/src/menu-layout.h 2004-07-22 01:22:36.741865272 +0200
-+++ desktop-file-utils-0.6/src/menu-layout.h 2004-07-22 01:43:10.477308976 +0200
-@@ -37,6 +37,7 @@
- MENU_NODE_PASSTHROUGH,
- MENU_NODE_MENU,
- MENU_NODE_MENU_ONLY_SHOW_IN,
-+ MENU_NODE_MENU_NO_DISPLAY,
- MENU_NODE_APP_DIR,
- MENU_NODE_DEFAULT_APP_DIRS,
- MENU_NODE_DIRECTORY_DIR,
-diff -urN aa/desktop-file-utils-0.6/src/menu-parser.c desktop-file-utils-0.6/src/menu-parser.c
---- aa/desktop-file-utils-0.6/src/menu-parser.c 2004-07-22 01:22:36.742865120 +0200
-+++ desktop-file-utils-0.6/src/menu-parser.c 2004-07-22 01:45:04.482977480 +0200
-@@ -338,6 +338,10 @@
- {
- push_node (parser, MENU_NODE_MENU_ONLY_SHOW_IN);
- }
-+ else if (ELEMENT_IS ("NoDisplay"))
-+ {
-+ push_node (parser, MENU_NODE_MENU_NO_DISPLAY);
-+ }
- else if (ELEMENT_IS ("AppDir"))
- {
- push_node (parser, MENU_NODE_APP_DIR);
-@@ -785,6 +789,7 @@
- switch (menu_node_get_type (parser->stack_top))
- {
- case MENU_NODE_MENU_ONLY_SHOW_IN:
-+ case MENU_NODE_MENU_NO_DISPLAY:
- case MENU_NODE_APP_DIR:
- case MENU_NODE_DIRECTORY_DIR:
- case MENU_NODE_NAME:
-@@ -873,6 +878,7 @@
- switch (menu_node_get_type (parser->stack_top))
- {
- case MENU_NODE_MENU_ONLY_SHOW_IN:
-+ case MENU_NODE_MENU_NO_DISPLAY:
- case MENU_NODE_APP_DIR:
- case MENU_NODE_DIRECTORY_DIR:
- case MENU_NODE_NAME:
-diff -urN aa/desktop-file-utils-0.6/src/menu-process.c desktop-file-utils-0.6/src/menu-process.c
---- aa/desktop-file-utils-0.6/src/menu-process.c 2004-07-22 01:22:36.746864512 +0200
-+++ desktop-file-utils-0.6/src/menu-process.c 2004-07-22 01:49:07.279066864 +0200
-@@ -1995,6 +1995,13 @@
- }
- break;
-
-+ case MENU_NODE_MENU_NO_DISPLAY:
-+ {
-+ if (strcasecmp (menu_node_get_content (child), "True") == 0)
-+ deleted = TRUE;
-+ }
-+ break;
-+
- case MENU_NODE_NAME:
- {
- if (tree_node->name)
+++ /dev/null
-diff -urN aa/desktop-file-utils-0.6/src/menu-entries.c desktop-file-utils-0.6/src/menu-entries.c
---- aa/desktop-file-utils-0.6/src/menu-entries.c 2004-07-22 01:37:57.796843632 +0200
-+++ desktop-file-utils-0.6/src/menu-entries.c 2004-07-23 00:12:03.519828512 +0200
-@@ -1226,6 +1226,7 @@
- int refcount;
- CachedDir *root_dir;
- char *only_show_in_name;
-+ char *no_show_in_name;
- GHashTable *atoms_by_name;
- GHashTable *names_by_atom;
- unsigned int next_atom;
-@@ -1832,6 +1833,47 @@
- }
- }
-
-+ if (cache->no_show_in_name)
-+ {
-+ char *noshowin;
-+
-+ show = TRUE;
-+
-+ noshowin = find_value (str, "NoShowIn");
-+
-+ if (noshowin != NULL)
-+ {
-+ char **split;
-+ int i;
-+
-+ split = string_list_from_desktop_value (noshowin);
-+ i = 0;
-+ while (split[i] != NULL)
-+ {
-+ if (strcmp (split[i], cache->no_show_in_name) == 0)
-+ {
-+ show = FALSE;
-+ break;
-+ }
-+
-+ ++i;
-+ }
-+
-+ if (!show)
-+ menu_verbose ("Not showing \"%s\" due to NoShowIn=%s\n",
-+ filename, noshowin);
-+
-+ g_strfreev (split);
-+ g_free (noshowin);
-+ }
-+
-+ if (!show)
-+ {
-+ g_free (str);
-+ return NULL;
-+ }
-+ }
-+
- e = entry_new (ENTRY_DESKTOP, basename, filename);
-
- categories = find_value (str, "Categories");
-@@ -2258,6 +2300,7 @@
- g_hash_table_destroy (cache->atoms_by_name);
-
- g_free (cache->only_show_in_name);
-+ g_free (cache->no_show_in_name);
- g_free (cache);
- }
- }
-@@ -2276,6 +2319,21 @@
- cache->only_show_in_name = g_strdup (name);
- }
-
-+void
-+entry_cache_set_no_show_in_name (EntryCache *cache,
-+ const char *name)
-+{
-+ g_return_if_fail (cache != NULL);
-+
-+ /* Really you're screwed if you do this after stuff has
-+ * already been loaded...
-+ */
-+
-+ g_free (cache->no_show_in_name);
-+ cache->no_show_in_name = g_strdup (name);
-+}
-+
-+
- static void
- cached_dir_invalidate (CachedDir *dir)
- {
-diff -urN aa/desktop-file-utils-0.6/src/menu-entries.h desktop-file-utils-0.6/src/menu-entries.h
---- aa/desktop-file-utils-0.6/src/menu-entries.h 2004-07-22 01:22:29.208010592 +0200
-+++ desktop-file-utils-0.6/src/menu-entries.h 2004-07-23 00:03:18.085706640 +0200
-@@ -60,6 +60,8 @@
- void entry_cache_unref (EntryCache *cache);
- void entry_cache_set_only_show_in_name (EntryCache *cache,
- const char *name);
-+void entry_cache_set_no_show_in_name (EntryCache *cache,
-+ const char *name);
- void entry_cache_invalidate (EntryCache *cache,
- const char *dir);
-
-diff -urN aa/desktop-file-utils-0.6/src/menu-layout.c desktop-file-utils-0.6/src/menu-layout.c
---- aa/desktop-file-utils-0.6/src/menu-layout.c 2004-07-22 01:43:43.405303160 +0200
-+++ desktop-file-utils-0.6/src/menu-layout.c 2004-07-23 00:06:03.359581192 +0200
-@@ -1645,6 +1645,9 @@
- case MENU_NODE_MENU_ONLY_SHOW_IN:
- append_simple (node, depth, "OnlyShowIn", str);
- break;
-+ case MENU_NODE_MENU_NO_SHOW_IN:
-+ append_simple (node, depth, "NoShowIn", str);
-+ break;
- case MENU_NODE_MENU_NO_DISPLAY:
- append_simple (node, depth, "NoDisplay", str);
- break;
-diff -urN aa/desktop-file-utils-0.6/src/menu-layout.h desktop-file-utils-0.6/src/menu-layout.h
---- aa/desktop-file-utils-0.6/src/menu-layout.h 2004-07-22 01:43:10.477308976 +0200
-+++ desktop-file-utils-0.6/src/menu-layout.h 2004-07-23 00:05:36.061731096 +0200
-@@ -37,6 +37,7 @@
- MENU_NODE_PASSTHROUGH,
- MENU_NODE_MENU,
- MENU_NODE_MENU_ONLY_SHOW_IN,
-+ MENU_NODE_MENU_NO_SHOW_IN,
- MENU_NODE_MENU_NO_DISPLAY,
- MENU_NODE_APP_DIR,
- MENU_NODE_DEFAULT_APP_DIRS,
-diff -urN aa/desktop-file-utils-0.6/src/menu-method.c desktop-file-utils-0.6/src/menu-method.c
---- aa/desktop-file-utils-0.6/src/menu-method.c 2004-07-22 01:22:29.218009072 +0200
-+++ desktop-file-utils-0.6/src/menu-method.c 2004-07-23 00:00:32.837828136 +0200
-@@ -747,6 +747,7 @@
- {
- desktop_entry_tree_diradd_callback_set (directory_add_callback);
- desktop_set_only_show_in ("GNOME");
-+ desktop_set_no_show_in ("GNOME");
- return &vtable;
- }
-
-diff -urN aa/desktop-file-utils-0.6/src/menu-parser.c desktop-file-utils-0.6/src/menu-parser.c
---- aa/desktop-file-utils-0.6/src/menu-parser.c 2004-07-22 01:45:04.482977480 +0200
-+++ desktop-file-utils-0.6/src/menu-parser.c 2004-07-23 00:06:54.961736472 +0200
-@@ -338,6 +338,10 @@
- {
- push_node (parser, MENU_NODE_MENU_ONLY_SHOW_IN);
- }
-+ if (ELEMENT_IS ("NoShowIn"))
-+ {
-+ push_node (parser, MENU_NODE_MENU_NO_SHOW_IN);
-+ }
- else if (ELEMENT_IS ("NoDisplay"))
- {
- push_node (parser, MENU_NODE_MENU_NO_DISPLAY);
-@@ -789,6 +793,7 @@
- switch (menu_node_get_type (parser->stack_top))
- {
- case MENU_NODE_MENU_ONLY_SHOW_IN:
-+ case MENU_NODE_MENU_NO_SHOW_IN:
- case MENU_NODE_MENU_NO_DISPLAY:
- case MENU_NODE_APP_DIR:
- case MENU_NODE_DIRECTORY_DIR:
-@@ -878,6 +883,7 @@
- switch (menu_node_get_type (parser->stack_top))
- {
- case MENU_NODE_MENU_ONLY_SHOW_IN:
-+ case MENU_NODE_MENU_NO_SHOW_IN:
- case MENU_NODE_MENU_NO_DISPLAY:
- case MENU_NODE_APP_DIR:
- case MENU_NODE_DIRECTORY_DIR:
-diff -urN aa/desktop-file-utils-0.6/src/menu-process.c desktop-file-utils-0.6/src/menu-process.c
---- aa/desktop-file-utils-0.6/src/menu-process.c 2004-07-22 01:49:07.279066864 +0200
-+++ desktop-file-utils-0.6/src/menu-process.c 2004-07-23 00:08:59.312832232 +0200
-@@ -38,6 +38,11 @@
- */
- static char * only_show_in_desktop = NULL;
-
-+/* Global NoShowIn variable, works for both
-+ * DesktopEntryTrees and Menus.
-+ */
-+static char * no_show_in_desktop = NULL;
-+
- static void menu_node_resolve_files (MenuCache *menu_cache,
- EntryCache *entry_cache,
- MenuNode *node);
-@@ -1103,6 +1108,10 @@
- if (only_show_in_desktop)
- entry_cache_set_only_show_in_name (entry_cache,
- only_show_in_desktop);
-+
-+ if (no_show_in_desktop)
-+ entry_cache_set_no_show_in_name (entry_cache,
-+ no_show_in_desktop);
-
- resolved_node = menu_node_deep_copy (orig_node);
- menu_node_resolve_files (menu_cache, entry_cache, resolved_node);
-@@ -1995,6 +2004,14 @@
- }
- break;
-
-+ case MENU_NODE_MENU_NO_SHOW_IN:
-+ {
-+ if (no_show_in_desktop)
-+ if (strcmp (no_show_in_desktop, menu_node_get_content (child)) == 0)
-+ deleted = TRUE;
-+ }
-+ break;
-+
- case MENU_NODE_MENU_NO_DISPLAY:
- {
- if (strcasecmp (menu_node_get_content (child), "True") == 0)
-@@ -3262,3 +3279,12 @@
-
- only_show_in_desktop = g_strdup (only_show_in);
- }
-+
-+void
-+desktop_set_no_show_in (const char *no_show_in)
-+{
-+ if (no_show_in_desktop)
-+ g_free (no_show_in_desktop);
-+
-+ no_show_in_desktop = g_strdup (no_show_in);
-+}
-diff -urN aa/desktop-file-utils-0.6/src/menu-process.h desktop-file-utils-0.6/src/menu-process.h
---- aa/desktop-file-utils-0.6/src/menu-process.h 2004-07-22 01:22:29.209010440 +0200
-+++ desktop-file-utils-0.6/src/menu-process.h 2004-07-22 23:59:56.010426752 +0200
-@@ -174,4 +174,7 @@
- /* Set OnlyShowIn globally */
- void desktop_set_only_show_in (const char *only_show_in);
-
-+/* Set NoShowIn globally */
-+void desktop_set_no_show_in (const char *no_show_in);
-+
- #endif /* MENU_PROCESS_H */
+++ /dev/null
---- desktop-file-utils-0.6/src/menu-layout.h.menu-onlyshowin 2004-03-05 15:38:25.231357480 -0500
-+++ desktop-file-utils-0.6/src/menu-layout.h 2004-03-05 15:39:10.444484040 -0500
-@@ -36,6 +36,7 @@
- MENU_NODE_ROOT,
- MENU_NODE_PASSTHROUGH,
- MENU_NODE_MENU,
-+ MENU_NODE_MENU_ONLY_SHOW_IN,
- MENU_NODE_APP_DIR,
- MENU_NODE_DEFAULT_APP_DIRS,
- MENU_NODE_DIRECTORY_DIR,
---- desktop-file-utils-0.6/src/menu-layout.c.menu-onlyshowin 2004-03-05 15:38:36.603628632 -0500
-+++ desktop-file-utils-0.6/src/menu-layout.c 2004-03-05 15:41:41.088582656 -0500
-@@ -1642,6 +1642,9 @@
- case MENU_NODE_MENU:
- append_container (node, depth, "Menu", str);
- break;
-+ case MENU_NODE_MENU_ONLY_SHOW_IN:
-+ append_simple (node, depth, "OnlyShowIn", str);
-+ break;
- case MENU_NODE_APP_DIR:
- append_simple (node, depth, "AppDir", str);
- break;
---- desktop-file-utils-0.6/src/menu-parser.c.menu-onlyshowin 2004-03-05 16:02:22.766818872 -0500
-+++ desktop-file-utils-0.6/src/menu-parser.c 2004-03-05 16:30:52.102960280 -0500
-@@ -334,7 +334,11 @@
- error))
- return;
-
-- if (ELEMENT_IS ("AppDir"))
-+ if (ELEMENT_IS ("OnlyShowIn"))
-+ {
-+ push_node (parser, MENU_NODE_MENU_ONLY_SHOW_IN);
-+ }
-+ else if (ELEMENT_IS ("AppDir"))
- {
- push_node (parser, MENU_NODE_APP_DIR);
- }
-@@ -780,6 +784,7 @@
-
- switch (menu_node_get_type (parser->stack_top))
- {
-+ case MENU_NODE_MENU_ONLY_SHOW_IN:
- case MENU_NODE_APP_DIR:
- case MENU_NODE_DIRECTORY_DIR:
- case MENU_NODE_NAME:
-@@ -867,6 +872,7 @@
-
- switch (menu_node_get_type (parser->stack_top))
- {
-+ case MENU_NODE_MENU_ONLY_SHOW_IN:
- case MENU_NODE_APP_DIR:
- case MENU_NODE_DIRECTORY_DIR:
- case MENU_NODE_NAME:
---- desktop-file-utils-0.6/src/menu-process.c.only-show-in-api 2004-05-04 14:38:29.593074535 -0400
-+++ desktop-file-utils-0.6/src/menu-process.c 2004-05-04 14:38:29.605072675 -0400
-@@ -33,6 +33,11 @@
- #define _(x) gettext ((x))
- #define N_(x) x
-
-+/* Global OnlyShowIn variable, works for both
-+ * DesktopEntryTrees and Menus.
-+ */
-+static char * only_show_in_desktop = NULL;
-+
- static void menu_node_resolve_files (MenuCache *menu_cache,
- EntryCache *entry_cache,
- MenuNode *node);
-@@ -1010,6 +1015,7 @@
- struct DesktopEntryTree
- {
- int refcount;
-+ char *only_show_in_env;
- char *menu_file;
- char *menu_file_dir;
- EntryCache *entry_cache;
-@@ -1053,7 +1059,6 @@
-
- DesktopEntryTree*
- desktop_entry_tree_load (const char *filename,
-- const char *only_show_in_desktop,
- const char *create_chaining_to,
- GError **error)
- {
-@@ -1111,6 +1116,7 @@
-
- tree = g_new0 (DesktopEntryTree, 1);
- tree->refcount = 1;
-+ tree->only_show_in_env = NULL;
- tree->menu_cache = menu_cache;
- tree->entry_cache = entry_cache;
- tree->menu_file = canonical;
-@@ -1151,6 +1157,7 @@
-
- if (tree->refcount == 0)
- {
-+ g_free (tree->only_show_in_env);
- g_free (tree->menu_file);
- g_free (tree->menu_file_dir);
- menu_node_unref (tree->orig_node);
-@@ -1861,6 +1861,14 @@
- }
- break;
-
-+ case MENU_NODE_MENU_ONLY_SHOW_IN:
-+ {
-+ if (only_show_in_desktop)
-+ if (strcmp (only_show_in_desktop, menu_node_get_content (child)) != 0)
-+ deleted = TRUE;
-+ }
-+ break;
-+
- case MENU_NODE_NAME:
- {
- if (tree_node->name)
-@@ -3257,3 +3264,12 @@
- g_free (change->path);
- g_free (change);
- }
-+
-+void
-+desktop_set_only_show_in (const char *only_show_in)
-+{
-+ if (only_show_in_desktop)
-+ g_free (only_show_in_desktop);
-+
-+ only_show_in_desktop = g_strdup (only_show_in);
-+}
---- desktop-file-utils-0.6/src/menu-process.h.only-show-in-api 2004-05-04 14:38:29.594074380 -0400
-+++ desktop-file-utils-0.6/src/menu-process.h 2004-05-04 14:38:29.606072520 -0400
-@@ -60,7 +60,6 @@
- } DesktopEntryTreePrintFlags;
-
- DesktopEntryTree* desktop_entry_tree_load (const char *filename,
-- const char *only_show_in_desktop,
- const char *create_chaining_to,
- GError **error);
- void desktop_entry_tree_ref (DesktopEntryTree *tree);
-@@ -172,5 +170,7 @@
-
- void desktop_entry_tree_change_free (DesktopEntryTreeChange *change);
-
-+/* Set OnlyShowIn globally */
-+void desktop_set_only_show_in (const char *only_show_in);
-
- #endif /* MENU_PROCESS_H */
---- desktop-file-utils-0.6/src/menu-tree-cache.c.only-show-in-api 2004-05-04 14:38:29.579076704 -0400
-+++ desktop-file-utils-0.6/src/menu-tree-cache.c 2004-05-04 14:38:29.608072210 -0400
-@@ -135,7 +135,6 @@
-
- tmp_error = NULL;
- reloaded = desktop_entry_tree_load (entry->canonical_path,
-- NULL, /* FIXME only show in desktop */
- entry->create_chaining_to,
- &tmp_error);
-
---- desktop-file-utils-0.6/src/menu-method.c.only-show-in-api 2004-05-04 14:43:02.375787404 -0400
-+++ desktop-file-utils-0.6/src/menu-method.c 2004-05-04 14:43:09.751643963 -0400
-@@ -750,6 +750,7 @@
- vfs_module_init (const char *method_name, const char *args)
- {
- desktop_entry_tree_diradd_callback_set (directory_add_callback);
-+ desktop_set_only_show_in ("GNOME");
- return &vtable;
- }
-