forked from AuroraMiddleware/gtk
Use GtkStack:vhomogeneous for popover menus
This allows us to get rid of a size group.
This commit is contained in:
parent
b86356bc1c
commit
e41a8cf6fc
@ -39,7 +39,6 @@ struct _GtkMenuSectionBox
|
|||||||
{
|
{
|
||||||
GtkBox parent_instance;
|
GtkBox parent_instance;
|
||||||
|
|
||||||
GtkSizeGroup *size_group;
|
|
||||||
GtkMenuSectionBox *toplevel;
|
GtkMenuSectionBox *toplevel;
|
||||||
GtkMenuTracker *tracker;
|
GtkMenuTracker *tracker;
|
||||||
GtkBox *item_box;
|
GtkBox *item_box;
|
||||||
@ -335,12 +334,6 @@ gtk_menu_section_box_dispose (GObject *object)
|
|||||||
box->separator = NULL;
|
box->separator = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box->size_group)
|
|
||||||
{
|
|
||||||
g_object_unref (box->size_group);
|
|
||||||
box->size_group = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (box->tracker)
|
if (box->tracker)
|
||||||
{
|
{
|
||||||
gtk_menu_tracker_free (box->tracker);
|
gtk_menu_tracker_free (box->tracker);
|
||||||
@ -364,8 +357,6 @@ gtk_menu_section_box_new_toplevel (GtkStack *stack,
|
|||||||
GtkMenuSectionBox *box;
|
GtkMenuSectionBox *box;
|
||||||
|
|
||||||
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, "margin", 10, NULL);
|
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, "margin", 10, NULL);
|
||||||
box->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
||||||
gtk_size_group_add_widget (box->size_group, GTK_WIDGET (box));
|
|
||||||
gtk_stack_add_named (stack, GTK_WIDGET (box), "main");
|
gtk_stack_add_named (stack, GTK_WIDGET (box), "main");
|
||||||
|
|
||||||
box->tracker = gtk_menu_tracker_new (GTK_ACTION_OBSERVABLE (_gtk_widget_get_action_muxer (GTK_WIDGET (box))),
|
box->tracker = gtk_menu_tracker_new (GTK_ACTION_OBSERVABLE (_gtk_widget_get_action_muxer (GTK_WIDGET (box))),
|
||||||
@ -385,8 +376,6 @@ gtk_menu_section_box_new_submenu (GtkMenuTrackerItem *item,
|
|||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
|
||||||
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, "margin", 10, NULL);
|
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, "margin", 10, NULL);
|
||||||
box->size_group = g_object_ref (toplevel->size_group);
|
|
||||||
gtk_size_group_add_widget (box->size_group, GTK_WIDGET (box));
|
|
||||||
|
|
||||||
button = g_object_new (GTK_TYPE_MODEL_BUTTON,
|
button = g_object_new (GTK_TYPE_MODEL_BUTTON,
|
||||||
"has-submenu", TRUE,
|
"has-submenu", TRUE,
|
||||||
@ -425,7 +414,6 @@ gtk_menu_section_box_new_section (GtkMenuTrackerItem *item,
|
|||||||
const gchar *hint;
|
const gchar *hint;
|
||||||
|
|
||||||
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, NULL);
|
box = g_object_new (GTK_TYPE_MENU_SECTION_BOX, NULL);
|
||||||
box->size_group = g_object_ref (parent->size_group);
|
|
||||||
box->toplevel = parent->toplevel;
|
box->toplevel = parent->toplevel;
|
||||||
box->depth = parent->depth + 1;
|
box->depth = parent->depth + 1;
|
||||||
|
|
||||||
|
@ -1961,7 +1961,7 @@ gtk_popover_bind_model (GtkPopover *popover,
|
|||||||
if (model)
|
if (model)
|
||||||
{
|
{
|
||||||
stack = gtk_stack_new ();
|
stack = gtk_stack_new ();
|
||||||
gtk_stack_set_homogeneous (GTK_STACK (stack), FALSE);
|
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
|
||||||
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
|
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT);
|
||||||
gtk_widget_show (stack);
|
gtk_widget_show (stack);
|
||||||
gtk_container_add (GTK_CONTAINER (popover), stack);
|
gtk_container_add (GTK_CONTAINER (popover), stack);
|
||||||
|
Loading…
Reference in New Issue
Block a user