[gnome-games] quit-dialog: Drop and construct manually



commit 9aec05aeaecfabbbc561260c863fd057873d1e22
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Oct 16 04:29:26 2020 +0500

    quit-dialog: Drop and construct manually

 data/org.gnome.Games.gresource.xml |  1 -
 data/ui/quit-dialog.ui             | 32 --------------------------------
 src/meson.build                    |  1 -
 src/ui/display-view.vala           | 17 ++++++++++++++---
 src/ui/quit-dialog.vala            |  5 -----
 5 files changed, 14 insertions(+), 42 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index d6d2e85d..69e7a8a3 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -44,7 +44,6 @@
     <file preprocess="xml-stripblanks">ui/preferences-subpage-gamepad.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-subpage-keyboard.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-window.ui</file>
-    <file preprocess="xml-stripblanks">ui/quit-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/remote-display.ui</file>
     <file preprocess="xml-stripblanks">ui/restart-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/search-bar.ui</file>
diff --git a/src/meson.build b/src/meson.build
index 363c7e2c..7222374f 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -155,7 +155,6 @@ vala_sources = [
   'ui/preferences-subpage-gamepad.vala',
   'ui/preferences-subpage-keyboard.vala',
   'ui/preferences-window.vala',
-  'ui/quit-dialog.vala',
   'ui/remote-display.vala',
   'ui/restart-dialog.vala',
   'ui/search-bar.vala',
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index 308d4f18..7320f6ec 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -128,7 +128,7 @@ private class Games.DisplayView : Gtk.Box, UiView {
 
        private Gtk.MessageDialog resume_dialog;
        private Gtk.MessageDialog resume_failed_dialog;
-       private QuitDialog quit_dialog;
+       private Gtk.MessageDialog quit_dialog;
        private RestartDialog restart_dialog;
 
        private ulong extra_widget_notify_block_autohide_id;
@@ -561,8 +561,19 @@ private class Games.DisplayView : Gtk.Box, UiView {
                if (quit_dialog != null)
                        return false;
 
-               quit_dialog = new QuitDialog ();
-               quit_dialog.transient_for = window;
+               quit_dialog = new Gtk.MessageDialog (
+                       window,
+                       Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
+                       Gtk.MessageType.QUESTION,
+                       Gtk.ButtonsType.CANCEL,
+                       "%s",
+                       _("Are you sure you want to quit?")
+               );
+
+               quit_dialog.format_secondary_text ("%s", _("All unsaved progress will be lost."));
+
+               var button = quit_dialog.add_button (_("Quit"), Gtk.ResponseType.ACCEPT);
+               button.get_style_context ().add_class ("destructive-action");
 
                cancellable.cancelled.connect (() => {
                        quit_dialog.destroy ();


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