gpointing-device-settings r273 - trunk/modules



Author: hiikezoe
Date: Wed Mar 25 11:40:51 2009
New Revision: 273
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=273&view=rev

Log:
code cleanup.

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

Modified: trunk/modules/gpds-mouse-ui.c
==============================================================================
--- trunk/modules/gpds-mouse-ui.c	(original)
+++ trunk/modules/gpds-mouse-ui.c	Wed Mar 25 11:40:51 2009
@@ -394,32 +394,30 @@
 {
     GpdsXInputUI *xinput_ui = GPDS_XINPUT_UI(ui);
 
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                         xinput_ui,
-                                         GPDS_MOUSE_MIDDLE_BUTTON_EMULATION,
-                                         GPDS_MOUSE_MIDDLE_BUTTON_EMULATION_KEY,
-                                         "middle_button_emulation");
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                         xinput_ui,
-                                         GPDS_MOUSE_WHEEL_EMULATION,
-                                         GPDS_MOUSE_WHEEL_EMULATION_KEY,
-                                         "wheel_emulation");
-
-    gpds_xinput_ui_set_widget_value_from_preference(
-                                        xinput_ui,
-                                        GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT,
-                                        GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT_KEY,
-                                        "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_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_scale");
+#define SET_INT_VALUE(PROP_NAME, widget_name)                           \
+    gpds_xinput_ui_set_widget_value_from_preference(                    \
+                                        xinput_ui,                      \
+                                        PROP_NAME,                      \
+                                        PROP_NAME ## _KEY,              \
+                                        widget_name);
+#define SET_BOOLEAN_VALUE(PROP_NAME, widget_name)                       \
+    gpds_xinput_ui_set_toggle_button_state_from_preference(             \
+                                        xinput_ui,                      \
+                                        PROP_NAME,                      \
+                                        PROP_NAME ## _KEY,              \
+                                        widget_name);
+
+    SET_BOOLEAN_VALUE(GPDS_MOUSE_MIDDLE_BUTTON_EMULATION,
+                      "middle_button_emulation");
+    SET_BOOLEAN_VALUE(GPDS_MOUSE_WHEEL_EMULATION,
+                      "wheel_emulation");
+
+    SET_INT_VALUE(GPDS_MOUSE_MIDDLE_BUTTON_TIMEOUT,
+                  "middle_button_timeout_scale");
+    SET_INT_VALUE(GPDS_MOUSE_WHEEL_EMULATION_TIMEOUT,
+                  "wheel_emulation_timeout_scale");
+    SET_INT_VALUE(GPDS_MOUSE_WHEEL_EMULATION_INERTIA,
+                  "wheel_emulation_inertia_scale");
 
     setup_num_buttons(ui);
     set_wheel_emulation_button_property_from_preference(ui);

Modified: trunk/modules/gpds-touchpad-ui.c
==============================================================================
--- trunk/modules/gpds-touchpad-ui.c	(original)
+++ trunk/modules/gpds-touchpad-ui.c	Wed Mar 25 11:40:51 2009
@@ -666,46 +666,28 @@
 {
     GpdsXInputUI *xinput_ui = GPDS_XINPUT_UI(ui);
 
-    gpds_xinput_ui_set_widget_value_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_TAP_TIME,
-                                        GPDS_TOUCHPAD_TAP_TIME_KEY,
-                                        "tapping_time_scale");
-    gpds_xinput_ui_set_widget_value_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_TAP_MOVE,
-                                        GPDS_TOUCHPAD_TAP_MOVE_KEY,
-                                        "tapping_move_scale");
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_TAP_FAST_TAP, 
-                                        GPDS_TOUCHPAD_TAP_FAST_TAP_KEY,
-                                        "faster_tapping_check");
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_GUEST_MOUSE_OFF, 
-                                        GPDS_TOUCHPAD_GUEST_MOUSE_OFF_KEY,
-                                        "guest_mouse_off");
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_PALM_DETECTION, 
-                                        GPDS_TOUCHPAD_PALM_DETECTION_KEY,
-                                        "palm_detection");
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_LOCKED_DRAGS,
-                                        GPDS_TOUCHPAD_LOCKED_DRAGS_KEY,
-                                        "locked_drags");
-    gpds_xinput_ui_set_widget_value_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT,
-                                        GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT_KEY,
-                                        "locked_drags_timeout_scale");
-    gpds_xinput_ui_set_toggle_button_state_from_preference(
-                                        xinput_ui,
-                                        GPDS_TOUCHPAD_CIRCULAR_SCROLLING,
-                                        GPDS_TOUCHPAD_CIRCULAR_SCROLLING_KEY,
-                                        "circular_scrolling");
+#define SET_INT_VALUE(PROP_NAME, widget_name)                           \
+    gpds_xinput_ui_set_widget_value_from_preference(                    \
+                                        xinput_ui,                      \
+                                        PROP_NAME,                      \
+                                        PROP_NAME ## _KEY,              \
+                                        widget_name);
+#define SET_BOOLEAN_VALUE(PROP_NAME, widget_name)                       \
+    gpds_xinput_ui_set_toggle_button_state_from_preference(             \
+                                        xinput_ui,                      \
+                                        PROP_NAME,                      \
+                                        PROP_NAME ## _KEY,              \
+                                        widget_name);
+
+    SET_INT_VALUE(GPDS_TOUCHPAD_TAP_TIME, "tapping_time_scale");
+    SET_INT_VALUE(GPDS_TOUCHPAD_TAP_MOVE, "tapping_move_scale");
+    SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_TAP_FAST_TAP, "faster_tapping_check");
+    SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_GUEST_MOUSE_OFF, "guest_mouse_off");
+    SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_PALM_DETECTION, "palm_detection");
+    SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_LOCKED_DRAGS, "locked_drags");
+    SET_INT_VALUE(GPDS_TOUCHPAD_LOCKED_DRAGS_TIMEOUT, "locked_drags_timeout_scale");
+    SET_BOOLEAN_VALUE(GPDS_TOUCHPAD_CIRCULAR_SCROLLING, "circular_scrolling");
+
     set_edge_scrolling_property_from_preference(ui, builder);
     set_scroll_distance_property_from_preference(ui, builder);
     set_circular_scrolling_trigger_property_from_preference(ui, builder);



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