summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-03 18:40:06 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-04 13:28:13 +0100
commite076d7f16e23cd7246a20a45164a71d9e53058af (patch)
tree9067ab67422c8622b606c77d963c0648bfb532e2
parente2bcc5b94496d755c28490f28925da6f54a4cf4d (diff)
downloadtelepathy-mission-control-e076d7f16e23cd7246a20a45164a71d9e53058af.tar.gz
McdAccount: have a reference to the connectivity monitor
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68712 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--src/mcd-account-manager.c6
-rw-r--r--src/mcd-account.c32
-rw-r--r--src/mcd-account.h7
3 files changed, 40 insertions, 5 deletions
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index 0dc53632..31329f39 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -342,7 +342,7 @@ created_cb (GObject *storage_plugin_obj,
/* actually fetch the data into our cache from the plugin: */
if (mcd_storage_add_account_from_plugin (storage, plugin, name))
{
- account = mcd_account_new (am, name);
+ account = mcd_account_new (am, name, priv->minotaur);
lad->account = account;
}
else
@@ -925,7 +925,7 @@ _mcd_account_manager_create_account (McdAccountManager *account_manager,
mcd_storage_set_string (storage, unique_name,
MC_ACCOUNTS_KEY_DISPLAY_NAME, display_name);
- account = mcd_account_new (account_manager, unique_name);
+ account = mcd_account_new (account_manager, unique_name, priv->minotaur);
g_free (unique_name);
if (G_LIKELY (account))
@@ -1444,7 +1444,7 @@ _mcd_account_manager_setup (McdAccountManager *account_manager)
continue;
}
- account = mcd_account_new (account_manager, *name);
+ account = mcd_account_new (account_manager, *name, priv->minotaur);
if (G_UNLIKELY (!account))
{
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 012367f9..0e317508 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -127,6 +127,7 @@ struct _McdAccountPrivate
McdStorage *storage;
TpDBusDaemon *dbus_daemon;
+ McdConnectivityMonitor *connectivity;
McdAccountConnectionContext *connection_context;
GKeyFile *keyfile; /* configuration file */
@@ -190,6 +191,7 @@ enum
{
PROP_0,
PROP_DBUS_DAEMON,
+ PROP_CONNECTIVITY_MONITOR,
PROP_STORAGE,
PROP_NAME,
PROP_ALWAYS_ON,
@@ -3441,6 +3443,11 @@ set_property (GObject *obj, guint prop_id,
priv->dbus_daemon = g_value_dup_object (val);
break;
+ case PROP_CONNECTIVITY_MONITOR:
+ g_assert (priv->connectivity == NULL);
+ priv->connectivity = g_value_dup_object (val);
+ break;
+
case PROP_NAME:
g_assert (priv->unique_name == NULL);
priv->unique_name = g_value_dup_string (val);
@@ -3479,6 +3486,11 @@ get_property (GObject *obj, guint prop_id,
case PROP_DBUS_DAEMON:
g_value_set_object (val, priv->dbus_daemon);
break;
+
+ case PROP_CONNECTIVITY_MONITOR:
+ g_value_set_object (val, priv->connectivity);
+ break;
+
case PROP_NAME:
g_value_set_string (val, priv->unique_name);
break;
@@ -3559,6 +3571,7 @@ _mcd_account_dispose (GObject *object)
tp_clear_object (&priv->storage);
tp_clear_object (&priv->dbus_daemon);
tp_clear_object (&priv->self_contact);
+ tp_clear_object (&priv->connectivity);
_mcd_account_set_connection_context (self, NULL);
_mcd_account_set_connection (self, NULL);
@@ -3635,6 +3648,14 @@ mcd_account_class_init (McdAccountClass * klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
+ (object_class, PROP_CONNECTIVITY_MONITOR,
+ g_param_spec_object ("connectivity monitor",
+ "Connectivity monitor",
+ "Connectivity monitor",
+ MCD_TYPE_CONNECTIVITY_MONITOR,
+ G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property
(object_class, PROP_STORAGE,
g_param_spec_object ("storage", "storage",
"storage", MCD_TYPE_STORAGE,
@@ -3729,7 +3750,9 @@ mcd_account_init (McdAccount *account)
}
McdAccount *
-mcd_account_new (McdAccountManager *account_manager, const gchar *name)
+mcd_account_new (McdAccountManager *account_manager,
+ const gchar *name,
+ McdConnectivityMonitor *connectivity)
{
gpointer *obj;
McdStorage *storage = mcd_account_manager_get_storage (account_manager);
@@ -3738,6 +3761,7 @@ mcd_account_new (McdAccountManager *account_manager, const gchar *name)
obj = g_object_new (MCD_TYPE_ACCOUNT,
"storage", storage,
"dbus-daemon", dbus,
+ "connectivity-monitor", connectivity,
"name", name,
NULL);
return MCD_ACCOUNT (obj);
@@ -5132,3 +5156,9 @@ mcd_account_dup_nickname (McdAccount *self)
return mcd_storage_dup_string (self->priv->storage, name, "Nickname");
}
+
+McdConnectivityMonitor *
+mcd_account_get_connectivity_monitor (McdAccount *self)
+{
+ return self->priv->connectivity;
+}
diff --git a/src/mcd-account.h b/src/mcd-account.h
index a213b913..e88e8018 100644
--- a/src/mcd-account.h
+++ b/src/mcd-account.h
@@ -79,8 +79,10 @@ struct _McdAccountClass
};
GType mcd_account_get_type (void);
+
McdAccount *mcd_account_new (McdAccountManager *account_manager,
- const gchar *name);
+ const gchar *name,
+ McdConnectivityMonitor *minotaur);
void mcd_account_delete (McdAccount *account, McdAccountDeleteCb callback,
gpointer user_data);
@@ -145,6 +147,9 @@ gchar * mcd_account_dup_icon (McdAccount *self);
gchar * mcd_account_dup_nickname (McdAccount *self);
+McdConnectivityMonitor *mcd_account_get_connectivity_monitor (
+ McdAccount *self);
+
G_END_DECLS
#endif