[gnome-games/wip/exalm/rebrand: 121/124] platforms-page: Replace leaflet with a flap
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/rebrand: 121/124] platforms-page: Replace leaflet with a flap
- Date: Sat, 19 Jun 2021 14:37:47 +0000 (UTC)
commit 0c8f0c1c9db98dca790c0c80e27f1e87fbbee33d
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Jun 19 17:46:51 2021 +0500
platforms-page: Replace leaflet with a flap
Avoid using a deprecated swipe group.
src/gtk-style.css | 50 ---
src/icons/view-sidebar-symbolic-rtl.svg | 68 +++++
src/icons/view-sidebar-symbolic.svg | 44 +++
src/org.gnome.Games.gresource.xml | 2 +
src/ui/collection-view.ui | 524 ++++++++++++++------------------
src/ui/collection-view.vala | 63 ++--
src/ui/platforms-page.ui | 22 +-
src/ui/platforms-page.vala | 67 ++--
8 files changed, 397 insertions(+), 443 deletions(-)
---
diff --git a/src/gtk-style.css b/src/gtk-style.css
index 81d33981..267b3c81 100644
--- a/src/gtk-style.css
+++ b/src/gtk-style.css
@@ -108,56 +108,6 @@ gamesflashbox {
background: none;
}
-box.sidebar,
-box.sidebar > list {
- transition: all 200ms;
- background: @theme_base_color;
- border: 0 solid @borders;
-}
-
-box.sidebar:backdrop,
-box.sidebar:backdrop > list {
- background-color: @theme_unfocused_base_color;
- border-color: @unfocused_borders;
-}
-
-.folded box.sidebar {
- padding: 18px;
- background: @theme_bg_color;
-}
-
-.folded:backdrop box.sidebar {
- background: @theme_unfocused_bg_color;
-}
-list.rounded,
-.folded box.sidebar > list {
- background: @theme_base_color;
- border-radius: 6px;
- border: 1px solid @borders;
-}
-
-list.rounded row:first-child,
- .folded box.sidebar > list row:first-child {
- border-top-left-radius: 6px;
- border-top-right-radius: 6px;
- -gtk-outline-top-left-radius: 6px;
- -gtk-outline-top-right-radius: 6px;
-}
-
-list.rounded row:last-child,
-.folded box.sidebar > list row:last-child {
- border-bottom-left-radius: 6px;
- border-bottom-right-radius: 6px;
- -gtk-outline-bottom-left-radius: 6px;
- -gtk-outline-bottom-right-radius: 6px;
-}
-
-list.rounded:backdrop,
-.folded:backdrop box.sidebar > list {
- background: @theme_unfocused_base_color;
- border-color: @unfocused_borders;
-}
-
list.separators row:not(:last-child) {
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
diff --git a/src/icons/view-sidebar-symbolic-rtl.svg b/src/icons/view-sidebar-symbolic-rtl.svg
new file mode 100644
index 00000000..a64dd061
--- /dev/null
+++ b/src/icons/view-sidebar-symbolic-rtl.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="4.2333331mm"
+ height="4.2333331mm"
+ viewBox="0 0 4.2333331 4.2333331"
+ version="1.1"
+ id="svg10539"
+ sodipodi:docname="view-sidebar-end-symbolic.svg"
+ inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ id="namedview8"
+ showgrid="false"
+ inkscape:zoom="51.04843"
+ inkscape:cx="7.9999996"
+ inkscape:cy="7.9999996"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg10539" />
+ <defs
+ id="defs10533" />
+ <metadata
+ id="metadata10536">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ transform="matrix(-1,0,0,1,-40.972619,-342.50834)">
+ <path
+ id="rect10509"
+
style="color:#bebebe;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#241f31;fill-opacity:1;stroke:none;stroke-width:1;marker:none"
+ d="M 3,2 C 1.9093002,2 1,2.9093039 1,4 v 8 c 0,1.090696 0.9093002,2 2,2 h 10 c 1.090704,0 2,-0.909304
2,-2 V 4 C 15,2.9093039 14.090704,2 13,2 Z m 0,2 h 3 v 8 H 3 Z m 4,0 h 6 v 8 H 7 Z"
+ transform="matrix(0.26458333,0,0,0.26458333,-45.205952,342.50834)" />
+ <rect
+ transform="matrix(0,-1,-1,0,0,0)"
+
style="color:#bebebe;display:inline;overflow:visible;visibility:visible;opacity:0.35;fill:#241f31;fill-opacity:1;stroke:none;stroke-width:0.264583;marker:none"
+ id="rect10511"
+ width="2.1166327"
+ height="0.79374611"
+ x="-345.68332"
+ y="43.618412" />
+ </g>
+</svg>
diff --git a/src/icons/view-sidebar-symbolic.svg b/src/icons/view-sidebar-symbolic.svg
new file mode 100644
index 00000000..780e286c
--- /dev/null
+++ b/src/icons/view-sidebar-symbolic.svg
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ width="4.2333331mm"
+ height="4.2333331mm"
+ viewBox="0 0 4.2333331 4.2333331"
+ version="1.1"
+ id="svg10539">
+ <defs
+ id="defs10533" />
+ <metadata
+ id="metadata10536">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ transform="translate(45.205952,-342.50834)">
+ <path
+ id="rect10509"
+
style="color:#bebebe;display:inline;overflow:visible;visibility:visible;opacity:1;fill:#241f31;fill-opacity:1;stroke:none;stroke-width:0.99999994;marker:none"
+ d="M 3 2 C 1.9093002 2 1 2.9093039 1 4 L 1 12 C 1 13.090696 1.9093002 14 3 14 L 13 14 C 14.090704 14
15 13.090696 15 12 L 15 4 C 15 2.9093039 14.090704 2 13 2 L 3 2 z M 3 4 L 6 4 L 6 12 L 3 12 L 3 4 z M 7 4 L
13 4 L 13 12 L 7 12 L 7 4 z "
+ transform="matrix(0.26458333,0,0,0.26458333,-45.205952,342.50834)" />
+ <rect
+ transform="matrix(0,-1,-1,0,0,0)"
+
style="color:#bebebe;display:inline;overflow:visible;visibility:visible;opacity:0.35;fill:#241f31;fill-opacity:1;stroke:none;stroke-width:0.26458332;marker:none"
+ id="rect10511"
+ width="2.1166327"
+ height="0.79374611"
+ x="-345.68332"
+ y="43.618412" />
+ </g>
+</svg>
diff --git a/src/org.gnome.Games.gresource.xml b/src/org.gnome.Games.gresource.xml
index 689cb99a..876ef05a 100644
--- a/src/org.gnome.Games.gresource.xml
+++ b/src/org.gnome.Games.gresource.xml
@@ -12,6 +12,8 @@
<file preprocess="xml-stripblanks">icons/screen-layout-right-left-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/screen-layout-top-bottom-symbolic.svg</file>
<file preprocess="xml-stripblanks">icons/view-bottom-screen-symbolic.svg</file>
+ <file preprocess="xml-stripblanks">icons/view-sidebar-symbolic.svg</file>
+ <file preprocess="xml-stripblanks">icons/view-sidebar-symbolic-rtl.svg</file>
<file preprocess="xml-stripblanks">icons/view-top-screen-symbolic.svg</file>
<file preprocess="xml-stripblanks">gesture/button-east-symbolic.svg</file>
diff --git a/src/ui/collection-view.ui b/src/ui/collection-view.ui
index fb5eb816..ad35d91d 100644
--- a/src/ui/collection-view.ui
+++ b/src/ui/collection-view.ui
@@ -10,7 +10,7 @@
<signal name="notify::is-showing-bottom-bar" handler="update_bottom_bar"/>
<signal name="notify::is-subview-open" handler="update_bottom_bar"/>
<signal name="notify::is-selection-mode" handler="on_selection_mode_changed"/>
- <signal name="notify::is-empty-collection" handler="on_empty_collection_changed"/>
+ <signal name="notify::is-empty-collection" handler="update_adaptive_state"/>
<signal name="notify::search-mode" handler="on_search_mode_changed"/>
<child>
<object class="GtkStack" id="header_bar_stack">
@@ -20,297 +20,234 @@
<object class="HdyDeck" id="collections_deck">
<property name="visible">True</property>
<property name="can-swipe-back">True</property>
- <child>
- <object class="HdyDeck" id="platforms_deck">
- <property name="visible">True</property>
- <property name="can-swipe-back">True</property>
- <child>
- <object class="HdyHeaderBar" id="header_bar">
- <property name="visible">True</property>
- <property name="show-close-button">True</property>
- <property name="centering-policy">strict</property>
- <child>
- <object class="GtkButton" id="add_game">
- <property name="visible" bind-source="GamesCollectionView"
bind-property="is-add-available"/>
- <property name="valign">center</property>
- <property name="action-name">app.add-game-files</property>
- <style>
- <class name="image-button"/>
- </style>
- <child internal-child="accessible">
- <object class="AtkObject" id="a11y-back">
- <property name="accessible-name" translatable="yes">Add game files…</property>
- </object>
- </child>
- <child>
- <object class="GtkImage" id="add_game_image">
- <property name="visible">True</property>
- <property name="icon-name">list-add-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">start</property>
- </packing>
- </child>
- <child>
- <object class="GtkMenuButton" id="menu">
- <property name="menu-model">primary_menu</property>
- <!-- Translators: tooltip for the application menu button -->
- <property name="tooltip-text" translatable="yes">Menu</property>
- <property name="valign">center</property>
- <property name="visible">True</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="GtkImage" id="menu_image">
- <property name="visible">True</property>
- <property name="icon-name">open-menu-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- <child type="title">
- <object class="HdyViewSwitcherTitle" id="view_switcher_title">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Games</property>
- <property name="stack">viewstack</property>
- <property name="view-switcher-enabled" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|sync-create|invert-boolean"/>
- <signal name="notify::title-visible" handler="update_adaptive_state"/>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="selection_button">
- <property name="visible" bind-source="GamesCollectionView"
bind-property="is_selection_available" bind-flags="bidirectional"/>
- <property name="valign">center</property>
- <property name="action-name">view.toggle-select</property>
- <property name="sensitive" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|invert-boolean"/>
- <child>
- <object class="GtkImage" id="select_image">
- <property name="visible">True</property>
- <property name="icon-name">object-select-symbolic</property>
- </object>
- </child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Select games</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleButton" id="search">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="active" bind-source="GamesCollectionView"
bind-property="search-mode" bind-flags="bidirectional"/>
- <property name="sensitive" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|invert-boolean"/>
- <style>
- <class name="image-button"/>
- </style>
- <child internal-child="accessible">
- <object class="AtkObject" id="a11y-search">
- <property name="accessible-name" translatable="yes">Search</property>
- </object>
- </child>
- <child>
- <object class="GtkImage" id="search_image">
- <property name="visible">True</property>
- <property name="icon-name">edit-find-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="HdyHeaderBar" id="subview_header_bar">
- <property name="visible">True</property>
- <property name="show_close_button">True</property>
- <property name="title" bind-source="platforms_page" bind-property="subview-title"/>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="on_subview_back_clicked"/>
- <style>
- <class name="image-button"/>
- </style>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Back</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">go-previous-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="subview_selection_button">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="sensitive" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|invert-boolean"/>
- <property name="action-name">view.toggle-select</property>"
- <child>
- <object class="GtkImage" id="subview_select_image">
- <property name="visible">True</property>
- <property name="icon-name">object-select-symbolic</property>
- </object>
- </child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Select games</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleButton" id="search_subview">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="active" bind-source="GamesCollectionView"
bind-property="search-mode" bind-flags="bidirectional"/>
- <property name="sensitive" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|invert-boolean"/>
- <style>
- <class name="image-button"/>
- </style>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Search</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">edit-find-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="HdyHeaderBar" id="collection_subpage_header_bar">
- <property name="visible">True</property>
- <property name="show-close-button">True</property>
- <property name="title" bind-source="collections_page" bind-property="collection-title"/>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="on_collection_subpage_back_clicked"/>
- <style>
- <class name="image-button"/>
- </style>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Back</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">go-previous-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton">
- <property name="menu-model">collection_menu</property>
- <property name="tooltip-text" translatable="yes">Collection menu</property>
- <property name="valign">center</property>
- <property name="visible" bind-source="collections_page"
bind-property="is-showing-user-collection"/>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">view-more-symbolic</property>
- </object>
- </child>
- <style>
- <class name="image-button"/>
- </style>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="action-name">view.toggle-select</property>
- <property name="sensitive" bind-source="collections_page"
bind-property="is-collection-empty" bind-flags="invert-boolean"/>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">object-select-symbolic</property>
- </object>
- </child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Select games</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- <child>
- <object class="GtkToggleButton">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <property name="active" bind-source="GamesCollectionView" bind-property="search-mode"
bind-flags="bidirectional"/>
- <property name="sensitive" bind-source="collections_page"
bind-property="is-collection-empty" bind-flags="invert-boolean"/>
- <style>
- <class name="image-button"/>
- </style>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="accessible-name" translatable="yes">Search</property>
- </object>
- </child>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon-name">edit-find-symbolic</property>
- <property name="icon-size">1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack-type">end</property>
- </packing>
- </child>
- </object>
- </child>
+ <child>
+ <object class="HdyHeaderBar" id="header_bar">
+ <property name="visible">True</property>
+ <property name="show-close-button">True</property>
+ <property name="centering-policy">strict</property>
+ <child>
+ <object class="GtkToggleButton" id="sidebar_button">
+ <property name="visible" bind-source="GamesCollectionView"
bind-property="is-sidebar-available"/>
+ <property name="valign">center</property>
+ <property name="tooltip-text" translatable="yes">Sidebar</property>
+ <property name="active" bind-source="platforms_page" bind-property="is-sidebar-visible"
bind-flags="sync-create|bidirectional"/>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">view-sidebar-symbolic</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="add_game">
+ <property name="visible" bind-source="GamesCollectionView"
bind-property="is-add-available"/>
+ <property name="valign">center</property>
+ <property name="action-name">app.add-game-files</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="a11y-back">
+ <property name="accessible-name" translatable="yes">Add game files…</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage" id="add_game_image">
+ <property name="visible">True</property>
+ <property name="icon-name">list-add-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="menu">
+ <property name="menu-model">primary_menu</property>
+ <!-- Translators: tooltip for the application menu button -->
+ <property name="tooltip-text" translatable="yes">Menu</property>
+ <property name="valign">center</property>
+ <property name="visible">True</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="menu_image">
+ <property name="visible">True</property>
+ <property name="icon-name">open-menu-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child type="title">
+ <object class="HdyViewSwitcherTitle" id="view_switcher_title">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">Games</property>
+ <property name="stack">viewstack</property>
+ <property name="view-switcher-enabled" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|sync-create|invert-boolean"/>
+ <signal name="notify::title-visible" handler="update_adaptive_state"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="selection_button">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="action-name">view.toggle-select</property>
+ <property name="sensitive" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|invert-boolean"/>
+ <child>
+ <object class="GtkImage" id="select_image">
+ <property name="visible">True</property>
+ <property name="icon-name">object-select-symbolic</property>
+ </object>
+ </child>
+ <child internal-child="accessible">
+ <object class="AtkObject">
+ <property name="accessible-name" translatable="yes">Select games</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="search">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="active" bind-source="GamesCollectionView" bind-property="search-mode"
bind-flags="bidirectional"/>
+ <property name="sensitive" bind-source="GamesCollectionView"
bind-property="is-empty-collection" bind-flags="bidirectional|invert-boolean"/>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="a11y-search">
+ <property name="accessible-name" translatable="yes">Search</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage" id="search_image">
+ <property name="visible">True</property>
+ <property name="icon-name">edit-find-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="HdyHeaderBar" id="collection_subpage_header_bar">
+ <property name="visible">True</property>
+ <property name="show-close-button">True</property>
+ <property name="title" bind-source="collections_page" bind-property="collection-title"/>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="on_collection_subpage_back_clicked"/>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child internal-child="accessible">
+ <object class="AtkObject">
+ <property name="accessible-name" translatable="yes">Back</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">go-previous-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuButton">
+ <property name="menu-model">collection_menu</property>
+ <property name="tooltip-text" translatable="yes">Collection menu</property>
+ <property name="valign">center</property>
+ <property name="visible" bind-source="collections_page"
bind-property="is-showing-user-collection"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">view-more-symbolic</property>
+ </object>
+ </child>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="action-name">view.toggle-select</property>
+ <property name="sensitive" bind-source="collections_page"
bind-property="is-collection-empty" bind-flags="invert-boolean"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">object-select-symbolic</property>
+ </object>
+ </child>
+ <child internal-child="accessible">
+ <object class="AtkObject">
+ <property name="accessible-name" translatable="yes">Select games</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton">
+ <property name="visible">True</property>
+ <property name="valign">center</property>
+ <property name="active" bind-source="GamesCollectionView" bind-property="search-mode"
bind-flags="bidirectional"/>
+ <property name="sensitive" bind-source="collections_page"
bind-property="is-collection-empty" bind-flags="invert-boolean"/>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child internal-child="accessible">
+ <object class="AtkObject">
+ <property name="accessible-name" translatable="yes">Search</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon-name">edit-find-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</object>
</child>
<child>
@@ -456,10 +393,8 @@
<object class="GamesPlatformsPage" id="platforms_page">
<property name="visible">True</property>
<property name="is-folded" bind-source="GamesCollectionView" bind-property="is-folded"
bind-flags="bidirectional"/>
- <property name="is-subview-open" bind-source="GamesCollectionView"
bind-property="is-subview-open" bind-flags="bidirectional"/>
<property name="is-selection-mode" bind-source="GamesCollectionView"
bind-property="is-selection-mode" bind-flags="bidirectional"/>
<signal name="game-activated" handler="on_game_activated"/>
- <signal name="notify::is-subview-open" handler="update_selection_availability"/>
<signal name="selected-items-changed" handler="on_selected_items_changed"/>
</object>
<packing>
@@ -632,7 +567,6 @@
</object>
</child>
</object>
- <object class="HdySwipeGroup" id="swipe_group"/>
<object class="HdySwipeGroup" id="collections_swipe_group">
<swipeables>
<swipeable name="collections_deck"/>
diff --git a/src/ui/collection-view.vala b/src/ui/collection-view.vala
index 7a7a4ed6..7678a045 100644
--- a/src/ui/collection-view.vala
+++ b/src/ui/collection-view.vala
@@ -6,8 +6,6 @@ private class Games.CollectionView : Gtk.Box, UiView {
public signal void game_activated (Game game);
- [GtkChild]
- private unowned Hdy.Deck platforms_deck;
[GtkChild]
private unowned Hdy.Deck collections_deck;
[GtkChild]
@@ -15,8 +13,6 @@ private class Games.CollectionView : Gtk.Box, UiView {
[GtkChild]
private unowned Hdy.HeaderBar header_bar;
[GtkChild]
- private unowned Hdy.HeaderBar subview_header_bar;
- [GtkChild]
private unowned Hdy.HeaderBar selection_mode_header_bar;
[GtkChild]
private unowned Hdy.ViewSwitcherTitle view_switcher_title;
@@ -45,8 +41,6 @@ private class Games.CollectionView : Gtk.Box, UiView {
[GtkChild]
private unowned Hdy.ViewSwitcherBar view_switcher_bar;
[GtkChild]
- private unowned Hdy.SwipeGroup swipe_group;
- [GtkChild]
private unowned Hdy.SwipeGroup collections_swipe_group;
[GtkChild]
private unowned UndoNotification undo_notification;
@@ -132,11 +126,11 @@ private class Games.CollectionView : Gtk.Box, UiView {
public bool is_showing_bottom_bar { get; set; }
public bool is_subview_open { get; set; }
public bool is_selection_mode { get; set; }
- public bool is_selection_available { get; set; }
public bool is_collection_rename_valid { get; set; }
public bool show_game_actions { get; set; }
public bool show_remove_action_button { get; set; }
public bool is_add_available { get; set; }
+ public bool is_sidebar_available { get; set; }
private CollectionManager collection_manager;
private KonamiCode konami_code;
@@ -152,6 +146,8 @@ private class Games.CollectionView : Gtk.Box, UiView {
{ "remove-from-collection", remove_from_collection }
};
+ private Binding title_binding;
+
construct {
collection_manager = Application.get_default ().get_collection_manager ();
collection_manager.collection_empty_changed.connect (() => {
@@ -166,7 +162,6 @@ private class Games.CollectionView : Gtk.Box, UiView {
viewstack.child_set (games_page, "icon-name", icon_name);
empty_collection.icon_name = icon_name;
- swipe_group.add_swipeable (platforms_page.get_leaflet ());
collections_swipe_group.add_swipeable (collections_page.get_collections_deck ());
konami_code = new KonamiCode (window);
@@ -199,9 +194,8 @@ private class Games.CollectionView : Gtk.Box, UiView {
if (((event.state & default_modifiers) == Gdk.ModifierType.MOD1_MASK) &&
(((window.get_direction () == Gtk.TextDirection.LTR) && keyval == Gdk.Key.Left) ||
((window.get_direction () == Gtk.TextDirection.RTL) && keyval == Gdk.Key.Right)) &&
- !is_selection_mode &&
- (platforms_deck.navigate (Hdy.NavigationDirection.BACK) ||
- collections_page.exit_subpage ())) {
+ !is_selection_mode &&
+ collections_page.exit_subpage ()) {
return true;
}
@@ -564,23 +558,12 @@ private class Games.CollectionView : Gtk.Box, UiView {
if (collections_page.is_subpage_open)
collections_deck.visible_child = collection_subpage_header_bar;
else
- collections_deck.visible_child = platforms_deck;
+ collections_deck.visible_child = header_bar;
}
update_bottom_bar ();
}
- [GtkCallback]
- private void on_empty_collection_changed () {
- update_adaptive_state ();
- update_selection_availability ();
- }
-
- [GtkCallback]
- private void update_selection_availability () {
- is_selection_available = viewstack.visible_child != platforms_page || !is_folded;
- }
-
[GtkCallback]
private void on_loading_notification_closed () {
loading_notification = false;
@@ -593,12 +576,22 @@ private class Games.CollectionView : Gtk.Box, UiView {
[GtkCallback]
private void on_visible_child_changed () {
- if (viewstack.visible_child == games_page)
+ if (viewstack.visible_child == platforms_page)
+ title_binding = platforms_page.bind_property ("subview-title", view_switcher_title,
"title", SYNC_CREATE);
+ else if (title_binding != null) {
+ title_binding.unbind ();
+ title_binding = null;
+ }
+
+ if (viewstack.visible_child == games_page) {
games_page.reset_scroll_position ();
- else if (viewstack.visible_child == platforms_page)
+ view_switcher_title.title = _("Games");
+ } else if (viewstack.visible_child == platforms_page) {
platforms_page.reset ();
- else
+ } else {
collections_page.reset_scroll_position ();
+ view_switcher_title.title = _("Collections");
+ }
filtering_text = null;
@@ -606,9 +599,9 @@ private class Games.CollectionView : Gtk.Box, UiView {
on_search_text_notify ();
}
- update_selection_availability ();
update_add_game_availablity ();
update_available_selection_actions ();
+ update_sidebar_availability ();
}
[GtkCallback]
@@ -648,22 +641,13 @@ private class Games.CollectionView : Gtk.Box, UiView {
[GtkCallback]
private void on_folded_changed () {
- if (is_folded) {
- platforms_deck.visible_child = is_subview_open ? subview_header_bar : header_bar;
- swipe_group.add_swipeable (platforms_deck);
- } else {
- swipe_group.remove_swipeable (platforms_deck);
- platforms_deck.visible_child = header_bar;
- }
-
update_bottom_bar ();
- update_selection_availability ();
+ update_sidebar_availability ();
}
[GtkCallback]
private void update_bottom_bar () {
view_switcher_bar.reveal = !is_selection_mode && is_showing_bottom_bar
- && (!is_folded || !is_subview_open)
&& !collections_page.is_subpage_open;
}
@@ -673,8 +657,7 @@ private class Games.CollectionView : Gtk.Box, UiView {
is_showing_bottom_bar = showing_title && !is_empty_collection;
}
- [GtkCallback]
- private void on_subview_back_clicked () {
- platforms_deck.navigate (Hdy.NavigationDirection.BACK);
+ private void update_sidebar_availability () {
+ is_sidebar_available = viewstack.visible_child == platforms_page && is_folded;
}
}
diff --git a/src/ui/platforms-page.ui b/src/ui/platforms-page.ui
index 3ba0c420..3e1ceacc 100644
--- a/src/ui/platforms-page.ui
+++ b/src/ui/platforms-page.ui
@@ -6,15 +6,16 @@
<signal name="map" after="yes" handler="on_map"/>
<signal name="unmap" after="no" handler="on_unmap"/>
<signal name="notify::is-folded" handler="on_folded_changed"/>
+ <signal name="notify::is-selection-mode" handler="on_selection_mode_changed"/>
<child>
- <object class="HdyLeaflet" id="leaflet">
+ <object class="HdyFlap" id="flap">
<property name="visible">True</property>
- <property name="can-swipe-back">True</property>
- <property name="mode-transition-duration">200</property>
- <property name="can-swipe-back" bind-source="GamesPlatformsPage" bind-property="is-selection-mode"
bind-flags="invert-boolean"/>
- <signal name="notify::folded" handler="on_leaflet_folded_changed"/>
- <signal name="notify::visible-child" handler="on_visible_child_changed"/>
- <child>
+ <property name="swipe-to-close" bind-source="flap" bind-property="folded" bind-flags="sync-create"/>
+ <property name="swipe-to-open" bind-source="GamesPlatformsPage" bind-property="is-selection-mode"
bind-flags="invert-boolean"/>
+ <property name="locked" bind-source="GamesPlatformsPage" bind-property="is-selection-mode"/>
+ <property name="reveal-flap" bind-source="GamesPlatformsPage" bind-property="is-sidebar-visible"
bind-flags="sync-create|bidirectional"/>
+ <signal name="notify::folded" handler="on_flap_folded_changed"/>
+ <child type="flap">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="vexpand">True</property>
@@ -39,18 +40,15 @@
</child>
</object>
</child>
- <child>
+ <child type="separator">
<object class="GtkSeparator">
<property name="visible">True</property>
<style>
<class name="sidebar"/>
</style>
</object>
- <packing>
- <property name="navigatable">False</property>
- </packing>
</child>
- <child>
+ <child type="content">
<object class="GamesGamesPage" id="games_page">
<property name="visible">True</property>
<property name="hexpand">True</property>
diff --git a/src/ui/platforms-page.vala b/src/ui/platforms-page.vala
index 7742da6f..f5351a9b 100644
--- a/src/ui/platforms-page.vala
+++ b/src/ui/platforms-page.vala
@@ -6,7 +6,7 @@ private class Games.PlatformsPage : Gtk.Bin {
public signal void selected_items_changed ();
[GtkChild]
- private unowned Hdy.Leaflet leaflet;
+ private unowned Hdy.Flap flap;
[GtkChild]
private unowned Gtk.ListBox list_box;
[GtkChild]
@@ -15,7 +15,6 @@ private class Games.PlatformsPage : Gtk.Bin {
private unowned GamepadBrowse gamepad_browse;
private Platform selected_platform;
- private bool has_used_gamepad;
private string[] filtering_terms;
@@ -47,7 +46,7 @@ private class Games.PlatformsPage : Gtk.Bin {
}
public bool is_folded { get; set; }
- public bool is_subview_open { get; set; }
+ public bool is_sidebar_visible { get; set; }
public string subview_title { get; set; }
public bool is_selection_mode { get; set; }
public bool is_search_empty { get; set; }
@@ -175,9 +174,6 @@ private class Games.PlatformsPage : Gtk.Bin {
if (first_row == null)
return false;
- has_used_gamepad = true;
- update_selection_mode ();
-
// This is needed to start moving the cursor with the gamepad only.
first_row.focus (direction);
@@ -196,7 +192,8 @@ private class Games.PlatformsPage : Gtk.Bin {
return true;
case Gtk.DirectionType.RIGHT:
- leaflet.navigate (Hdy.NavigationDirection.FORWARD);
+ if (flap.folded)
+ flap.reveal_flap = false;
games_page.select_default_game (Gtk.DirectionType.RIGHT);
return true;
@@ -207,7 +204,9 @@ private class Games.PlatformsPage : Gtk.Bin {
[GtkCallback]
private bool on_gamepad_accept () {
- leaflet.navigate (Hdy.NavigationDirection.FORWARD);
+ if (flap.folded)
+ flap.reveal_flap = false;
+
games_page.select_default_game (Gtk.DirectionType.RIGHT);
return true;
@@ -216,7 +215,7 @@ private class Games.PlatformsPage : Gtk.Bin {
[GtkCallback]
private bool on_gamepad_cancel () {
games_page.unselect_game ();
- leaflet.navigate (Hdy.NavigationDirection.BACK);
+ flap.reveal_flap = true;
return true;
}
@@ -225,7 +224,8 @@ private class Games.PlatformsPage : Gtk.Bin {
private void on_list_box_row_activated (Gtk.ListBoxRow row_item) {
select_platform_for_row (row_item);
- leaflet.navigate (Hdy.NavigationDirection.FORWARD);
+ if (flap.folded)
+ flap.reveal_flap = false;
}
private void select_platform_for_row (Gtk.ListBoxRow row_item) {
@@ -239,7 +239,7 @@ private class Games.PlatformsPage : Gtk.Bin {
public void reset () {
select_first_visible_row ();
- leaflet.navigate (Hdy.NavigationDirection.BACK);
+ flap.reveal_flap = true;
}
private void select_first_visible_row () {
@@ -255,20 +255,6 @@ private class Games.PlatformsPage : Gtk.Bin {
}
}
- private void select_current_row () {
- if (is_folded && !has_used_gamepad)
- return;
-
- foreach (var child in list_box.get_children ()) {
- var platform_item = child as PlatformListItem;
-
- if (Platform.equal (platform_item.platform, selected_platform)) {
- list_box.select_row (platform_item);
- break;
- }
- }
- }
-
private Gtk.Widget add_platform (Object object) {
var platform = object as Platform;
@@ -278,38 +264,27 @@ private class Games.PlatformsPage : Gtk.Bin {
return item;
}
- private void update_selection_mode () {
- if (!is_folded || has_used_gamepad)
- list_box.selection_mode = Gtk.SelectionMode.SINGLE;
- else
- list_box.selection_mode = Gtk.SelectionMode.NONE;
- select_current_row ();
- }
-
[GtkCallback]
private void on_folded_changed () {
- update_selection_mode ();
-
if (is_selection_mode && is_folded)
- leaflet.navigate (Hdy.NavigationDirection.FORWARD);
+ flap.reveal_flap = false;
}
[GtkCallback]
- private void on_leaflet_folded_changed () {
- is_folded = leaflet.folded;
+ private void on_selection_mode_changed () {
+ if (is_selection_mode)
+ flap.reveal_flap = false;
+ else if (!flap.folded)
+ flap.reveal_flap = true;
}
[GtkCallback]
- public void on_game_activated (Game game) {
- game_activated (game);
+ private void on_flap_folded_changed () {
+ is_folded = flap.folded;
}
[GtkCallback]
- private void on_visible_child_changed () {
- is_subview_open = (leaflet.visible_child == games_page);
- }
-
- public Hdy.Leaflet get_leaflet () {
- return leaflet;
+ public void on_game_activated (Game game) {
+ game_activated (game);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]