]> git.pld-linux.org Git - packages/desktop-file-utils.git/commitdiff
- support for NoDisplay in .directory files
authorgrzegol <grzegol@pld-linux.org>
Wed, 28 Jul 2004 20:27:53 +0000 (20:27 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    desktop-file-utils-directory_nodisplay.patch -> 1.1

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

diff --git a/desktop-file-utils-directory_nodisplay.patch b/desktop-file-utils-directory_nodisplay.patch
new file mode 100644 (file)
index 0000000..2993ba6
--- /dev/null
@@ -0,0 +1,191 @@
+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);
This page took 0.051132 seconds and 4 git commands to generate.