[gnome-settings-daemon] wacom: Keep GsdWacomDeviceType on the stack in device_added_cb()



commit db719654662e49cb80f9d444fd9c4bb3a3bf085a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Dec 6 14:05:35 2013 +0100

    wacom: Keep GsdWacomDeviceType on the stack in device_added_cb()
    
    So gsd_wacom_device_get_device_type() isn't called multiple times.

 plugins/wacom/gsd-wacom-manager.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index ac65a82..b74d8d7 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -1115,13 +1115,14 @@ device_added_cb (GdkDeviceManager *device_manager,
        GsdWacomDevice *device;
        GSettings *settings;
        const gchar *device_name;
+       GsdWacomDeviceType type;
 
        device = gsd_wacom_device_new (gdk_device);
        device_name = gsd_wacom_device_get_name (device);
+       type = gsd_wacom_device_get_device_type (device);
 
         if (gsd_wacom_device_is_fallback (device) &&
-            gsd_wacom_device_get_device_type (device) != WACOM_TYPE_TOUCH &&
-            device_name != NULL) {
+            type != WACOM_TYPE_TOUCH && device_name != NULL) {
                 GHashTable *warned_devices;
 
                 warned_devices = manager->priv->warned_devices;
@@ -1134,21 +1135,20 @@ device_added_cb (GdkDeviceManager *device_manager,
                 }
         }
 
-       if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_INVALID) {
+       if (type == WACOM_TYPE_INVALID) {
                g_object_unref (device);
                return;
        }
        g_debug ("Adding device '%s' (type: '%s') to known devices list",
                 gsd_wacom_device_get_tool_name (device),
-                gsd_wacom_device_type_to_string (gsd_wacom_device_get_device_type (device)));
+                gsd_wacom_device_type_to_string (type));
        g_hash_table_insert (manager->priv->devices, (gpointer) gdk_device, device);
 
        settings = gsd_wacom_device_get_settings (device);
        g_signal_connect (G_OBJECT (settings), "changed",
                          G_CALLBACK (wacom_settings_changed), device);
 
-       if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_STYLUS ||
-           gsd_wacom_device_get_device_type (device) == WACOM_TYPE_ERASER) {
+       if (type == WACOM_TYPE_STYLUS || type == WACOM_TYPE_ERASER) {
                GList *styli, *l;
 
                styli = gsd_wacom_device_list_styli (device);


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