[gtk+/gtk-3-10] GtkMenuTracker: tweak separator logic
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-10] GtkMenuTracker: tweak separator logic
- Date: Mon, 14 Apr 2014 13:20:55 +0000 (UTC)
commit 2e06ff3d4d3e41430d3f4c45a1588fa2f71967bb
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Dec 26 22:45:03 2013 -0500
GtkMenuTracker: tweak separator logic
Ignacio Casal Quinteiro reported a problem whereby an empty section at
the start of a menu has a separator placed after it. This was caused by
the implementation of the logic that separators should be inserted at
the top of all non-empty sections that are not the first section. This
logic is obviously incorrect in the case that the first section is empty
(in which case we would not expect to see a separator at the top of the
second section).
Change the logic so that we only insert separators when we see a
non-zero number of actual items in the menu before us.
https://bugzilla.gnome.org/show_bug.cgi?id=721119
gtk/gtkmenutracker.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkmenutracker.c b/gtk/gtkmenutracker.c
index 6f0f4ba..6027520 100644
--- a/gtk/gtkmenutracker.c
+++ b/gtk/gtkmenutracker.c
@@ -141,8 +141,8 @@ gtk_menu_tracker_section_find_model (GtkMenuTrackerSection *section,
*
* could_have_separator is true in two situations:
*
- * - our parent section had with_separators defined and we are not the
- * first section (ie: we should add a separator if we have content in
+ * - our parent section had with_separators defined and there are items
+ * before us (ie: we should add a separator if we have content in
* order to divide us from the items above)
*
* - if we had a 'label' attribute set for this section
@@ -177,7 +177,7 @@ gtk_menu_tracker_section_sync_separators (GtkMenuTrackerSection *section,
{
gboolean could_have_separator;
- could_have_separator = (section->with_separators && i > 0) ||
+ could_have_separator = (section->with_separators && n_items > 0) ||
g_menu_model_get_item_attribute (section->model, i, "label", "s", NULL);
n_items += gtk_menu_tracker_section_sync_separators (subsection, tracker, offset + n_items,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]