aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/empathy-call-window.c79
-rw-r--r--src/empathy-call-window.h3
-rw-r--r--src/empathy.c9
3 files changed, 31 insertions, 60 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 54eb8a4cd..a3bbd6afd 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -475,6 +475,36 @@ empathy_call_window_new (TpChannel *channel)
g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
+ if (windows)
+ {
+ window = (EmpathyCallWindow*) windows->data;
+ if (!window->call)
+ {
+ window->call = empathy_tp_call_new (channel);
+ g_signal_connect_swapped (G_OBJECT (window->call), "notify",
+ G_CALLBACK (call_window_update), window);
+ call_window_update (window);
+ }
+ else
+ {
+ GtkWidget *dialog;
+
+ /* We don't want to have multiple calls running.
+ * FIXME: We should use the hold interface... */
+ tp_cli_channel_call_close (channel, -1, NULL, NULL, NULL, NULL);
+
+ dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_INFO,
+ GTK_BUTTONS_CLOSE,
+ _("Call rejected because there is already a running call."));
+ g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy),
+ NULL);
+ gtk_widget_show (dialog);
+ }
+
+ gtk_window_present (GTK_WINDOW (window->window));
+ return window->window;
+ }
+
window = g_slice_new0 (EmpathyCallWindow);
windows = g_slist_prepend (windows, window);
window->call = empathy_tp_call_new (channel);
@@ -568,52 +598,3 @@ empathy_call_window_new (TpChannel *channel)
return window->window;
}
-GtkWidget *
-empathy_call_window_find (TpChannel *channel)
-{
- GSList *l;
-
- g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
-
- for (l = windows; l; l = l->next)
- {
- EmpathyCallWindow *window = l->data;
- TpChannel *this_channel = NULL;
-
- if (window->call)
- g_object_get (window->call, "channel", &this_channel, NULL);
- if (this_channel)
- {
- g_object_unref (this_channel);
- if (empathy_proxy_equal (channel, this_channel))
- return window->window;
- }
- }
-
- return NULL;
-}
-
-void
-empathy_call_window_set_channel (GtkWidget *window, TpChannel *channel)
-{
- GSList *l;
-
- g_return_if_fail (GTK_IS_WIDGET (window));
- g_return_if_fail (TP_IS_CHANNEL (channel));
-
- for (l = windows; l; l = l->next)
- {
- EmpathyCallWindow *call_window = l->data;
-
- if (call_window->window == window)
- {
- if (!call_window->call)
- {
- call_window->call = empathy_tp_call_new (channel);
- call_window_update (call_window);
- }
- break;
- }
- }
-}
-
diff --git a/src/empathy-call-window.h b/src/empathy-call-window.h
index 782eda09c..018babe9b 100644
--- a/src/empathy-call-window.h
+++ b/src/empathy-call-window.h
@@ -31,9 +31,6 @@
G_BEGIN_DECLS
GtkWidget *empathy_call_window_new (TpChannel *channel);
-GtkWidget *empathy_call_window_find (TpChannel *channel);
-void empathy_call_window_set_channel (GtkWidget *window,
- TpChannel *channel);
G_END_DECLS
diff --git a/src/empathy.c b/src/empathy.c
index 19d9cb220..d30935d24 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -98,14 +98,7 @@ dispatch_channel_cb (EmpathyDispatcher *dispatcher,
g_object_unref (tp_chat);
}
else if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA)) {
- GtkWidget *window;
-
- window = empathy_call_window_find (channel);
- if (window) {
- gtk_window_present (GTK_WINDOW (window));
- } else {
- empathy_call_window_new (channel);
- }
+ empathy_call_window_new (channel);
}
}