]> git.0d.be Git - empathy.git/commitdiff
Show an error dialog if starting a call fails
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 22 Feb 2011 18:15:07 +0000 (18:15 +0000)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 9 Jun 2011 09:20:05 +0000 (10:20 +0100)
libempathy-gtk/empathy-call-utils.c

index 2a4158539a1365b71f78b87a567d7ff584484fe2..5f821dd19fc56afede1e49f426508b549f23f0da 100644 (file)
 
 #include "config.h"
 
+#include <glib/gi18n.h>
+
+#include <gtk/gtk.h>
+
 #include <telepathy-glib/telepathy-glib.h>
 
 #if HAVE_CALL
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
 
+static void
+show_call_error (GError *error)
+{
+  GtkWidget *dialog;
+
+  dialog = gtk_message_dialog_new (NULL, 0,
+      GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+      _("There was an error starting the call"));
+
+  g_signal_connect_swapped (dialog, "response",
+      G_CALLBACK (gtk_widget_destroy),
+      dialog);
+
+  gtk_widget_show (dialog);
+}
+
 #if HAVE_CALL
 GHashTable *
 empathy_call_create_call_request (const gchar *contact,
@@ -86,6 +106,7 @@ create_streamed_media_channel_cb (GObject *source,
            &error))
     {
       DEBUG ("Failed to create StreamedMedia channel: %s", error->message);
+      show_call_error (error);
       g_error_free (error);
     }
 }
@@ -109,7 +130,10 @@ create_call_channel_cb (GObject *source,
   DEBUG ("Failed to create Call channel: %s", error->message);
 
   if (error->code != TP_ERROR_NOT_IMPLEMENTED)
-    return;
+    {
+      show_call_error (error);
+      return;
+    }
 
   DEBUG ("Let's try with an StreamedMedia channel");
   g_error_free (error);