[gnome-software] Correctly unmap modal dialogs



commit 8e42943ffa7a9a253f609f809c68d090f185a043
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   |   10 ++++++++++
 src/gs-shell-installed.c |    2 ++
 src/gs-shell-updates.c   |    7 +++++++
 src/gs-shell.c           |    4 ++++
 6 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index a68947c..e46cb4e 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -255,6 +255,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);
        }
 }
 
@@ -379,6 +381,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 9e6cbd0..c160a65 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -212,6 +212,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);
@@ -290,6 +293,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 d14dd4c..5ba729f 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -665,6 +665,10 @@ gs_shell_details_history_cb (GtkLabel *label,
        gs_history_dialog_set_app (GS_HISTORY_DIALOG (dialog), self->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);
+
        return TRUE;
 }
 
@@ -1344,6 +1348,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);
 }
@@ -1640,6 +1647,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 87b1ed1..01e2f43 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -635,6 +635,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 0f5f15e..a6e34d2 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -677,6 +677,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);
 }
 
 /**
@@ -790,6 +794,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 0f77cbc..eca3e79 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -772,6 +772,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]