[gnome-software/wip/ubuntu-xenial] Correctly unmap modal dialogs



commit ba8379ce2570dc48996f4841267c756e79e780a9
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 532ff09..96f3b5f 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 de00aea..91c8e1d 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1174,6 +1174,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);
 }
@@ -1448,6 +1451,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 1ab9ff0..ceeceda 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 989df4b..f65c413 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -867,6 +867,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]