aboutsummaryrefslogtreecommitdiff
path: root/src/status-provider-mc5.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-10-08 14:05:02 -0400
committerTed Gould <ted@canonical.com>2009-10-08 14:05:02 -0400
commitaa76fd1782f7ab3c7ebf031065722f394961e37a (patch)
tree886478cc3c4b81800ee7043ef7c3472322cdcba9 /src/status-provider-mc5.c
parent8bee87898909ee3daa1a66dd080f4dbc915651b0 (diff)
downloadayatana-indicator-session-aa76fd1782f7ab3c7ebf031065722f394961e37a.tar.gz
ayatana-indicator-session-aa76fd1782f7ab3c7ebf031065722f394961e37a.tar.bz2
ayatana-indicator-session-aa76fd1782f7ab3c7ebf031065722f394961e37a.zip
Moving the building of the EmpathyAccountManager to it's own function.
Diffstat (limited to 'src/status-provider-mc5.c')
-rw-r--r--src/status-provider-mc5.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/status-provider-mc5.c b/src/status-provider-mc5.c
index 671e459..e277fc7 100644
--- a/src/status-provider-mc5.c
+++ b/src/status-provider-mc5.c
@@ -104,6 +104,23 @@ status_provider_mc5_class_init (StatusProviderMC5Class *klass)
return;
}
+/* Build our empathy account manager instance if we don't
+ have one. */
+static void
+build_eam (StatusProviderMC5 * self)
+{
+ StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self);
+
+ if (priv->manager != NULL) {
+ return;
+ }
+
+ priv->manager = EMPATHY_ACCOUNT_MANAGER(g_object_new(EMPATHY_TYPE_ACCOUNT_MANAGER, NULL));
+ g_signal_connect(G_OBJECT(priv->manager), "global-presence-changed", G_CALLBACK(presence_changed), self);
+
+ return;
+}
+
/* Creating an instance of the status provider. We set the variables
and create an EmpathyAccountManager object. It does all the hard
work in this module of tracking MissionControl and enumerating the
@@ -116,8 +133,6 @@ status_provider_mc5_init (StatusProviderMC5 *self)
priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED;
priv->manager = NULL;
- g_signal_connect(G_OBJECT(priv->manager), "global-presence-changed", G_CALLBACK(presence_changed), self);
-
return;
}
@@ -168,9 +183,8 @@ static void
set_status (StatusProvider * sp, StatusProviderStatus status)
{
StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp);
- if (priv->manager == NULL) {
- priv->manager = EMPATHY_ACCOUNT_MANAGER(g_object_new(EMPATHY_TYPE_ACCOUNT_MANAGER, NULL));
- }
+
+ build_eam(STATUS_PROVIDER_MC5(sp));
empathy_account_manager_request_global_presence(priv->manager, sp_to_tp_map[status], sp_to_mc_map[status], "");