[gnome-builder] dspy: only show one error dialog at a time



commit d7a5a2e150e3fdc4f2ad51a4c5f1668265830bc6
Author: Christian Hergert <chergert redhat com>
Date:   Sun May 5 13:49:20 2019 -0700

    dspy: only show one error dialog at a time

 src/plugins/dspy/libdspy/dspy-view.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/dspy/libdspy/dspy-view.c b/src/plugins/dspy/libdspy/dspy-view.c
index fd9317ad9..853c8e6b2 100644
--- a/src/plugins/dspy/libdspy/dspy-view.c
+++ b/src/plugins/dspy/libdspy/dspy-view.c
@@ -138,13 +138,17 @@ connection_got_error_cb (DspyView       *self,
                          const GError   *error,
                          DspyConnection *connection)
 {
+  static GtkWidget *dialog;
   const gchar *title;
-  GtkWidget *dialog;
 
   g_assert (DSPY_IS_VIEW (self));
   g_assert (error != NULL);
   g_assert (DSPY_IS_CONNECTION (connection));
 
+  /* Only show one dialog at a time */
+  if (dialog != NULL)
+    return;
+
   if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_ACCESS_DENIED))
     title = _("Access Denied by Peer");
   else if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_AUTH_FAILED))
@@ -163,6 +167,7 @@ connection_got_error_cb (DspyView       *self,
                                    "%s", title);
   gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
   g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+  g_signal_connect (dialog, "destroy", G_CALLBACK (gtk_widget_destroyed), &dialog);
   gtk_window_present (GTK_WINDOW (dialog));
 }
 


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