Commit c8e15e43 authored by Matthias Clasen's avatar Matthias Clasen

testmenubutton: Add a toggle for use-popover

parent 8e5982ca
...@@ -39,6 +39,7 @@ int main (int argc, char **argv) ...@@ -39,6 +39,7 @@ int main (int argc, char **argv)
GtkWidget *grid; GtkWidget *grid;
GtkWidget *entry; GtkWidget *entry;
GtkWidget *label; GtkWidget *label;
GtkWidget *check;
GtkWidget *combo; GtkWidget *combo;
GtkWidget *menu_widget; GtkWidget *menu_widget;
GtkAccelGroup *accel_group; GtkAccelGroup *accel_group;
...@@ -132,6 +133,10 @@ int main (int argc, char **argv) ...@@ -132,6 +133,10 @@ int main (int argc, char **argv)
gtk_grid_attach (GTK_GRID (grid), button, 1, row++, 1, 1); gtk_grid_attach (GTK_GRID (grid), button, 1, row++, 1, 1);
gtk_widget_show (create_prop_editor (G_OBJECT (button), 0)); gtk_widget_show (create_prop_editor (G_OBJECT (button), 0));
check = gtk_check_button_new_with_label ("Popover");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_grid_attach (GTK_GRID (grid), check, 0, row, 1, 1);
/* Button with GMenuModel */ /* Button with GMenuModel */
menu = g_menu_new (); menu = g_menu_new ();
for (i = 5; i > 0; i--) { for (i = 5; i > 0; i--) {
...@@ -147,6 +152,8 @@ int main (int argc, char **argv) ...@@ -147,6 +152,8 @@ int main (int argc, char **argv)
} }
button = gtk_menu_button_new (); button = gtk_menu_button_new ();
g_object_bind_property (check, "active", button, "use-popover", G_BINDING_SYNC_CREATE);
gtk_widget_set_halign (button, GTK_ALIGN_START); gtk_widget_set_halign (button, GTK_ALIGN_START);
menubuttons = g_list_prepend (menubuttons, button); menubuttons = g_list_prepend (menubuttons, button);
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (menu)); gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (menu));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment