[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 240/331]	Show ask for refresh dialog only when visible
- From: William Hua <williamhua src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 240/331]	Show ask for refresh dialog only when visible
 
- Date: Wed,  4 May 2016 14:18:42 +0000 (UTC)
 
commit 56eae9fcf579303e9fd86af3bcd9829ce793df4e
Author: William Hua <william hua canonical com>
Date:   Thu Apr 14 20:23:12 2016 -0400
    Show ask for refresh dialog only when visible
 src/plugins/gs-plugin-appstream.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index e028e25..eb7fba3 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -209,17 +209,19 @@ ask_refresh (gpointer user_data)
 
        parent = gtk_application_get_active_window (GTK_APPLICATION (application));
 
-       dialog = gtk_message_dialog_new (parent,
-                                        GTK_DIALOG_MODAL |
-                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                        GTK_MESSAGE_QUESTION,
-                                        GTK_BUTTONS_YES_NO,
-                                        _("An update is needed to show all installable apps. Download 
now?"));
-
-       if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
-               start_refresh (user_data);
-
-       gtk_widget_destroy (dialog);
+       if (gtk_widget_is_visible (GTK_WIDGET (parent))) {
+               dialog = gtk_message_dialog_new (parent,
+                                                GTK_DIALOG_MODAL |
+                                                GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                GTK_MESSAGE_QUESTION,
+                                                GTK_BUTTONS_YES_NO,
+                                                _("An update is needed to show all installable apps. 
Download now?"));
+
+               if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
+                       start_refresh (user_data);
+
+               gtk_widget_destroy (dialog);
+       }
 
        return G_SOURCE_REMOVE;
 }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]