summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-11-26 10:19:54 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-11-26 10:29:48 +0100
commit51eb9027ec1b72591166ecde65793c9f5877ac16 (patch)
treef1e5b58d483d1a505e0fbd27546a42677d230a08
parentf1de10a0f71638da502a77cae189b5fa6a047be6 (diff)
downloadtelepathy-mission-control-51eb9027ec1b72591166ecde65793c9f5877ac16.tar.gz
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.
-rw-r--r--src/connectivity-monitor.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/connectivity-monitor.c b/src/connectivity-monitor.c
index b1b03a1a..682dfa19 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;