From d51c9e033740901742eb522a1b1113f4cee8e877 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 19 Nov 2014 09:26:25 +0100 Subject: GtkPopoverMenu: be more careful about change notification Only emit notify for ::visible-submenu when the visible page in the stack actually changed. --- gtk/gtkpopovermenu.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c index 4d6ecded41..4588844236 100644 --- a/gtk/gtkpopovermenu.c +++ b/gtk/gtkpopovermenu.c @@ -113,6 +113,14 @@ enum { G_DEFINE_TYPE (GtkPopoverMenu, gtk_popover_menu, GTK_TYPE_POPOVER) +static void +visible_submenu_changed (GObject *object, + GParamSpec *pspec, + GtkPopoverMenu *popover) +{ + g_object_notify (G_OBJECT (popover), "visible-submenu"); +} + static void gtk_popover_menu_init (GtkPopoverMenu *popover) { @@ -123,6 +131,8 @@ gtk_popover_menu_init (GtkPopoverMenu *popover) gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT); gtk_widget_show (stack); gtk_container_add (GTK_CONTAINER (popover), stack); + g_signal_connect (stack, "notify::visible-child-name", + G_CALLBACK (visible_submenu_changed), popover); } static void @@ -410,5 +420,4 @@ gtk_popover_menu_open_submenu (GtkPopoverMenu *popover, stack = gtk_bin_get_child (GTK_BIN (popover)); gtk_stack_set_visible_child_name (GTK_STACK (stack), name); - g_object_notify (G_OBJECT (popover), "visible-submenu"); } -- cgit v1.2.1