[gnome-software/gnome-3-20] Correctly unmap modal dialogs



commit 9c3a0907b80222d9892d7d61051fb7d2ea37599e
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jun 8 14:18:54 2016 +0100

    Correctly unmap modal dialogs

 src/gs-application.c     |    6 ++++++
 src/gs-page.c            |    6 ++++++
 src/gs-shell-details.c   |    6 ++++++
 src/gs-shell-installed.c |    2 ++
 src/gs-shell-updates.c   |    7 +++++++
 src/gs-shell.c           |    4 ++++
 6 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 02270fa..438ee15 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -251,6 +251,8 @@ gs_application_show_first_run_dialog (GsApplication *app)
                dialog = gs_first_run_dialog_new ();
                gs_shell_modal_dialog_present (app->shell, GTK_DIALOG (dialog));
                g_settings_set_boolean (app->settings, "first-run", FALSE);
+               g_signal_connect_swapped (dialog, "response",
+                                         G_CALLBACK (gtk_widget_destroy), dialog);
        }
 }
 
@@ -378,6 +380,10 @@ about_activated (GSimpleAction *action,
                                                 "software on your system."));
 
        gs_shell_modal_dialog_present (app->shell, GTK_DIALOG (dialog));
+
+       /* just destroy */
+       g_signal_connect_swapped (dialog, "response",
+                                 G_CALLBACK (gtk_widget_destroy), dialog);
 }
 
 static void
diff --git a/src/gs-page.c b/src/gs-page.c
index b7dd9da..30104eb 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -216,6 +216,9 @@ gs_page_update_app_response_cb (GtkDialog *dialog,
 {
        GsPagePrivate *priv = gs_page_get_instance_private (helper->page);
 
+       /* unmap the dialog */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+
        /* not agreed */
        if (response != GTK_RESPONSE_OK) {
                gs_page_helper_free (helper);
@@ -294,6 +297,9 @@ gs_page_remove_app_response_cb (GtkDialog *dialog,
 {
        GsPagePrivate *priv = gs_page_get_instance_private (helper->page);
 
+       /* unmap the dialog */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+
        /* not agreed */
        if (response != GTK_RESPONSE_OK) {
                gs_page_helper_free (helper);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 57e0aa9..b3b5782 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1157,6 +1157,9 @@ gs_shell_details_failed_response_cb (GtkDialog *dialog,
                                     gint response,
                                     GsShellDetails *self)
 {
+       /* unmap the dialog */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+
        /* switch away from the details view that failed to load */
        gs_shell_set_mode (self->shell, GS_SHELL_MODE_OVERVIEW);
 }
@@ -1428,6 +1431,9 @@ gs_shell_details_review_response_cb (GtkDialog *dialog,
        g_autoptr(GsReview) review = NULL;
        GsReviewDialog *rdialog = GS_REVIEW_DIALOG (dialog);
 
+       /* unmap the dialog */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+
        /* not agreed */
        if (response != GTK_RESPONSE_OK)
                return;
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 01dbe61..3d5c750 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -626,6 +626,8 @@ show_folder_dialog (GtkButton *button, GsShellInstalled *self)
        dialog = gs_app_folder_dialog_new (GTK_WINDOW (toplevel), apps);
        g_signal_connect_swapped (dialog, "delete-event",
                                  G_CALLBACK (folder_dialog_done), self);
+       g_signal_connect_swapped (dialog, "response",
+                                 G_CALLBACK (gtk_widget_destroy), dialog);
        gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
 }
 
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 128b4be..83ffb6c 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -655,6 +655,10 @@ show_update_details (GsApp *app, GsShellUpdates *self)
        dialog = gs_update_dialog_new (self->plugin_loader);
        gs_update_dialog_show_update_details (GS_UPDATE_DIALOG (dialog), app);
        gs_shell_modal_dialog_present (self->shell, GTK_DIALOG (dialog));
+
+       /* just destroy */
+       g_signal_connect_swapped (dialog, "response",
+                                 G_CALLBACK (gtk_widget_destroy), dialog);
 }
 
 /**
@@ -768,6 +772,9 @@ gs_shell_updates_refresh_confirm_cb (GtkDialog *dialog,
                                     GtkResponseType response_type,
                                     GsShellUpdates *self)
 {
+       /* unmap the dialog */
+       gtk_widget_destroy (GTK_WIDGET (dialog));
+
        switch (response_type) {
        case GTK_RESPONSE_REJECT:
                /* open the control center */
diff --git a/src/gs-shell.c b/src/gs-shell.c
index d3afcdd..c082035 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -868,6 +868,10 @@ gs_shell_show_sources (GsShell *shell)
 
        dialog = gs_sources_dialog_new (priv->main_window, priv->plugin_loader);
        gs_shell_modal_dialog_present (shell, GTK_DIALOG (dialog));
+
+       /* just destroy */
+       g_signal_connect_swapped (dialog, "response",
+                                 G_CALLBACK (gtk_widget_destroy), dialog);
 }
 
 void


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