]> Pileus Git - ~andy/gtk/commitdiff
spinbutton: don't override initial text in non-numeric-only spin buttons
authorAleksander Morgado <aleksander@lanedo.com>
Wed, 6 Mar 2013 18:16:25 +0000 (19:16 +0100)
committerAleksander Morgado <aleksander@lanedo.com>
Fri, 8 Mar 2013 10:23:11 +0000 (11:23 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=695312

gtk/gtkspinbutton.c

index 2e071d9aca310c8b528cb81a9e35254cedf047de..f1a09c96394aa24533e20fc497c6a43351bdaf34 100644 (file)
@@ -1048,7 +1048,12 @@ gtk_spin_button_realize (GtkWidget *widget)
 
   return_val = FALSE;
   g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val);
-  if (return_val == FALSE)
+
+  /* If output wasn't processed explicitly by the method connected to the
+   * 'output' signal; and if we don't have any explicit 'text' set initially,
+   * fallback to the default output. */
+  if (!return_val &&
+      (spin_button->numeric || gtk_entry_get_text (GTK_ENTRY (spin_button)) == NULL))
     gtk_spin_button_default_output (spin_button);
 
   gtk_widget_queue_resize (GTK_WIDGET (spin_button));