[gnome-games] ui: Add QuitDialog



commit cb96d555cf2413d8653661264ae00ed7c65acef6
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Mar 6 19:32:54 2016 +0100

    ui: Add QuitDialog
    
    This will be used in a next subsequent to warn the user of losing his
    progress and prompting whether he really wants to quit the game or not.

 data/Makefile.am                   |    1 +
 data/org.gnome.Games.gresource.xml |    1 +
 data/ui/quit-dialog.ui             |   55 ++++++++++++++++++++++++++++++++++++
 po/POTFILES.in                     |    1 +
 src/Makefile.am                    |    1 +
 src/ui/quit-dialog.vala            |    9 ++++++
 6 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 4625ff0..c0e2342 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -17,6 +17,7 @@ EXTRA_DIST = \
        ui/dummy-display.ui \
        ui/empty-collection.ui \
        ui/header-bar.ui \
+       ui/quit-dialog.ui \
        ui/remote-display.ui \
        ui/resume-dialog.ui \
        $(NULL)
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index 4e6063d..b1dbf29 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -14,6 +14,7 @@
     <file preprocess="xml-stripblanks">ui/preferences-page-plugins.ui</file>
     <file preprocess="xml-stripblanks">ui/preferences-page-plugins-item.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/resume-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/search-bar.ui</file>
diff --git a/data/ui/quit-dialog.ui b/data/ui/quit-dialog.ui
new file mode 100644
index 0000000..916aed2
--- /dev/null
+++ b/data/ui/quit-dialog.ui
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GamesQuitDialog" parent="GtkDialog">
+    <property name="use-header-bar">1</property>
+    <property name="modal">True</property>
+    <property name="destroy-with-parent">True</property>
+    <child internal-child="vbox">"
+      <object class="GtkBox" id="vbox">
+        <property name="margin-top">12</property>
+        <property name="margin-bottom">12</property>
+        <property name="margin-start">21</property>
+        <property name="margin-end">21</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="question">
+            <property name="visible">True</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="label" translatable="yes">Are you sure you want to quit?</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkLabel" id="warning">
+            <property name="visible">True</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="label" translatable="yes">All unsaved progress will be lost.</property>
+          </object>
+        </child>
+      </object>
+    </child>
+
+    <child type="action">
+      <object class="GtkButton" id="button_quit">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Quit</property>
+        <style>
+          <class name="destructive-action"/>
+        </style>
+      </object>
+    </child>
+    <child type="action">
+      <object class="GtkButton" id="button_cancel">
+        <property name="visible">True</property>
+        <property name="can-default">True</property>
+        <property name="label" translatable="yes">Cancel</property>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="accept">button_quit</action-widget>
+      <action-widget response="cancel" default="true">button_cancel</action-widget>
+    </action-widgets>
+  </template>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d8fb1c6..e33f931 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,7 @@ data/org.gnome.Games.desktop.in
 [type: gettext/glade]data/ui/header-bar.ui
 [type: gettext/glade]data/ui/preferences-page-plugins.ui
 [type: gettext/glade]data/ui/preferences-window.ui
+[type: gettext/glade]data/ui/quit-dialog.ui
 [type: gettext/glade]data/ui/remote-display.ui
 [type: gettext/glade]data/ui/resume-dialog.ui
 src/ui/application.vala
diff --git a/src/Makefile.am b/src/Makefile.am
index 792a368..58bd90c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -73,6 +73,7 @@ gnome_games_SOURCES = \
        ui/preferences-page-plugins.vala \
        ui/preferences-page-plugins-item.vala \
        ui/preferences-window.vala \
+       ui/quit-dialog.vala \
        ui/remote-display.vala \
        ui/resume-dialog.vala \
        ui/search-bar.vala \
diff --git a/src/ui/quit-dialog.vala b/src/ui/quit-dialog.vala
new file mode 100644
index 0000000..11bbe63
--- /dev/null
+++ b/src/ui/quit-dialog.vala
@@ -0,0 +1,9 @@
+// This file is part of GNOME Games. License: GPLv3
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/quit-dialog.ui")]
+private class Games.QuitDialog : Gtk.Dialog {
+       construct {
+               use_header_bar = 1; // FIXME: Why doesn't this work from UI file?
+       }
+}
+


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