[gnome-games/wip/exalm/savestates: 1/5] ui: Track snapshot revealer transition through DisplayBox
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/savestates: 1/5] ui: Track snapshot revealer transition through DisplayBox
- Date: Sun, 26 Jan 2020 19:23:35 +0000 (UTC)
commit f62550fdd4afc0587fc823a18955fef1fad14441
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Jan 26 23:10:17 2020 +0500
ui: Track snapshot revealer transition through DisplayBox
Get rid of SavestatesListState.on_revealer_transition_end()
data/ui/display-box.ui | 1 +
src/ui/display-box.vala | 6 ++++++
src/ui/display-view.vala | 7 ++++---
src/ui/savestates-list-state.vala | 1 -
src/ui/savestates-list.vala | 5 ++++-
5 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/display-box.ui b/data/ui/display-box.ui
index 0e2044ff..106c7d30 100644
--- a/data/ui/display-box.ui
+++ b/data/ui/display-box.ui
@@ -46,6 +46,7 @@
<property name="visible">True</property>
<property name="halign">end</property>
<signal name="size-allocate" handler="on_savestates_list_size_allocate"/>
+ <signal name="hidden" handler="on_snapshots_hidden"/>
</object>
</child>
</object>
diff --git a/src/ui/display-box.vala b/src/ui/display-box.vala
index 412002bd..37c71e24 100644
--- a/src/ui/display-box.vala
+++ b/src/ui/display-box.vala
@@ -3,6 +3,7 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/display-box.ui")]
private class Games.DisplayBox : Gtk.Bin {
public signal void back ();
+ public signal void snapshots_hidden ();
private bool _is_fullscreen;
public bool is_fullscreen {
@@ -140,4 +141,9 @@ private class Games.DisplayBox : Gtk.Bin {
private void on_savestates_list_size_allocate (Gtk.Allocation allocation) {
display_bin.horizontal_offset = -allocation.width / 2;
}
+
+ [GtkCallback]
+ private void on_snapshots_hidden () {
+ snapshots_hidden ();
+ }
}
diff --git a/src/ui/display-view.vala b/src/ui/display-view.vala
index 6adc3e5e..29e5a9db 100644
--- a/src/ui/display-view.vala
+++ b/src/ui/display-view.vala
@@ -62,10 +62,11 @@ private class Games.DisplayView : Object, UiView {
box = new DisplayBox (savestates_list_state);
header_bar = new DisplayHeaderBar (savestates_list_state);
- savestates_list_state.on_revealer_transition_end.connect (on_savestates_list_transition_end);
box.back.connect (on_display_back);
header_bar.back.connect (on_display_back);
+ box.snapshots_hidden.connect (on_snapshots_hidden);
+
settings = new Settings ("org.gnome.Games");
bind_property ("is-fullscreen", box,
@@ -481,8 +482,8 @@ private class Games.DisplayView : Object, UiView {
box.header_bar.media_set = null;
}
- public void on_savestates_list_transition_end () {
- if (!savestates_list_state.is_revealed && window.is_active) {
+ public void on_snapshots_hidden () {
+ if (window.is_active) {
box.runner.resume ();
box.runner.get_display ().grab_focus ();
}
diff --git a/src/ui/savestates-list-state.vala b/src/ui/savestates-list-state.vala
index b34f920e..546da1af 100644
--- a/src/ui/savestates-list-state.vala
+++ b/src/ui/savestates-list-state.vala
@@ -1,7 +1,6 @@
private class Games.SavestatesListState : Object {
public signal void load_clicked ();
public signal void delete_clicked ();
- public signal void on_revealer_transition_end ();
public bool is_revealed { get; set; }
public Savestate? selected_savestate { get; set; }
diff --git a/src/ui/savestates-list.vala b/src/ui/savestates-list.vala
index 99b4d6cf..e2435cbc 100644
--- a/src/ui/savestates-list.vala
+++ b/src/ui/savestates-list.vala
@@ -2,6 +2,8 @@
[GtkTemplate (ui = "/org/gnome/Games/ui/savestates-list.ui")]
private class Games.SavestatesList : Gtk.Box {
+ public signal void hidden ();
+
[GtkChild]
private Gtk.Revealer revealer;
[GtkChild]
@@ -144,7 +146,8 @@ private class Games.SavestatesList : Gtk.Box {
[GtkCallback]
private void on_revealer_transition_end () {
- state.on_revealer_transition_end ();
+ if (!state.is_revealed)
+ hidden ();
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]