aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-26 01:47:51 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-28 16:00:38 +0800
commita12146186cab45c3b3ae074847c77007e23a077c (patch)
treead8a7e4c241593e4f866151460b0e3acda8b4db3
parent146b284c38cd87ee7a56ad454ccd485d3938c1b1 (diff)
downloadgsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.tar
gsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.tar.gz
gsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.tar.bz2
gsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.tar.lz
gsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.tar.xz
gsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.tar.zst
gsoc2013-empathy-a12146186cab45c3b3ae074847c77007e23a077c.zip
CallWindow: show audio and video call buttons to start a call
Instead of the redial button.
-rw-r--r--src/empathy-call-handler.c2
-rw-r--r--src/empathy-call-window.c49
-rw-r--r--src/empathy-call-window.ui22
3 files changed, 58 insertions, 15 deletions
diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c
index 1db5a34ef..c141b9ffa 100644
--- a/src/empathy-call-handler.c
+++ b/src/empathy-call-handler.c
@@ -391,7 +391,7 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass)
param_spec = g_param_spec_boolean ("initial-video",
"initial-video", "Whether the call should start with video",
FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_INITIAL_VIDEO,
param_spec);
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index e84f41fb9..d2d878fe4 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -127,7 +127,9 @@ struct _EmpathyCallWindowPriv
GtkWidget *sidebar;
GtkWidget *volume_item;
GtkWidget *status_label;
- GtkWidget *redial_button;
+ GtkWidget *hangup_button;
+ GtkWidget *audio_call_button;
+ GtkWidget *video_call_button;
GtkWidget *mic_button;
GtkWidget *camera_button;
GtkWidget *dialpad_button;
@@ -289,6 +291,32 @@ empathy_call_window_volume_changed_cb (GtkScaleButton *button,
gdouble value, EmpathyCallWindow *window);
static void
+empathy_call_window_show_hangup_button (EmpathyCallWindow *self,
+ gboolean show)
+{
+ gtk_widget_set_visible (self->priv->hangup_button, show);
+ gtk_widget_set_visible (self->priv->audio_call_button, !show);
+ gtk_widget_set_visible (self->priv->video_call_button, !show);
+}
+
+static void
+empathy_call_window_audio_call_cb (GtkToggleToolButton *button,
+ EmpathyCallWindow *self)
+{
+ g_object_set (self->priv->handler, "initial-video", FALSE, NULL);
+ empathy_call_window_restart_call (self);
+}
+
+static void
+empathy_call_window_video_call_cb (GtkToggleToolButton *button,
+ EmpathyCallWindow *self)
+{
+ empathy_call_window_set_send_video (self, CAMERA_STATE_ON);
+ g_object_set (self->priv->handler, "initial-video", TRUE, NULL);
+ empathy_call_window_restart_call (self);
+}
+
+static void
empathy_call_window_setup_toolbars (EmpathyCallWindow *self)
{
EmpathyCallWindowPriv *priv = GET_PRIV (self);
@@ -1017,10 +1045,12 @@ empathy_call_window_init (EmpathyCallWindow *self)
"call_window_vbox", &top_vbox,
"errors_vbox", &priv->errors_vbox,
"pane", &priv->pane,
- "redial", &priv->redial_button,
+ "audiocall", &priv->audio_call_button,
+ "videocall", &priv->video_call_button,
"volume", &priv->volume_item,
"microphone", &priv->mic_button,
"camera", &priv->camera_button,
+ "hangup", &priv->hangup_button,
"dialpad", &priv->dialpad_button,
"toolbar", &priv->toolbar,
"bottom_toolbar", &priv->bottom_toolbar,
@@ -1048,7 +1078,8 @@ empathy_call_window_init (EmpathyCallWindow *self)
"menuhangup", "activate", empathy_call_window_hangup_cb,
"hangup", "clicked", empathy_call_window_hangup_cb,
"menuredial", "activate", empathy_call_window_redial_cb,
- "redial", "clicked", empathy_call_window_redial_cb,
+ "audiocall", "clicked", empathy_call_window_audio_call_cb,
+ "videocall", "clicked", empathy_call_window_video_call_cb,
"menusidebar", "toggled", empathy_call_window_sidebar_cb,
"microphone", "toggled", empathy_call_window_mic_toggled_cb,
"camera", "toggled", empathy_call_window_camera_toggled_cb,
@@ -1908,7 +1939,7 @@ empathy_call_window_disconnected (EmpathyCallWindow *self,
empathy_call_window_status_message (self, _("Disconnected"));
gtk_action_set_sensitive (priv->redial, TRUE);
- gtk_widget_set_sensitive (priv->redial_button, TRUE);
+ empathy_call_window_show_hangup_button (self, FALSE);
/* Unsensitive the camera and mic button */
gtk_widget_set_sensitive (priv->camera_button, FALSE);
@@ -2394,7 +2425,7 @@ empathy_call_window_state_changed_cb (EmpathyCallHandler *handler,
gtk_widget_set_sensitive (priv->camera_button, can_send_video);
gtk_action_set_sensitive (priv->redial, FALSE);
- gtk_widget_set_sensitive (priv->redial_button, FALSE);
+ empathy_call_window_show_hangup_button (self, TRUE);
gtk_widget_set_sensitive (priv->mic_button, TRUE);
@@ -2826,6 +2857,11 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
{
EmpathyCallWindowPriv *priv = GET_PRIV (window);
TpyCallChannel *call;
+ gint width;
+
+ /* Make the hangup button twice as wide */
+ width = gtk_widget_get_allocated_width (priv->hangup_button);
+ gtk_widget_set_size_request (priv->hangup_button, width * 2, -1);
g_signal_connect (priv->handler, "state-changed",
G_CALLBACK (empathy_call_window_state_changed_cb), window);
@@ -3168,11 +3204,10 @@ empathy_call_window_restart_call (EmpathyCallWindow *window)
/* call will be started when the pipeline is ready */
priv->start_call_when_playing = TRUE;
-
empathy_call_window_setup_avatars (window, priv->handler);
gtk_action_set_sensitive (priv->redial, FALSE);
- gtk_widget_set_sensitive (priv->redial_button, FALSE);
+ empathy_call_window_show_hangup_button (window, TRUE);
}
static void
diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui
index 6bb025c46..63362d177 100644
--- a/src/empathy-call-window.ui
+++ b/src/empathy-call-window.ui
@@ -107,23 +107,31 @@
<child>
<object class="GtkToolButton" id="hangup">
<property name="visible">True</property>
- <property name="is_important">True</property>
<property name="label" translatable="yes">Hang up</property>
<property name="icon_name">call-stop</property>
<property name="tooltip_text" translatable="yes">Hang up current call</property>
</object>
<packing>
+ <property name="homogeneous">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="videocall">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Video call</property>
+ <property name="icon_name">camera-web</property>
+ <property name="tooltip_text" translatable="yes">Start a video call</property>
+ </object>
+ <packing>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="redial">
+ <object class="GtkToolButton" id="audiocall">
<property name="visible">True</property>
- <property name="is_important">True</property>
- <property name="label" translatable="yes">Redial</property>
- <property name="stock_id">gtk-refresh</property>
- <property name="sensitive">False</property>
- <property name="tooltip_text" translatable="yes">Call the contact again</property>
+ <property name="label" translatable="yes">Call</property>
+ <property name="icon_name">call-start</property>
+ <property name="tooltip_text" translatable="yes">Start an audio call</property>
</object>
<packing>
<property name="homogeneous">True</property>