]> git.pld-linux.org Git - packages/desktop-file-utils.git/blob - desktop-file-utils-onlyshowin.patch
- added nodisplay and noshowin patches (support for NoDisplay and NoShowIn
[packages/desktop-file-utils.git] / desktop-file-utils-onlyshowin.patch
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
3 @@ -36,6 +36,7 @@
4    MENU_NODE_ROOT,
5    MENU_NODE_PASSTHROUGH,
6    MENU_NODE_MENU,
7 +  MENU_NODE_MENU_ONLY_SHOW_IN,
8    MENU_NODE_APP_DIR,
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
13 @@ -1642,6 +1642,9 @@
14      case MENU_NODE_MENU:
15        append_container (node, depth, "Menu", str);
16        break;
17 +    case MENU_NODE_MENU_ONLY_SHOW_IN:
18 +      append_simple (node, depth, "OnlyShowIn", str);
19 +      break;
20      case MENU_NODE_APP_DIR:
21        append_simple (node, depth, "AppDir", str);
22        break;
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
25 @@ -334,7 +334,11 @@
26                                  error))
27          return;
28  
29 -      if (ELEMENT_IS ("AppDir"))
30 +      if (ELEMENT_IS ("OnlyShowIn"))
31 +        {
32 +          push_node (parser, MENU_NODE_MENU_ONLY_SHOW_IN);
33 +        }
34 +      else if (ELEMENT_IS ("AppDir"))
35          {
36            push_node (parser, MENU_NODE_APP_DIR);
37          }
38 @@ -780,6 +784,7 @@
39  
40    switch (menu_node_get_type (parser->stack_top))
41      {
42 +    case MENU_NODE_MENU_ONLY_SHOW_IN:
43      case MENU_NODE_APP_DIR:
44      case MENU_NODE_DIRECTORY_DIR:
45      case MENU_NODE_NAME:
46 @@ -867,6 +872,7 @@
47  
48    switch (menu_node_get_type (parser->stack_top))
49      {
50 +    case MENU_NODE_MENU_ONLY_SHOW_IN:
51      case MENU_NODE_APP_DIR:
52      case MENU_NODE_DIRECTORY_DIR:
53      case MENU_NODE_NAME:
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
56 @@ -33,6 +33,11 @@
57  #define _(x) gettext ((x))
58  #define N_(x) x
59  
60 +/* Global OnlyShowIn variable, works for both
61 + * DesktopEntryTrees and Menus.
62 + */
63 +static char *    only_show_in_desktop = NULL;
64 +
65  static void      menu_node_resolve_files            (MenuCache  *menu_cache,
66                                                       EntryCache *entry_cache,
67                                                       MenuNode   *node);
68 @@ -1010,6 +1015,7 @@
69  struct DesktopEntryTree
70  {
71    int refcount;
72 +  char *only_show_in_env;
73    char *menu_file;
74    char *menu_file_dir;
75    EntryCache *entry_cache;
76 @@ -1053,7 +1059,6 @@
77  
78  DesktopEntryTree*
79  desktop_entry_tree_load (const char  *filename,
80 -                         const char  *only_show_in_desktop,
81                           const char  *create_chaining_to,
82                           GError     **error)
83  {
84 @@ -1111,6 +1116,7 @@
85    
86    tree = g_new0 (DesktopEntryTree, 1);
87    tree->refcount = 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;
92 @@ -1151,6 +1157,7 @@
93  
94    if (tree->refcount == 0)
95      {
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 @@
101            }
102            break;
103  
104 +        case MENU_NODE_MENU_ONLY_SHOW_IN:
105 +          {
106 +            if (only_show_in_desktop)
107 +              if (strcmp (only_show_in_desktop, menu_node_get_content (child)) != 0)
108 +                  deleted = TRUE;
109 +          }
110 +          break;
111 +
112          case MENU_NODE_NAME:
113            {
114              if (tree_node->name)
115 @@ -3257,3 +3264,12 @@
116    g_free (change->path);
117    g_free (change);
118  }
119 +
120 +void
121 +desktop_set_only_show_in (const char *only_show_in)
122 +{
123 +  if (only_show_in_desktop)
124 +    g_free (only_show_in_desktop);
125 +
126 +  only_show_in_desktop = g_strdup (only_show_in);
127 +}
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
130 @@ -60,7 +60,6 @@
131  } DesktopEntryTreePrintFlags;
132  
133  DesktopEntryTree* desktop_entry_tree_load  (const char  *filename,
134 -                                            const char  *only_show_in_desktop,
135                                              const char  *create_chaining_to,
136                                              GError     **error);
137  void              desktop_entry_tree_ref   (DesktopEntryTree *tree);
138 @@ -172,5 +170,7 @@
139  
140  void desktop_entry_tree_change_free (DesktopEntryTreeChange *change);
141  
142 +/* Set OnlyShowIn globally */
143 +void        desktop_set_only_show_in (const char *only_show_in);
144  
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
148 @@ -135,7 +135,6 @@
149        
150        tmp_error = NULL;
151        reloaded = desktop_entry_tree_load (entry->canonical_path,
152 -                                          NULL, /* FIXME only show in desktop */
153                                            entry->create_chaining_to,
154                                            &tmp_error);
155  
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
158 @@ -750,6 +750,7 @@
159  vfs_module_init (const char *method_name, const char *args)
160  {
161          desktop_entry_tree_diradd_callback_set (directory_add_callback);
162 +        desktop_set_only_show_in ("GNOME");
163          return &vtable;
164  }
165  
This page took 0.044838 seconds and 3 git commands to generate.