From a3b0218137c8796fbb7bd6d852dc8ab5895a65cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
Date: Sat, 3 Nov 2012 18:32:01 +0100
Subject: [PATCH 3/5] XfcePointersHelper gets a pointer to XfceXSettingsHelper
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit


Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Upstream-Status: Submitted [1]
[1] https://bugzilla.xfce.org/show_bug.cgi?id=9474
---
 xfsettingsd/main.c     |    2 +-
 xfsettingsd/pointers.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/xfsettingsd/main.c b/xfsettingsd/main.c
index 55c4183..99982f7 100644
--- a/xfsettingsd/main.c
+++ b/xfsettingsd/main.c
@@ -273,7 +273,7 @@ main (gint argc, gchar **argv)
 #ifdef HAVE_XRANDR
     displays_helper = g_object_new (XFCE_TYPE_DISPLAYS_HELPER, NULL);
 #endif
-    pointer_helper = g_object_new (XFCE_TYPE_POINTERS_HELPER, NULL);
+    pointer_helper = g_object_new (XFCE_TYPE_POINTERS_HELPER, "xsettings-helper", xsettings_helper, NULL);
     keyboards_helper = g_object_new (XFCE_TYPE_KEYBOARDS_HELPER, NULL);
     accessibility_helper = g_object_new (XFCE_TYPE_ACCESSIBILITY_HELPER, NULL);
     shortcuts_helper = g_object_new (XFCE_TYPE_KEYBOARD_SHORTCUTS_HELPER, NULL);
diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
index e7192e7..62ebc60 100644
--- a/xfsettingsd/pointers.c
+++ b/xfsettingsd/pointers.c
@@ -47,8 +47,16 @@
 
 #define XFCONF_TYPE_G_VALUE_ARRAY (dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE))
 
+/* Property identifiers */
+enum
+{
+  PROP_0,
+  PROP_XSETTINGS_HELPER,
+};
+
 
 
+static void             xfce_pointers_helper_constructed              (GObject            *object);
 static void             xfce_pointers_helper_finalize                 (GObject            *object);
 static void             xfce_pointers_helper_syndaemon_stop           (XfcePointersHelper *helper);
 static void             xfce_pointers_helper_syndaemon_check          (XfcePointersHelper *helper);
@@ -63,6 +71,10 @@ static GdkFilterReturn  xfce_pointers_helper_event_filter             (GdkXEvent
                                                                        GdkEvent           *gdk_event,
                                                                        gpointer            user_data);
 #endif
+static void             xfce_pointers_helper_set_property             (GObject              *object,
+                                                                       guint                 prop_id,
+                                                                       const GValue         *value,
+                                                                       GParamSpec           *pspec);
 
 
 
@@ -75,6 +87,8 @@ struct _XfcePointersHelper
 {
     GObject  __parent__;
 
+    GObject       *xsettings_helper;
+
     /* xfconf channel */
     XfconfChannel *channel;
 
@@ -108,7 +122,18 @@ xfce_pointers_helper_class_init (XfcePointersHelperClass *klass)
 {
     GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
+    gobject_class->constructed = xfce_pointers_helper_constructed;
     gobject_class->finalize = xfce_pointers_helper_finalize;
+    gobject_class->set_property = xfce_pointers_helper_set_property;
+
+    g_object_class_install_property (gobject_class,
+                                     PROP_XSETTINGS_HELPER,
+                                     g_param_spec_object ("xsettings-helper",
+                                                          "xsettings-helper",
+                                                          "xsettings-helper",
+                                                          G_TYPE_OBJECT,
+                                                          G_PARAM_CONSTRUCT_ONLY |
+                                                          G_PARAM_WRITABLE));
 }
 
 
@@ -116,6 +141,15 @@ xfce_pointers_helper_class_init (XfcePointersHelperClass *klass)
 static void
 xfce_pointers_helper_init (XfcePointersHelper *helper)
 {
+  /* All initialisation is done at xfce_pointers_helper_constructed */
+}
+
+
+
+static void
+xfce_pointers_helper_constructed (GObject *object)
+{
+    XfcePointersHelper *helper = XFCE_POINTERS_HELPER (object);
     XExtensionVersion *version = NULL;
     Display           *xdisplay;
 #ifdef DEVICE_HOTPLUGGING
@@ -181,6 +215,27 @@ xfce_pointers_helper_init (XfcePointersHelper *helper)
 
 
 static void
+xfce_pointers_helper_set_property (GObject      *object,
+                                   guint         prop_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+    XfcePointersHelper *helper = XFCE_POINTERS_HELPER (object);
+
+    switch (prop_id)
+    {
+        case PROP_XSETTINGS_HELPER:
+            helper->xsettings_helper = g_value_get_object (value);
+            break;
+        default:
+            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+            break;
+    }
+}
+
+
+
+static void
 xfce_pointers_helper_finalize (GObject *object)
 {
     xfce_pointers_helper_syndaemon_stop (XFCE_POINTERS_HELPER (object));
-- 
1.7.6.5

