From bd22bdcc0c16b51e460650ce70bac49065de9c29 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 9 Jan 2009 16:12:16 +0000 Subject: Initial port to the new dispatcher Signed-off-by: Sjoerd Simons svn path=/trunk/; revision=2132 --- src/empathy.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'src/empathy.c') diff --git a/src/empathy.c b/src/empathy.c index 412c1efa6..65f4ec51b 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -62,19 +63,21 @@ static BaconMessageConnection *connection = NULL; static void -dispatch_channel_cb (EmpathyDispatcher *dispatcher, - TpChannel *channel, +dispatch_cb (EmpathyDispatcher *dispatcher, + EmpathyDispatchOperation *operation, gpointer user_data) { - const gchar *channel_type; + GQuark channel_type; - channel_type = tp_channel_get_channel_type (channel); - if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT)) { + channel_type = empathy_dispatch_operation_get_channel_type_id (operation); + + if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT) { EmpathyTpChat *tp_chat; EmpathyChat *chat = NULL; const gchar *id; - tp_chat = empathy_tp_chat_new (channel); + tp_chat = EMPATHY_TP_CHAT ( + empathy_dispatch_operation_get_channel_wrapper (operation)); empathy_run_until_ready (tp_chat); id = empathy_tp_chat_get_id (tp_chat); @@ -102,7 +105,10 @@ dispatch_channel_cb (EmpathyDispatcher *dispatcher, empathy_chat_window_present_chat (chat); g_object_unref (tp_chat); + + empathy_dispatch_operation_claim (operation); } +#if 0 else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA)) { empathy_call_window_new (channel); } @@ -115,6 +121,7 @@ dispatch_channel_cb (EmpathyDispatcher *dispatcher, empathy_ft_manager_add_tp_file (ft_manager, tp_file); g_object_unref (tp_file); } +#endif } static void @@ -502,10 +509,8 @@ main (int argc, char *argv[]) } /* Handle channels */ - dispatcher = empathy_dispatcher_new (); - g_signal_connect (dispatcher, "dispatch-channel", - G_CALLBACK (dispatch_channel_cb), - NULL); + dispatcher = empathy_get_dispatcher (); + g_signal_connect (dispatcher, "dispatch", G_CALLBACK (dispatch_cb), NULL); gtk_main (); -- cgit v1.2.3