1 --- desktop-file-utils-0.6/src/menu-layout.h.menu-onlyshowin 2004-03-05 15:38:25.231357480 -0500
2 +++ desktop-file-utils-0.6/src/menu-layout.h 2004-03-05 15:39:10.444484040 -0500
7 + MENU_NODE_MENU_ONLY_SHOW_IN,
9 MENU_NODE_DEFAULT_APP_DIRS,
10 MENU_NODE_DIRECTORY_DIR,
11 --- desktop-file-utils-0.6/src/menu-layout.c.menu-onlyshowin 2004-03-05 15:38:36.603628632 -0500
12 +++ desktop-file-utils-0.6/src/menu-layout.c 2004-03-05 15:41:41.088582656 -0500
15 append_container (node, depth, "Menu", str);
17 + case MENU_NODE_MENU_ONLY_SHOW_IN:
18 + append_simple (node, depth, "OnlyShowIn", str);
20 case MENU_NODE_APP_DIR:
21 append_simple (node, depth, "AppDir", str);
23 --- desktop-file-utils-0.6/src/menu-parser.c.menu-onlyshowin 2004-03-05 16:02:22.766818872 -0500
24 +++ desktop-file-utils-0.6/src/menu-parser.c 2004-03-05 16:30:52.102960280 -0500
29 - if (ELEMENT_IS ("AppDir"))
30 + if (ELEMENT_IS ("OnlyShowIn"))
32 + push_node (parser, MENU_NODE_MENU_ONLY_SHOW_IN);
34 + else if (ELEMENT_IS ("AppDir"))
36 push_node (parser, MENU_NODE_APP_DIR);
40 switch (menu_node_get_type (parser->stack_top))
42 + case MENU_NODE_MENU_ONLY_SHOW_IN:
43 case MENU_NODE_APP_DIR:
44 case MENU_NODE_DIRECTORY_DIR:
48 switch (menu_node_get_type (parser->stack_top))
50 + case MENU_NODE_MENU_ONLY_SHOW_IN:
51 case MENU_NODE_APP_DIR:
52 case MENU_NODE_DIRECTORY_DIR:
54 --- desktop-file-utils-0.6/src/menu-process.c.only-show-in-api 2004-05-04 14:38:29.593074535 -0400
55 +++ desktop-file-utils-0.6/src/menu-process.c 2004-05-04 14:38:29.605072675 -0400
57 #define _(x) gettext ((x))
60 +/* Global OnlyShowIn variable, works for both
61 + * DesktopEntryTrees and Menus.
63 +static char * only_show_in_desktop = NULL;
65 static void menu_node_resolve_files (MenuCache *menu_cache,
66 EntryCache *entry_cache,
69 struct DesktopEntryTree
72 + char *only_show_in_env;
75 EntryCache *entry_cache;
79 desktop_entry_tree_load (const char *filename,
80 - const char *only_show_in_desktop,
81 const char *create_chaining_to,
86 tree = g_new0 (DesktopEntryTree, 1);
88 + tree->only_show_in_env = NULL;
89 tree->menu_cache = menu_cache;
90 tree->entry_cache = entry_cache;
91 tree->menu_file = canonical;
94 if (tree->refcount == 0)
96 + g_free (tree->only_show_in_env);
97 g_free (tree->menu_file);
98 g_free (tree->menu_file_dir);
99 menu_node_unref (tree->orig_node);
100 @@ -1861,6 +1861,14 @@
104 + case MENU_NODE_MENU_ONLY_SHOW_IN:
106 + if (only_show_in_desktop)
107 + if (strcmp (only_show_in_desktop, menu_node_get_content (child)) != 0)
115 @@ -3257,3 +3264,12 @@
116 g_free (change->path);
121 +desktop_set_only_show_in (const char *only_show_in)
123 + if (only_show_in_desktop)
124 + g_free (only_show_in_desktop);
126 + only_show_in_desktop = g_strdup (only_show_in);
128 --- desktop-file-utils-0.6/src/menu-process.h.only-show-in-api 2004-05-04 14:38:29.594074380 -0400
129 +++ desktop-file-utils-0.6/src/menu-process.h 2004-05-04 14:38:29.606072520 -0400
131 } DesktopEntryTreePrintFlags;
133 DesktopEntryTree* desktop_entry_tree_load (const char *filename,
134 - const char *only_show_in_desktop,
135 const char *create_chaining_to,
137 void desktop_entry_tree_ref (DesktopEntryTree *tree);
140 void desktop_entry_tree_change_free (DesktopEntryTreeChange *change);
142 +/* Set OnlyShowIn globally */
143 +void desktop_set_only_show_in (const char *only_show_in);
145 #endif /* MENU_PROCESS_H */
146 --- desktop-file-utils-0.6/src/menu-tree-cache.c.only-show-in-api 2004-05-04 14:38:29.579076704 -0400
147 +++ desktop-file-utils-0.6/src/menu-tree-cache.c 2004-05-04 14:38:29.608072210 -0400
151 reloaded = desktop_entry_tree_load (entry->canonical_path,
152 - NULL, /* FIXME only show in desktop */
153 entry->create_chaining_to,
156 --- desktop-file-utils-0.6/src/menu-method.c.only-show-in-api 2004-05-04 14:43:02.375787404 -0400
157 +++ desktop-file-utils-0.6/src/menu-method.c 2004-05-04 14:43:09.751643963 -0400
159 vfs_module_init (const char *method_name, const char *args)
161 desktop_entry_tree_diradd_callback_set (directory_add_callback);
162 + desktop_set_only_show_in ("GNOME");