[empathy: 6/8] Corrected code style in empathy_call_window_setup_video_preview.
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Subject: [empathy: 6/8] Corrected code style in empathy_call_window_setup_video_preview.
- Date: Mon, 15 Jun 2009 05:48:17 -0400 (EDT)
commit 1a2da857a423d46a4496064078c92fd3214ebf3e
Author: Jonathan Tellier <jonathan tellier gmail com>
Date: Fri Jun 12 10:55:05 2009 -0400
Corrected code style in empathy_call_window_setup_video_preview.
The video preview is now shown no matter if we are sending video or not.
src/empathy-call-window.c | 101 +++++++++++++++++++++++++--------------------
1 files changed, 56 insertions(+), 45 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 4b4f53f..749f9eb 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -611,41 +611,39 @@ static void
empathy_call_window_setup_video_preview (EmpathyCallWindow *window)
{
EmpathyCallWindowPriv *priv = GET_PRIV (window);
+ GstElement *preview;
+ GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
- if (priv->video_preview != NULL)
- {
- /* Since the video preview and the video tee are initialized and freed
- at the same time, if one is initialized, then the other one should
- be too. */
- g_assert (priv->video_tee != NULL);
- return;
- }
+ /* Since the video preview and the video tee are initialized and freed at
+ the same time, if one is initialized, then the other one should be too. */
+ g_assert ((priv->video_preview != NULL && priv->video_tee != NULL)
+ || (priv->video_preview == NULL && priv->video_tee == NULL));
- GstElement *preview;
- GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
+ if (priv->video_preview != NULL)
+ return;
- priv->video_tee = gst_element_factory_make ("tee", NULL);
- gst_object_ref (priv->video_tee);
- gst_object_sink (priv->video_tee);
+ priv->video_tee = gst_element_factory_make ("tee", NULL);
+ gst_object_ref (priv->video_tee);
+ gst_object_sink (priv->video_tee);
- priv->video_preview = empathy_video_widget_new_with_size (bus,
- SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH);
- g_object_set (priv->video_preview, "sync", FALSE, "async", TRUE, NULL);
- gtk_box_pack_start (GTK_BOX (priv->self_user_output_hbox),
- priv->video_preview, TRUE, TRUE, 0);
+ priv->video_preview = empathy_video_widget_new_with_size (bus,
+ SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH);
+ g_object_set (priv->video_preview, "sync", FALSE, "async", TRUE, NULL);
+ gtk_box_pack_start (GTK_BOX (priv->self_user_output_hbox),
+ priv->video_preview, TRUE, TRUE, 0);
- preview = empathy_video_widget_get_element (
- EMPATHY_VIDEO_WIDGET (priv->video_preview));
- gst_bin_add_many (GST_BIN (priv->pipeline), priv->video_input,
- priv->video_tee, preview, NULL);
- gst_element_link_many (priv->video_input, priv->video_tee,
- preview, NULL);
+ preview = empathy_video_widget_get_element (
+ EMPATHY_VIDEO_WIDGET (priv->video_preview));
+ gst_bin_add_many (GST_BIN (priv->pipeline), priv->video_input,
+ priv->video_tee, preview, NULL);
+ gst_element_link_many (priv->video_input, priv->video_tee,
+ preview, NULL);
- g_object_unref (bus);
+ g_object_unref (bus);
- gst_element_set_state (preview, GST_STATE_PLAYING);
- gst_element_set_state (priv->video_input, GST_STATE_PLAYING);
- gst_element_set_state (priv->video_tee, GST_STATE_PLAYING);
+ gst_element_set_state (preview, GST_STATE_PLAYING);
+ gst_element_set_state (priv->video_input, GST_STATE_PLAYING);
+ gst_element_set_state (priv->video_tee, GST_STATE_PLAYING);
}
static void
@@ -1547,26 +1545,13 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message,
}
static void
-empathy_call_window_update_avatars_visibility (EmpathyTpCall *call,
- EmpathyCallWindow *window)
+empathy_call_window_update_self_avatar_visibility (EmpathyCallWindow *window)
{
EmpathyCallWindowPriv *priv = GET_PRIV (window);
- if (empathy_tp_call_is_receiving_video (call))
- {
- gtk_widget_hide (priv->remote_user_avatar_widget);
- gtk_widget_show (priv->video_output);
- }
- else
- {
- gtk_widget_hide (priv->video_output);
- gtk_widget_show (priv->remote_user_avatar_widget);
- }
-
if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (priv->show_preview)))
{
- if (priv->video_preview != NULL
- && empathy_tp_call_is_sending_video (call))
+ if (priv->video_preview != NULL)
{
gtk_widget_hide (priv->self_user_avatar_widget);
gtk_widget_show (priv->video_preview);
@@ -1582,6 +1567,26 @@ empathy_call_window_update_avatars_visibility (EmpathyTpCall *call,
}
static void
+empathy_call_window_update_avatars_visibility (EmpathyTpCall *call,
+ EmpathyCallWindow *window)
+{
+ EmpathyCallWindowPriv *priv = GET_PRIV (window);
+
+ if (empathy_tp_call_is_receiving_video (call))
+ {
+ gtk_widget_hide (priv->remote_user_avatar_widget);
+ gtk_widget_show (priv->video_output);
+ }
+ else
+ {
+ gtk_widget_hide (priv->video_output);
+ gtk_widget_show (priv->remote_user_avatar_widget);
+ }
+
+ empathy_call_window_update_self_avatar_visibility (window);
+}
+
+static void
empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
{
EmpathyCallWindowPriv *priv = GET_PRIV (window);
@@ -1812,9 +1817,15 @@ empathy_call_window_show_preview_toggled_cb (GtkToggleAction *toggle,
show_preview_toggled = gtk_toggle_action_get_active (toggle);
if (show_preview_toggled)
- gtk_widget_show (priv->self_user_output_frame);
+ {
+ empathy_call_window_setup_video_preview (window);
+ gtk_widget_show (priv->self_user_output_frame);
+ empathy_call_window_update_self_avatar_visibility (window);
+ }
else
- gtk_widget_hide (priv->self_user_output_frame);
+ {
+ gtk_widget_hide (priv->self_user_output_frame);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]