[gnome-software/gnome-3-20] Actually show the error dialog for an invalid file



commit e9c1d71eea0c6ea40d17a15e9e9d1e05528da3ff
Author: Richard Hughes <richard hughsie com>
Date:   Wed Mar 16 09:18:47 2016 +0000

    Actually show the error dialog for an invalid file
    
    We have to use gs_shell_set_mode() after the response otherwise the modal error
    dialog gets closed automatically.

 src/gs-shell-details.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index d09e8d5..9caa854 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1129,6 +1129,18 @@ gs_shell_details_app_refine_cb (GObject *source,
 }
 
 /**
+ * gs_shell_details_failed_response_cb:
+ **/
+static void
+gs_shell_details_failed_response_cb (GtkDialog *dialog,
+                                    gint response,
+                                    GsShellDetails *self)
+{
+       /* switch away from the details view that failed to load */
+       gs_shell_set_mode (self->shell, GS_SHELL_MODE_OVERVIEW);
+}
+
+/**
  * gs_shell_details_filename_to_app_cb:
  **/
 static void
@@ -1162,12 +1174,11 @@ gs_shell_details_filename_to_app_cb (GObject *source,
                                                 _("Sorry, this did not work"));
                gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
                                                          "%s", error->message);
+               g_signal_connect (dialog, "response",
+                                 G_CALLBACK (gs_shell_details_failed_response_cb), self);
                gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
 
                g_warning ("failed to convert to GsApp: %s", error->message);
-
-               /* Switch away from the details view that failed to load */
-               gs_shell_set_mode (self->shell, GS_SHELL_MODE_OVERVIEW);
                return;
        }
 


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