GtkPopoverMenu: be more careful about change notification

Only emit notify for ::visible-submenu when the visible page
in the stack actually changed.
This commit is contained in:
Matthias Clasen 2014-11-19 09:26:25 +01:00
parent 46b6c2f024
commit d51c9e0337

View File

@ -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");
}