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



commit d45acc15667e23b2a62440b02bb6396fad790d8a
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Oct 16 04:31:11 2020 +0500

    restart-dialog: Drop and construct manually

 data/org.gnome.Games.gresource.xml |  1 -
 data/ui/restart-dialog.ui          | 32 --------------------------------
 src/meson.build                    |  1 -
 src/ui/display-view.vala           | 17 ++++++++++++++---
 src/ui/restart-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 69e7a8a3..f4756bf9 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -45,7 +45,6 @@
     <file preprocess="xml-stripblanks">ui/preferences-subpage-keyboard.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-window.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>
     <file preprocess="xml-stripblanks">ui/selection-action-bar.ui</file>
     <file preprocess="xml-stripblanks">ui/shortcuts-window.ui</file>
diff --git a/src/meson.build b/src/meson.build
index 7222374f..aff81fbe 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -156,7 +156,6 @@ vala_sources = [
   'ui/preferences-subpage-keyboard.vala',
   'ui/preferences-window.vala',
   'ui/remote-display.vala',
-  'ui/restart-dialog.vala',
   'ui/search-bar.vala',
   'ui/selection-action-bar.vala',
   'ui/shortcuts-window.vala',
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index 7320f6ec..1b21e1a3 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -129,7 +129,7 @@ private class Games.DisplayView : Gtk.Box, UiView {
        private Gtk.MessageDialog resume_dialog;
        private Gtk.MessageDialog resume_failed_dialog;
        private Gtk.MessageDialog quit_dialog;
-       private RestartDialog restart_dialog;
+       private Gtk.MessageDialog restart_dialog;
 
        private ulong extra_widget_notify_block_autohide_id;
 
@@ -678,8 +678,19 @@ private class Games.DisplayView : Gtk.Box, UiView {
                        runner.pause ();
 
                        if (runner.try_create_snapshot (true) == null) {
-                               restart_dialog = new RestartDialog ();
-                               restart_dialog.transient_for = window;
+                               restart_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 restart?")
+                               );
+
+                               restart_dialog.format_secondary_text ("%s", _("All unsaved progress will be 
lost."));
+
+                               var button = restart_dialog.add_button (_("Restart"), 
Gtk.ResponseType.ACCEPT);
+                               button.get_style_context ().add_class ("destructive-action");
 
                                var response = restart_dialog.run ();
                                restart_dialog.destroy ();


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