From fb66f539aefb91b70e7fcd0478512e8420ea7c23 Mon Sep 17 00:00:00 2001 From: Daniel Boles Date: Mon, 14 Aug 2017 23:10:59 +0100 Subject: [PATCH] testpopover: Sync initial vals of controls & props The ComboBoxes were initially empty, rather than reflecting the initial values of the properties. The CheckButtons were only correct by chance. Fix this by setting the initial values on the widgets and binding them to the properties using SYNC_CREATE, so the two are always synced up. https://bugzilla.gnome.org/show_bug.cgi?id=786209 --- tests/testpopover.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/testpopover.c b/tests/testpopover.c index 1289829502..7747e05644 100644 --- a/tests/testpopover.c +++ b/tests/testpopover.c @@ -100,21 +100,19 @@ main (int argc, char *argv[]) gtk_menu_button_set_popover (GTK_MENU_BUTTON (button2), popover2); g_object_set (box, "margin", 10, NULL); - gtk_widget_set_halign (box, GTK_ALIGN_END); - gtk_widget_set_valign (box, GTK_ALIGN_START); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), box); label = gtk_label_new ("Popover hexpand"); check = gtk_check_button_new (); - g_object_bind_property (check, "active", popover, "hexpand", G_BINDING_DEFAULT); - g_object_bind_property (check, "active", popover2, "hexpand", G_BINDING_DEFAULT); + g_object_bind_property (check, "active", popover, "hexpand", G_BINDING_SYNC_CREATE); + g_object_bind_property (check, "active", popover2, "hexpand", G_BINDING_SYNC_CREATE); gtk_grid_attach (GTK_GRID (grid), label , 1, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), check, 2, 1, 1, 1); label = gtk_label_new ("Popover vexpand"); check = gtk_check_button_new (); - g_object_bind_property (check, "active", popover, "vexpand", G_BINDING_DEFAULT); - g_object_bind_property (check, "active", popover2, "vexpand", G_BINDING_DEFAULT); + g_object_bind_property (check, "active", popover, "vexpand", G_BINDING_SYNC_CREATE); + g_object_bind_property (check, "active", popover2, "vexpand", G_BINDING_SYNC_CREATE); gtk_grid_attach (GTK_GRID (grid), label , 1, 2, 1, 1); gtk_grid_attach (GTK_GRID (grid), check, 2, 2, 1, 1); @@ -124,9 +122,9 @@ main (int argc, char *argv[]) gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "down", "Down"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "left", "Left"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "right", "Right"); - - g_object_bind_property (combo, "active", button, "direction", G_BINDING_DEFAULT); - g_object_bind_property (combo, "active", button2, "direction", G_BINDING_DEFAULT); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 1); + g_object_bind_property (combo, "active", button, "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); @@ -136,7 +134,8 @@ main (int argc, char *argv[]) gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center"); - g_object_bind_property (combo, "active", box, "halign", G_BINDING_DEFAULT); + 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); @@ -146,7 +145,8 @@ main (int argc, char *argv[]) gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End"); gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center", "Center"); - g_object_bind_property (combo, "active", box, "valign", G_BINDING_DEFAULT); + 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);