[gnome-settings-daemon] wacom: separate LED/OLED setup to a separate function



commit c9397748266ee9369930411a8ae16fa706bae9db
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 19 15:35:09 2013 +0100

    wacom: separate LED/OLED setup to a separate function
    
    There could be situations where calling this without updating
    button mappings is desired.

 plugins/wacom/gsd-wacom-manager.c |   42 ++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 17 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 4813abf..5490646 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -759,6 +759,30 @@ reset_touch_buttons (XDevice               *xdev,
                               (const guchar *) actions, i);
 }
 
+/* This function does LED and OLED */
+static void
+update_pad_leds (GsdWacomDevice *device)
+{
+       GList *buttons, *l;
+
+       /* Reset all the LEDs and OLEDs*/
+       buttons = gsd_wacom_device_get_buttons (device);
+       for (l = buttons; l != NULL; l = l->next) {
+               GsdWacomTabletButton *button = l->data;
+               if (button->type == WACOM_TABLET_BUTTON_TYPE_HARDCODED &&
+                   button->status_led != GSD_WACOM_NO_LED) {
+                       set_led (device, button, 1);
+               }
+               if (button->has_oled) {
+                       char *label;
+                       label = g_settings_get_string (button->settings, OLED_LABEL);
+                       set_oled (device, button->id, label);
+                       g_free (label);
+               }
+       }
+       g_list_free (buttons);
+}
+
 static void
 reset_pad_buttons (GsdWacomDevice *device)
 {
@@ -766,7 +790,6 @@ reset_pad_buttons (GsdWacomDevice *device)
        int nmap;
        unsigned char *map;
        int i, j, rc;
-       GList *buttons, *l;
 
        /* Normal buttons */
        xdev = open_device (device);
@@ -799,22 +822,7 @@ reset_pad_buttons (GsdWacomDevice *device)
 
        XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdev);
 
-       /* Reset all the LEDs and OLEDs*/
-       buttons = gsd_wacom_device_get_buttons (device);
-       for (l = buttons; l != NULL; l = l->next) {
-               GsdWacomTabletButton *button = l->data;
-                if (button->type == WACOM_TABLET_BUTTON_TYPE_HARDCODED &&
-                    button->status_led != GSD_WACOM_NO_LED) {
-                        set_led (device, button, 1);
-                }
-               if (button->has_oled) {
-                       char *label;
-                       label = g_settings_get_string (button->settings, OLED_LABEL);
-                       set_oled (device, button->id, label);
-                       g_free (label);
-               }
-       }
-        g_list_free (buttons);
+       update_pad_leds (device);
 }
 
 static void


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