Commit fcfabb2f authored by Daniel Boles's avatar Daniel Boles

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!

#88
parent bb16f1a0
...@@ -35,7 +35,7 @@ on_delete_event (GtkWidget *w, ...@@ -35,7 +35,7 @@ on_delete_event (GtkWidget *w,
static void static void
prepare_window_for_orientation (GtkOrientation orientation) prepare_window_for_orientation (GtkOrientation orientation)
{ {
GtkWidget *window, *mainbox; GtkWidget *window, *mainbox, *wrap_button;
int max; int max;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
...@@ -44,6 +44,9 @@ prepare_window_for_orientation (GtkOrientation orientation) ...@@ -44,6 +44,9 @@ prepare_window_for_orientation (GtkOrientation orientation)
mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL ^ orientation, 2); mainbox = gtk_box_new (GTK_ORIENTATION_VERTICAL ^ orientation, 2);
gtk_container_add (GTK_CONTAINER (window), mainbox); 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) for (max = 9; max <= 999999999; max = max * 10 + 9)
{ {
GtkAdjustment *adj = gtk_adjustment_new (max, GtkAdjustment *adj = gtk_adjustment_new (max,
...@@ -56,6 +59,8 @@ prepare_window_for_orientation (GtkOrientation orientation) ...@@ -56,6 +59,8 @@ prepare_window_for_orientation (GtkOrientation orientation)
gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), orientation); gtk_orientable_set_orientation (GTK_ORIENTABLE (spin), orientation);
gtk_widget_set_halign (GTK_WIDGET (spin), GTK_ALIGN_CENTER); 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, 2); GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 2);
gtk_container_add (GTK_CONTAINER (mainbox), hbox); gtk_container_add (GTK_CONTAINER (mainbox), hbox);
......
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