diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-01-03 19:26:36 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-01-03 19:26:36 +0000 |
commit | 44ec61dd97f1e159457b24458cf86ec39660efd7 (patch) | |
tree | 036b478f431462c22a8e0464d58854b2e86f4233 /examples/spinbutton/spinbutton.c | |
parent | 6803d93d38eb7f1cf09b89eeaf0cb414ab001d15 (diff) | |
download | gtk+-44ec61dd97f1e159457b24458cf86ec39660efd7.tar.gz |
Re-extract.
2005-01-03 Matthias Clasen <mclasen@redhat.com>
* examples/*: Re-extract.
* docs/tutorial/gtk-tut.sgml: Small corrections.
Diffstat (limited to 'examples/spinbutton/spinbutton.c')
-rw-r--r-- | examples/spinbutton/spinbutton.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/spinbutton/spinbutton.c b/examples/spinbutton/spinbutton.c index fdeb7716e9..7c69d9028e 100644 --- a/examples/spinbutton/spinbutton.c +++ b/examples/spinbutton/spinbutton.c @@ -1,44 +1,44 @@ -#include <config.h> #include <stdio.h> #include <gtk/gtk.h> static GtkWidget *spinner1; -void toggle_snap( GtkWidget *widget, - GtkSpinButton *spin ) +static void toggle_snap( GtkWidget *widget, + GtkSpinButton *spin ) { gtk_spin_button_set_snap_to_ticks (spin, GTK_TOGGLE_BUTTON (widget)->active); } -void toggle_numeric( GtkWidget *widget, - GtkSpinButton *spin ) +static void toggle_numeric( GtkWidget *widget, + GtkSpinButton *spin ) { gtk_spin_button_set_numeric (spin, GTK_TOGGLE_BUTTON (widget)->active); } -void change_digits( GtkWidget *widget, - GtkSpinButton *spin ) +static void change_digits( GtkWidget *widget, + GtkSpinButton *spin ) { gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spinner1), gtk_spin_button_get_value_as_int (spin)); } -void get_value( GtkWidget *widget, - gpointer data ) +static void get_value( GtkWidget *widget, + gpointer data ) { - gchar buf[32]; + gchar *buf; GtkLabel *label; GtkSpinButton *spin; spin = GTK_SPIN_BUTTON (spinner1); label = GTK_LABEL (g_object_get_data (G_OBJECT (widget), "user_data")); if (GPOINTER_TO_INT (data) == 1) - sprintf (buf, "%d", gtk_spin_button_get_value_as_int (spin)); + buf = g_strdup_printf ("%d", gtk_spin_button_get_value_as_int (spin)); else - sprintf (buf, "%0.*f", spin->digits, - gtk_spin_button_get_value (spin)); + buf = g_strdup_printf ("%0.*f", spin->digits, + gtk_spin_button_get_value (spin)); gtk_label_set_text (label, buf); + g_free (buf); } |