diff options
Diffstat (limited to 'examples/gtkdial/dial_test.c')
-rw-r--r-- | examples/gtkdial/dial_test.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/examples/gtkdial/dial_test.c b/examples/gtkdial/dial_test.c index ebcea0c7d9..e753cc1986 100644 --- a/examples/gtkdial/dial_test.c +++ b/examples/gtkdial/dial_test.c @@ -1,17 +1,19 @@ +#include <stdio.h> +#include <stdlib.h> #include <gtk/gtk.h> #include "gtkdial.h" -void -value_changed (GtkAdjustment *adjustment, GtkWidget *label) +void value_changed( GtkAdjustment *adjustment, + GtkWidget *label ) { char buffer[16]; sprintf(buffer,"%4.2f",adjustment->value); - gtk_label_set (GTK_LABEL (label), buffer); + gtk_label_set_text (GTK_LABEL (label), buffer); } -int -main (int argc, char *argv[]) +int main( int argc, + char *argv[]) { GtkWidget *window; GtkAdjustment *adjustment; @@ -26,10 +28,10 @@ main (int argc, char *argv[]) gtk_window_set_title (GTK_WINDOW (window), "Dial"); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (gtk_exit), NULL); + g_signal_connect (GTK_OBJECT (window), "destroy", + GTK_SIGNAL_FUNC (exit), NULL); - gtk_container_border_width (GTK_CONTAINER (window), 10); + gtk_container_set_border_width (GTK_CONTAINER (window), 10); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (window), vbox); @@ -37,23 +39,23 @@ main (int argc, char *argv[]) frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX(vbox), frame, TRUE, TRUE, 0); + gtk_container_add (GTK_CONTAINER (vbox), frame); gtk_widget_show (frame); - adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, -1.0, 1.0, 0.01, 0.1, 0)); + adjustment = GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0)); dial = gtk_dial_new(adjustment); gtk_dial_set_update_policy (GTK_DIAL(dial), GTK_UPDATE_DELAYED); - /* gtk_widget_set_usize (dial, 100, 100); */ + /* gtk_widget_set_size_request (dial, 100, 100); */ gtk_container_add (GTK_CONTAINER (frame), dial); gtk_widget_show (dial); label = gtk_label_new("0.00"); - gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0); + gtk_box_pack_end (GTK_BOX(vbox), label, 0, 0, 0); gtk_widget_show (label); - gtk_signal_connect (GTK_OBJECT(adjustment), "value_changed", + g_signal_connect (GTK_OBJECT(adjustment), "value_changed", GTK_SIGNAL_FUNC (value_changed), label); gtk_widget_show (window); |