[gnome-games/wip/exalm/spinner: 1/4] ui: Add loading state
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/spinner: 1/4] ui: Add loading state
- Date: Wed, 12 Sep 2018 11:54:17 +0000 (UTC)
commit 9eb998a8a92358c53654d48571f61dc664c7174b
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Wed Sep 5 19:36:10 2018 +0500
ui: Add loading state
Add UiState.LOADING state represented by LoadingBox and LoadingHeaderBar
widgets.
This will be used in subsequent commits to show loading collection.
data/org.gnome.Games.gresource.xml | 2 ++
data/ui/application-window.ui | 17 +++++++++++++++++
data/ui/loading-box.ui | 13 +++++++++++++
data/ui/loading-header-bar.ui | 7 +++++++
src/meson.build | 2 ++
src/ui/application-window.vala | 28 ++++++++++++++++++++--------
src/ui/loading-box.vala | 5 +++++
src/ui/loading-header-bar.vala | 5 +++++
src/ui/ui-state.vala | 1 +
9 files changed, 72 insertions(+), 8 deletions(-)
---
diff --git a/data/org.gnome.Games.gresource.xml b/data/org.gnome.Games.gresource.xml
index dc309b63..032b0f2b 100644
--- a/data/org.gnome.Games.gresource.xml
+++ b/data/org.gnome.Games.gresource.xml
@@ -29,6 +29,8 @@
<file preprocess="xml-stripblanks">ui/keyboard-configurer.ui</file>
<file preprocess="xml-stripblanks">ui/keyboard-mapper.ui</file>
<file preprocess="xml-stripblanks">ui/keyboard-tester.ui</file>
+ <file preprocess="xml-stripblanks">ui/loading-box.ui</file>
+ <file preprocess="xml-stripblanks">ui/loading-header-bar.ui</file>
<file preprocess="xml-stripblanks">ui/media-menu-button.ui</file>
<file preprocess="xml-stripblanks">ui/media-selector.ui</file>
<file preprocess="xml-stripblanks">ui/platform-list-item.ui</file>
diff --git a/data/ui/application-window.ui b/data/ui/application-window.ui
index 9efae3e7..61b45eef 100644
--- a/data/ui/application-window.ui
+++ b/data/ui/application-window.ui
@@ -14,6 +14,14 @@
<child>
<object class="GtkStack" id="content_box">
<property name="visible">True</property>
+ <child>
+ <object class="GamesLoadingBox" id="loading_box">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="name">loading</property>
+ </packing>
+ </child>
<child>
<object class="GamesCollectionBox" id="collection_box">
<property name="visible">True</property>
@@ -37,6 +45,15 @@
<child type="titlebar">
<object class="GtkStack" id="header_bar">
<property name="visible">True</property>
+ <child>
+ <object class="GamesLoadingHeaderBar" id="loading_header_bar">
+ <property name="visible">True</property>
+ <property name="show_close_button">True</property>
+ </object>
+ <packing>
+ <property name="name">loading</property>
+ </packing>
+ </child>
<child>
<object class="GamesCollectionHeaderBar" id="collection_header_bar">
<property name="visible">True</property>
diff --git a/data/ui/loading-box.ui b/data/ui/loading-box.ui
new file mode 100644
index 00000000..ec2190f6
--- /dev/null
+++ b/data/ui/loading-box.ui
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.16"/>
+ <template class="GamesLoadingBox" parent="GtkBin">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkSpinner">
+ <property name="visible">True</property>
+ <property name="active">True</property>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/data/ui/loading-header-bar.ui b/data/ui/loading-header-bar.ui
new file mode 100644
index 00000000..c489c09a
--- /dev/null
+++ b/data/ui/loading-header-bar.ui
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="3.16"/>
+ <template class="GamesLoadingHeaderBar" parent="GtkHeaderBar">
+ <property name="visible">True</property>
+ </template>
+</interface>
diff --git a/src/meson.build b/src/meson.build
index 6c556d47..267f0c2a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -148,6 +148,8 @@ vala_sources = [
'ui/keyboard-configurer.vala',
'ui/keyboard-mapper.vala',
'ui/keyboard-tester.vala',
+ 'ui/loading-box.vala',
+ 'ui/loading-header-bar.vala',
'ui/konami-code.vala',
'ui/media-selector.vala',
'ui/media-menu-button.vala',
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 53debf3c..d7889f25 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -16,25 +16,33 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
_ui_state = value;
switch (ui_state) {
+ case UiState.LOADING:
+ content_box.set_visible_child (loading_box);
+ header_bar.set_visible_child (loading_header_bar);
+
+ break;
case UiState.COLLECTION:
content_box.set_visible_child (collection_box);
header_bar.set_visible_child (collection_header_bar);
- is_fullscreen = false;
-
- if (display_box.runner != null) {
- display_box.runner.stop ();
- display_box.runner = null;
- }
-
break;
case UiState.DISPLAY:
content_box.set_visible_child (display_box);
header_bar.set_visible_child (display_header_bar);
+ break;
+ }
+
+ if (ui_state != UiState.COLLECTION)
search_mode = false;
- break;
+ if (ui_state != UiState.DISPLAY) {
+ is_fullscreen = false;
+
+ if (display_box.runner != null) {
+ display_box.runner.stop ();
+ display_box.runner = null;
+ }
}
konami_code.reset ();
@@ -68,6 +76,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
[GtkChild]
private Gtk.Stack content_box;
[GtkChild]
+ private LoadingBox loading_box;
+ [GtkChild]
private CollectionBox collection_box;
[GtkChild]
private DisplayBox display_box;
@@ -75,6 +85,8 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
[GtkChild]
private Gtk.Stack header_bar;
[GtkChild]
+ private LoadingHeaderBar loading_header_bar;
+ [GtkChild]
private CollectionHeaderBar collection_header_bar;
[GtkChild]
private DisplayHeaderBar display_header_bar;
diff --git a/src/ui/loading-box.vala b/src/ui/loading-box.vala
new file mode 100644
index 00000000..d74a4301
--- /dev/null
+++ b/src/ui/loading-box.vala
@@ -0,0 +1,5 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/loading-box.ui")]
+private class Games.LoadingBox : Gtk.Bin {
+}
diff --git a/src/ui/loading-header-bar.vala b/src/ui/loading-header-bar.vala
new file mode 100644
index 00000000..aecc72e8
--- /dev/null
+++ b/src/ui/loading-header-bar.vala
@@ -0,0 +1,5 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+[GtkTemplate (ui = "/org/gnome/Games/ui/loading-header-bar.ui")]
+private class Games.LoadingHeaderBar : Gtk.HeaderBar {
+}
diff --git a/src/ui/ui-state.vala b/src/ui/ui-state.vala
index 68324f60..e504b6fd 100644
--- a/src/ui/ui-state.vala
+++ b/src/ui/ui-state.vala
@@ -1,6 +1,7 @@
// This file is part of GNOME Games. License: GPL-3.0+.
private enum Games.UiState {
+ LOADING,
COLLECTION,
DISPLAY,
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]