r20518 - in /desktop/unstable/gnome-menus/debian: changelog copyright patches/12_merge_duplicates.patch patches/12_submenus_inherit.patch patches/series
joss at users.alioth.debian.org
joss at users.alioth.debian.org
Mon Jun 29 19:25:58 UTC 2009
Author: joss
Date: Mon Jun 29 19:25:56 2009
New Revision: 20518
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=20518
Log:
* 12_merge_duplicates.patch: use the version provided by upstream
instead of my gross hack. Thanks a lot, Vincent.
* 12_submenus_inherit.patch: stolen upstream. Make children correctly
inherit their parents’ layout. Necessary for
12_merge_duplicates.patch to work.
* Point to versioned GPL.
Added:
desktop/unstable/gnome-menus/debian/patches/12_submenus_inherit.patch
Modified:
desktop/unstable/gnome-menus/debian/changelog
desktop/unstable/gnome-menus/debian/copyright
desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch
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=20518&op=diff
==============================================================================
--- desktop/unstable/gnome-menus/debian/changelog (original)
+++ desktop/unstable/gnome-menus/debian/changelog Mon Jun 29 19:25:56 2009
@@ -1,3 +1,14 @@
+gnome-menus (2.26.1-2) unstable; urgency=low
+
+ * 12_merge_duplicates.patch: use the version provided by upstream
+ instead of my gross hack. Thanks a lot, Vincent.
+ * 12_submenus_inherit.patch: stolen upstream. Make children correctly
+ inherit their parentsâ layout. Necessary for
+ 12_merge_duplicates.patch to work.
+ * Point to versioned GPL.
+
+ -- Josselin Mouette <joss at debian.org> Sat, 27 Jun 2009 13:01:24 +0200
+
gnome-menus (2.26.1-1) unstable; urgency=low
* New upstream release.
Modified: desktop/unstable/gnome-menus/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-menus/debian/copyright?rev=20518&op=diff
==============================================================================
--- desktop/unstable/gnome-menus/debian/copyright (original)
+++ desktop/unstable/gnome-menus/debian/copyright Mon Jun 29 19:25:56 2009
@@ -25,5 +25,4 @@
USA.
On Debian systems, the complete text of the GNU General
-Public License can be found in `/usr/share/common-licenses/GPL'.
-
+Public License can be found in `/usr/share/common-licenses/GPL-2'.
Modified: 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=20518&op=diff
==============================================================================
--- desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch (original)
+++ desktop/unstable/gnome-menus/debian/patches/12_merge_duplicates.patch Mon Jun 29 19:25:56 2009
@@ -1,99 +1,662 @@
Debian #447823 and #444587
GNOME #490483
-Index: gnome-menus-2.24.2/libmenu/gmenu-tree.c
-===================================================================
---- gnome-menus-2.24.2.orig/libmenu/gmenu-tree.c 2008-12-26 17:32:49.935593279 +0100
-+++ gnome-menus-2.24.2/libmenu/gmenu-tree.c 2008-12-26 17:37:37.047586983 +0100
-@@ -3548,6 +3548,73 @@ process_only_unallocated (GMenuTree
- static void process_layout_info (GMenuTree *tree,
- GMenuTreeDirectory *directory);
+From 8bddaf2076e094043189a20c36bf66b8c3813921 Mon Sep 17 00:00:00 2001
+From: Vincent Untz <vuntz at gnome.org>
+Date: Sat, 27 Jun 2009 02:18:02 +0000
+Subject: [libmenu] Sort inlined items unless inline_header is used
+
+We also strip duplicate entries in a menu when we do such a sort.
+
+This is actually not a trivial task since it means we have to correctly
+preprocess all inline data before using the layout -- else, we'd try to
+sort items while a layout has been used, which is too late (since you
+can specify that you want mixed entries and directories, eg; or even
+entries or directories in a specified order).
+
+We make sure to evaluate the inline data at the deepest first, so we can
+correctly propagate as much inline items as possible to the top.
+
+http://bugzilla.gnome.org/show_bug.cgi?id=490483
+---
+diff --git a/libmenu/gmenu-tree.c b/libmenu/gmenu-tree.c
+index 7fd486a..dd4c417 100644
+--- a/libmenu/gmenu-tree.c
++++ b/libmenu/gmenu-tree.c
+@@ -102,6 +102,10 @@ struct GMenuTreeDirectory
+ guint is_root : 1;
+ guint is_nodisplay : 1;
+ guint layout_pending_separator : 1;
++ guint preprocessed : 1;
++
++ /* 16 bits should be more than enough; G_MAXUINT16 means no inline header */
++ guint will_inline_header : 16;
+ };
+
+ typedef struct
+@@ -1256,6 +1260,9 @@ gmenu_tree_directory_new (GMenuTreeDirectory *parent,
+ retval->contents = NULL;
+ retval->only_unallocated = FALSE;
+ retval->is_nodisplay = FALSE;
++ retval->layout_pending_separator = FALSE;
++ retval->preprocessed = FALSE;
++ retval->will_inline_header = G_MAXUINT16;
+
+ retval->default_layout_values.mask = MENU_LAYOUT_VALUES_NONE;
+ retval->default_layout_values.show_empty = FALSE;
+@@ -1453,6 +1460,13 @@ gmenu_tree_entry_compare (GMenuTreeEntry *a,
+ desktop_entry_get_name (b->desktop_entry));
+ }
+static int
-+gmenu_tree_item_compare_with_type (GMenuTreeItem *a,
-+ GMenuTreeItem *b)
++gmenu_tree_entry_compare_by_id (GMenuTreeEntry *a,
++ GMenuTreeEntry *b)
+{
-+ if (a->type == b->type)
++ return strcmp (a->desktop_file_id, b->desktop_file_id);
++}
++
+ gpointer
+ gmenu_tree_item_ref (gpointer itemp)
+ {
+@@ -3544,107 +3558,403 @@ process_only_unallocated (GMenuTree *tree,
+ }
+ }
+
+-static void process_layout_info (GMenuTree *tree,
+- GMenuTreeDirectory *directory);
++static void preprocess_layout_info (GMenuTree *tree,
++ GMenuTreeDirectory *directory);
+
+-static void
+-check_pending_separator (GMenuTreeDirectory *directory)
++static GSList *
++get_layout_info (GMenuTreeDirectory *directory)
+ {
+- if (directory->layout_pending_separator)
++ GMenuTreeDirectory *iter;
++
++ if (directory->layout_info != NULL)
+ {
+- menu_verbose ("Adding pending separator in '%s'\n", directory->name);
++ return directory->layout_info;
++ }
+
+- directory->contents = g_slist_append (directory->contents,
+- gmenu_tree_separator_new (directory));
+- directory->layout_pending_separator = FALSE;
++ iter = directory;
++ while (iter != NULL)
+ {
-+ if (a->type == GMENU_TREE_ITEM_DIRECTORY || a->type == GMENU_TREE_ITEM_ENTRY)
-+ return gmenu_tree_item_compare (a, b);
-+ return 0;
++ if (iter->default_layout_info != NULL)
++ {
++ return iter->default_layout_info;
++ }
++
++ iter = GMENU_TREE_ITEM (iter)->parent;
+ }
++
++ return NULL;
+ }
+
+ static void
+-merge_subdir (GMenuTree *tree,
+- GMenuTreeDirectory *directory,
+- GMenuTreeDirectory *subdir,
+- MenuLayoutValues *layout_values)
++get_values_with_defaults (MenuLayoutNode *node,
++ MenuLayoutValues *layout_values,
++ MenuLayoutValues *default_layout_values)
+ {
+- gboolean removed;
++ menu_layout_node_menuname_get_values (node, layout_values);
+
+- menu_verbose ("Merging subdir '%s' in directory '%s'\n",
+- subdir->name, directory->name);
++ if (!(layout_values->mask & MENU_LAYOUT_VALUES_SHOW_EMPTY))
++ layout_values->show_empty = default_layout_values->show_empty;
+
+- process_layout_info (tree, subdir);
++ if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_MENUS))
++ layout_values->inline_menus = default_layout_values->inline_menus;
+
+- removed = FALSE;
++ if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_LIMIT))
++ layout_values->inline_limit = default_layout_values->inline_limit;
+
+- if (subdir->contents == NULL)
++ if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_HEADER))
++ layout_values->inline_header = default_layout_values->inline_header;
++
++ if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_ALIAS))
++ layout_values->inline_alias = default_layout_values->inline_alias;
++}
++
++static guint
++get_real_subdirs_len (GMenuTreeDirectory *directory)
++{
++ guint len;
++ GSList *tmp;
++
++ len = 0;
++
++ tmp = directory->subdirs;
++ while (tmp != NULL)
+ {
+- if (!(tree->flags & GMENU_TREE_FLAGS_SHOW_EMPTY) && !layout_values->show_empty)
++ GMenuTreeDirectory *subdir = tmp->data;
++
++ tmp = tmp->next;
++
++ if (subdir->will_inline_header)
++ {
++ len = get_real_subdirs_len (subdir) + g_slist_length (subdir->entries) + 1;
++ }
++ else
++ len += 1;
+ }
-+ /* 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;
++
++ return len;
+}
+
-+static gboolean
-+gmenu_tree_are_same_entry (GMenuTreeItem *a,
-+ GMenuTreeItem *b)
++static void
++preprocess_layout_info_subdir_helper (GMenuTree *tree,
++ GMenuTreeDirectory *directory,
++ GMenuTreeDirectory *subdir,
++ MenuLayoutValues *layout_values,
++ gboolean *contents_added,
++ gboolean *should_remove)
+{
-+ 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_menus || 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)
++ preprocess_layout_info (tree, subdir);
++
++ *should_remove = FALSE;
++ *contents_added = FALSE;
++
++ if (subdir->subdirs == NULL && subdir->entries == NULL)
+ {
-+ GSList *next = l->next;
-+ if (next != NULL)
-+ {
-+ GMenuTreeItem *a = l->data;
-+ GMenuTreeItem *b = next->data;
-+ if (gmenu_tree_are_same_entry (a, b))
++ if (!(tree->flags & GMENU_TREE_FLAGS_SHOW_EMPTY) &&
++ !layout_values->show_empty)
+ {
+ menu_verbose ("Not showing empty menu '%s'\n", subdir->name);
+- removed = TRUE;
++ *should_remove = TRUE;
+ }
+ }
++
+ else if (layout_values->inline_menus)
+ {
+- check_pending_separator (directory);
++ guint real_subdirs_len;
+
+- if (layout_values->inline_alias && g_slist_length (subdir->contents) == 1)
+- {
+- GMenuTreeAlias *alias;
+- GMenuTreeItem *item;
++ real_subdirs_len = get_real_subdirs_len (subdir);
++
++ if (layout_values->inline_alias &&
++ real_subdirs_len + g_slist_length (subdir->entries) == 1)
++ {
++ GMenuTreeAlias *alias;
++ GMenuTreeItem *item;
++ GSList *list;
++
++ if (subdir->subdirs != NULL)
++ list = subdir->subdirs;
++ else
++ list = subdir->entries;
++
++ item = GMENU_TREE_ITEM (list->data);
++
++ menu_verbose ("Inline aliasing '%s' to '%s'\n",
++ subdir->name,
++ item->type == GMENU_TREE_ITEM_ENTRY ?
++ gmenu_tree_entry_get_name (GMENU_TREE_ENTRY (item)) :
++ GMENU_TREE_DIRECTORY (directory)->name);
++
++ alias = gmenu_tree_alias_new (directory, subdir, item);
++
++ g_slist_foreach (list,
++ (GFunc) gmenu_tree_item_unref_and_unset_parent,
++ NULL);
++ g_slist_free (list);
++ subdir->subdirs = NULL;
++ subdir->entries = NULL;
++
++ if (item->type == GMENU_TREE_ITEM_DIRECTORY)
++ directory->subdirs = g_slist_append (directory->subdirs, alias);
++ else
++ directory->entries = g_slist_append (directory->entries, alias);
++
++ *contents_added = TRUE;
++ *should_remove = TRUE;
++ }
++
++ else if (layout_values->inline_limit == 0 ||
++ layout_values->inline_limit >= real_subdirs_len + g_slist_length (subdir->entries))
++ {
++ if (layout_values->inline_header)
+ {
-+ directory->contents = g_slist_delete_link (directory->contents, next);
-+ gmenu_tree_item_unref_and_unset_parent (b);
-+ continue;
++ menu_verbose ("Creating inline header with name '%s'\n", subdir->name);
++ /* we're limited to 16-bits to spare some memory; if the limit is
++ * higher than that (would be crazy), we just consider it's
++ * unlimited */
++ if (layout_values->inline_limit < G_MAXUINT16)
++ subdir->will_inline_header = layout_values->inline_limit;
++ else
++ subdir->will_inline_header = 0;
+ }
-+ }
-+ l = l->next;
++ else
++ {
++ g_slist_foreach (subdir->subdirs,
++ (GFunc) gmenu_tree_item_set_parent,
++ directory);
++ directory->subdirs = g_slist_concat (directory->subdirs,
++ subdir->subdirs);
++ subdir->subdirs = NULL;
++
++ g_slist_foreach (subdir->entries,
++ (GFunc) gmenu_tree_item_set_parent,
++ directory);
++ directory->entries = g_slist_concat (directory->entries,
++ subdir->entries);
++ subdir->entries = NULL;
++
++ *contents_added = TRUE;
++ *should_remove = TRUE;
++ }
+
+- item = GMENU_TREE_ITEM (subdir->contents->data);
++ menu_verbose ("Inlining directory contents of '%s' to '%s'\n",
++ subdir->name, directory->name);
++ }
+ }
+}
-+
+
+- menu_verbose ("Inline aliasing '%s' to '%s'\n",
+- subdir->name,
+- item->type == GMENU_TREE_ITEM_ENTRY ?
+- gmenu_tree_entry_get_name (GMENU_TREE_ENTRY (item)) :
+- GMENU_TREE_DIRECTORY (directory)->name);
++static void
++preprocess_layout_info (GMenuTree *tree,
++ GMenuTreeDirectory *directory)
++{
++ GSList *tmp;
++ GSList *layout_info;
++ GSList *last_subdir;
++ gboolean strip_duplicates;
++ gboolean contents_added;
++ gboolean should_remove;
++ GSList *subdirs_sentinel;
++
++ /* Note: we need to preprocess all menus, even if the layout mask for a menu
++ * is MENU_LAYOUT_VALUES_NONE: in this case, we need to remove empty menus;
++ * and the layout mask can be different for a submenu anyway */
++
++ menu_verbose ("Processing menu layout inline hints for %s\n", directory->name);
++ g_assert (!directory->preprocessed);
++
++ strip_duplicates = FALSE;
++ /* we use last_subdir to track the last non-inlined subdirectory */
++ last_subdir = g_slist_last (directory->subdirs);
++
++ /*
++ * First process subdirectories with explicit layout
++ */
++ layout_info = get_layout_info (directory);
++ tmp = layout_info;
++ /* see comment below about Menuname to undersand why we leave the loop if
++ * last_subdir is NULL */
++ while (tmp != NULL && last_subdir != NULL)
++ {
++ MenuLayoutNode *node = tmp->data;
++ MenuLayoutValues layout_values;
++ const char *name;
++ GMenuTreeDirectory *subdir;
++ GSList *subdir_l;
+
+- alias = gmenu_tree_alias_new (directory, subdir, item);
++ tmp = tmp->next;
+
+- g_slist_foreach (subdir->contents,
+- (GFunc) gmenu_tree_item_unref_and_unset_parent,
+- NULL);
+- g_slist_free (subdir->contents);
+- subdir->contents = NULL;
++ /* only Menuname nodes are relevant here */
++ if (menu_layout_node_get_type (node) != MENU_LAYOUT_NODE_MENUNAME)
++ continue;
+
+- directory->contents = g_slist_append (directory->contents, alias);
++ get_values_with_defaults (node,
++ &layout_values,
++ &directory->default_layout_values);
+
+- removed = TRUE;
+- }
+- else if (layout_values->inline_limit == 0 ||
+- layout_values->inline_limit >= g_slist_length (subdir->contents))
+- {
+- if (layout_values->inline_header)
+- {
+- GMenuTreeHeader *header;
++ /* find the subdirectory that is affected by those attributes */
++ name = menu_layout_node_get_content (node);
++ subdir = NULL;
++ subdir_l = directory->subdirs;
++ while (subdir_l != NULL)
++ {
++ GMenuTreeDirectory *subdir = subdir_l->data;
+
+- menu_verbose ("Creating inline header with name '%s'\n", subdir->name);
++ if (!strcmp (subdir->name, name))
++ break;
+
+- header = gmenu_tree_header_new (directory, subdir);
+- directory->contents = g_slist_append (directory->contents, header);
+- }
++ subdir = NULL;
++ subdir_l = subdir_l->next;
+
+- menu_verbose ("Inlining directory contents of '%s' to '%s'\n",
+- subdir->name, directory->name);
++ /* we do not want to use Menuname on a menu that appeared via
++ * inlining: without inlining, the Menuname wouldn't have matched
++ * anything, and we want to keep the same behavior */
++ if (subdir_l == last_subdir)
++ {
++ subdir_l = NULL;
++ break;
++ }
++ }
+
+- g_slist_foreach (subdir->contents,
+- (GFunc) gmenu_tree_item_set_parent,
+- directory);
+- directory->contents = g_slist_concat (directory->contents, subdir->contents);
+- subdir->contents = NULL;
++ if (subdir == NULL)
++ continue;
+
+- removed = TRUE;
+- }
++ preprocess_layout_info_subdir_helper (tree, directory,
++ subdir, &layout_values,
++ &contents_added, &should_remove);
++ strip_duplicates = strip_duplicates || contents_added;
++ if (should_remove)
++ {
++ if (last_subdir == subdir_l)
++ {
++ /* we need to recompute last_subdir since we'll remove it from
++ * the list */
++ GSList *buf;
++
++ if (subdir_l == directory->subdirs)
++ last_subdir = NULL;
++ else
++ {
++ buf = directory->subdirs;
++ while (buf != NULL && buf->next != subdir_l)
++ buf = buf->next;
++ last_subdir = buf;
++ }
++ }
++
++ directory->subdirs = g_slist_remove (directory->subdirs, subdir);
++ gmenu_tree_item_unref_and_unset_parent (GMENU_TREE_ITEM (subdir));
++ }
++ }
++
++ /*
++ * Now process the subdirectories with no explicit layout
++ */
++ /* this is bogus data, but we just need the pointer anyway */
++ subdirs_sentinel = g_slist_prepend (directory->subdirs, PACKAGE);
++ directory->subdirs = subdirs_sentinel;
++
++ tmp = directory->subdirs;
++ while (tmp->next != NULL)
++ {
++ GMenuTreeDirectory *subdir = tmp->next->data;
++
++ if (subdir->preprocessed)
++ {
++ tmp = tmp->next;
++ continue;
++ }
++
++ preprocess_layout_info_subdir_helper (tree, directory,
++ subdir, &directory->default_layout_values,
++ &contents_added, &should_remove);
++ strip_duplicates = strip_duplicates || contents_added;
++ if (should_remove)
++ {
++ tmp = g_slist_delete_link (tmp, tmp->next);
++ gmenu_tree_item_unref_and_unset_parent (GMENU_TREE_ITEM (subdir));
++ }
++ else
++ tmp = tmp->next;
+ }
+
+- if (removed)
++ /* remove the sentinel */
++ directory->subdirs = g_slist_delete_link (directory->subdirs,
++ directory->subdirs);
++
++ /*
++ * Finally, remove duplicates if needed
++ */
++ if (strip_duplicates)
+ {
++ /* strip duplicate entries; there should be no duplicate directories */
++ directory->entries = g_slist_sort (directory->entries,
++ (GCompareFunc) gmenu_tree_entry_compare_by_id);
++ tmp = directory->entries;
++ while (tmp != NULL && tmp->next != NULL)
++ {
++ GMenuTreeEntry *a = tmp->data;
++ GMenuTreeEntry *b = tmp->next->data;
++
++ if (strcmp (a->desktop_file_id, b->desktop_file_id) == 0)
++ {
++ tmp = g_slist_delete_link (tmp, tmp->next);
++ gmenu_tree_item_unref (b);
++ }
++ else
++ tmp = tmp->next;
++ }
++ }
++
++ directory->preprocessed = TRUE;
++}
++
++static void process_layout_info (GMenuTree *tree,
++ GMenuTreeDirectory *directory);
++
++static void
++check_pending_separator (GMenuTreeDirectory *directory)
++{
++ if (directory->layout_pending_separator)
++ {
++ menu_verbose ("Adding pending separator in '%s'\n", directory->name);
++
++ directory->contents = g_slist_append (directory->contents,
++ gmenu_tree_separator_new (directory));
++ directory->layout_pending_separator = FALSE;
++ }
++}
++
++static void
++merge_subdir (GMenuTree *tree,
++ GMenuTreeDirectory *directory,
++ GMenuTreeDirectory *subdir)
++{
++ menu_verbose ("Merging subdir '%s' in directory '%s'\n",
++ subdir->name, directory->name);
++
++ process_layout_info (tree, subdir);
++
++ check_pending_separator (directory);
++
++ if (subdir->will_inline_header == 0 ||
++ (subdir->will_inline_header != G_MAXUINT16 &&
++ g_slist_length (subdir->contents) <= subdir->will_inline_header))
++ {
++ GMenuTreeHeader *header;
++
++ header = gmenu_tree_header_new (directory, subdir);
++ directory->contents = g_slist_append (directory->contents, header);
++
++ g_slist_foreach (subdir->contents,
++ (GFunc) gmenu_tree_item_set_parent,
++ directory);
++ directory->contents = g_slist_concat (directory->contents,
++ subdir->contents);
++ subdir->contents = NULL;
++ subdir->will_inline_header = G_MAXUINT16;
++
+ gmenu_tree_item_set_parent (GMENU_TREE_ITEM (subdir), NULL);
+ }
+ else
+ {
+- check_pending_separator (directory);
+ directory->contents = g_slist_append (directory->contents,
+ gmenu_tree_item_ref (subdir));
+ }
+@@ -3653,8 +3963,7 @@ merge_subdir (GMenuTree *tree,
static void
- check_pending_separator (GMenuTreeDirectory *directory)
+ merge_subdir_by_name (GMenuTree *tree,
+ GMenuTreeDirectory *directory,
+- const char *subdir_name,
+- MenuLayoutValues *values)
++ const char *subdir_name)
{
-@@ -3771,6 +3838,8 @@ merge_subdirs (GMenuTree *tree,
-
- g_slist_free (subdirs);
- g_slist_free (except);
-+
-+ sort_after_merge (directory, &directory->default_layout_values);
+ GSList *tmp;
+
+@@ -3670,7 +3979,7 @@ merge_subdir_by_name (GMenuTree *tree,
+ if (!strcmp (subdir->name, subdir_name))
+ {
+ directory->subdirs = g_slist_delete_link (directory->subdirs, tmp);
+- merge_subdir (tree, directory, subdir, values);
++ merge_subdir (tree, directory, subdir);
+ gmenu_tree_item_unref (subdir);
+ }
+
+@@ -3756,7 +4065,7 @@ merge_subdirs (GMenuTree *tree,
+
+ if (!find_name_in_list (subdir->name, except))
+ {
+- merge_subdir (tree, directory, subdir, &directory->default_layout_values);
++ merge_subdir (tree, directory, subdir);
+ gmenu_tree_item_unref (subdir);
+ }
+ else
+@@ -3842,8 +4151,7 @@ merge_subdirs_and_entries (GMenuTree *tree,
+ {
+ merge_subdir (tree,
+ directory,
+- GMENU_TREE_DIRECTORY (item),
+- &directory->default_layout_values);
++ GMENU_TREE_DIRECTORY (item));
+ gmenu_tree_item_unref (item);
+ }
+ else
+@@ -3876,53 +4184,6 @@ merge_subdirs_and_entries (GMenuTree *tree,
+ g_slist_free (except_entries);
}
- static void
-@@ -3875,6 +3944,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
+-static void
+-get_values_with_defaults (MenuLayoutNode *node,
+- MenuLayoutValues *layout_values,
+- MenuLayoutValues *default_layout_values)
+-{
+- menu_layout_node_menuname_get_values (node, layout_values);
+-
+- if (!(layout_values->mask & MENU_LAYOUT_VALUES_SHOW_EMPTY))
+- layout_values->show_empty = default_layout_values->show_empty;
+-
+- if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_MENUS))
+- layout_values->inline_menus = default_layout_values->inline_menus;
+-
+- if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_LIMIT))
+- layout_values->inline_limit = default_layout_values->inline_limit;
+-
+- if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_HEADER))
+- layout_values->inline_header = default_layout_values->inline_header;
+-
+- if (!(layout_values->mask & MENU_LAYOUT_VALUES_INLINE_ALIAS))
+- layout_values->inline_alias = default_layout_values->inline_alias;
+-}
+-
+-static GSList *
+-get_layout_info (GMenuTreeDirectory *directory)
+-{
+- GMenuTreeDirectory *iter;
+-
+- if (directory->layout_info != NULL)
+- {
+- return directory->layout_info;
+- }
+-
+- iter = directory;
+- while (iter != NULL)
+- {
+- if (iter->default_layout_info != NULL)
+- {
+- return iter->default_layout_info;
+- }
+-
+- iter = GMENU_TREE_ITEM (iter)->parent;
+- }
+-
+- return NULL;
+-}
+-
+ static GSList *
+ get_subdirs_from_layout_info (GSList *layout_info)
+ {
+@@ -4005,18 +4266,9 @@ process_layout_info (GMenuTree *tree,
+ switch (menu_layout_node_get_type (node))
+ {
+ case MENU_LAYOUT_NODE_MENUNAME:
+- {
+- MenuLayoutValues layout_values;
+-
+- get_values_with_defaults (node,
+- &layout_values,
+- &directory->default_layout_values);
+-
+- merge_subdir_by_name (tree,
+- directory,
+- menu_layout_node_get_content (node),
+- &layout_values);
+- }
++ merge_subdir_by_name (tree,
++ directory,
++ menu_layout_node_get_content (node));
+ break;
+
+ case MENU_LAYOUT_NODE_FILENAME:
+@@ -4142,6 +4394,7 @@ gmenu_tree_build_from_layout (GMenuTree *tree)
+
+ allocated = desktop_entry_set_new ();
+
++ /* create the menu structure */
+ tree->root = process_layout (tree,
+ NULL,
+ find_menu_child (tree->layout),
+@@ -4152,6 +4405,11 @@ gmenu_tree_build_from_layout (GMenuTree *tree)
+
+ process_only_unallocated (tree, tree->root, allocated);
+
++ /* process the layout info part that can move/remove items:
++ * inline, show_empty, etc. */
++ preprocess_layout_info (tree, tree->root);
++ /* populate the menu structure that we got with the items, and order it
++ * according to the layout info */
+ process_layout_info (tree, tree->root);
+
+ menu_layout_node_root_add_entries_monitor (tree->layout,
+--
+cgit v0.8.2
Added: desktop/unstable/gnome-menus/debian/patches/12_submenus_inherit.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-menus/debian/patches/12_submenus_inherit.patch?rev=20518&op=file
==============================================================================
--- desktop/unstable/gnome-menus/debian/patches/12_submenus_inherit.patch (added)
+++ desktop/unstable/gnome-menus/debian/patches/12_submenus_inherit.patch Mon Jun 29 19:25:56 2009
@@ -1,0 +1,27 @@
+Make submenus inherit the DefaultLayout settings from their parents.
+
+Upstream commits:
+89ab14f5fd34d18ef1591baf1000f5197344cd92
+7a6b5b5a292357357f4458820b6e8f851472c592
+
+Index: gnome-menus-2.26.1/libmenu/gmenu-tree.c
+===================================================================
+--- gnome-menus-2.26.1.orig/libmenu/gmenu-tree.c 2009-06-27 13:52:05.500406227 +0200
++++ gnome-menus-2.26.1/libmenu/gmenu-tree.c 2009-06-27 13:52:30.119903872 +0200
+@@ -3167,10 +3167,12 @@ set_default_layout_values (GMenuTreeDire
+ GSList *tmp;
+
+ /* if the child has a defined default layout, we don't want to override its
+- * values, and if the parent doesn't have a defined default layout, then
+- * everybody already uses the default values */
+- if (parent->default_layout_info == NULL ||
+- child->default_layout_info != NULL)
++ * values. The parent might have a non-defined layout info (ie, no child of
++ * the DefaultLayout node) but it doesn't meant the default layout values
++ * (ie, DefaultLayout attributes) aren't different from the global defaults.
++ */
++ if (child->default_layout_info != NULL ||
++ child->default_layout_values.mask != MENU_LAYOUT_VALUES_NONE)
+ return;
+
+ child->default_layout_values = parent->default_layout_values;
Modified: desktop/unstable/gnome-menus/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-menus/debian/patches/series?rev=20518&op=diff
==============================================================================
--- desktop/unstable/gnome-menus/debian/patches/series (original)
+++ desktop/unstable/gnome-menus/debian/patches/series Mon Jun 29 19:25:56 2009
@@ -6,5 +6,6 @@
10_use-default-python-path.patch
#20_show-admin-tools-for-admin-group.patch
11_science-menu.patch
+12_submenus_inherit.patch
12_merge_duplicates.patch
21_default-python-in-shebang.patch
More information about the pkg-gnome-commits
mailing list