]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkspinbutton.c
filechooserbutton: Give proper names to the SELECT_FOLDER tests with cancelled dialog
[~andy/gtk] / gtk / gtkspinbutton.c
index 915f8ba6f392e5e103865847a8675709bed46abb..f05657cf42cc3915b68063a7aaddc6228b0c7ce4 100644 (file)
@@ -771,15 +771,9 @@ gtk_spin_button_panel_nthchildize_context (GtkSpinButton *spin_button,
   gtk_widget_path_iter_add_class (siblings_path, down_pos, GTK_STYLE_CLASS_SPINBUTTON);
 
   if (panel == priv->down_panel)
-    {
-      gtk_widget_path_append_with_siblings (path, siblings_path, up_pos);
-      gtk_widget_path_append_with_siblings (path, siblings_path, down_pos);
-    }
+    gtk_widget_path_append_with_siblings (path, siblings_path, down_pos);
   else
-    {
-      gtk_widget_path_append_with_siblings (path, siblings_path, down_pos);
-      gtk_widget_path_append_with_siblings (path, siblings_path, up_pos);
-    }
+    gtk_widget_path_append_with_siblings (path, siblings_path, up_pos);
 
   gtk_style_context_set_path (context, path);
   gtk_widget_path_unref (path);
@@ -1040,7 +1034,7 @@ gtk_spin_button_realize (GtkWidget *widget)
 
   priv->down_panel = gdk_window_new (gtk_widget_get_window (widget),
                                      &attributes, attributes_mask);
-  gdk_window_set_user_data (priv->down_panel, widget);
+  gtk_widget_register_window (widget, priv->down_panel);
 
   /* create the right panel window */
   attributes.x = up_allocation.x;
@@ -1050,11 +1044,16 @@ gtk_spin_button_realize (GtkWidget *widget)
 
   priv->up_panel = gdk_window_new (gtk_widget_get_window (widget),
                                       &attributes, attributes_mask);
-  gdk_window_set_user_data (priv->up_panel, widget);
+  gtk_widget_register_window (widget, priv->up_panel);
 
   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->priv->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));
@@ -1070,14 +1069,14 @@ gtk_spin_button_unrealize (GtkWidget *widget)
 
   if (priv->down_panel)
     {
-      gdk_window_set_user_data (priv->down_panel, NULL);
+      gtk_widget_unregister_window (widget, priv->down_panel);
       gdk_window_destroy (priv->down_panel);
       priv->down_panel = NULL;
     }
 
   if (priv->up_panel)
     {
-      gdk_window_set_user_data (priv->up_panel, NULL);
+      gtk_widget_unregister_window (widget, priv->up_panel);
       gdk_window_destroy (priv->up_panel);
       priv->up_panel = NULL;
     }
@@ -2413,7 +2412,7 @@ gtk_spin_button_set_value (GtkSpinButton *spin_button,
  * @policy: a #GtkSpinButtonUpdatePolicy value
  *
  * Sets the update behavior of a spin button.
- * This determines wether the spin button is always updated
+ * This determines whether the spin button is always updated
  * or only when a valid value is set.
  */
 void