From: Jonathan Tellier Date: Mon, 15 Jun 2009 20:07:59 +0000 (-0400) Subject: The EmpathyCallHandler correctly initializes it "initial_video" property X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=2360a56f96df9315b7cbcfc8bf3a3f8ddcb919cf The EmpathyCallHandler correctly initializes it "initial_video" property when the remote contact initiates the call. empathy_tp_call_is_(sending/receiving)_video correctly returns a gboolean. The remote avatar is correctly shown when the remote site does not send video. When a call is disconnected, the video preview is hidden. --- diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c index bbc1f9a8..dd117eb9 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-call-handler.c @@ -304,7 +304,9 @@ EmpathyCallHandler * empathy_call_handler_new_for_channel (EmpathyTpCall *call) { return EMPATHY_CALL_HANDLER (g_object_new (EMPATHY_TYPE_CALL_HANDLER, - "tp-call", call, NULL)); + "tp-call", call, + "initial-video", empathy_tp_call_is_receiving_video (call), + NULL)); } void diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c index a672d8a8..eb70c1a8 100644 --- a/libempathy/empathy-tp-call.c +++ b/libempathy/empathy-tp-call.c @@ -687,7 +687,8 @@ empathy_tp_call_is_receiving_video (EmpathyTpCall *call) g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE); - return priv->video->direction & TP_MEDIA_STREAM_DIRECTION_RECEIVE; + return priv->video->direction & TP_MEDIA_STREAM_DIRECTION_RECEIVE ? + TRUE : FALSE; } /** @@ -705,5 +706,6 @@ empathy_tp_call_is_sending_video (EmpathyTpCall *call) g_return_val_if_fail (EMPATHY_IS_TP_CALL (call), FALSE); - return priv->video->direction & TP_MEDIA_STREAM_DIRECTION_SEND; + return priv->video->direction & TP_MEDIA_STREAM_DIRECTION_SEND ? + TRUE : FALSE; } diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 9946dd32..4ad1b260 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -1180,8 +1180,12 @@ empathy_call_window_disconnected (EmpathyCallWindow *self) EmpathyCallWindowPriv *priv = GET_PRIV (self); gboolean could_reset_pipeline = empathy_call_window_reset_pipeline (self); + priv->connected = FALSE; + if (could_reset_pipeline) { + gboolean initial_video = empathy_call_handler_has_initial_video ( + priv->handler); g_mutex_lock (priv->lock); g_timer_stop (priv->timer); @@ -1196,10 +1200,23 @@ empathy_call_window_disconnected (EmpathyCallWindow *self) gtk_action_set_sensitive (priv->redial, TRUE); gtk_widget_set_sensitive (priv->redial_button, TRUE); + + /* Reseting the send_video and camera_buton to their initial state */ gtk_widget_set_sensitive (priv->camera_button, FALSE); gtk_action_set_sensitive (priv->send_video, FALSE); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->send_video), + initial_video); + gtk_toggle_tool_button_set_active ( + GTK_TOGGLE_TOOL_BUTTON (priv->camera_button), initial_video); + + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->show_preview), + FALSE); + gtk_action_set_sensitive (priv->show_preview, FALSE); + + gtk_widget_hide (priv->video_output); + gtk_widget_show (priv->remote_user_avatar_widget); + priv->sending_video = FALSE; - priv->connected = FALSE; priv->call_started = FALSE; could_disconnect = TRUE; @@ -1316,6 +1333,7 @@ empathy_call_window_connected (gpointer user_data) priv->sending_video = empathy_tp_call_is_sending_video (call); + gtk_action_set_sensitive (priv->show_preview, TRUE); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->show_preview), priv->sending_video || gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (priv->show_preview))); @@ -1772,6 +1790,9 @@ empathy_call_window_camera_toggled_cb (GtkToggleToolButton *toggle, EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; + if (!priv->connected) + return; + active = (gtk_toggle_tool_button_get_active (toggle)); if (priv->sending_video == active) @@ -1788,6 +1809,9 @@ empathy_call_window_send_video_toggled_cb (GtkToggleAction *toggle, EmpathyCallWindowPriv *priv = GET_PRIV (window); gboolean active; + if (!priv->connected) + return; + active = (gtk_toggle_action_get_active (toggle)); if (priv->sending_video == active) @@ -1895,12 +1919,13 @@ empathy_call_window_restart_call (EmpathyCallWindow *window) gtk_widget_show_all (priv->content_hbox); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (priv->show_preview), - gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (priv->show_preview))); + if (!empathy_call_handler_has_initial_video (priv->handler)) + gtk_widget_hide (priv->self_user_output_frame); empathy_call_window_status_message (window, CONNECTING_STATUS_TEXT); priv->call_started = TRUE; empathy_call_handler_start_call (priv->handler); + empathy_call_window_setup_avatars (window, priv->handler); gst_element_set_state (priv->pipeline, GST_STATE_PLAYING); gtk_action_set_sensitive (priv->redial, FALSE);