diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:46:29 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:46:29 +0800 |
commit | 132128da9d8b9e14aae3495791cc508d1899aab4 (patch) | |
tree | 7e5ceb854645b0928046494e9899aadaa3fef640 | |
parent | 49176d07b1d5a72bbc45216a503990726a4772a7 (diff) | |
download | gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.tar gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.tar.gz gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.tar.bz2 gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.tar.lz gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.tar.xz gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.tar.zst gsoc2013-empathy-132128da9d8b9e14aae3495791cc508d1899aab4.zip |
Port EmpathyChat to the new API.
svn path=/trunk/; revision=2034
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 5fd61dbdc..c29bf31a4 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -34,9 +34,9 @@ #include <glib/gi18n-lib.h> #include <gtk/gtk.h> -#include <libmissioncontrol/mission-control.h> #include <telepathy-glib/util.h> +#include <libempathy/empathy-account-manager.h> #include <libempathy/empathy-log-manager.h> #include <libempathy/empathy-contact-list.h> #include <libempathy/empathy-utils.h> @@ -71,7 +71,7 @@ typedef struct { EmpathyContact *remote_contact; EmpathyLogManager *log_manager; - MissionControl *mc; + EmpathyAccountManager *account_manager; GSList *sent_messages; gint sent_messages_index; GList *compositors; @@ -79,7 +79,6 @@ typedef struct { guint composing_stop_timeout_id; guint block_events_timeout_id; TpHandleType handle_type; - gpointer token; gint contacts_width; gboolean has_input_vscroll; @@ -167,24 +166,24 @@ chat_set_property (GObject *object, } static void -chat_status_changed_cb (MissionControl *mc, - TpConnectionStatus status, - McPresence presence, - TpConnectionStatusReason reason, - const gchar *unique_name, - EmpathyChat *chat) +chat_connection_changed_cb (EmpathyAccountManager *manager, + McAccount *account, + TpConnectionStatusReason reason, + TpConnectionStatus current, + TpConnectionStatus previous, + EmpathyChat *chat) { EmpathyChatPriv *priv = GET_PRIV (chat); - McAccount *account; - account = mc_account_lookup (unique_name); - - if (status == TP_CONNECTION_STATUS_CONNECTED && !priv->tp_chat && + if (current == TP_CONNECTION_STATUS_CONNECTED && !priv->tp_chat && empathy_account_equal (account, priv->account) && priv->handle_type != TP_HANDLE_TYPE_NONE) { TpConnection *connection; + MissionControl *mc; DEBUG ("Account reconnected, request a new Text channel"); + + mc = empathy_mission_control_new (); connection = mission_control_get_tpconnection (mc, account, NULL); tp_connection_run_until_ready (connection, FALSE, NULL, NULL); empathy_connection_request_channel (connection, -1, @@ -194,8 +193,6 @@ chat_status_changed_cb (MissionControl *mc, NULL, NULL, NULL, NULL); g_object_unref (connection); } - - g_object_unref (account); } static void @@ -1394,8 +1391,7 @@ chat_finalize (GObject *object) chat_composing_remove_timeout (chat); - empathy_disconnect_account_status_changed (priv->token); - g_object_unref (priv->mc); + g_object_unref (priv->account_manager); g_object_unref (priv->log_manager); if (priv->tp_chat) { @@ -1530,11 +1526,12 @@ empathy_chat_init (EmpathyChat *chat) priv->contacts_width = -1; priv->sent_messages = NULL; priv->sent_messages_index = -1; - priv->mc = empathy_mission_control_new (); + priv->account_manager = empathy_account_manager_new (); - priv->token = empathy_connect_to_account_status_changed (priv->mc, - G_CALLBACK (chat_status_changed_cb), - chat, NULL); + g_signal_connect (priv->account_manager, + "account-connection-changed", + G_CALLBACK (chat_connection_changed_cb), + chat); /* Block events for some time to avoid having "has come online" or * "joined" messages. */ |