[gnome-panel] menu: fix GpUserMenu:empty property
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] menu: fix GpUserMenu:empty property
- Date: Wed, 12 Sep 2018 11:54:56 +0000 (UTC)
commit 502367af86664deb334f55551940616297ca5c1d
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Wed Sep 12 01:04:01 2018 +0300
menu: fix GpUserMenu:empty property
modules/menu/gp-user-menu.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/modules/menu/gp-user-menu.c b/modules/menu/gp-user-menu.c
index fd7a0f237..173bc8b57 100644
--- a/modules/menu/gp-user-menu.c
+++ b/modules/menu/gp-user-menu.c
@@ -171,20 +171,10 @@ remove_item (GtkWidget *widget,
gtk_widget_destroy (widget);
}
-static void
-count_visible_item (GtkWidget *widget,
- gpointer user_data)
-{
- gint *count = user_data;
-
- if (gtk_widget_is_visible (widget))
- (*count)++;
-}
-
static void
menu_reload (GpUserMenu *menu)
{
- gint count;
+ GList *children;
gboolean empty;
gtk_container_foreach (GTK_CONTAINER (menu), remove_item, NULL);
@@ -194,9 +184,9 @@ menu_reload (GpUserMenu *menu)
if (menu->append_func != NULL)
menu->append_func (GTK_MENU (menu), menu->append_data);
- count = 0;
- gtk_container_foreach (GTK_CONTAINER (menu), count_visible_item, &count);
- empty = count == 0;
+ children = gtk_container_get_children (GTK_CONTAINER (menu));
+ empty = g_list_length (children) == 0;
+ g_list_free (children);
if (menu->empty == empty)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]