summaryrefslogtreecommitdiff
path: root/gtk/gtkmenutracker.c
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2014-01-08 14:31:16 -0500
committerRyan Lortie <desrt@desrt.ca>2014-01-08 14:31:16 -0500
commitd31bf779bbcfa44f6b6a64ca3af963e59df0dd05 (patch)
tree9ffe233e8048d70a575ea624731f0c6de7d08b65 /gtk/gtkmenutracker.c
parent2bcb4fc354231f6e8a8fe93a1d2aacf62702ded9 (diff)
downloadgtk+-d31bf779bbcfa44f6b6a64ca3af963e59df0dd05.tar.gz
GtkMenuTracker: fix hidden-when='' vs. separators
Ensure that adding hidden-when='' to a menu item does not produce an extra separator item as a side effect. https://bugzilla.gnome.org/show_bug.cgi?id=688421
Diffstat (limited to 'gtk/gtkmenutracker.c')
-rw-r--r--gtk/gtkmenutracker.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/gtk/gtkmenutracker.c b/gtk/gtkmenutracker.c
index efb67e85a9..6752338d2d 100644
--- a/gtk/gtkmenutracker.c
+++ b/gtk/gtkmenutracker.c
@@ -78,6 +78,7 @@ struct _GtkMenuTrackerSection
guint separator_label : 1;
guint with_separators : 1;
guint has_separator : 1;
+ guint is_fake : 1;
gulong handler;
};
@@ -193,7 +194,7 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
i++;
}
- should_have_separator = could_have_separator && n_items != 0;
+ should_have_separator = !section->is_fake && could_have_separator && n_items != 0;
if (should_have_separator > section->has_separator)
{
@@ -367,21 +368,13 @@ gtk_menu_tracker_add_items (GtkMenuTracker *tracker,
* The only other thing that '->model' is used for is in the
* case that we want to show a separator, but we will never do
* that because separators are not shown for this fake section.
- *
- * Because of the game we play where the menu item is
- * essentially its own section, it is possible that the menu
- * item itself could get added as its own separator label in
- * the case that the item is inside of a with_separators
- * section, but this should never happen -- the user should
- * always have the menu item inside of a <section>, never at
- * the toplevel. It would be easy to add an extra boolean to
- * check for that, but we already have a lot of those...
*/
if (_gtk_menu_tracker_item_may_disappear (item))
{
GtkMenuTrackerSection *fake_section;
fake_section = g_slice_new0 (GtkMenuTrackerSection);
+ fake_section->is_fake = TRUE;
fake_section->model = g_object_ref (item);
fake_section->handler = g_signal_connect (item, "visibility-changed",
G_CALLBACK (gtk_menu_tracker_item_visibility_changed),