[gnome-settings-daemon] wacom: Avoid global variables in the helpers



commit 59b1edb3895b0bd4b7c10f2843627a83ca0f6d62
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jul 17 10:35:26 2013 +0200

    wacom: Avoid global variables in the helpers

 plugins/wacom/gsd-wacom-led-helper.c  |   23 +++++++++++------------
 plugins/wacom/gsd-wacom-oled-helper.c |   23 +++++++++++------------
 2 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-led-helper.c b/plugins/wacom/gsd-wacom-led-helper.c
index d5c6176..95e32c2 100644
--- a/plugins/wacom/gsd-wacom-led-helper.c
+++ b/plugins/wacom/gsd-wacom-led-helper.c
@@ -78,18 +78,6 @@ get_led_sysfs_path (GUdevDevice *device,
        return filename;
 }
 
-static char *path = NULL;
-static int group_num = -1;
-static int led_num = -1;
-
-const GOptionEntry options[] = {
-       { "path", '\0', 0, G_OPTION_ARG_FILENAME, &path, "Device path for the Wacom device", NULL },
-       { "group", '\0', 0, G_OPTION_ARG_INT, &group_num, "Which LED group to set", NULL },
-       { "led", '\0', 0, G_OPTION_ARG_INT, &led_num, "Which LED to set", NULL },
-       { NULL}
-};
-
-
 int main (int argc, char **argv)
 {
        GOptionContext *context;
@@ -100,6 +88,17 @@ int main (int argc, char **argv)
        GError *error = NULL;
         const char * const subsystems[] = { "input", NULL };
 
+       char *path = NULL;
+       int group_num = -1;
+       int led_num = -1;
+
+       const GOptionEntry options[] = {
+               { "path", '\0', 0, G_OPTION_ARG_FILENAME, &path, "Device path for the Wacom device", NULL },
+               { "group", '\0', 0, G_OPTION_ARG_INT, &group_num, "Which LED group to set", NULL },
+               { "led", '\0', 0, G_OPTION_ARG_INT, &led_num, "Which LED to set", NULL },
+               { NULL}
+       };
+
        /* get calling process */
        uid = getuid ();
        euid = geteuid ();
diff --git a/plugins/wacom/gsd-wacom-oled-helper.c b/plugins/wacom/gsd-wacom-oled-helper.c
index 9fda081..dc89f2e 100644
--- a/plugins/wacom/gsd-wacom-oled-helper.c
+++ b/plugins/wacom/gsd-wacom-oled-helper.c
@@ -82,18 +82,6 @@ get_oled_sysfs_path (GUdevDevice *device,
        return filename;
 }
 
-static char *path = NULL;
-static char *buffer = "";
-static int button_num = -1;
-
-const GOptionEntry options[] = {
-       { "path", '\0', 0, G_OPTION_ARG_FILENAME, &path, "Device path for the Wacom device", NULL },
-       { "buffer", '\0', 0, G_OPTION_ARG_STRING, &buffer, "Image to set base64 encoded", NULL },
-       { "button", '\0', 0, G_OPTION_ARG_INT, &button_num, "Which button icon to set", NULL },
-       { NULL}
-};
-
-
 int main (int argc, char **argv)
 {
        GOptionContext *context;
@@ -104,6 +92,17 @@ int main (int argc, char **argv)
        GError *error = NULL;
        const char * const subsystems[] = { "input", NULL };
 
+       char *path = NULL;
+       char *buffer = "";
+       int button_num = -1;
+
+       const GOptionEntry options[] = {
+               { "path", '\0', 0, G_OPTION_ARG_FILENAME, &path, "Device path for the Wacom device", NULL },
+               { "buffer", '\0', 0, G_OPTION_ARG_STRING, &buffer, "Image to set base64 encoded", NULL },
+               { "button", '\0', 0, G_OPTION_ARG_INT, &button_num, "Which button icon to set", NULL },
+               { NULL}
+       };
+
        /* get calling process */
        uid = getuid ();
        euid = geteuid ();


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