1 diff -urN aa/desktop-file-utils-0.6/src/menu-entries.c desktop-file-utils-0.6/src/menu-entries.c
2 --- aa/desktop-file-utils-0.6/src/menu-entries.c 2004-07-22 01:37:57.796843632 +0200
3 +++ desktop-file-utils-0.6/src/menu-entries.c 2004-07-23 00:12:03.519828512 +0200
7 char *only_show_in_name;
8 + char *no_show_in_name;
9 GHashTable *atoms_by_name;
10 GHashTable *names_by_atom;
11 unsigned int next_atom;
12 @@ -1832,6 +1833,47 @@
16 + if (cache->no_show_in_name)
22 + noshowin = find_value (str, "NoShowIn");
24 + if (noshowin != NULL)
29 + split = string_list_from_desktop_value (noshowin);
31 + while (split[i] != NULL)
33 + if (strcmp (split[i], cache->no_show_in_name) == 0)
43 + menu_verbose ("Not showing \"%s\" due to NoShowIn=%s\n",
44 + filename, noshowin);
57 e = entry_new (ENTRY_DESKTOP, basename, filename);
59 categories = find_value (str, "Categories");
61 g_hash_table_destroy (cache->atoms_by_name);
63 g_free (cache->only_show_in_name);
64 + g_free (cache->no_show_in_name);
68 @@ -2276,6 +2319,21 @@
69 cache->only_show_in_name = g_strdup (name);
73 +entry_cache_set_no_show_in_name (EntryCache *cache,
76 + g_return_if_fail (cache != NULL);
78 + /* Really you're screwed if you do this after stuff has
79 + * already been loaded...
82 + g_free (cache->no_show_in_name);
83 + cache->no_show_in_name = g_strdup (name);
88 cached_dir_invalidate (CachedDir *dir)
90 diff -urN aa/desktop-file-utils-0.6/src/menu-entries.h desktop-file-utils-0.6/src/menu-entries.h
91 --- aa/desktop-file-utils-0.6/src/menu-entries.h 2004-07-22 01:22:29.208010592 +0200
92 +++ desktop-file-utils-0.6/src/menu-entries.h 2004-07-23 00:03:18.085706640 +0200
94 void entry_cache_unref (EntryCache *cache);
95 void entry_cache_set_only_show_in_name (EntryCache *cache,
97 +void entry_cache_set_no_show_in_name (EntryCache *cache,
99 void entry_cache_invalidate (EntryCache *cache,
102 diff -urN aa/desktop-file-utils-0.6/src/menu-layout.c desktop-file-utils-0.6/src/menu-layout.c
103 --- aa/desktop-file-utils-0.6/src/menu-layout.c 2004-07-22 01:43:43.405303160 +0200
104 +++ desktop-file-utils-0.6/src/menu-layout.c 2004-07-23 00:06:03.359581192 +0200
105 @@ -1645,6 +1645,9 @@
106 case MENU_NODE_MENU_ONLY_SHOW_IN:
107 append_simple (node, depth, "OnlyShowIn", str);
109 + case MENU_NODE_MENU_NO_SHOW_IN:
110 + append_simple (node, depth, "NoShowIn", str);
112 case MENU_NODE_MENU_NO_DISPLAY:
113 append_simple (node, depth, "NoDisplay", str);
115 diff -urN aa/desktop-file-utils-0.6/src/menu-layout.h desktop-file-utils-0.6/src/menu-layout.h
116 --- aa/desktop-file-utils-0.6/src/menu-layout.h 2004-07-22 01:43:10.477308976 +0200
117 +++ desktop-file-utils-0.6/src/menu-layout.h 2004-07-23 00:05:36.061731096 +0200
119 MENU_NODE_PASSTHROUGH,
121 MENU_NODE_MENU_ONLY_SHOW_IN,
122 + MENU_NODE_MENU_NO_SHOW_IN,
123 MENU_NODE_MENU_NO_DISPLAY,
125 MENU_NODE_DEFAULT_APP_DIRS,
126 diff -urN aa/desktop-file-utils-0.6/src/menu-method.c desktop-file-utils-0.6/src/menu-method.c
127 --- aa/desktop-file-utils-0.6/src/menu-method.c 2004-07-22 01:22:29.218009072 +0200
128 +++ desktop-file-utils-0.6/src/menu-method.c 2004-07-23 00:00:32.837828136 +0200
131 desktop_entry_tree_diradd_callback_set (directory_add_callback);
132 desktop_set_only_show_in ("GNOME");
133 + desktop_set_no_show_in ("GNOME");
137 diff -urN aa/desktop-file-utils-0.6/src/menu-parser.c desktop-file-utils-0.6/src/menu-parser.c
138 --- aa/desktop-file-utils-0.6/src/menu-parser.c 2004-07-22 01:45:04.482977480 +0200
139 +++ desktop-file-utils-0.6/src/menu-parser.c 2004-07-23 00:06:54.961736472 +0200
142 push_node (parser, MENU_NODE_MENU_ONLY_SHOW_IN);
144 + if (ELEMENT_IS ("NoShowIn"))
146 + push_node (parser, MENU_NODE_MENU_NO_SHOW_IN);
148 else if (ELEMENT_IS ("NoDisplay"))
150 push_node (parser, MENU_NODE_MENU_NO_DISPLAY);
152 switch (menu_node_get_type (parser->stack_top))
154 case MENU_NODE_MENU_ONLY_SHOW_IN:
155 + case MENU_NODE_MENU_NO_SHOW_IN:
156 case MENU_NODE_MENU_NO_DISPLAY:
157 case MENU_NODE_APP_DIR:
158 case MENU_NODE_DIRECTORY_DIR:
160 switch (menu_node_get_type (parser->stack_top))
162 case MENU_NODE_MENU_ONLY_SHOW_IN:
163 + case MENU_NODE_MENU_NO_SHOW_IN:
164 case MENU_NODE_MENU_NO_DISPLAY:
165 case MENU_NODE_APP_DIR:
166 case MENU_NODE_DIRECTORY_DIR:
167 diff -urN aa/desktop-file-utils-0.6/src/menu-process.c desktop-file-utils-0.6/src/menu-process.c
168 --- aa/desktop-file-utils-0.6/src/menu-process.c 2004-07-22 01:49:07.279066864 +0200
169 +++ desktop-file-utils-0.6/src/menu-process.c 2004-07-23 00:08:59.312832232 +0200
172 static char * only_show_in_desktop = NULL;
174 +/* Global NoShowIn variable, works for both
175 + * DesktopEntryTrees and Menus.
177 +static char * no_show_in_desktop = NULL;
179 static void menu_node_resolve_files (MenuCache *menu_cache,
180 EntryCache *entry_cache,
182 @@ -1103,6 +1108,10 @@
183 if (only_show_in_desktop)
184 entry_cache_set_only_show_in_name (entry_cache,
185 only_show_in_desktop);
187 + if (no_show_in_desktop)
188 + entry_cache_set_no_show_in_name (entry_cache,
189 + no_show_in_desktop);
191 resolved_node = menu_node_deep_copy (orig_node);
192 menu_node_resolve_files (menu_cache, entry_cache, resolved_node);
193 @@ -1995,6 +2004,14 @@
197 + case MENU_NODE_MENU_NO_SHOW_IN:
199 + if (no_show_in_desktop)
200 + if (strcmp (no_show_in_desktop, menu_node_get_content (child)) == 0)
205 case MENU_NODE_MENU_NO_DISPLAY:
207 if (strcasecmp (menu_node_get_content (child), "True") == 0)
208 @@ -3262,3 +3279,12 @@
210 only_show_in_desktop = g_strdup (only_show_in);
214 +desktop_set_no_show_in (const char *no_show_in)
216 + if (no_show_in_desktop)
217 + g_free (no_show_in_desktop);
219 + no_show_in_desktop = g_strdup (no_show_in);
221 diff -urN aa/desktop-file-utils-0.6/src/menu-process.h desktop-file-utils-0.6/src/menu-process.h
222 --- aa/desktop-file-utils-0.6/src/menu-process.h 2004-07-22 01:22:29.209010440 +0200
223 +++ desktop-file-utils-0.6/src/menu-process.h 2004-07-22 23:59:56.010426752 +0200
225 /* Set OnlyShowIn globally */
226 void desktop_set_only_show_in (const char *only_show_in);
228 +/* Set NoShowIn globally */
229 +void desktop_set_no_show_in (const char *no_show_in);
231 #endif /* MENU_PROCESS_H */