aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-call-window.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-07-08 19:46:33 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-09-08 19:26:25 +0800
commitd5136f90339362d53d780700808dc055fc0a7121 (patch)
tree32ec6c397399c8d22bee88ffd1f1474cbbc1ceff /src/empathy-call-window.c
parent44731ebba06458462f5c26fed8fd0abab30e7450 (diff)
downloadgsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.tar
gsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.tar.gz
gsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.tar.bz2
gsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.tar.lz
gsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.tar.xz
gsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.tar.zst
gsoc2013-empathy-d5136f90339362d53d780700808dc055fc0a7121.zip
Reuse Call windows when possible
If we have a call window opened for a contact and we get an incoming call from the same person, use the existing window instead of creating another one. Based on a patch from Jonathan Tellier. https://bugzilla.gnome.org/show_bug.cgi?id=580794
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r--src/empathy-call-window.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index ccec9f628..af06b6251 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -293,6 +293,8 @@ static gboolean empathy_call_window_video_output_motion_notify (
static void empathy_call_window_video_menu_popup (EmpathyCallWindow *window,
guint button);
+static void empathy_call_window_connect_handler (EmpathyCallWindow *self);
+
static void empathy_call_window_dialpad_cb (GtkToggleToolButton *button,
EmpathyCallWindow *window);
@@ -2199,6 +2201,20 @@ empathy_call_window_new (EmpathyCallHandler *handler)
g_object_new (EMPATHY_TYPE_CALL_WINDOW, "handler", handler, NULL));
}
+void
+empathy_call_window_present (EmpathyCallWindow *self,
+ EmpathyCallHandler *handler)
+{
+ g_return_if_fail (EMPATHY_IS_CALL_HANDLER (handler));
+
+ tp_clear_object (&self->priv->handler);
+ self->priv->handler = g_object_ref (handler);
+ empathy_call_window_connect_handler (self);
+
+ empathy_window_present (GTK_WINDOW (self));
+ empathy_call_window_restart_call (self);
+}
+
static void
empathy_call_window_conference_added_cb (EmpathyCallHandler *handler,
GstElement *conference, gpointer user_data)
@@ -3272,9 +3288,9 @@ call_handler_notify_call_cb (EmpathyCallHandler *handler,
}
static void
-empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
+empathy_call_window_connect_handler (EmpathyCallWindow *self)
{
- EmpathyCallWindowPriv *priv = GET_PRIV (window);
+ EmpathyCallWindowPriv *priv = GET_PRIV (self);
TpyCallChannel *call;
gint width;
@@ -3283,24 +3299,24 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
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);
+ G_CALLBACK (empathy_call_window_state_changed_cb), self);
g_signal_connect (priv->handler, "conference-added",
- G_CALLBACK (empathy_call_window_conference_added_cb), window);
+ G_CALLBACK (empathy_call_window_conference_added_cb), self);
g_signal_connect (priv->handler, "conference-removed",
- G_CALLBACK (empathy_call_window_conference_removed_cb), window);
+ G_CALLBACK (empathy_call_window_conference_removed_cb), self);
g_signal_connect (priv->handler, "closed",
- G_CALLBACK (empathy_call_window_channel_closed_cb), window);
+ G_CALLBACK (empathy_call_window_channel_closed_cb), self);
g_signal_connect (priv->handler, "src-pad-added",
- G_CALLBACK (empathy_call_window_src_added_cb), window);
+ G_CALLBACK (empathy_call_window_src_added_cb), self);
g_signal_connect (priv->handler, "sink-pad-added",
- G_CALLBACK (empathy_call_window_sink_added_cb), window);
+ G_CALLBACK (empathy_call_window_sink_added_cb), self);
g_signal_connect (priv->handler, "sink-pad-removed",
- G_CALLBACK (empathy_call_window_sink_removed_cb), window);
+ G_CALLBACK (empathy_call_window_sink_removed_cb), self);
g_object_get (priv->handler, "call-channel", &call, NULL);
if (call != NULL)
{
- call_handler_notify_call_cb (priv->handler, NULL, window);
+ call_handler_notify_call_cb (priv->handler, NULL, self);
g_object_unref (call);
}
else
@@ -3308,10 +3324,17 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
/* call-channel doesn't exist yet, we'll connect signals once it has been
* set */
g_signal_connect (priv->handler, "notify::call-channel",
- G_CALLBACK (call_handler_notify_call_cb), window);
+ G_CALLBACK (call_handler_notify_call_cb), self);
}
+}
+
+static void
+empathy_call_window_realized_cb (GtkWidget *widget,
+ EmpathyCallWindow *self)
+{
+ empathy_call_window_connect_handler (self);
- gst_element_set_state (priv->pipeline, GST_STATE_PAUSED);
+ gst_element_set_state (self->priv->pipeline, GST_STATE_PAUSED);
}
static gboolean