aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-09-17 15:56:38 -0500
committerTed Gould <ted@gould.cx>2014-09-17 15:56:38 -0500
commit2f9058621c5dfa8e3f7780731072e593898c3db8 (patch)
treecf7f34d56570338b5581fae22e4855bbe789fb63 /src
parent22fcf3da4c9549daa3ba109373805bfdd960d0df (diff)
downloadayatana-indicator-messages-2f9058621c5dfa8e3f7780731072e593898c3db8.tar.gz
ayatana-indicator-messages-2f9058621c5dfa8e3f7780731072e593898c3db8.tar.bz2
ayatana-indicator-messages-2f9058621c5dfa8e3f7780731072e593898c3db8.zip
Setting up default referencing
Diffstat (limited to 'src')
-rw-r--r--src/im-accounts-service.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/im-accounts-service.c b/src/im-accounts-service.c
index 6fc2922..dc18d1b 100644
--- a/src/im-accounts-service.c
+++ b/src/im-accounts-service.c
@@ -76,9 +76,18 @@ im_accounts_service_finalize (GObject *object)
G_OBJECT_CLASS (im_accounts_service_parent_class)->finalize (object);
}
+/* Not the most testable way to do this but, it is a less invasive one, and we'll
+ probably restructure this codebase soonish */
+/* Gets an account service wrapper reference, so then it can be free'd */
ImAccountsService *
im_accounts_service_ref_default (void)
{
-
- return NULL;
+ static ImAccountsService * as = NULL;
+ if (as == NULL) {
+ as = IM_ACCOUNTS_SERVICE(g_object_new(IM_ACCOUNTS_SERVICE_TYPE, NULL));
+ g_object_add_weak_pointer(G_OBJECT(as), (gpointer *)&as);
+ return as;
+ }
+
+ return g_object_ref(as);
}