What is a non-editable spinbutton?



It was pointed out to me that currently a non-editable GtkSpinButton 
is inconsistent ... you can change its value using the mouse to
click on the buttons, but not with the keyboard.

Which way should it be? Is a non-editable spinbutton not editable
at all, or just not editable by editing the contents of the entry?
I suspect the second is more useful, though I think its basically
never right to make a spinbutton not-editable.

(The attached patch implements the second approach")

Opinions? Is anybody using not-editable spinbuttons?

                                        Owen

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.3338.2.149
diff -u -p -u -w -r1.3338.2.149 ChangeLog
--- ChangeLog	5 Aug 2002 21:10:22 -0000	1.3338.2.149
+++ ChangeLog	8 Aug 2002 21:00:46 -0000
@@ -1,3 +1,8 @@
+Thu Aug  8 16:58:22 2002  Owen Taylor  <otaylor redhat com>
+
+	* gtk/gtkspinbutton.c (gtk_spin_button_real_change_value): 
+	Remove the check for editable. (Reported by Brent Fox)
+
 Mon Aug  5 17:01:30 2002  Owen Taylor  <otaylor redhat com>
 
 	* gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS,
Index: gtk/gtkspinbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkspinbutton.c,v
retrieving revision 1.92.2.1
diff -u -p -u -w -r1.92.2.1 gtkspinbutton.c
--- gtk/gtkspinbutton.c	12 Jun 2002 19:42:36 -0000	1.92.2.1
+++ gtk/gtkspinbutton.c	8 Aug 2002 21:00:46 -0000
@@ -1220,8 +1220,11 @@ static void
 gtk_spin_button_real_change_value (GtkSpinButton *spin,
 				   GtkScrollType  scroll)
 {
-  if (GTK_ENTRY (spin)->editable)
-    {
+  /* 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:
@@ -1294,7 +1297,6 @@ gtk_spin_button_real_change_value (GtkSp
         }
       
       gtk_spin_button_update (spin);
-    }
 }
 
 static gint


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