[Telepathy-commits] [telepathy-mission-control/master] Allow creation of derived Account objects

Alberto Mardegan alberto.mardegan at nokia.com
Fri Dec 5 00:01:43 PST 2008


Allow a subclass of McdAccountManager to create Account objects by using a
different function than mcd_account_new().
---
 src/mcd-account-manager.c |    8 ++++++--
 src/mcd-account-manager.h |    3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index 018094a..1b45b99 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -185,7 +185,8 @@ complete_account_creation (McdAccountManager *account_manager,
     McdAccount *account;
     gboolean ok;
 
-    account = mcd_account_new (priv->dbus_daemon, priv->keyfile, unique_name);
+    account = MCD_ACCOUNT_MANAGER_GET_CLASS (account_manager)->account_new
+        (priv->dbus_daemon, priv->keyfile, unique_name);
 
     ok = mcd_account_set_parameters (account, params, error);
     if (ok)
@@ -460,7 +461,8 @@ _mcd_account_manager_setup (McdAccountManager *account_manager)
     {
 	McdAccount *account;
 
-	account = mcd_account_new (priv->dbus_daemon, priv->keyfile, *name);
+        account = MCD_ACCOUNT_MANAGER_GET_CLASS (account_manager)->account_new
+            (priv->dbus_daemon, priv->keyfile, *name);
 	if (account)
 	    add_account (account_manager, account);
     }
@@ -571,6 +573,8 @@ mcd_account_manager_class_init (McdAccountManagerClass *klass)
     object_class->set_property = set_property;
     object_class->get_property = get_property;
 
+    klass->account_new = mcd_account_new;
+
     g_object_class_install_property
         (object_class, PROP_DBUS_DAEMON,
          g_param_spec_object ("dbus-daemon", "DBus daemon", "DBus daemon",
diff --git a/src/mcd-account-manager.h b/src/mcd-account-manager.h
index 9a4c3f4..d4d2200 100644
--- a/src/mcd-account-manager.h
+++ b/src/mcd-account-manager.h
@@ -56,7 +56,8 @@ struct _McdAccountManager
 struct _McdAccountManagerClass
 {
     GObjectClass parent_class;
-    void (*_mc_reserved1) (void);
+    McdAccount *(*account_new) (TpDBusDaemon *dbus_daemon, GKeyFile *keyfile,
+                                const gchar *name);
     void (*_mc_reserved2) (void);
     void (*_mc_reserved3) (void);
     void (*_mc_reserved4) (void);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list