gpointing-device-settings r105 - in trunk/modules: . common gnome-settings-daemon-plugins



Author: hiikezoe
Date: Tue Mar  3 03:37:12 2009
New Revision: 105
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=105&view=rev

Log:
Remove GPDS_TRACK_POINT_DEVICE_NAME, use gpds_track_point_xinput_find_device_name.

Modified:
   trunk/modules/common/gpds-touchpad-xinput.c
   trunk/modules/common/gpds-trackpoint-definitions.h
   trunk/modules/common/gpds-trackpoint-xinput.c
   trunk/modules/common/gpds-trackpoint-xinput.h
   trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c
   trunk/modules/gpds-trackpoint-ui.c

Modified: trunk/modules/common/gpds-touchpad-xinput.c
==============================================================================
--- trunk/modules/common/gpds-touchpad-xinput.c	(original)
+++ trunk/modules/common/gpds-touchpad-xinput.c	Tue Mar  3 03:37:12 2009
@@ -26,8 +26,7 @@
 #include <gconf/gconf-client.h>
 #include <gpds-xinput.h>
 
-static const gchar *touchpad_device_names[] =
-{
+static const gchar *touchpad_device_names[] = {
     "SynPS/2 Synaptics TouchPad",
     "AlpsPS/2 ALPS GlidePoint"
 };

Modified: trunk/modules/common/gpds-trackpoint-definitions.h
==============================================================================
--- trunk/modules/common/gpds-trackpoint-definitions.h	(original)
+++ trunk/modules/common/gpds-trackpoint-definitions.h	Tue Mar  3 03:37:12 2009
@@ -20,8 +20,6 @@
 #ifndef __GPDS_TRACK_POINT_GCONF_H__
 #define __GPDS_TRACK_POINT_GCONF_H__
 
-#define GPDS_TRACK_POINT_DEVICE_NAME "TPPS/2 IBM TrackPoint"
-
 #define GPDS_TRACK_POINT_GCONF_DIR                   "/desktop/gnome/peripherals/trackpoint"
 #define GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION_KEY GPDS_TRACK_POINT_GCONF_DIR "/middle_button_emulation"
 #define GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT_KEY   GPDS_TRACK_POINT_GCONF_DIR "/middle_button_timeoue"

Modified: trunk/modules/common/gpds-trackpoint-xinput.c
==============================================================================
--- trunk/modules/common/gpds-trackpoint-xinput.c	(original)
+++ trunk/modules/common/gpds-trackpoint-xinput.c	Tue Mar  3 03:37:12 2009
@@ -26,6 +26,12 @@
 #include <gconf/gconf-client.h>
 #include <gpds-xinput.h>
 
+static const gchar *track_point_device_names[] = {
+    "TPPS/2 IBM TrackPoint"
+};
+
+static const gint n_track_point_device_names = G_N_ELEMENTS(track_point_device_names);
+
 static GpdsTrackPointXInputProperty properties[] = {
     {GPDS_TRACK_POINT_MIDDLE_BUTTON_EMULATION, "Evdev Middle Button Emulation", 8, 1},
     {GPDS_TRACK_POINT_MIDDLE_BUTTON_TIMEOUT, "Evdev Middle Button Timeout", 32, 1},
@@ -78,6 +84,17 @@
     return -1;
 }
 
+const gchar *
+gpds_track_point_xinput_find_device_name (void)
+{
+    gint i;
+
+    for (i = 0; i < n_track_point_device_names; i++) {
+        if (gpds_xinput_exist_device(track_point_device_names[i]))
+            return track_point_device_names[i];
+    }
+    return NULL;
+}
 
 /*
 vi:ts=4:nowrap:ai:expandtab:sw=4

Modified: trunk/modules/common/gpds-trackpoint-xinput.h
==============================================================================
--- trunk/modules/common/gpds-trackpoint-xinput.h	(original)
+++ trunk/modules/common/gpds-trackpoint-xinput.h	Tue Mar  3 03:37:12 2009
@@ -45,6 +45,7 @@
 const gchar *gpds_track_point_xinput_get_name            (GpdsTrackPointProperty property);
 gint         gpds_track_point_xinput_get_format_type     (GpdsTrackPointProperty property);
 gint         gpds_track_point_xinput_get_max_value_count (GpdsTrackPointProperty property);
+const gchar *gpds_track_point_xinput_find_device_name    (void);
 
 
 #endif /* __GPDS_TRACK_POINT_XINPUT_H__ */

Modified: trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c
==============================================================================
--- trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c	(original)
+++ trunk/modules/gnome-settings-daemon-plugins/gsd-trackpoint-manager.c	Tue Mar  3 03:37:12 2009
@@ -84,11 +84,16 @@
     const gchar *key;
     GpdsXInput *xinput;
     gint properties[4];
+    const gchar *device_name;
 
-    if (!gpds_xinput_exist_device(GPDS_TRACK_POINT_DEVICE_NAME))
+    device_name = gpds_track_point_xinput_find_device_name();
+    if (!device_name)
         return;
 
-    xinput = gpds_xinput_new(GPDS_TRACK_POINT_DEVICE_NAME);
+    if (!gpds_xinput_exist_device(device_name))
+        return;
+
+    xinput = gpds_xinput_new(device_name);
 
     value = gconf_entry_get_value(entry);
     key = gconf_entry_get_key(entry);

Modified: trunk/modules/gpds-trackpoint-ui.c
==============================================================================
--- trunk/modules/gpds-trackpoint-ui.c	(original)
+++ trunk/modules/gpds-trackpoint-ui.c	Tue Mar  3 03:37:12 2009
@@ -46,6 +46,7 @@
     GpdsXInput *xinput;
     gchar *ui_file_path;
     GConfClient *gconf;
+    gchar *device_name;
 };
 
 struct _GpdsTrackPointUIClass
@@ -99,6 +100,7 @@
                                         "trackpoint.ui",
                                         NULL);
     ui->gconf = gconf_client_get_default();
+    ui->device_name = NULL;
 }
 
 G_MODULE_EXPORT void
@@ -137,6 +139,7 @@
     }
 
     g_free(ui->ui_file_path);
+    g_free(ui->device_name);
 
     if (G_OBJECT_CLASS(gpds_track_point_ui_parent_class)->dispose)
         G_OBJECT_CLASS(gpds_track_point_ui_parent_class)->dispose(object);
@@ -539,7 +542,10 @@
 static gboolean
 is_available (GpdsUI *ui, GError **error)
 {
-    if (!gpds_xinput_exist_device(GPDS_TRACK_POINT_DEVICE_NAME)) {
+    const gchar *device_name;
+    device_name = gpds_track_point_xinput_find_device_name();
+
+    if (!device_name) {
         g_set_error(error,
                     GPDS_XINPUT_ERROR,
                     GPDS_XINPUT_ERROR_NO_DEVICE,
@@ -557,6 +563,8 @@
         return FALSE;
     }
 
+    GPDS_TRACK_POINT_UI(ui)->device_name = g_strdup(device_name);
+
     return TRUE;
 }
 
@@ -573,7 +581,7 @@
         return FALSE;
     }
 
-    GPDS_TRACK_POINT_UI(ui)->xinput = gpds_xinput_new(GPDS_TRACK_POINT_DEVICE_NAME);
+    GPDS_TRACK_POINT_UI(ui)->xinput = gpds_xinput_new(GPDS_TRACK_POINT_UI(ui)->device_name);
 
     setup_current_values(ui, builder);
     setup_signals(ui, builder);



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