diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-11-19 09:26:25 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-11-19 21:14:30 -0500 |
commit | d51c9e033740901742eb522a1b1113f4cee8e877 (patch) | |
tree | 18eb89001d996da2aa6de3f668c8d96f30d0f0ff | |
parent | 46b6c2f024a539da70baa78377b9d0d5dd39eac1 (diff) | |
download | gtk+-d51c9e033740901742eb522a1b1113f4cee8e877.tar.gz |
GtkPopoverMenu: be more careful about change notification
Only emit notify for ::visible-submenu when the visible page
in the stack actually changed.
-rw-r--r-- | gtk/gtkpopovermenu.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk/gtkpopovermenu.c b/gtk/gtkpopovermenu.c index 4d6ecded41..4588844236 100644 --- a/gtk/gtkpopovermenu.c +++ b/gtk/gtkpopovermenu.c @@ -114,6 +114,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) { GtkWidget *stack; @@ -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"); } |