[maemo-commits] [maemo-commits] r16974 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Dec 16 13:50:09 EET 2008
Author: kalikiana
Date: 2008-12-16 13:50:07 +0200 (Tue, 16 Dec 2008)
New Revision: 16974

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtk.symbols
   projects/haf/trunk/gtk+/gtk/gtkadjustment.c
   projects/haf/trunk/gtk+/gtk/gtkrange.c
   projects/haf/trunk/gtk+/gtk/gtkrange.h
Log:
2008-12-16  Christian Dywan  <christian at imendio.com>

	Fixes: NB#93744 - Tapping should jump to location on GtkScale

	* gtk/gtk.symbols:
	* gtk/gtkadjustment.c: Revert Since to "2.14".
	* gtk/gtkrange.c (gtk_range_class_init), (gtk_range_set_property),
	(gtk_range_get_property), (gtk_range_set_jump_to_position),
	(gtk_range_get_jump_to_position), (gtk_range_button_press):
	* gtk/gtkrange.h: Implement jump-to-position in GtkRange



Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2008-12-16 11:44:12 UTC (rev 16973)
+++ projects/haf/trunk/gtk+/ChangeLog	2008-12-16 11:50:07 UTC (rev 16974)
@@ -1,3 +1,14 @@
+2008-12-16  Christian Dywan  <christian at imendio.com>
+
+	Fixes: NB#93744 - Tapping should jump to location on GtkScale
+
+	* gtk/gtk.symbols:
+	* gtk/gtkadjustment.c: Revert Since to "2.14".
+	* gtk/gtkrange.c (gtk_range_class_init), (gtk_range_set_property),
+	(gtk_range_get_property), (gtk_range_set_jump_to_position),
+	(gtk_range_get_jump_to_position), (gtk_range_button_press):
+	* gtk/gtkrange.h: Implement jump-to-position in GtkRange
+
 2008-12-15  Christian Dywan  <christian at imendio.com>
 
 	Use "Since: maemo 4.0" instead of "2.14" to avoid confusion

Modified: projects/haf/trunk/gtk+/gtk/gtk.symbols
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtk.symbols	2008-12-16 11:44:12 UTC (rev 16973)
+++ projects/haf/trunk/gtk+/gtk/gtk.symbols	2008-12-16 11:50:07 UTC (rev 16974)
@@ -3062,6 +3062,9 @@
 gtk_range_get_inverted
 gtk_range_get_lower_stepper_sensitivity
 gtk_range_get_restrict_to_fill_level
+#ifdef MAEMO_CHANGES
+gtk_range_get_jump_to_position
+#endif
 gtk_range_get_show_fill_level
 gtk_range_get_type G_GNUC_CONST
 gtk_range_get_update_policy
@@ -3074,6 +3077,9 @@
 gtk_range_set_lower_stepper_sensitivity
 gtk_range_set_range
 gtk_range_set_restrict_to_fill_level
+#ifdef MAEMO_CHANGES
+gtk_range_set_jump_to_position
+#endif
 gtk_range_set_show_fill_level
 gtk_range_set_update_policy
 gtk_range_set_upper_stepper_sensitivity

Modified: projects/haf/trunk/gtk+/gtk/gtkadjustment.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkadjustment.c	2008-12-16 11:44:12 UTC (rev 16973)
+++ projects/haf/trunk/gtk+/gtk/gtkadjustment.c	2008-12-16 11:50:07 UTC (rev 16974)
@@ -400,8 +400,7 @@
  * signal. See gtk_adjustment_set_lower() for an alternative way
  * of compressing multiple emissions of "changed" into one.
  *
- * Since: maemo 4.0
- * Stability: Unstable
+ * Since: 2.14
  **/
 void
 gtk_adjustment_configure (GtkAdjustment *adjustment,

Modified: projects/haf/trunk/gtk+/gtk/gtkrange.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkrange.c	2008-12-16 11:44:12 UTC (rev 16973)
+++ projects/haf/trunk/gtk+/gtk/gtkrange.c	2008-12-16 11:50:07 UTC (rev 16974)
@@ -49,7 +49,10 @@
   PROP_UPPER_STEPPER_SENSITIVITY,
   PROP_SHOW_FILL_LEVEL,
   PROP_RESTRICT_TO_FILL_LEVEL,
-  PROP_FILL_LEVEL
+  PROP_FILL_LEVEL,
+#ifdef MAEMO_CHANGES
+  PROP_JUMP_TO_POSITION
+#endif
 };
 
 enum {
@@ -110,6 +113,9 @@
   guint repaint_id;
 
   gdouble fill_level;
+#ifdef MAEMO_CHANGES
+  gboolean jump_to_position;
+#endif
 };
 
 
@@ -426,6 +432,25 @@
                                                         G_MAXDOUBLE,
                                                         GTK_PARAM_READWRITE));
 
+#ifdef MAEMO_CHANGES
+  /**
+   * GtkRange:jump-to-position:
+   *
+   * Whether to jump to the destined position immediately
+   * instead of moving a number of steps
+   *
+   * Since: maemo 4.0
+   * Stability: Unstable
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_JUMP_TO_POSITION,
+                                   g_param_spec_boolean ("jump-to-position",
+                                                         P_("Jump to Position"),
+                                                         P_("Whether to jump to the destined position immediately instead of moving a number of steps"),
+                                                         FALSE,
+                                                         GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+#endif /* MAEMO_CHANGES */
+
   gtk_widget_class_install_style_property (widget_class,
 					   g_param_spec_int ("slider-width",
 							     P_("Slider Width"),
@@ -576,6 +601,11 @@
     case PROP_FILL_LEVEL:
       gtk_range_set_fill_level (range, g_value_get_double (value));
       break;
+#ifdef MAEMO_CHANGES
+    case PROP_JUMP_TO_POSITION:
+      gtk_range_set_jump_to_position (range, g_value_get_boolean (value));
+      break;
+#endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -618,6 +648,11 @@
     case PROP_FILL_LEVEL:
       g_value_set_double (value, gtk_range_get_fill_level (range));
       break;
+#ifdef MAEMO_CHANGES
+    case PROP_JUMP_TO_POSITION:
+      g_value_set_boolean (value, gtk_range_get_jump_to_position (range));
+      break;
+#endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1164,6 +1199,54 @@
   return range->layout->fill_level;
 }
 
+#ifdef MAEMO_CHANGES
+/**
+ * gtk_range_set_jump_to_position:
+ * @range: A #GtkRange
+ * @jump_to_position: Whether to jump to the position immediately
+ *
+ * Sets whether scrolling through user interaction should
+ * jump directly to the destined position, as opposed to moving
+ * a number of steps towards the destination.
+ *
+ * Since: maemo 4.0
+ * Stability: Unstable
+ **/
+void
+gtk_range_set_jump_to_position (GtkRange *range,
+                                gboolean  jump_to_position)
+{
+  g_return_if_fail (GTK_IS_RANGE (range));
+
+  if (jump_to_position != range->layout->jump_to_position)
+    {
+      range->layout->jump_to_position = jump_to_position;
+      g_object_notify (G_OBJECT (range), "jump-to-position");
+    }
+}
+
+/**
+ * gtk_range_get_jump_to_position:
+ * @range: A #GtkRange
+ *
+ * Determines whether the value should jump immediately to the
+ * destined position as opposed to moving a number of steps.
+ * See also gtk_range_set_jump_to_position().
+ *
+ * Return value: %TRUE if @range jumps directly to the destination
+ *
+ * Since: maemo 4.0
+ * Stability: Unstable
+ **/
+gboolean
+gtk_range_get_jump_to_position (GtkRange *range)
+{
+  g_return_val_if_fail (GTK_IS_RANGE (range), FALSE);
+
+  return range->layout->jump_to_position;
+}
+#endif
+
 static gboolean
 should_invert (GtkRange *range)
 {  
@@ -1916,7 +1999,11 @@
     gtk_widget_queue_draw (widget);
     
   if (range->layout->mouse_location == MOUSE_TROUGH  &&
+#ifdef MAEMO_CHANGES
+      event->button == 1 && !range->layout->jump_to_position)
+#else
       event->button == 1)
+#endif
     {
       /* button 1 steps by page increment, as with button 2 on a stepper
        */
@@ -1961,7 +2048,11 @@
       return TRUE;
     }
   else if ((range->layout->mouse_location == MOUSE_TROUGH &&
+#ifdef MAEMO_CHANGES
+            (event->button == 2 || range->layout->jump_to_position)) ||
+#else
             event->button == 2) ||
+#endif
            range->layout->mouse_location == MOUSE_SLIDER)
     {
       gboolean need_value_update = FALSE;
@@ -1972,7 +2063,11 @@
        * On button 2 press, we warp the slider to mouse position,
        * then begin the slider drag.
        */
+#ifdef MAEMO_CHANGES
+      if (event->button == 2 || range->layout->jump_to_position)
+#else
       if (event->button == 2)
+#endif
         {
           gdouble slider_low_value, slider_high_value, new_value;
           

Modified: projects/haf/trunk/gtk+/gtk/gtkrange.h
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkrange.h	2008-12-16 11:44:12 UTC (rev 16973)
+++ projects/haf/trunk/gtk+/gtk/gtkrange.h	2008-12-16 11:50:07 UTC (rev 16974)
@@ -169,7 +169,13 @@
 void               gtk_range_set_fill_level                (GtkRange      *range,
                                                             gdouble        fill_level);
 gdouble            gtk_range_get_fill_level                (GtkRange      *range);
+#ifdef MAEMO_CHANGES
+void               gtk_range_set_jump_to_position          (GtkRange      *range,
+                                                            gboolean       jump_to_position);
+gboolean           gtk_range_get_jump_to_position          (GtkRange      *range);
+#endif
 
+
 gdouble            _gtk_range_get_wheel_delta              (GtkRange      *range,
                                                             GdkScrollDirection direction);
 


More information about the maemo-commits mailing list