[empathy/gnome-2-34] Show an error dialog if starting a call fails



commit 2c751f8089462c379401b930242b0ee244eeaf14
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Tue Feb 22 18:15:07 2011 +0000

    Show an error dialog if starting a call fails

 libempathy-gtk/empathy-call-utils.c |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/libempathy-gtk/empathy-call-utils.c b/libempathy-gtk/empathy-call-utils.c
index d9c35e2..3883dad 100644
--- a/libempathy-gtk/empathy-call-utils.c
+++ b/libempathy-gtk/empathy-call-utils.c
@@ -20,6 +20,10 @@
 
 #include "config.h"
 
+#include <glib/gi18n.h>
+
+#include <gtk/gtk.h>
+
 #include <telepathy-glib/telepathy-glib.h>
 
 #if HAVE_CALL
@@ -31,6 +35,22 @@
 #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,
@@ -84,6 +104,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);
     }
 }
@@ -107,7 +128,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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]