diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:46:48 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:46:48 +0800 |
commit | fb7bd41be639479486e8b31804d733fb88acac25 (patch) | |
tree | ab854e23a0720d6168c03277f9eca78ace641101 | |
parent | 8597ceefd4e4d58769a34b2e55725b60e54de695 (diff) | |
download | gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.tar gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.tar.gz gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.tar.bz2 gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.tar.lz gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.tar.xz gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.tar.zst gsoc2013-empathy-fb7bd41be639479486e8b31804d733fb88acac25.zip |
Port EmpathyDispatcher to the new API.
svn path=/trunk/; revision=2040
-rw-r--r-- | libempathy/empathy-dispatcher.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index d2995691e..56c2e4bf4 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -39,6 +39,7 @@ #include "empathy-dispatcher.h" #include "empathy-utils.h" #include "empathy-tube-handler.h" +#include "empathy-account-manager.h" #include "empathy-contact-factory.h" #include "empathy-tp-group.h" #include "empathy-tp-file.h" @@ -51,10 +52,10 @@ #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyDispatcher) typedef struct { GHashTable *connections; - gpointer token; + EmpathyAccountManager *account_manager; MissionControl *mc; GSList *tubes; - EmpathyChatroomManager *chatroom_mgr; + EmpathyChatroomManager *chatroom_mgr; } EmpathyDispatcherPriv; G_DEFINE_TYPE (EmpathyDispatcher, empathy_dispatcher, G_TYPE_OBJECT); @@ -656,18 +657,14 @@ dispatcher_update_account (EmpathyDispatcher *dispatcher, } static void -dispatcher_status_changed_cb (MissionControl *mc, - TpConnectionStatus status, - McPresence presence, - TpConnectionStatusReason reason, - const gchar *unique_name, - EmpathyDispatcher *dispatcher) +dispatcher_account_connection_cb (EmpathyAccountManager *manager, + McAccount *account, + TpConnectionStatusReason reason, + TpConnectionStatus status, + TpConnectionStatus previous, + EmpathyDispatcher *dispatcher) { - McAccount *account; - - account = mc_account_lookup (unique_name); dispatcher_update_account (dispatcher, account); - g_object_unref (account); } static void @@ -676,7 +673,10 @@ dispatcher_finalize (GObject *object) EmpathyDispatcherPriv *priv = GET_PRIV (object); GSList *l; - empathy_disconnect_account_status_changed (priv->token); + g_signal_handlers_disconnect_by_func (priv->account_manager, + dispatcher_account_connection_cb, + object); + g_object_unref (priv->account_manager); g_object_unref (priv->mc); for (l = priv->tubes; l; l = l->next) { @@ -689,7 +689,7 @@ dispatcher_finalize (GObject *object) g_hash_table_destroy (priv->connections); - g_object_unref (priv->chatroom_mgr); + g_object_unref (priv->chatroom_mgr); } static void @@ -739,9 +739,12 @@ empathy_dispatcher_init (EmpathyDispatcher *dispatcher) dispatcher->priv = priv; priv->mc = empathy_mission_control_new (); - priv->token = empathy_connect_to_account_status_changed (priv->mc, - G_CALLBACK (dispatcher_status_changed_cb), - dispatcher, NULL); + priv->account_manager = empathy_account_manager_new (); + + g_signal_connect (priv->account_manager, + "account-connection-changed", + G_CALLBACK (dispatcher_account_connection_cb), + dispatcher); priv->connections = g_hash_table_new_full (empathy_account_hash, empathy_account_equal, @@ -754,7 +757,7 @@ empathy_dispatcher_init (EmpathyDispatcher *dispatcher) } g_list_free (accounts); - priv->chatroom_mgr = empathy_chatroom_manager_new (NULL); + priv->chatroom_mgr = empathy_chatroom_manager_new (NULL); } EmpathyDispatcher * |