aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/status-provider-mc5.c24
-rw-r--r--src/status-provider-mc5.h4
2 files changed, 21 insertions, 7 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], "");
diff --git a/src/status-provider-mc5.h b/src/status-provider-mc5.h
index 2c03729..4d5659d 100644
--- a/src/status-provider-mc5.h
+++ b/src/status-provider-mc5.h
@@ -31,8 +31,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
G_BEGIN_DECLS
#define STATUS_PROVIDER_MC5_TYPE (status_provider_mc5_get_type ())
-#define STATUS_PROVIDER_MC5(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_MC5_TYPE, StatusProviderTelepathy))
-#define STATUS_PROVIDER_MC5_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_MC5_TYPE, StatusProviderTelepathyClass))
+#define STATUS_PROVIDER_MC5(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5))
+#define STATUS_PROVIDER_MC5_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5Class))
#define IS_STATUS_PROVIDER_MC5(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), STATUS_PROVIDER_MC5_TYPE))
#define IS_STATUS_PROVIDER_MC5_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), STATUS_PROVIDER_MC5_TYPE))
#define STATUS_PROVIDER_MC5_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), STATUS_PROVIDER_MC5_TYPE, StatusProviderMC5Class))