diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-05-27 04:16:59 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-05-27 04:16:59 +0800 |
commit | 8f3603b251d4dc3f164947ab1e1cce03538ad575 (patch) | |
tree | 50066a8f7bca134ecc671d19efe0ba6cfe2c0119 /src | |
parent | 8e18f8c707d22e911014d8c9d25c202231ef7368 (diff) | |
parent | adcea193bbc45b44312b82742612ea7e9a0d786d (diff) | |
download | gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.tar gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.tar.gz gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.tar.bz2 gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.tar.lz gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.tar.xz gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.tar.zst gsoc2013-empathy-8f3603b251d4dc3f164947ab1e1cce03538ad575.zip |
Merge branch 'empathy-skype' into debian
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 55 | ||||
-rw-r--r-- | src/empathy-chat-manager.c | 9 | ||||
-rw-r--r-- | src/empathy-chat-window.c | 9 | ||||
-rw-r--r-- | src/empathy-main-window.c | 86 |
4 files changed, 108 insertions, 51 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 4728e9f64..98993fc7d 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -85,6 +85,7 @@ enum { typedef enum { CONNECTING, CONNECTED, + HELD, DISCONNECTED, REDIALING } CallState; @@ -1744,6 +1745,10 @@ empathy_call_window_reset_pipeline (EmpathyCallWindow *self) g_signal_handlers_disconnect_by_func (priv->audio_input_adj, empathy_call_window_mic_volume_changed_cb, self); + if (priv->audio_output != NULL) + g_object_unref (priv->audio_output); + priv->audio_output = NULL; + if (priv->video_tee != NULL) g_object_unref (priv->video_tee); priv->video_tee = NULL; @@ -2022,6 +2027,7 @@ empathy_call_window_get_audio_sink_pad (EmpathyCallWindow *self) if (priv->audio_output == NULL) { priv->audio_output = empathy_audio_sink_new (); + g_object_ref_sink (priv->audio_output); if (!gst_bin_add (GST_BIN (priv->pipeline), priv->audio_output)) { @@ -2072,9 +2078,10 @@ empathy_call_window_update_timer (gpointer user_data) time_ = g_timer_elapsed (priv->timer, NULL); - /* Translators: number of minutes:seconds the caller has been connected */ - str = g_strdup_printf (_("Connected — %d:%02dm"), (int) time_ / 60, - (int) time_ % 60); + /* Translators: 'status - minutes:seconds' the caller has been connected */ + str = g_strdup_printf (_("%s — %d:%02dm"), + priv->call_state == HELD ? _("On hold") : _("Connected"), + (int) time_ / 60, (int) time_ % 60); empathy_call_window_status_message (self, str); g_free (str); @@ -2745,6 +2752,35 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, } static void +empathy_call_window_members_changed_cb (TpyCallChannel *call, + GHashTable *members, + EmpathyCallWindow *self) +{ + EmpathyCallWindowPriv *priv = GET_PRIV (self); + GHashTableIter iter; + gpointer key, value; + gboolean held = FALSE; + + g_hash_table_iter_init (&iter, members); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + if (GPOINTER_TO_INT (value) & TPY_CALL_MEMBER_FLAG_HELD) + { + /* This assumes this is a 1-1 call, otherwise one participant + * putting the call on hold wouldn't mean the call is on hold + * for everyone. */ + held = TRUE; + break; + } + } + + if (held) + priv->call_state = HELD; + else if (priv->call_state == HELD) + priv->call_state = CONNECTED; +} + +static void call_handler_notify_call_cb (EmpathyCallHandler *handler, GParamSpec *spec, EmpathyCallWindow *self) @@ -2762,6 +2798,10 @@ call_handler_notify_call_cb (EmpathyCallHandler *handler, tp_g_signal_connect_object (call, "video-stream-error", G_CALLBACK (empathy_call_window_video_stream_error), self, 0); */ + + tp_g_signal_connect_object (call, "members-changed", + G_CALLBACK (empathy_call_window_members_changed_cb), self, 0); + g_object_unref (call); } @@ -2789,14 +2829,7 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window) g_object_get (priv->handler, "call-channel", &call, NULL); if (call != NULL) { -/* FIXME: part of the improvements for DRAFT2 - tp_g_signal_connect_object (call, "audio-stream-error", - G_CALLBACK (empathy_call_window_audio_stream_error), window, - 0); - tp_g_signal_connect_object (call, "video-stream-error", - G_CALLBACK (empathy_call_window_video_stream_error), window, - 0); -*/ + call_handler_notify_call_cb (priv->handler, NULL, window); g_object_unref (call); } else diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c index b31684069..eced9951c 100644 --- a/src/empathy-chat-manager.c +++ b/src/empathy-chat-manager.c @@ -61,6 +61,7 @@ typedef struct TpAccount *account; gchar *id; gboolean room; + gboolean sms; } ChatData; static ChatData * @@ -73,6 +74,7 @@ chat_data_new (EmpathyChat *chat) data->account = g_object_ref (empathy_chat_get_account (chat)); data->id = g_strdup (empathy_chat_get_id (chat)); data->room = empathy_chat_is_room (chat); + data->sms = empathy_chat_is_sms_channel (chat); return data; } @@ -397,9 +399,14 @@ empathy_chat_manager_undo_closed_chat (EmpathyChatManager *self) if (data->room) empathy_dispatcher_join_muc (data->account, data->id, TP_USER_ACTION_TIME_NOT_USER_ACTION); + else if (data->sms) + empathy_dispatcher_sms_contact_id (data->account, data->id, + TP_USER_ACTION_TIME_NOT_USER_ACTION, + NULL, NULL); else empathy_dispatcher_chat_with_contact_id (data->account, data->id, - TP_USER_ACTION_TIME_NOT_USER_ACTION); + TP_USER_ACTION_TIME_NOT_USER_ACTION, + NULL, NULL); g_signal_emit (self, signals[CHATS_CHANGED], 0, g_queue_get_length (priv->queue)); diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 7dcc996ac..bb23e016a 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -1828,7 +1828,9 @@ chat_window_drag_data_received (GtkWidget *widget, if (!chat) { empathy_dispatcher_chat_with_contact_id ( - account, contact_id, gtk_get_current_event_time ()); + account, contact_id, + gtk_get_current_event_time (), + NULL, NULL); g_strfreev (strv); return; @@ -2443,6 +2445,11 @@ empathy_chat_window_present_chat (EmpathyChat *chat, window = empathy_chat_window_get_default (empathy_chat_is_room (chat)); if (!window) { window = empathy_chat_window_new (); + + /* we want to display the newly created window even if we don't present + * it */ + priv = GET_PRIV (window); + gtk_widget_show (priv->dialog); } empathy_chat_window_add_chat (window, chat); diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index e81218f2c..57bd7b67f 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -1201,6 +1201,50 @@ main_window_setup_balance (EmpathyMainWindow *window, } static void +main_window_remove_balance_action (EmpathyMainWindow *window, + TpAccount *account) +{ + EmpathyMainWindowPriv *priv = GET_PRIV (window); + GtkAction *action; + char *name; + GList *a; + + if (priv->balance_action_group == NULL) + return; + + name = main_window_account_to_action_name (account); + + action = gtk_action_group_get_action ( + priv->balance_action_group, name); + + if (action != NULL) { + guint merge_id; + + DEBUG ("Removing action"); + + merge_id = GPOINTER_TO_UINT (g_object_get_data ( + G_OBJECT (action), + "merge-id")); + + gtk_ui_manager_remove_ui (priv->ui_manager, + merge_id); + gtk_action_group_remove_action ( + priv->balance_action_group, action); + } + + g_free (name); + + a = gtk_action_group_list_actions ( + priv->balance_action_group); + + gtk_action_set_visible ( + priv->view_balance_show_in_roster, + g_list_length (a) > 0); + + g_list_free (a); +} + +static void main_window_connection_changed_cb (TpAccount *account, guint old_status, guint current, @@ -1209,8 +1253,6 @@ main_window_connection_changed_cb (TpAccount *account, GHashTable *details, EmpathyMainWindow *window) { - EmpathyMainWindowPriv *priv = GET_PRIV (window); - main_window_update_status (window); if (current == TP_CONNECTION_STATUS_DISCONNECTED && @@ -1223,42 +1265,7 @@ main_window_connection_changed_cb (TpAccount *account, EMPATHY_SOUND_ACCOUNT_DISCONNECTED); /* remove balance action if required */ - if (priv->balance_action_group != NULL) { - GtkAction *action; - char *name; - GList *a; - - name = main_window_account_to_action_name (account); - - action = gtk_action_group_get_action ( - priv->balance_action_group, name); - - if (action != NULL) { - guint merge_id; - - DEBUG ("Removing action"); - - merge_id = GPOINTER_TO_UINT (g_object_get_data ( - G_OBJECT (action), - "merge-id")); - - gtk_ui_manager_remove_ui (priv->ui_manager, - merge_id); - gtk_action_group_remove_action ( - priv->balance_action_group, action); - } - - g_free (name); - - a = gtk_action_group_list_actions ( - priv->balance_action_group); - - gtk_action_set_visible ( - priv->view_balance_show_in_roster, - g_list_length (a) > 0); - - g_list_free (a); - } + main_window_remove_balance_action (window, account); } if (current == TP_CONNECTION_STATUS_CONNECTED) { @@ -2022,6 +2029,9 @@ main_window_account_removed_cb (TpAccountManager *manager, /* remove errors if any */ main_window_remove_error (window, account); + + /* remove the balance action if required */ + main_window_remove_balance_action (window, account); } static void |