[gtk+] gtkspinbutton: Ignore keynav when !editable



commit 43e29f7cbf107e33c1155448e25730be303fdd44
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jan 5 03:09:06 2012 +0200

    gtkspinbutton: Ignore keynav when !editable
    
    Don't allow changing of value through keyboard when 'editable' property is
    set to 'FALSE.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=667229

 gtk/gtkspinbutton.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 5a5cf80..bff3d66 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -1504,6 +1504,12 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
   GtkSpinButtonPrivate *priv = spin->priv;
   gdouble old_value;
 
+  if (!gtk_editable_get_editable (GTK_EDITABLE (spin)))
+    {
+      gtk_widget_error_bell (GTK_WIDGET (spin));
+      return;
+    }
+
   /* When the key binding is activated, there may be an outstanding
    * value, so we first have to commit what is currently written in
    * the spin buttons text entry. See #106574
@@ -1512,11 +1518,6 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin,
 
   old_value = gtk_adjustment_get_value (priv->adjustment);
 
-  /* We don't test whether the entry is editable, since
-   * this key binding conceptually corresponds to changing
-   * the value with the buttons using the mouse, which
-   * we allow for non-editable spin buttons.
-   */
   switch (scroll)
     {
     case GTK_SCROLL_STEP_BACKWARD:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]