forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
f90016f069
commit
ba09124f9f
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user