[gpointing-device-settings] speed property support.



commit 74562ea8736ef36bd45faca0ff0ebd80768fdc04
Author: Hiroyuki Ikezoe <poincare ikezoe net>
Date:   Thu Mar 4 19:29:27 2010 +0900

    speed property support.

 data/pointingstick.ui                              |  126 ++++++++++++++++++++
 modules/common/gpds-pointingstick-definitions.h    |    1 +
 modules/common/gpds-pointingstick-xinput.c         |    1 +
 modules/common/gpds-pointingstick-xinput.h         |    1 +
 .../gsd-pointingstick-manager.c                    |    4 +
 modules/gpds-pointingstick-ui.c                    |    5 +
 6 files changed, 138 insertions(+), 0 deletions(-)
---
diff --git a/data/pointingstick.ui b/data/pointingstick.ui
index d448e73..6d3fd32 100644
--- a/data/pointingstick.ui
+++ b/data/pointingstick.ui
@@ -130,6 +130,132 @@
       </packing>
     </child>
     <child>
+      <object class="GtkLabel" id="speed_label">
+        <property name="label" translatable="yes">&lt;b&gt;Speed&lt;/b&gt;</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">True</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+      </object>
+      <packing>
+        <property name="padding">0</property>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkHBox" id="speed_box">
+        <property name="border-width">5</property>
+        <child>
+          <object class="GtkAdjustment" id="speed_scale_adjustment">
+            <property name="lower">1</property>
+            <property name="upper">255</property>
+            <property name="step-increment">5</property>
+            <property name="page_increment">5</property>
+            <property name="page_size">0</property>
+          </object>
+          <object class="GtkLabel" id="speed_scale_label">
+            <property name="label" translatable="yes">_Speed:</property>
+            <property name="mnemonic-widget">speed_scale</property>
+            <property name="use_underline">True</property>
+            <property name="use_markup">False</property>
+            <property name="justify">GTK_JUSTIFY_LEFT</property>
+            <property name="wrap">False</property>
+            <property name="selectable">False</property>
+            <property name="xalign">0.5</property>
+            <property name="yalign">0.5</property>
+            <property name="xpad">0</property>
+            <property name="ypad">0</property>
+            <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+            <property name="width_chars">-1</property>
+            <property name="single_line_mode">False</property>
+            <property name="angle">0</property>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="speed_left_label">
+            <property name="label" translatable="yes" context="speed">&lt;i&gt;Slow&lt;/i&gt;</property>
+            <property name="use_underline">False</property>
+            <property name="use_markup">True</property>
+            <property name="justify">GTK_JUSTIFY_LEFT</property>
+            <property name="wrap">False</property>
+            <property name="selectable">False</property>
+            <property name="xalign">0.5</property>
+            <property name="yalign">0.5</property>
+            <property name="xpad">0</property>
+            <property name="ypad">0</property>
+            <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+            <property name="width_chars">-1</property>
+            <property name="single_line_mode">False</property>
+            <property name="angle">0</property>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHScale" id="speed_scale">
+            <property name="can_focus">True</property>
+            <property name="draw_value">False</property>
+            <property name="value_pos">GTK_POS_TOP</property>
+            <property name="digits">0</property>
+            <property name="update_policy">GTK_UPDATE_DISCONTINUOUS</property>
+            <property name="inverted">False</property>
+            <property name="adjustment">speed_scale_adjustment</property>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="speed_right_label">
+            <property name="label" translatable="yes" context="speed">&lt;i&gt;Fast&lt;/i&gt;</property>
+            <property name="use_underline">False</property>
+            <property name="use_markup">True</property>
+            <property name="justify">GTK_JUSTIFY_LEFT</property>
+            <property name="wrap">False</property>
+            <property name="selectable">False</property>
+            <property name="xalign">0.5</property>
+            <property name="yalign">0.5</property>
+            <property name="xpad">0</property>
+            <property name="ypad">0</property>
+            <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+            <property name="width_chars">-1</property>
+            <property name="single_line_mode">False</property>
+            <property name="angle">0</property>
+          </object>
+          <packing>
+            <property name="padding">0</property>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="padding">0</property>
+        <property name="expand">False</property>
+        <property name="fill">False</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkLabel" id="scrolling_label">
         <property name="label" translatable="yes">&lt;b&gt;Scrolling&lt;/b&gt;</property>
         <property name="use_underline">False</property>
diff --git a/modules/common/gpds-pointingstick-definitions.h b/modules/common/gpds-pointingstick-definitions.h
index d37ec33..024fd3e 100644
--- a/modules/common/gpds-pointingstick-definitions.h
+++ b/modules/common/gpds-pointingstick-definitions.h
@@ -21,6 +21,7 @@
 #define __GPDS_POINTINGSTICK_GCONF_H__
 
 #define GPDS_POINTINGSTICK_SENSITIVITY_KEY               "sensitivity"
+#define GPDS_POINTINGSTICK_SPEED_KEY                     "speed"
 #define GPDS_POINTINGSTICK_SCROLLING_KEY                 "scrolling"
 #define GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT_KEY     "middle_button_timeout"
 #define GPDS_POINTINGSTICK_PRESS_TO_SELECT_KEY           "press_to_select"
diff --git a/modules/common/gpds-pointingstick-xinput.c b/modules/common/gpds-pointingstick-xinput.c
index c25207e..661914e 100644
--- a/modules/common/gpds-pointingstick-xinput.c
+++ b/modules/common/gpds-pointingstick-xinput.c
@@ -29,6 +29,7 @@
 
 static const GpdsXInputPropertyEntry entries[] = {
     {GPDS_POINTINGSTICK_SENSITIVITY,               "PointingStick Sensitivity",               G_TYPE_INT,  8, 1},
+    {GPDS_POINTINGSTICK_SPEED,                     "PointingStick Speed",                     G_TYPE_INT,  8, 1},
     {GPDS_POINTINGSTICK_SCROLLING,                 "PointingStick Scrolling",                 G_TYPE_INT,  8, 1},
     {GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT,     "PointingStick Middle Button Timeout",     G_TYPE_INT, 16, 1},
     {GPDS_POINTINGSTICK_PRESS_TO_SELECT,           "PointingStick Press to Select",           G_TYPE_INT,  8, 1},
diff --git a/modules/common/gpds-pointingstick-xinput.h b/modules/common/gpds-pointingstick-xinput.h
index e792233..c7a18db 100644
--- a/modules/common/gpds-pointingstick-xinput.h
+++ b/modules/common/gpds-pointingstick-xinput.h
@@ -25,6 +25,7 @@
 
 typedef enum {
     GPDS_POINTINGSTICK_SENSITIVITY,
+    GPDS_POINTINGSTICK_SPEED,
     GPDS_POINTINGSTICK_SCROLLING,
     GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT,
     GPDS_POINTINGSTICK_PRESS_TO_SELECT,
diff --git a/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c b/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c
index e3eac31..c68a326 100644
--- a/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c
+++ b/modules/gnome-settings-daemon-plugins/gsd-pointingstick-manager.c
@@ -60,6 +60,7 @@ DEFINE_SET_BOOLEAN_FUNCTION (scrolling, GPDS_POINTINGSTICK_SCROLLING)
 DEFINE_SET_BOOLEAN_FUNCTION (press_to_select, GPDS_POINTINGSTICK_PRESS_TO_SELECT)
 DEFINE_SET_INT_FUNCTION (middle_button_timeout, GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT)
 DEFINE_SET_INT_FUNCTION (sensitivity, GPDS_POINTINGSTICK_SENSITIVITY)
+DEFINE_SET_INT_FUNCTION (speed, GPDS_POINTINGSTICK_SPEED)
 DEFINE_SET_INT_FUNCTION (press_to_select_threshold, GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD)
 
 static gboolean
@@ -80,6 +81,7 @@ start_manager (GsdPointingDeviceManager *manager)
 
     gpds_pointingstick_xinput_setup_property_entries(xinput);
     set_sensitivity(manager, xinput, gconf);
+    set_speed(manager, xinput, gconf);
     set_scrolling(manager, xinput, gconf);
     set_middle_button_timeout(manager, xinput, gconf);
     set_press_to_select(manager, xinput, gconf);
@@ -135,6 +137,8 @@ _gconf_client_notify (GsdPointingDeviceManager *manager,
             set_middle_button_timeout(manager, xinput, client);
         else if (!strcmp(key, GPDS_POINTINGSTICK_SENSITIVITY_KEY))
             set_sensitivity(manager, xinput, client);
+        else if (!strcmp(key, GPDS_POINTINGSTICK_SPEED_KEY))
+            set_speed(manager, xinput, client);
         else if (!strcmp(key, GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD_KEY))
             set_press_to_select_threshold(manager, xinput, client);
         break;
diff --git a/modules/gpds-pointingstick-ui.c b/modules/gpds-pointingstick-ui.c
index fcbfd39..6028596 100644
--- a/modules/gpds-pointingstick-ui.c
+++ b/modules/gpds-pointingstick-ui.c
@@ -135,6 +135,8 @@ GPDS_XINPUT_UI_DEFINE_TOGGLE_BUTTON_CALLBACK(press_to_select,
 
 GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(sensitivity_scale,
                                                    GPDS_POINTINGSTICK_SENSITIVITY)
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(speed_scale,
+                                                   GPDS_POINTINGSTICK_SPEED)
 GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(middle_button_timeout_scale,
                                                    GPDS_POINTINGSTICK_MIDDLE_BUTTON_TIMEOUT)
 GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(press_to_select_threshold_scale,
@@ -155,6 +157,7 @@ setup_signals (GpdsUI *ui, GtkBuilder *builder)
     CONNECT(press_to_select, toggled);
     CONNECT(middle_button_timeout_scale, value_changed);
     CONNECT(sensitivity_scale, value_changed);
+    CONNECT(speed_scale, value_changed);
     CONNECT(press_to_select_threshold_scale, value_changed);
 
 #undef CONNECT
@@ -187,6 +190,8 @@ setup_current_values (GpdsUI *ui)
                   "middle_button_timeout_scale");
     SET_INT_VALUE(GPDS_POINTINGSTICK_SENSITIVITY,
                   "sensitivity_scale");
+    SET_INT_VALUE(GPDS_POINTINGSTICK_SPEED,
+                  "speed_scale");
     SET_INT_VALUE(GPDS_POINTINGSTICK_PRESS_TO_SELECT_THRESHOLD,
                   "press_to_select_threshold_scale");
 }



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