aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-call-window.c
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 /src/empathy-call-window.c
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
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r--src/empathy-call-window.c79
1 files changed, 30 insertions, 49 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;
- }
- }
-}
-