summaryrefslogtreecommitdiff
path: root/gtk/gtkspinbutton.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2008-01-06 06:35:49 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2008-01-06 06:35:49 +0000
commitf8c2aaf4737af09bc27cf92f8cfa46ab3645455a (patch)
tree2e2742644a534923189fa2fc5912ad33743b2db6 /gtk/gtkspinbutton.c
parent71e9be7e6da95f11da67271afb7a8c4fcfa46713 (diff)
downloadgtk+-f8c2aaf4737af09bc27cf92f8cfa46ab3645455a.tar.gz
Document the ::output signal and add an example. (#507566, example by Owen
2008-01-06 Matthias Clasen <mclasen@redhat.com> * gtk/gtkspinbutton.c: Document the ::output signal and add an example. (#507566, example by Owen Taylor) svn path=/trunk/; revision=19312
Diffstat (limited to 'gtk/gtkspinbutton.c')
-rw-r--r--gtk/gtkspinbutton.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 7aa6ebaa52..4831ba5d7a 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -290,6 +290,33 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
G_TYPE_INT, 1,
G_TYPE_POINTER);
+ /**
+ * GtkSpinButton::output:
+ * @spin_button: the object which received the signal
+ *
+ * The ::output signal can be used to change to formatting
+ * of the value that is displayed in the spin buttons entry.
+ * |[
+ * /&ast; show leading zeros &ast;/
+ * static gboolean
+ * on_output (GtkSpinButton *spin,
+ * gpointer data)
+ * {
+ * GtkAdjustment *adj;
+ * gchar *text;
+ *
+ * adj = gtk_spin_button_get_adjustment (spin);
+ * value = (int)gtk_adjustment_get_value (adj);
+ * text = g_strdup_printf ("%02d", value);
+ * gtk_entry_set_text (GTK_ENTRY (spin), text);
+ * g_free (text);
+ *
+ * return TRUE;
+ * }
+ * ]|
+ *
+ * Returns: %TRUE if the value has been displayed.
+ */
spinbutton_signals[OUTPUT] =
g_signal_new (I_("output"),
G_TYPE_FROM_CLASS (gobject_class),