aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-05-27 01:42:57 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-05-27 01:42:57 +0800
commit411439eb384aea34a05bbde805a236e97882895b (patch)
tree5784eb63eb2deb8d7fff35bb9087eea7da04bff4
parent2d2388ff8dd0b1faed6de9c168699032edc29660 (diff)
downloadgsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.tar
gsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.tar.gz
gsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.tar.bz2
gsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.tar.lz
gsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.tar.xz
gsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.tar.zst
gsoc2013-empathy-411439eb384aea34a05bbde805a236e97882895b.zip
Only permit to have one running call at any time. Fixes bug #527970.
svn path=/trunk/; revision=1126
-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);
}
}