[telepathy-mission-control/master] McdAccountManager: move unexported functions to a new mcd-account-manager-priv.h

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 15 05:09:46 PDT 2009


Also rename some G_GNUC_INTERNAL functions to clarify what is and isn't
public.
---
 src/Makefile.am                    |    1 +
 src/mcd-account-manager-creation.c |    9 +++--
 src/mcd-account-manager-priv.h     |   54 ++++++++++++++++++++++++++++++++++++
 src/mcd-account-manager-query.c    |   10 ++++--
 src/mcd-account-manager.c          |   29 ++++++++++--------
 src/mcd-account-manager.h          |   23 ---------------
 src/mcd-account.c                  |    1 +
 src/mcd-master.c                   |    9 +++--
 8 files changed, 88 insertions(+), 48 deletions(-)
 create mode 100644 src/mcd-account-manager-priv.h

diff --git a/src/Makefile.am b/src/Makefile.am
index 5b0239e..de3ff72 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -121,6 +121,7 @@ libmissioncontrol_server_la_SOURCES = \
 	mcd-account-stats.c \
 	mcd-account-manager.c \
 	mcd-account-manager-creation.c \
+	mcd-account-manager-priv.h \
 	mcd-account-manager-query.c \
 	mcd-account-priv.h \
 	mcd-dbusprop.c \
diff --git a/src/mcd-account-manager-creation.c b/src/mcd-account-manager-creation.c
index e520bb0..55b0c33 100644
--- a/src/mcd-account-manager-creation.c
+++ b/src/mcd-account-manager-creation.c
@@ -35,6 +35,7 @@
 #include "mcd-account.h"
 #include "mcd-account-manager.h"
 #include "mcd-account-manager-creation.h"
+#include "mcd-account-manager-priv.h"
 #include "_gen/interfaces.h"
 
 typedef struct
@@ -118,10 +119,10 @@ account_manager_create_account (McSvcAccountManagerInterfaceCreation *self,
     cd = g_slice_new (McdCreationData);
     cd->properties = g_hash_table_ref (properties);
     cd->context = context;
-    mcd_account_manager_create_account (MCD_ACCOUNT_MANAGER (self),
-                                        manager, protocol, display_name,
-                                        parameters, create_account_cb, cd,
-                                        (GDestroyNotify)mcd_creation_data_free);
+    _mcd_account_manager_create_account (MCD_ACCOUNT_MANAGER (self),
+                                         manager, protocol, display_name,
+                                         parameters, create_account_cb, cd,
+                                         (GDestroyNotify)mcd_creation_data_free);
 }
 
 
diff --git a/src/mcd-account-manager-priv.h b/src/mcd-account-manager-priv.h
new file mode 100644
index 0000000..e4f6203
--- /dev/null
+++ b/src/mcd-account-manager-priv.h
@@ -0,0 +1,54 @@
+/* vi: set et sw=4 ts=8 cino=t0,(0: */
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
+/*
+ * mcd-account-manager.h - the Telepathy Account D-Bus interface (service side)
+ *
+ * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __MCD_ACCOUNT_MANAGER_PRIV_H__
+#define __MCD_ACCOUNT_MANAGER_PRIV_H__
+
+#include "mcd-account-manager.h"
+
+G_BEGIN_DECLS
+
+G_GNUC_INTERNAL void _mcd_account_manager_setup
+    (McdAccountManager *account_manager);
+
+G_GNUC_INTERNAL GHashTable *_mcd_account_manager_get_accounts
+    (McdAccountManager *account_manager);
+
+typedef void (*McdGetAccountCb) (McdAccountManager *account_manager,
+                                 McdAccount *account,
+                                 const GError *error,
+                                 gpointer user_data);
+
+G_GNUC_INTERNAL void _mcd_account_manager_create_account
+    (McdAccountManager *account_manager,
+     const gchar *manager, const gchar *protocol,
+     const gchar *display_name, GHashTable *params,
+     McdGetAccountCb callback, gpointer user_data, GDestroyNotify destroy);
+
+G_GNUC_INTERNAL
+void _mcd_account_manager_store_account_connections
+    (McdAccountManager *manager);
+
+G_END_DECLS
+
+#endif
diff --git a/src/mcd-account-manager-query.c b/src/mcd-account-manager-query.c
index e4c6f06..cad522a 100644
--- a/src/mcd-account-manager-query.c
+++ b/src/mcd-account-manager-query.c
@@ -35,6 +35,7 @@
 #include "mcd-account.h"
 #include "mcd-account-manager.h"
 #include "mcd-account-manager-query.h"
+#include "mcd-account-manager-priv.h"
 #include "mcd-account-priv.h"
 #include "_gen/interfaces.h"
 
@@ -319,10 +320,11 @@ account_manager_find_accounts (McSvcAccountManagerInterfaceQuery *self,
     g_hash_table_foreach (query, parse_query, &fd);
     if (!fd.error)
     {
-	GHashTable *accounts;
-	fd.accounts = g_ptr_array_sized_new (16);
-	accounts = mcd_account_manager_get_accounts (account_manager);
-	g_hash_table_foreach (accounts, find_accounts, &fd);
+        GHashTable *accounts;
+
+        fd.accounts = g_ptr_array_sized_new (16);
+        accounts = _mcd_account_manager_get_accounts (account_manager);
+        g_hash_table_foreach (accounts, find_accounts, &fd);
     }
     g_array_free (fd.params, TRUE);
     for (i = 0; i < fd.properties->len; i++)
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index 6a46def..2eab452 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -23,6 +23,8 @@
  *
  */
 
+#include "mcd-account-manager.h"
+
 #include <glib/gi18n.h>
 #include <string.h>
 #include <stdio.h>
@@ -33,9 +35,9 @@
 #include <telepathy-glib/svc-generic.h>
 #include <telepathy-glib/util.h>
 #include <telepathy-glib/errors.h>
-#include "mcd-account-manager.h"
 #include "mcd-account-manager-query.h"
 #include "mcd-account-manager-creation.h"
+#include "mcd-account-manager-priv.h"
 #include "mcd-account.h"
 #include "mcd-account-config.h"
 #include "mcd-account-priv.h"
@@ -400,13 +402,14 @@ create_unique_name (McdAccountManagerPrivate *priv, const gchar *manager,
 }
 
 void
-mcd_account_manager_create_account (McdAccountManager *account_manager,
-				    const gchar *manager,
-				    const gchar *protocol,
-				    const gchar *display_name,
-				    GHashTable *params,
-                                    McdGetAccountCb callback,
-                                    gpointer user_data, GDestroyNotify destroy)
+_mcd_account_manager_create_account (McdAccountManager *account_manager,
+                                     const gchar *manager,
+                                     const gchar *protocol,
+                                     const gchar *display_name,
+                                     GHashTable *params,
+                                     McdGetAccountCb callback,
+                                     gpointer user_data,
+                                     GDestroyNotify destroy)
 {
     McdAccountManagerPrivate *priv = account_manager->priv;
     McdCreateAccountData *cad;
@@ -485,10 +488,10 @@ account_manager_create_account (McSvcAccountManager *self,
 				GHashTable *parameters,
 				DBusGMethodInvocation *context)
 {
-    mcd_account_manager_create_account (MCD_ACCOUNT_MANAGER (self),
-                                        manager, protocol, display_name,
-                                        parameters,
-                                        create_account_cb, context, NULL);
+    _mcd_account_manager_create_account (MCD_ACCOUNT_MANAGER (self),
+                                         manager, protocol, display_name,
+                                         parameters,
+                                         create_account_cb, context, NULL);
 }
 
 static void
@@ -890,7 +893,7 @@ mcd_account_manager_write_conf (McdAccountManager *account_manager)
 }
 
 GHashTable *
-mcd_account_manager_get_accounts (McdAccountManager *account_manager)
+_mcd_account_manager_get_accounts (McdAccountManager *account_manager)
 {
     return account_manager->priv->accounts;
 }
diff --git a/src/mcd-account-manager.h b/src/mcd-account-manager.h
index b63430b..61fe973 100644
--- a/src/mcd-account-manager.h
+++ b/src/mcd-account-manager.h
@@ -76,8 +76,6 @@ McdAccountManager *mcd_account_manager_new (TpDBusDaemon *dbus_daemon);
 TpDBusDaemon *mcd_account_manager_get_dbus_daemon
     (McdAccountManager *account_manager);
 
-void _mcd_account_manager_setup (McdAccountManager *account_manager);
-
 GKeyFile *mcd_account_manager_get_config (McdAccountManager *account_manager);
 void mcd_account_manager_write_conf (McdAccountManager *account_manager);
 
@@ -86,25 +84,4 @@ McdAccount *mcd_account_manager_lookup_account (McdAccountManager *account_manag
 McdAccount *mcd_account_manager_lookup_account_by_path (McdAccountManager *account_manager,
 						       	const gchar *object_path);
 
-/* for interfaces only */
-G_GNUC_INTERNAL
-GHashTable *mcd_account_manager_get_accounts (McdAccountManager *account_manager);
-
-typedef void (*McdGetAccountCb) (McdAccountManager *account_manager,
-                                 McdAccount *account,
-                                 const GError *error,
-                                 gpointer user_data);
-G_GNUC_INTERNAL
-void mcd_account_manager_create_account (McdAccountManager *account_manager,
-                                         const gchar *manager,
-                                         const gchar *protocol,
-                                         const gchar *display_name,
-                                         GHashTable *params,
-                                         McdGetAccountCb callback,
-                                         gpointer user_data,
-                                         GDestroyNotify destroy);
-G_GNUC_INTERNAL
-void _mcd_account_manager_store_account_connections
-    (McdAccountManager *manager);
-
 #endif
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 598f473..235068b 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -41,6 +41,7 @@
 #include "mcd-account-compat.h"
 #include "mcd-account-conditions.h"
 #include "mcd-account-connection.h"
+#include "mcd-account-manager-priv.h"
 #include "mcd-account-requests.h"
 #include "mcd-account-stats.h"
 #include "mcd-connection-plugin.h"
diff --git a/src/mcd-master.c b/src/mcd-master.c
index fab2c94..e8c59bc 100644
--- a/src/mcd-master.c
+++ b/src/mcd-master.c
@@ -60,6 +60,7 @@
 #include "mcd-manager.h"
 #include "mcd-dispatcher.h"
 #include "mcd-account-manager.h"
+#include "mcd-account-manager-priv.h"
 #include "mcd-account-conditions.h"
 #include "mcd-account-compat.h"
 #include "mcd-account-priv.h"
@@ -166,7 +167,7 @@ mcd_master_transport_connected (McdMaster *master, McdTransportPlugin *plugin,
     td.plugin = plugin;
     td.transport = transport;
 
-    accounts = mcd_account_manager_get_accounts (priv->account_manager);
+    accounts = _mcd_account_manager_get_accounts (priv->account_manager);
     g_hash_table_foreach (accounts, check_account_transport, &td);
 }
 
@@ -211,7 +212,7 @@ mcd_master_transport_disconnected (McdMaster *master, McdTransportPlugin *plugin
     td.plugin = plugin;
     td.transport = transport;
 
-    accounts = mcd_account_manager_get_accounts (priv->account_manager);
+    accounts = _mcd_account_manager_get_accounts (priv->account_manager);
     g_hash_table_foreach (accounts, disconnect_account_transport, &td);
 }
 
@@ -223,7 +224,7 @@ mcd_master_connect_automatic_accounts (McdMaster *master)
     GHashTableIter iter;
     gpointer ht_key, ht_value;
 
-    accounts = mcd_account_manager_get_accounts (priv->account_manager);
+    accounts = _mcd_account_manager_get_accounts (priv->account_manager);
     g_hash_table_iter_init (&iter, accounts);
     while (g_hash_table_iter_next (&iter, &ht_key, &ht_value))
     {
@@ -430,7 +431,7 @@ _mcd_master_set_flags (McdMission * mission, McdSystemFlags flags)
         gpointer v;
 
         g_hash_table_iter_init (&iter,
-            mcd_account_manager_get_accounts (priv->account_manager));
+            _mcd_account_manager_get_accounts (priv->account_manager));
 
         while (g_hash_table_iter_next (&iter, NULL, &v))
         {
-- 
1.5.6.5




More information about the telepathy-commits mailing list