gpointing-device-settings r258 - in trunk: data modules



Author: hiikezoe
Date: Tue Mar 24 03:14:27 2009
New Revision: 258
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=258&view=rev

Log:
Use GtkScale instead of GtkSpinButton.

Modified:
   trunk/data/mouse.ui
   trunk/modules/gpds-mouse-ui.c

Modified: trunk/data/mouse.ui
==============================================================================
--- trunk/data/mouse.ui	(original)
+++ trunk/data/mouse.ui	Tue Mar 24 03:14:27 2009
@@ -14,56 +14,110 @@
     </child>
     <child>
       <object class="GtkHBox" id="middle_button_emulation_box">
-      <property name="visible">True</property>
-      <property name="border-width">5</property>
-      <child>
-        <object class="GtkLabel" id="middle_button_timeout_label">
-          <property name="visible">True</property>
-          <property name="label" translatable="yes">Middle button _timeout:</property>
-          <property name="use_underline">True</property>
-          <property name="mnemonic-widget">middle_button_timeout</property>
-        </object>
-        <packing>
-          <property name="expand">False</property>
-        </packing>
-      </child>
-      <child>
-        <object class="GtkAlignment" id="alignment1">
-          <property name="visible">True</property>
-          <property name="xalign">1</property>
-          <property name="yalign">0.5</property>
-          <property name="xscale">0</property>
-          <property name="yscale">1</property>
-          <property name="top_padding">6</property>
-          <property name="bottom_padding">0</property>
-          <property name="left_padding">12</property>
-          <property name="right_padding">0</property>
-          <child>
-            <object class="GtkAdjustment" id="middle_button_timeout_adjustment">
-              <property name="lower">50</property>
-              <property name="upper">10000</property>
-              <property name="step-increment">50</property>
-            </object>
-            <object class="GtkSpinButton" id="middle_button_timeout">
-              <property name="numeric">True</property>
-              <property name="visible">True</property>
-              <property name="adjustment">middle_button_timeout_adjustment</property>
-            </object>
-          </child>
-        </object>
-      </child>
-      <child>
-        <object class="GtkLabel" id="middle_button_timeout_unit">
-          <property name="visible">True</property>
-          <property name="label" translatable="yes">(ms)</property>
-        </object>
-        <packing>
-          <property name="expand">False</property>
-        </packing>
-      </child>
+        <property name="visible">True</property>
+        <property name="border-width">5</property>
+        <child>
+          <object class="GtkAdjustment" id="middle_button_timeout_scale_adjustment">
+            <property name="lower">50</property>
+            <property name="upper">1000</property>
+            <property name="step-increment">50</property>
+	    <property name="page_increment">50</property>
+	    <property name="page_size">0</property>
+          </object>
+          <object class="GtkLabel" id="middle_button_timeout_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">_timeout:</property>
+            <property name="mnemonic-widget">middle_button_timeout_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="middle_button_timeout_left_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">&lt;i&gt;Short&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="middle_button_timeout_scale">
+            <property name="visible">True</property>
+            <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">middle_button_timeout_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="middle_button_timouet_right_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">&lt;i&gt;Long&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">True</property>
       </packing>
     </child>
     <child>
@@ -86,7 +140,7 @@
         <child>
           <object class="GtkLabel" id="wheel_emulation_button_label">
             <property name="visible">True</property>
-            <property name="label" translatable="yes">Wheel emulation _button:</property>
+            <property name="label" translatable="yes">_button:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic-widget">wheel_emulation_button</property>
           </object>
@@ -130,95 +184,220 @@
         </object>
       </child>
       <child>
-        <object class="GtkHBox" id="hbox2">
-        <property name="visible">True</property>
-        <child>
-          <object class="GtkLabel" id="wheel_emulation_timeout_label">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Wheel _emulation timeout:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic-widget">wheel_emulation_timeout</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkAlignment" id="alignment3">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="yalign">0.5</property>
-            <property name="xscale">0</property>
-            <property name="yscale">1</property>
-            <property name="top_padding">6</property>
-            <property name="bottom_padding">0</property>
-            <property name="left_padding">12</property>
-            <property name="right_padding">0</property>
-            <child>
-              <object class="GtkAdjustment" id="wheel_emulation_timeout_adjustment">
-                <property name="lower">100</property>
-                <property name="upper">10000</property>
-                <property name="step-increment">50</property>
-              </object>
-              <object class="GtkSpinButton" id="wheel_emulation_timeout">
-                <property name="numeric">True</property>
-                <property name="visible">True</property>
-                <property name="adjustment">wheel_emulation_timeout_adjustment</property>
-              </object>
-            </child>
-          </object>
-        </child>
-        <child>
-          <object class="GtkLabel" id="wheel_emulation_timeout_unit">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">(ms)</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-          </packing>
-        </child>
+        <object class="GtkHBox" id="wheel_emulation_timeout_box">
+          <property name="visible">True</property>
+          <property name="border-width">5</property>
+          <child>
+            <object class="GtkAdjustment" id="wheel_emulation_timeout_scale_adjustment">
+              <property name="lower">100</property>
+              <property name="upper">1000</property>
+              <property name="step-increment">50</property>
+	      <property name="page_increment">50</property>
+	      <property name="page_size">0</property>
+            </object>
+            <object class="GtkLabel" id="wheel_emulation_timeout_label">
+              <property name="visible">True</property>
+              <property name="label" translatable="yes">tim_eout:</property>
+              <property name="mnemonic-widget">wheel_emulation_timeout_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="wheel_emulation_timeout_left_label">
+              <property name="visible">True</property>
+              <property name="label" translatable="yes">&lt;i&gt;Short&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="wheel_emulation_timeout_scale">
+              <property name="visible">True</property>
+              <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">wheel_emulation_timeout_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="wheel_emulation_timeout_right_label">
+              <property name="visible">True</property>
+              <property name="label" translatable="yes">&lt;i&gt;Long&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">True</property>
+        </packing>
       </child>
       <child>
-        <object class="GtkHBox" id="hbox3">
-        <property name="visible">True</property>
-        <child>
-          <object class="GtkLabel" id="wheel_emulation_inertia_label">
-            <property name="visible">True</property>
-            <property name="label" translatable="yes">Wheel emulation _inertia:</property>
-            <property name="use_underline">True</property>
-            <property name="mnemonic-widget">wheel_emulation_inertia</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkAlignment" id="alignment4">
-            <property name="visible">True</property>
-            <property name="xalign">1</property>
-            <property name="yalign">0.5</property>
-            <property name="xscale">0</property>
-            <property name="yscale">1</property>
-            <property name="top_padding">6</property>
-            <property name="bottom_padding">0</property>
-            <property name="left_padding">12</property>
-            <property name="right_padding">0</property>
-            <child>
-              <object class="GtkAdjustment" id="wheel_emulation_inertia_adjustment">
-                <property name="lower">10</property>
-                <property name="upper">1000</property>
-                <property name="step-increment">10</property>
-              </object>
-              <object class="GtkSpinButton" id="wheel_emulation_inertia">
-                <property name="numeric">True</property>
-                <property name="visible">True</property>
-                <property name="adjustment">wheel_emulation_inertia_adjustment</property>
-              </object>
-            </child>
-          </object>
-        </child>
+        <object class="GtkHBox" id="wheel_emulation_inertia_box">
+          <property name="visible">True</property>
+          <property name="border-width">5</property>
+          <child>
+            <object class="GtkAdjustment" id="wheel_emulation_inertia_scale_adjustment">
+              <property name="lower">10</property>
+              <property name="upper">500</property>
+              <property name="step-increment">10</property>
+	      <property name="page_increment">10</property>
+	      <property name="page_size">0</property>
+            </object>
+            <object class="GtkLabel" id="wheel_emulation_inertia_label">
+              <property name="visible">True</property>
+              <property name="label" translatable="yes">_inertia:</property>
+              <property name="mnemonic-widget">wheel_emulation_inertia_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="wheel_emulation_inertia_left_label">
+              <property name="visible">True</property>
+              <property name="label" translatable="yes">&lt;i&gt;Short&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="wheel_emulation_inertia_scale">
+              <property name="visible">True</property>
+              <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">wheel_emulation_inertia_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="wheel_emulation_inertia_right_label">
+              <property name="visible">True</property>
+              <property name="label" translatable="yes">&lt;i&gt;Long&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">True</property>
+        </packing>
       </child>
       <child>
         <object class="GtkCheckButton" id="wheel_emulation_vertical">

Modified: trunk/modules/gpds-mouse-ui.c
==============================================================================
--- trunk/modules/gpds-mouse-ui.c	(original)
+++ trunk/modules/gpds-mouse-ui.c	Tue Mar 24 03:14:27 2009
@@ -126,27 +126,6 @@
     g_print("%s\n", error->message);
 }
 
-static void
-set_spin_property (GpdsXInput *xinput, GtkSpinButton *button, GpdsMouseProperty property)
-{
-    GError *error = NULL;
-    gdouble value;
-    gint properties[1];
-
-    value = gtk_spin_button_get_value(button);
-
-    properties[0] = (gint)value;
-    gpds_xinput_set_int_properties(xinput,
-                                   property,
-                                   &error,
-                                   properties,
-                                   1);
-    if (error) {
-        show_error(error);
-        g_error_free(error);
-    }
-}
-
 GPDS_XINPUT_UI_DEFINE_TOGGLE_BUTTON_CALLBACK(middle_button_emulation,
                                              GPDS_MOUSE_MIDDLE_BUTTON_EMULATION,
                                              "middle_button_emulation_box")
@@ -154,6 +133,13 @@
                                              GPDS_MOUSE_WHEEL_EMULATION,
                                              "wheel_emulation_box")
 
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(wheel_emulation_inertia_scale,
+                                                   GPDS_MOUSE_WHEEL_EMULATION_INERTIA)
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(wheel_emulation_timeout_scale,
+                                                   GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT)
+GPDS_XINPUT_UI_DEFINE_SCALE_VALUE_CHANGED_CALLBACK(middle_button_timeout_scale,
+                                                   GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT)
+
 static void
 cb_wheel_emulation_button_changed (GtkComboBox *combo, gpointer user_data)
 {
@@ -258,26 +244,6 @@
 DEFINE_WHEEL_EMULATION_SCROLL_BUTTON_TOGGLED_CALLBACK(wheel_emulation_vertical, WHEEL_EMULATION_Y_AXIS)
 DEFINE_WHEEL_EMULATION_SCROLL_BUTTON_TOGGLED_CALLBACK(wheel_emulation_horizontal, WHEEL_EMULATION_X_AXIS)
 
-#define DEFINE_SPIN_BUTTON_VALUE_CHANGED_CALLBACK(name, NAME)                       \
-static void                                                                         \
-cb_ ## name ## _value_changed (GtkSpinButton *button,                               \
-                               gpointer user_data)                                  \
-{                                                                                   \
-    gdouble value;                                                                  \
-    GpdsMouseUI *ui = GPDS_MOUSE_UI(user_data);                                     \
-    GpdsXInput *xinput;                                                             \
-    xinput = gpds_xinput_ui_get_xinput(GPDS_XINPUT_UI(ui));                         \
-    if (!xinput)                                                                    \
-        return;                                                                     \
-    set_spin_property(xinput, button, GPDS_MOUSE_ ## NAME);                         \
-    value = gtk_spin_button_get_value(button);                                      \
-    gpds_ui_set_gconf_int(GPDS_UI(ui), GPDS_MOUSE_ ## NAME ## _KEY, (gint)value);   \
-}
-
-DEFINE_SPIN_BUTTON_VALUE_CHANGED_CALLBACK(wheel_emulation_timeout, WHEEL_EMULATION_TIMEOUT)
-DEFINE_SPIN_BUTTON_VALUE_CHANGED_CALLBACK(wheel_emulation_inertia, WHEEL_EMULATION_INERTIA)
-DEFINE_SPIN_BUTTON_VALUE_CHANGED_CALLBACK(middle_button_timeout, MIDDLE_BUTTON_TIMEOUT)
-
 static void
 setup_signals (GpdsUI *ui, GtkBuilder *builder)
 {
@@ -290,11 +256,11 @@
                      ui)
 
     CONNECT(middle_button_emulation, toggled);
-    CONNECT(middle_button_timeout, value_changed);
+    CONNECT(middle_button_timeout_scale, value_changed);
     CONNECT(wheel_emulation, toggled);
-    CONNECT(wheel_emulation_timeout, value_changed);
+    CONNECT(wheel_emulation_timeout_scale, value_changed);
     CONNECT(wheel_emulation_button, changed);
-    CONNECT(wheel_emulation_inertia, value_changed);
+    CONNECT(wheel_emulation_inertia_scale, value_changed);
     CONNECT(wheel_emulation_vertical, toggled);
     CONNECT(wheel_emulation_horizontal, toggled);
 
@@ -443,17 +409,17 @@
                                         xinput_ui,
                                         GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT,
                                         GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY,
-                                        "middle_button_timeout");
+                                        "middle_button_timeout_scale");
     gpds_xinput_ui_set_widget_value_from_preference(
                                         xinput_ui,
                                         GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT,
                                         GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT_KEY,
-                                        "wheel_emulation_timeout");
+                                        "wheel_emulation_timeout_scale");
     gpds_xinput_ui_set_widget_value_from_preference(
                                         xinput_ui,
                                         GPDS_MOUSE_WHEEL_EMULATION_INERTIA,
                                         GPDS_MOUSE_WHEEL_EMULATION_INERTIA_KEY,
-                                        "wheel_emulation_inertia");
+                                        "wheel_emulation_inertia_scale");
 
     setup_num_buttons(ui);
     set_wheel_emulation_button_property_from_preference(ui);



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