Commit 4bec5432 authored by Daniel Boles's avatar Daniel Boles

testframe: Use a generic widget pointer

parent 0349574b
......@@ -132,8 +132,7 @@ int main (int argc, char **argv)
{
GtkStyleContext *context;
GtkBorder pad;
GtkWidget *window, *frame, *xthickness_spin, *ythickness_spin, *vbox;
GtkWidget *xalign_spin, *yalign_spin, *button, *grid, *label;
GtkWidget *window, *frame, *vbox, *grid, *widget;
gfloat xalign, yalign;
gtk_init (&argc, &argv);
......@@ -150,8 +149,8 @@ int main (int argc, char **argv)
frame = gtk_frame_new ("Testing");
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
button = gtk_button_new_with_label ("Hello!");
gtk_container_add (GTK_CONTAINER (frame), button);
widget = gtk_button_new_with_label ("Hello!");
gtk_container_add (GTK_CONTAINER (frame), widget);
grid = gtk_grid_new ();
gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0);
......@@ -163,42 +162,42 @@ int main (int argc, char **argv)
gtk_style_context_restore (context);
/* Spin to control xthickness */
label = gtk_label_new ("xthickness: ");
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
widget = gtk_label_new ("xthickness: ");
gtk_grid_attach (GTK_GRID (grid), widget, 0, 0, 1, 1);
xthickness_spin = gtk_spin_button_new_with_range (0, 250, 1);
g_signal_connect (G_OBJECT (xthickness_spin), "value-changed", G_CALLBACK (spin_xthickness_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (xthickness_spin), pad.left);
gtk_grid_attach (GTK_GRID (grid), xthickness_spin, 1, 0, 1, 1);
widget = gtk_spin_button_new_with_range (0, 250, 1);
g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (spin_xthickness_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), pad.left);
gtk_grid_attach (GTK_GRID (grid), widget, 1, 0, 1, 1);
/* Spin to control ythickness */
label = gtk_label_new ("ythickness: ");
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
widget = gtk_label_new ("ythickness: ");
gtk_grid_attach (GTK_GRID (grid), widget, 0, 1, 1, 1);
ythickness_spin = gtk_spin_button_new_with_range (0, 250, 1);
g_signal_connect (G_OBJECT (ythickness_spin), "value-changed", G_CALLBACK (spin_ythickness_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (ythickness_spin), pad.top);
gtk_grid_attach (GTK_GRID (grid), ythickness_spin, 1, 1, 1, 1);
widget = gtk_spin_button_new_with_range (0, 250, 1);
g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (spin_ythickness_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), pad.top);
gtk_grid_attach (GTK_GRID (grid), widget, 1, 1, 1, 1);
gtk_frame_get_label_align (GTK_FRAME (frame), &xalign, &yalign);
/* Spin to control label xalign */
label = gtk_label_new ("xalign: ");
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
widget = gtk_label_new ("xalign: ");
gtk_grid_attach (GTK_GRID (grid), widget, 0, 2, 1, 1);
xalign_spin = gtk_spin_button_new_with_range (0.0, 1.0, 0.1);
g_signal_connect (G_OBJECT (xalign_spin), "value-changed", G_CALLBACK (spin_xalign_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (xalign_spin), xalign);
gtk_grid_attach (GTK_GRID (grid), xalign_spin, 1, 2, 1, 1);
widget = gtk_spin_button_new_with_range (0.0, 1.0, 0.1);
g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (spin_xalign_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), xalign);
gtk_grid_attach (GTK_GRID (grid), widget, 1, 2, 1, 1);
/* Spin to control label yalign */
label = gtk_label_new ("yalign: ");
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
widget = gtk_label_new ("yalign: ");
gtk_grid_attach (GTK_GRID (grid), widget, 0, 3, 1, 1);
yalign_spin = gtk_spin_button_new_with_range (0.0, 1.0, 0.1);
g_signal_connect (G_OBJECT (yalign_spin), "value-changed", G_CALLBACK (spin_yalign_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (yalign_spin), yalign);
gtk_grid_attach (GTK_GRID (grid), yalign_spin, 1, 3, 1, 1);
widget = gtk_spin_button_new_with_range (0.0, 1.0, 0.1);
g_signal_connect (G_OBJECT (widget), "value-changed", G_CALLBACK (spin_yalign_cb), frame);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), yalign);
gtk_grid_attach (GTK_GRID (grid), widget, 1, 3, 1, 1);
gtk_widget_show_all (window);
......
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