[Xfce4-commits] <parole:master> Fix startup error handling

Sean Davis noreply at xfce.org
Fri Oct 11 11:51:38 CEST 2013


Updating branch refs/heads/master
         to 6063931151c10a172449e2c216d06e47c46eb7f0 (commit)
       from 58979637bbd0bdcecbe97ac545de171dc823cc9d (commit)

commit 6063931151c10a172449e2c216d06e47c46eb7f0
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Mon Sep 2 00:01:29 2013 -0400

    Fix startup error handling

 src/gst/parole-gst.c |   47 ++++++++++++++++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index d132001..f43a10c 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -50,7 +50,6 @@
 #include <gst/tag/tag.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfce4ui/libxfce4ui.h>
 
 #include <gdk/gdkx.h>
 
@@ -2115,6 +2114,21 @@ parole_notify_volume_cb (GObject        *object,
 }
 
 static void
+parole_gst_show_error(GtkWindow *window, GError *error)
+{
+    GtkWidget *dialog;
+    gchar *message;
+    dialog = gtk_message_dialog_new (NULL,
+                                     GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+                                     GTK_MESSAGE_ERROR,
+                                     GTK_BUTTONS_CLOSE,
+                                     _("GStreamer Error"));
+    message = g_strdup_printf("%s\n%s", error->message, _("Parole Media Player cannot start."));
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), message, "%s");
+    gtk_dialog_run(GTK_DIALOG(dialog));
+}
+
+static void
 parole_gst_constructed (GObject *object)
 {
     ParoleGst *gst;
@@ -2136,11 +2150,17 @@ parole_gst_constructed (GObject *object)
     if ( G_UNLIKELY (gst->priv->playbin == NULL) )
     {
         GError *error;
-        error = g_error_new (0, 0, "%s", _("Unable to load playbin GStreamer plugin"
-                                           ", check your GStreamer installation"));
+
+        error = g_error_new (1, 0, _("Unable to load \"%s\" plugin"
+                                     ", check your GStreamer installation."), 
+#if GST_CHECK_VERSION(1, 0, 0)
+                                     "playbin");
+#else
+                                     "playbin2");
+#endif
                             
-        xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
-                                error, NULL);
+        parole_gst_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
+                                error);
         g_error_free (error);
         g_error ("playbin load failed");
     }
@@ -2149,10 +2169,10 @@ parole_gst_constructed (GObject *object)
     if ( G_UNLIKELY (gst->priv->audio_sink == NULL) )
     {
         GError *error;
-        error = g_error_new (0, 0, "%s", _("Unable to load audio GStreamer plugin"
-                                           ", check your GStreamer installation"));
-        xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
-                                error, NULL);
+        error = g_error_new (1, 0, _("Unable to load \"%s\" plugin"
+                                     ", check your GStreamer installation."), "autoaudiosink");
+        parole_gst_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
+                                error);
         g_error_free (error);
         g_error ("autoaudiosink load failed");
     }
@@ -2172,10 +2192,11 @@ parole_gst_constructed (GObject *object)
         if ( G_UNLIKELY (gst->priv->video_sink == NULL) )
         {
             GError *error;
-            error = g_error_new (0, 0, "%s", _("Unable to load video GStreamer plugin"
-                                               ", check your GStreamer installation"));
-            xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
-                                    error, NULL);
+            error = g_error_new (1, 0, _("Unable to load \"%s\" plugin"
+                                     ", check your GStreamer installation."), 
+                                     enable_xv ? "xvimagesink" : "ximagesink");
+            parole_gst_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
+                                    error);
             g_error_free (error);
             g_error ("ximagesink load failed");
         }


More information about the Xfce4-commits mailing list