r15950 - in /desktop/unstable/gnome-menus/debian: changelog patches/12_merge_duplicates.patch patches/series

joss at users.alioth.debian.org joss at users.alioth.debian.org
Tue May 13 11:14:16 UTC 2008


Author: joss
Date: Tue May 13 11:14:16 2008
New Revision: 15950

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=15950
Log:
12_merge_duplicates.patch: when merging subdirectories without the 
inline_header property, sort again the entries after the merge.
Closes: #447823. Also filter out duplicates. Closes: #444587.

Added:
    desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch
Modified:
    desktop/unstable/gnome-menus/debian/changelog
    desktop/unstable/gnome-menus/debian/patches/series

Modified: desktop/unstable/gnome-menus/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-menus/debian/changelog?rev=15950&op=diff
==============================================================================
--- desktop/unstable/gnome-menus/debian/changelog (original)
+++ desktop/unstable/gnome-menus/debian/changelog Tue May 13 11:14:16 2008
@@ -1,3 +1,11 @@
+gnome-menus (2.22.1-3) unstable; urgency=low
+
+  * 12_merge_duplicates.patch: when merging subdirectories without the 
+    inline_header property, sort again the entries after the merge.
+    Closes: #447823. Also filter out duplicates. Closes: #444587.
+
+ -- Josselin Mouette <joss at debian.org>  Tue, 13 May 2008 13:14:12 +0200
+
 gnome-menus (2.22.1-2) unstable; urgency=low
 
   * 09_games-menu.patch: don't use the flawed <OnlyUnallocated> marker, 

Added: desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch?rev=15950&op=file
==============================================================================
--- desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch (added)
+++ desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch Tue May 13 11:14:16 2008
@@ -1,0 +1,95 @@
+Index: gnome-menus-2.22.1/libmenu/gmenu-tree.c
+===================================================================
+--- gnome-menus-2.22.1.orig/libmenu/gmenu-tree.c	2008-05-13 13:00:03.028979620 +0200
++++ gnome-menus-2.22.1/libmenu/gmenu-tree.c	2008-05-13 13:06:26.088988539 +0200
+@@ -3433,6 +3433,72 @@ process_only_unallocated (GMenuTree     
+ static void process_layout_info (GMenuTree          *tree,
+ 				 GMenuTreeDirectory *directory);
+ 
++static int
++gmenu_tree_item_compare_with_type (GMenuTreeItem *a,
++                                   GMenuTreeItem *b)
++{
++  if (a->type == b->type)
++    {
++      if (a->type == GMENU_TREE_ITEM_DIRECTORY || a->type == GMENU_TREE_ITEM_ENTRY)
++        return gmenu_tree_item_compare (a, b);
++      return 0;
++    }
++  /* Entries after the rest */
++  if (a->type == GMENU_TREE_ITEM_ENTRY)
++    return 1;
++  if (b->type == GMENU_TREE_ITEM_ENTRY)
++    return -1;
++  /* Directories before */
++  if (a->type == GMENU_TREE_ITEM_DIRECTORY)
++    return -1;
++  if (b->type == GMENU_TREE_ITEM_DIRECTORY)
++    return 1;
++
++  return 0;
++}
++
++static gboolean
++gmenu_tree_are_same_entry (GMenuTreeItem *a,
++                           GMenuTreeItem *b)
++{
++  if (a->type != GMENU_TREE_ITEM_ENTRY || b->type != GMENU_TREE_ITEM_ENTRY)
++    return FALSE;
++
++  GMenuTreeEntry *entry_a = (GMenuTreeEntry *) a;
++  GMenuTreeEntry *entry_b = (GMenuTreeEntry *) b;
++
++  return (strcmp (entry_a->desktop_file_id, entry_b->desktop_file_id) == 0);
++}
++
++static void sort_after_merge (GMenuTreeDirectory *directory,
++                              MenuLayoutValues *layout_values)
++{
++  /* Only sort if needed */
++  if (layout_values->inline_header || layout_values->inline_alias)
++    return;
++
++  directory->contents = g_slist_sort (directory->contents,
++                                      (GCompareFunc) gmenu_tree_item_compare_with_type);
++
++  /* Remove duplicates */
++  GSList *l = directory->contents;
++  while (l != NULL)
++    {
++      GSList *next = l->next;
++      if (next != NULL)
++        {
++          GMenuTreeItem *a = l->data;
++          GMenuTreeItem *b = next->data;
++          if (gmenu_tree_are_same_entry (a, b))
++            {
++              directory->contents = g_slist_delete_link (directory->contents, next);
++              gmenu_tree_item_unref_and_unset_parent (b);
++            }
++        }
++      l = l->next;
++    }
++}
++
+ static void
+ merge_subdir (GMenuTree          *tree,
+ 	      GMenuTreeDirectory *directory,
+@@ -3639,6 +3705,8 @@ merge_subdirs (GMenuTree          *tree,
+ 
+   g_slist_free (subdirs);
+   g_slist_free (except);
++
++  sort_after_merge (directory, &directory->default_layout_values);
+ }
+ 
+ static void
+@@ -3743,6 +3811,8 @@ merge_subdirs_and_entries (GMenuTree    
+   g_slist_free (items);
+   g_slist_free (except_subdirs);
+   g_slist_free (except_entries);
++
++  sort_after_merge (directory, &directory->default_layout_values);
+ }
+ 
+ static void

Modified: desktop/unstable/gnome-menus/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-menus/debian/patches/series?rev=15950&op=diff
==============================================================================
--- desktop/unstable/gnome-menus/debian/patches/series (original)
+++ desktop/unstable/gnome-menus/debian/patches/series Tue May 13 11:14:16 2008
@@ -9,4 +9,5 @@
 10_use-default-python-path.patch
 #20_show-admin-tools-for-admin-group.patch
 11_accessibility_accessories.patch
+12_merge_duplicates.patch
 21_default-python-in-shebang.patch




More information about the pkg-gnome-commits mailing list