[nautilus/gnome-3-20] places-view: show an error dialog on failed connection



commit 5c2b3e14b1a4eec248ec3c1aa0e4bd99545e2c3d
Author: Ernestas Kulik <ernestas kulik gmail com>
Date:   Sun Apr 17 15:01:22 2016 +0300

    places-view: show an error dialog on failed connection
    
    Since 474a6c2aa025fcd94bff50e3501a2eb41e4f0388, due to an overlook, no
    error is displayed if a connection to a server fails.
    
    This commit restores error reporting by connecting to the
    NautilusPlacesView show-error-message signal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704872

 src/nautilus-places-view.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index 44ea65d..f6214f8 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -104,6 +104,29 @@ loading_cb (NautilusView *view)
 }
 
 static void
+show_error_message_cb (NautilusGtkPlacesView *view,
+                       const gchar           *primary,
+                       const gchar           *secondary)
+{
+        GtkWidget *dialog;
+        GtkWidget *window;
+
+        window = gtk_widget_get_toplevel (GTK_WIDGET (view));
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW (window),
+                                         GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
+                                         GTK_MESSAGE_ERROR,
+                                         GTK_BUTTONS_CLOSE,
+                                         "%s", primary);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                                  "%s", secondary);
+
+        gtk_dialog_run (GTK_DIALOG (dialog));
+
+        gtk_widget_destroy (dialog);
+}
+
+static void
 nautilus_places_view_finalize (GObject *object)
 {
         NautilusPlacesView *self = (NautilusPlacesView *)object;
@@ -348,6 +371,11 @@ nautilus_places_view_init (NautilusPlacesView *self)
                                   G_CALLBACK (open_location_cb),
                                   self);
 
+        g_signal_connect_swapped (priv->places_view,
+                                  "show-error-message",
+                                  G_CALLBACK (show_error_message_cb),
+                                  self);
+
 }
 
 NautilusPlacesView *


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