]> git.pld-linux.org Git - packages/desktop-file-utils.git/commitdiff
- support for NoShowIn menu entry
authorgrzegol <grzegol@pld-linux.org>
Thu, 22 Jul 2004 22:25:10 +0000 (22:25 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    desktop-file-utils-noshowin.patch -> 1.1

desktop-file-utils-noshowin.patch [new file with mode: 0644]

diff --git a/desktop-file-utils-noshowin.patch b/desktop-file-utils-noshowin.patch
new file mode 100644 (file)
index 0000000..d0aa003
--- /dev/null
@@ -0,0 +1,231 @@
+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 */
This page took 0.094552 seconds and 4 git commands to generate.