From: Daniel Boles Date: Wed, 14 Mar 2018 22:39:19 +0000 (+0000) Subject: testspinbutton: Add button to toggle wrap on Spins X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~22^2~984 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2f16c092a5d39dc5fd76be0e0533aac3d3615b32;p=gtk4.git testspinbutton: Add button to toggle wrap on Spins I found myself wanting to test this for something else, so let's test it. It revealed a bug immediately! https://gitlab.gnome.org/GNOME/gtk/issues/88 --- diff --git a/tests/testspinbutton.c b/tests/testspinbutton.c index b7371400c2..e16ad3bbf3 100644 --- a/tests/testspinbutton.c +++ b/tests/testspinbutton.c @@ -33,7 +33,7 @@ on_delete (GtkWindow *w) static void prepare_window_for_orientation (GtkOrientation orientation) { - GtkWidget *window, *mainbox; + GtkWidget *window, *mainbox, *wrap_button; int max; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -42,6 +42,9 @@ prepare_window_for_orientation (GtkOrientation orientation) mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL ^ orientation, 2); gtk_container_add (GTK_CONTAINER (window), mainbox); + wrap_button = gtk_toggle_button_new_with_label ("Wrap"); + gtk_container_add (GTK_CONTAINER (mainbox), wrap_button); + for (max = 9; max <= 999999999; max = max * 10 + 9) { GtkAdjustment *adj = gtk_adjustment_new (max, @@ -54,6 +57,8 @@ prepare_window_for_orientation (GtkOrientation orientation) gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), orientation); gtk_widget_set_halign (GTK_WIDGET (spin), GTK_ALIGN_CENTER); + g_object_bind_property (wrap_button, "active", spin, "wrap", G_BINDING_SYNC_CREATE); + GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_pack_start (GTK_BOX (hbox), spin); gtk_container_add (GTK_CONTAINER (mainbox), hbox);