tests/popover: Add check box for switching autohide prop

This commit is contained in:
Jonas Ådahl 2019-07-22 22:26:39 +02:00
parent f43717a42e
commit 6eaeadb3b9

View File

@ -99,7 +99,7 @@ main (int argc, char *argv[])
label = gtk_label_new ("");
gtk_widget_set_hexpand (label, TRUE);
gtk_widget_set_vexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (grid), label, 3, 6, 1, 1);
gtk_grid_attach (GTK_GRID (grid), label, 3, 7, 1, 1);
builder = gtk_builder_new_from_file ("popover.ui");
model = (GMenuModel *)gtk_builder_get_object (builder, "menu");
@ -142,6 +142,16 @@ main (int argc, char *argv[])
gtk_grid_attach (GTK_GRID (grid), label , 1, 2, 1, 1);
gtk_grid_attach (GTK_GRID (grid), check, 2, 2, 1, 1);
label = gtk_label_new ("Autohide");
check = gtk_check_button_new ();
g_object_bind_property (check, "active", popover, "autohide", G_BINDING_SYNC_CREATE);
g_object_bind_property (check, "active", popover1, "autohide", G_BINDING_SYNC_CREATE);
g_object_bind_property (check, "active", popover2, "autohide", G_BINDING_SYNC_CREATE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
gtk_grid_attach (GTK_GRID (grid), label , 1, 3, 1, 1);
gtk_grid_attach (GTK_GRID (grid), check, 2, 3, 1, 1);
label = gtk_label_new ("Button direction");
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "up", "Up");
@ -152,8 +162,8 @@ main (int argc, char *argv[])
g_object_bind_property (combo, "active", button, "direction", G_BINDING_SYNC_CREATE);
g_object_bind_property (combo, "active", button1, "direction", G_BINDING_SYNC_CREATE);
g_object_bind_property (combo, "active", button2, "direction", G_BINDING_SYNC_CREATE);
gtk_grid_attach (GTK_GRID (grid), label , 1, 3, 1, 1);
gtk_grid_attach (GTK_GRID (grid), combo, 2, 3, 1, 1);
gtk_grid_attach (GTK_GRID (grid), label , 1, 4, 1, 1);
gtk_grid_attach (GTK_GRID (grid), combo, 2, 4, 1, 1);
label = gtk_label_new ("Button halign");
combo = gtk_combo_box_text_new ();
@ -163,8 +173,8 @@ main (int argc, char *argv[])
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 2);
g_object_bind_property (combo, "active", box, "halign", G_BINDING_SYNC_CREATE);
gtk_grid_attach (GTK_GRID (grid), label , 1, 4, 1, 1);
gtk_grid_attach (GTK_GRID (grid), combo, 2, 4, 1, 1);
gtk_grid_attach (GTK_GRID (grid), label , 1, 5, 1, 1);
gtk_grid_attach (GTK_GRID (grid), combo, 2, 5, 1, 1);
label = gtk_label_new ("Button valign");
combo = gtk_combo_box_text_new ();
@ -174,8 +184,8 @@ main (int argc, char *argv[])
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1);
g_object_bind_property (combo, "active", box, "valign", G_BINDING_SYNC_CREATE);
gtk_grid_attach (GTK_GRID (grid), label , 1, 5, 1, 1);
gtk_grid_attach (GTK_GRID (grid), combo, 2, 5, 1, 1);
gtk_grid_attach (GTK_GRID (grid), label , 1, 6, 1, 1);
gtk_grid_attach (GTK_GRID (grid), combo, 2, 6, 1, 1);
g_object_unref (builder);