[gnome-software/wip/rancell/ubuntu-3-20-rebase: 24/37] Correctly unmap modal dialogs



commit aef1f21c0077c7941c02f7966a0c3a70670a9e16
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 71c2aef..09c7459 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -332,6 +332,8 @@ gs_application_show_first_run_dialog (GsApplication *app)
                g_signal_connect (dialog, "destroy", G_CALLBACK (first_run_dialog_destroyed_cb), app);
                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);
        } else if (needs_refresh ())
                gdk_threads_add_idle (ask_refresh, app);
 }
@@ -460,6 +462,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 db91dea..34a2701 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -188,6 +188,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);
@@ -266,6 +269,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 73cab03..fe80d37 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1172,6 +1172,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);
 }
@@ -1464,6 +1467,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 813843d..8c9c86a 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -612,6 +612,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 59c8fa1..68fb442 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -636,6 +636,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);
 }
 
 /**
@@ -762,6 +766,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 2920010..e605ce0 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -884,6 +884,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]