gpointing-device-settings r177 - in trunk: data modules modules/gnome-settings-daemon-plugins



Author: hiikezoe
Date: Sun Mar  8 05:29:44 2009
New Revision: 177
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=177&view=rev

Log:
middle button number support.

Modified:
   trunk/data/mouse.ui.in
   trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c
   trunk/modules/gpds-mouse-ui.c

Modified: trunk/data/mouse.ui.in
==============================================================================
--- trunk/data/mouse.ui.in	(original)
+++ trunk/data/mouse.ui.in	Sun Mar  8 05:29:44 2009
@@ -81,6 +81,45 @@
       <property name="visible">True</property>
       <property name="border-width">5</property>
       <child>
+        <object class="GtkHBox" id="hbox1">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkLabel" id="wheel_emulation_button_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Wheel emulation button:</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkAlignment" id="alignment2">
+            <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_button_adjustment">
+                <property name="lower">1</property>
+                <property name="upper">3</property>
+                <property name="step-increment">1</property>
+              </object>
+              <object class="GtkSpinButton" id="wheel_emulation_button">
+                <property name="numeric">True</property>
+                <property name="visible">True</property>
+                <property name="adjustment">wheel_emulation_button_adjustment</property>
+              </object>
+            </child>
+          </object>
+        </child>
+        </object>
+      </child>
+      <child>
         <object class="GtkHBox" id="hbox2">
         <property name="visible">True</property>
         <child>
@@ -93,7 +132,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkAlignment" id="alignment1">
+          <object class="GtkAlignment" id="alignment3">
             <property name="visible">True</property>
             <property name="xalign">1</property>
             <property name="yalign">0.5</property>
@@ -141,7 +180,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkAlignment" id="alignment1">
+          <object class="GtkAlignment" id="alignment4">
             <property name="visible">True</property>
             <property name="xalign">1</property>
             <property name="yalign">0.5</property>

Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c	(original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-mouse-extension-manager.c	Sun Mar  8 05:29:44 2009
@@ -148,6 +148,13 @@
                                            NULL,
                                            properties,
                                            1);
+        } else if (!strcmp(key, GPDS_MOUSE_WHEEL_EMULATION_BUTTON_KEY)) {
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_mouse_xinput_get_name(GPDS_MOUSE_WHEEL_EMULATION_BUTTON),
+                                           gpds_mouse_xinput_get_format_type(GPDS_MOUSE_WHEEL_EMULATION_BUTTON),
+                                           NULL,
+                                           properties,
+                                           1);
         }
         break;
     default:

Modified: trunk/modules/gpds-mouse-ui.c
==============================================================================
--- trunk/modules/gpds-mouse-ui.c	(original)
+++ trunk/modules/gpds-mouse-ui.c	Sun Mar  8 05:29:44 2009
@@ -25,6 +25,7 @@
 #include <glib/gi18n.h>
 #include <gpointing-device-settings.h>
 #include <gpds-xinput.h>
+#include <gpds-xinput-utils.h>
 #include <gconf/gconf-client.h>
 
 #include "gpds-mouse-definitions.h"
@@ -229,6 +230,17 @@
 }
 
 static void
+cb_wheel_emulation_button_value_changed (GtkSpinButton *button, gpointer user_data)
+{
+    gdouble value;
+    GpdsMouseUI *ui = GPDS_MOUSE_UI(user_data);
+    set_spin_property(ui->xinput, button, GPDS_MOUSE_WHEEL_EMULATION_BUTTON);
+
+    value = gtk_spin_button_get_value(button);
+    gpds_ui_set_gconf_int(GPDS_UI(ui), GPDS_MOUSE_WHEEL_EMULATION_BUTTON_KEY, (gint)value);
+}
+
+static void
 set_scroll_axes_property (GpdsMouseUI *ui)
 {
     GtkBuilder *builder;
@@ -346,6 +358,7 @@
     CONNECT(middle_button_timeout, value_changed);
     CONNECT(wheel_emulation, toggled);
     CONNECT(wheel_emulation_timeout, value_changed);
+    CONNECT(wheel_emulation_button, value_changed);
     CONNECT(wheel_emulation_inertia, value_changed);
     CONNECT(wheel_emulation_vertical, toggled);
     CONNECT(wheel_emulation_horizontal, toggled);
@@ -468,6 +481,29 @@
 }
 
 static void
+setup_num_buttons (GpdsUI *ui)
+{
+    GObject *spin;
+    gshort num_buttons;
+    GError *error = NULL;
+    GtkBuilder *builder;
+    GtkAdjustment *adjustment;
+
+    builder = gpds_ui_get_builder(ui);
+
+    spin = gtk_builder_get_object(builder, "wheel_emulation_button");
+    num_buttons = gpds_xinput_utils_get_device_num_buttons(gpds_ui_get_device_name(ui),
+                                                           &error);
+    if (error) {
+        show_error(error);
+        g_error_free(error);
+        return;
+    }
+    adjustment = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(spin));
+    gtk_adjustment_set_upper(adjustment, num_buttons - 1);
+}
+
+static void
 setup_current_values (GpdsUI *ui, GtkBuilder *builder)
 {
     GpdsMouseUI *mouse_ui = GPDS_MOUSE_UI(ui);
@@ -483,6 +519,12 @@
                                          builder,
                                          "wheel_emulation");
     set_integer_property_from_preference(mouse_ui,
+                                         GPDS_MOUSE_WHEEL_EMULATION_BUTTON,
+                                         GPDS_MOUSE_WHEEL_EMULATION_BUTTON_KEY,
+                                         builder,
+                                         "wheel_emulation_button");
+    setup_num_buttons(ui);
+    set_integer_property_from_preference(mouse_ui,
                                          GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT,
                                          GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY,
                                          builder,



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