gpointing-device-settings r90 - trunk/modules



Author: hiikezoe
Date: Mon Mar  2 04:20:57 2009
New Revision: 90
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=90&view=rev

Log:
Use gpds_xinput_set_int_properties instead of gpds_xinput_set_property.

Modified:
   trunk/modules/gpds-touchpad-ui.c
   trunk/modules/gpds-trackpoint-ui.c
   trunk/modules/gsd-touchpad-manager.c
   trunk/modules/gsd-trackpoint-manager.c

Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c	(original)
+++ trunk/modules/gpds-touchpad-ui.c	Mon Mar  2 04:20:57 2009
@@ -177,15 +177,16 @@
 set_toggle_property (GpdsXInput *xinput, GtkToggleButton *button, GpdsTouchpadProperty property)
 {
     GError *error = NULL;
-    gboolean active;
+    gint properties[1];
 
-    active = gtk_toggle_button_get_active(button);
-    if (!gpds_xinput_set_property(xinput,
-                                  gpds_touchpad_xinput_get_name(property),
-                                  gpds_touchpad_xinput_get_format_type(property),
-                                  &error,
-                                  active ? 1 : 0,
-                                  NULL)) {
+    properties[0] = gtk_toggle_button_get_active(button) ? 1 : 0;
+
+    if (!gpds_xinput_set_int_properties(xinput,
+                                        gpds_touchpad_xinput_get_name(property),
+                                        gpds_touchpad_xinput_get_format_type(property),
+                                        &error,
+                                        properties,
+                                        1)) {
         if (error) {
             show_error(error);
             g_error_free(error);
@@ -197,25 +198,25 @@
 set_edge_scroll_toggle_property (GpdsXInput *xinput, GtkBuilder *builder)
 {
     GError *error = NULL;
-    gboolean vertical_scrolling_active;
-    gboolean horizontal_scrolling_active;
     GObject *object;
+    gint properties[3];
 
     object = gtk_builder_get_object(builder, "vertical_scroll_check");
-    vertical_scrolling_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object));
     set_widget_sensitivity(builder, "vertical_scroll_box", GTK_TOGGLE_BUTTON(object));
+    properties[0] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)) ? 1 :0;
 
     object = gtk_builder_get_object(builder, "horizontal_scroll_check");
-    horizontal_scrolling_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object));
     set_widget_sensitivity(builder, "horizontal_scroll_box", GTK_TOGGLE_BUTTON(object));
+    properties[1] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)) ? 1 :0;
 
-    if (!gpds_xinput_set_property(xinput,
-                                  gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
-                                  gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
-                                  &error,
-                                  vertical_scrolling_active ? 1 : 0,
-                                  horizontal_scrolling_active ? 1 : 0,
-                                  NULL)) {
+    properties[2] = 0;
+
+    if (!gpds_xinput_set_int_properties(xinput,
+                                        gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
+                                        gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
+                                        &error,
+                                        properties,
+                                        3)) {
         if (error) {
             show_error(error);
             g_error_free(error);
@@ -227,15 +228,15 @@
 set_range_property (GpdsXInput *xinput, GtkRange *range, GpdsTouchpadProperty property)
 {
     GError *error = NULL;
-    gdouble value;
+    gint properties[1];
 
-    value = gtk_range_get_value(range);
-    if (!gpds_xinput_set_property(xinput,
-                                  gpds_touchpad_xinput_get_name(property),
-                                  gpds_touchpad_xinput_get_format_type(property),
-                                  &error,
-                                  (gint)value,
-                                  NULL)) {
+    properties[0] = (gint)gtk_range_get_value(range);
+    if (!gpds_xinput_set_int_properties(xinput,
+                                        gpds_touchpad_xinput_get_name(property),
+                                        gpds_touchpad_xinput_get_format_type(property),
+                                        &error,
+                                        properties,
+                                        1)) {
         if (error) {
             show_error(error);
             g_error_free(error);
@@ -247,23 +248,21 @@
 set_scrolling_distance_range_property (GpdsXInput *xinput, GtkBuilder *builder)
 {
     GError *error = NULL;
-    gdouble vertical_scrolling_distance;
-    gdouble horizontal_scrolling_distance;
     GObject *object;
+    gint properties[2];
 
     object = gtk_builder_get_object(builder, "horizontal_scroll_scale");
-    vertical_scrolling_distance = gtk_range_get_value(GTK_RANGE(object));
+    properties[0] = (gint)gtk_range_get_value(GTK_RANGE(object));
 
     object = gtk_builder_get_object(builder, "vertical_scroll_scale");
-    horizontal_scrolling_distance = gtk_range_get_value(GTK_RANGE(object));
+    properties[1] = (gint)gtk_range_get_value(GTK_RANGE(object));
 
-    if (!gpds_xinput_set_property(xinput,
-                                  gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
-                                  gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
-                                  &error,
-                                  (gint)vertical_scrolling_distance,
-                                  (gint)horizontal_scrolling_distance,
-                                  NULL)) {
+    if (!gpds_xinput_set_int_properties(xinput,
+                                        gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+                                        gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+                                        &error,
+                                        properties,
+                                        2)) {
         if (error) {
             show_error(error);
             g_error_free(error);

Modified: trunk/modules/gpds-trackpoint-ui.c
==============================================================================
--- trunk/modules/gpds-trackpoint-ui.c	(original)
+++ trunk/modules/gpds-trackpoint-ui.c	Mon Mar  2 04:20:57 2009
@@ -158,17 +158,19 @@
     gboolean active;
     const gchar *property_name;
     gint format_type;
+    gint properties[1];
 
     active = gtk_toggle_button_get_active(button);
     property_name = gpds_track_point_xinput_get_name(property);
     format_type = gpds_track_point_xinput_get_format_type(property);
 
-    gpds_xinput_set_property(xinput,
-                             property_name,
-                             format_type,
-                             &error,
-                             active ? 1 : 0,
-                             NULL);
+    properties[0] = active ? 1 : 0;
+    gpds_xinput_set_int_properties(xinput,
+                                   property_name,
+                                   format_type,
+                                   &error,
+                                   properties,
+                                   1);
     if (error) {
         show_error(error);
         g_error_free(error);
@@ -182,17 +184,19 @@
     gdouble value;
     const gchar *property_name;
     gint format_type;
+    gint properties[1];
 
     value = gtk_spin_button_get_value(button);
     property_name = gpds_track_point_xinput_get_name(property);
     format_type = gpds_track_point_xinput_get_format_type(property);
 
-    gpds_xinput_set_property(xinput,
-                             property_name,
-                             format_type,
-                             &error,
-                             (gint)value,
-                             NULL);
+    properties[0] = (gint)value;
+    gpds_xinput_set_int_properties(xinput,
+                                   property_name,
+                                   format_type,
+                                   &error,
+                                   properties,
+                                   1);
     if (error) {
         show_error(error);
         g_error_free(error);
@@ -249,31 +253,42 @@
     GtkBuilder *builder;
     GtkToggleButton *button;
     GError *error = NULL;
-    gboolean horizontal_scroll_active;
-    gboolean vertical_scroll_active;
+    gboolean active;
     const gchar *property_name;
     gint format_type;
+    gint properties[4];
 
     builder = gpds_ui_get_builder(GPDS_UI(ui));
 
     button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "wheel_emulation_vertical"));
-    vertical_scroll_active = gtk_toggle_button_get_active(button);
+    active = gtk_toggle_button_get_active(button);
+    if (active) {
+        properties[0] = 6;
+        properties[1] = 7;
+    } else {
+        properties[0] = 0;
+        properties[1] = 0;
+    }
 
     button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "wheel_emulation_horizontal"));
-    horizontal_scroll_active = gtk_toggle_button_get_active(button);
+    active = gtk_toggle_button_get_active(button);
+    if (active) {
+        properties[2] = 4;
+        properties[3] = 5;
+    } else {
+        properties[2] = 0;
+        properties[3] = 0;
+    }
 
     property_name = gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES);
     format_type = gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES);
 
-    gpds_xinput_set_property(ui->xinput,
-                             property_name,
-                             format_type,
-                             &error,
-                             vertical_scroll_active ? 6 : -1,
-                             vertical_scroll_active ? 7 : -1,
-                             horizontal_scroll_active ? 4 : -1,
-                             horizontal_scroll_active ? 5 : -1,
-                             NULL);
+    gpds_xinput_set_int_properties(ui->xinput,
+                                   property_name,
+                                   format_type,
+                                   &error,
+                                   properties,
+                                   4);
     if (error) {
         show_error(error);
         g_error_free(error);

Modified: trunk/modules/gsd-touchpad-manager.c
==============================================================================
--- trunk/modules/gsd-touchpad-manager.c	(original)
+++ trunk/modules/gsd-touchpad-manager.c	Mon Mar  2 04:20:57 2009
@@ -83,6 +83,7 @@
     GConfValue *value;
     const gchar *key;
     GpdsXInput *xinput;
+    gint properties[4];
 
     if (!gpds_xinput_exist_device(GPDS_TOUCHPAD_DEVICE_NAME))
         return;
@@ -95,66 +96,66 @@
     switch (value->type) {
     case GCONF_VALUE_BOOL:
         if (!strcmp(key, GPDS_TOUCHPAD_TAP_FAST_TAP_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TAP_FAST_TAP),
-                                     gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TAP_FAST_TAP),
-                                     NULL,
-                                     gconf_value_get_bool(value),
-                                     NULL);
+            properties[0] = gconf_value_get_bool(value) ? 1 : 0;
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TAP_FAST_TAP),
+                                           gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TAP_FAST_TAP),
+                                           NULL,
+                                           properties,
+                                           1);
         } else  if (!strcmp(key, GPDS_TOUCHPAD_CIRCULAR_SCROLLING_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_CIRCULAR_SCROLLING),
-                                     gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_CIRCULAR_SCROLLING),
-                                     NULL,
-                                     gconf_value_get_bool(value),
-                                     NULL);
+            properties[0] = gconf_value_get_bool(value) ? 1 : 0;
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_CIRCULAR_SCROLLING),
+                                           gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_CIRCULAR_SCROLLING),
+                                           NULL,
+                                           properties,
+                                           1);
         } else  if (!strcmp(key, GPDS_TOUCHPAD_VERTICAL_SCROLLING_KEY) ||
                     !strcmp(key, GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_KEY)) {
-            gboolean enable_vertical, enable_horizontal;
-            enable_vertical = gconf_client_get_bool(client,
-                                                    GPDS_TOUCHPAD_VERTICAL_SCROLLING_KEY,
-                                                    NULL);
-            enable_horizontal = gconf_client_get_bool(client,
-                                                      GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_KEY,
-                                                      NULL);
-
-            gpds_xinput_set_property(xinput,
-                                     gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
-                                     gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
-                                     NULL,
-                                     enable_vertical ? 1 : 0,
-                                     enable_horizontal ? 1 : 0,
-                                     NULL);
+            gboolean enable;
+            enable = gconf_client_get_bool(client,
+                                           GPDS_TOUCHPAD_VERTICAL_SCROLLING_KEY,
+                                           NULL);
+            properties[0] = enable ? 1 : 0;
+            enable = gconf_client_get_bool(client,
+                                           GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_KEY,
+                                           NULL);
+            properties[1] = enable ? 1 : 0;
+
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_EDGE_SCROLLING),
+                                           gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_EDGE_SCROLLING),
+                                           NULL,
+                                           properties,
+                                           2);
         }
         break;
     case GCONF_VALUE_INT:
         if (!strcmp(key, GPDS_TOUCHPAD_TAP_TIME_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TAP_TIME),
-                                     gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TAP_TIME),
-                                     NULL,
-                                     gconf_value_get_int(value),
-                                     NULL);
+            properties[0] = gconf_value_get_int(value);
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_TAP_TIME),
+                                           gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_TAP_TIME),
+                                           NULL,
+                                           properties,
+                                           1);
         } else if (!strcmp(key, GPDS_TOUCHPAD_VERTICAL_SCROLLING_DISTANCE_KEY) ||
                    !strcmp(key, GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_DISTANCE_KEY)) {
-            gint vertical_scrolling_distance;
-            gint horizontal_scrolling_distance;
-
-            vertical_scrolling_distance =
+            properties[0] =
                 gconf_client_get_int(client,
                                      GPDS_TOUCHPAD_VERTICAL_SCROLLING_DISTANCE_KEY,
                                      NULL);
-            horizontal_scrolling_distance =
+            properties[1] =
                 gconf_client_get_int(client,
                                      GPDS_TOUCHPAD_HORIZONTAL_SCROLLING_DISTANCE_KEY,
                                      NULL);
-            gpds_xinput_set_property(xinput,
-                                     gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
-                                     gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
-                                     NULL,
-                                     vertical_scrolling_distance,
-                                     horizontal_scrolling_distance,
-                                     NULL);
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_touchpad_xinput_get_name(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+                                           gpds_touchpad_xinput_get_format_type(GPDS_TOUCHPAD_SCROLLING_DISTANCE),
+                                           NULL,
+                                           properties,
+                                           2);
         }
         break;
     default:

Modified: trunk/modules/gsd-trackpoint-manager.c
==============================================================================
--- trunk/modules/gsd-trackpoint-manager.c	(original)
+++ trunk/modules/gsd-trackpoint-manager.c	Mon Mar  2 04:20:57 2009
@@ -83,6 +83,7 @@
     GConfValue *value;
     const gchar *key;
     GpdsXInput *xinput;
+    gint properties[4];
 
     if (!gpds_xinput_exist_device(GPDS_TRACK_POINT_DEVICE_NAME))
         return;
@@ -95,61 +96,76 @@
     switch (value->type) {
     case GCONF_VALUE_BOOL:
         if (!strcmp(key, GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION),
-                                     gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION),
-                                     NULL,
-                                     gconf_value_get_bool(value),
-                                     NULL);
+            properties[0] = gconf_value_get_bool(value) ? 1 : 0;
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION),
+                                           gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION),
+                                           NULL,
+                                           properties,
+                                           1);
         } else  if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION),
-                                     gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION),
-                                     NULL,
-                                     gconf_value_get_bool(value),
-                                     NULL);
+            properties[0] = gconf_value_get_bool(value) ? 1 : 0;
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION),
+                                           gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION),
+                                           NULL,
+                                           properties,
+                                           1);
         } else  if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY) ||
                     !strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY)) {
-            gboolean enable_vertical, enable_horizontal;
-            enable_vertical = gconf_client_get_bool(client,
-                                                    GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY,
-                                                    NULL);
-            enable_horizontal = gconf_client_get_bool(client,
-                                                      GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY,
-                                                      NULL);
-            gpds_xinput_set_property(xinput,
-                                     gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES),
-                                     gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES),
-                                     NULL,
-                                     enable_vertical ? 6 : -1,
-                                     enable_vertical ? 7 : -1,
-                                     enable_horizontal ? 4 : -1,
-                                     enable_horizontal ? 5 : -1,
-                                     NULL);
+            gboolean enable;
+            enable = gconf_client_get_bool(client,
+                                           GPDS_TRACK_POINT_WHEEL_EMULATION_Y_AXIS_KEY,
+                                           NULL);
+            if (enable) {
+                properties[0] = 6;
+                properties[1] = 7;
+            } else {
+                properties[0] = 0;
+                properties[1] = 0;
+            }
+
+            enable = gconf_client_get_bool(client,
+                                           GPDS_TRACK_POINT_WHEEL_EMULATION_X_AXIS_KEY,
+                                           NULL);
+            if (enable) {
+                properties[2] = 4;
+                properties[3] = 5;
+            } else {
+                properties[2] = 0;
+                properties[3] = 0;
+            }
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES),
+                                           gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_AXES),
+                                           NULL,
+                                           properties,
+                                           4);
         }
         break;
     case GCONF_VALUE_INT:
+        properties[0] = gconf_value_get_int(value);
         if (!strcmp(key, GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT),
-                                     gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT),
-                                     NULL,
-                                     gconf_value_get_int(value),
-                                     NULL);
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT),
+                                           gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT),
+                                           NULL,
+                                           properties,
+                                           1);
         } else if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT),
-                                     gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT),
-                                     NULL,
-                                     gconf_value_get_int(value),
-                                     NULL);
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT),
+                                           gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_TIMEOUT),
+                                           NULL,
+                                           properties,
+                                           1);
         } else if (!strcmp(key, GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA_KEY)) {
-            gpds_xinput_set_property(xinput,
-                                     gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA),
-                                     gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA),
-                                     NULL,
-                                     gconf_value_get_int(value),
-                                     NULL);
+            gpds_xinput_set_int_properties(xinput,
+                                           gpds_track_point_xinput_get_name(GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA),
+                                           gpds_track_point_xinput_get_format_type(GPDS_TRACK_POINT_WHEEL_EMULATION_INERTIA),
+                                           NULL,
+                                           properties,
+                                           1);
         }
         break;
     default:



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