[Pkg-telepathy-commits] [telepathy-mission-control-5] 07/16: connectivity-monitor: start watching 'use-conn' key in constructed

Simon McVittie smcv at debian.org
Mon Jan 27 14:50:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-mission-control-5.

commit 51eb9027ec1b72591166ecde65793c9f5877ac16
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Tue Nov 26 10:19:54 2013 +0100

    connectivity-monitor: start watching 'use-conn' key in constructed
    
    We have to wait for the default GObject properties to be set before calling
    g_settings_bind(). If we don't, they override the value fetched from
    GSettings.
---
 src/connectivity-monitor.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/connectivity-monitor.c b/src/connectivity-monitor.c
index b1b03a1..682dfa1 100644
--- a/src/connectivity-monitor.c
+++ b/src/connectivity-monitor.c
@@ -522,9 +522,9 @@ mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor)
 
 #ifdef ENABLE_CONN_SETTING
   priv->settings = g_settings_new ("im.telepathy.MissionControl.FromEmpathy");
-  g_settings_bind (priv->settings, "use-conn",
-      connectivity_monitor, "use-conn",
-      G_SETTINGS_BIND_GET);
+  /* We'll call g_settings_bind() in constructed because default values of
+   * properties haven't been set yet at this point and we don't want them to
+   * override the value from GSettings. */
 #endif
 
 #ifdef HAVE_NM
@@ -558,6 +558,17 @@ mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor)
 }
 
 static void
+connectivity_monitor_constructed (GObject *object)
+{
+#ifdef ENABLE_CONN_SETTING
+  McdConnectivityMonitor *self = MCD_CONNECTIVITY_MONITOR (object);
+
+  g_settings_bind (self->priv->settings, "use-conn",
+      self, "use-conn", G_SETTINGS_BIND_GET);
+#endif
+}
+
+static void
 connectivity_monitor_finalize (GObject *object)
 {
 #if defined(HAVE_NM) || defined(HAVE_UPOWER)
@@ -687,6 +698,7 @@ mcd_connectivity_monitor_class_init (McdConnectivityMonitorClass *klass)
   oclass->finalize = connectivity_monitor_finalize;
   oclass->dispose = connectivity_monitor_dispose;
   oclass->constructor = connectivity_monitor_constructor;
+  oclass->constructed = connectivity_monitor_constructed;
   oclass->get_property = connectivity_monitor_get_property;
   oclass->set_property = connectivity_monitor_set_property;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-5.git



More information about the Pkg-telepathy-commits mailing list