Commit 3a5e492c authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko
Browse files

ui: Restore popover fullscreen autohide block

parent d251595c
Pipeline #292546 passed with stage
in 58 minutes and 34 seconds
......@@ -3,10 +3,14 @@
<requires lib="gtk+" version="3.24"/>
<template class="HighscoreNintendo64PakSwitcher" parent="AdwBin">
<child>
<object class="GtkMenuButton" id="menu_button">
<object class="GtkMenuButton">
<property name="icon-name">input-gaming-symbolic</property>
<property name="tooltip-text" translatable="yes">Controller Expansion</property>
<signal name="notify::active" handler="on_menu_state_changed"/>
<property name="popover">
<object class="GtkPopoverMenu" id="menu_popover">
<signal name="notify::visible" handler="on_menu_state_changed"/>
</object>
</property>
</object>
</child>
</template>
......
......@@ -3,7 +3,7 @@
[GtkTemplate (ui = "/org/gnome/World/Highscore/platforms/nintendo-64/nintendo-64-pak-switcher.ui")]
private class Highscore.Nintendo64PakSwitcher : Adw.Bin, HeaderBarWidget {
[GtkChild]
private unowned Gtk.MenuButton menu_button;
private unowned Gtk.PopoverMenu menu_popover;
public Nintendo64Runner runner { get; construct; }
......@@ -12,16 +12,15 @@ private class Highscore.Nintendo64PakSwitcher : Adw.Bin, HeaderBarWidget {
public Nintendo64Pak pak3 { get; set; }
public Nintendo64Pak pak4 { get; set; }
private bool is_menu_open;
public bool block_autohide {
get { return is_menu_open; }
public bool popover_visible {
get { return menu_popover.visible; }
}
private Menu menu;
public override void constructed () {
menu = new Menu ();
menu_button.menu_model = menu;
menu_popover.menu_model = menu;
update_ui ();
......@@ -52,8 +51,7 @@ private class Highscore.Nintendo64PakSwitcher : Adw.Bin, HeaderBarWidget {
[GtkCallback]
private void on_menu_state_changed () {
// FIXME GTK4 is_menu_open = menu_button.active;
notify_property ("block-autohide");
notify_property ("popover-visible");
}
private void update_ui () {
......
......@@ -18,9 +18,9 @@
<object class="GtkMenuButton" id="layout_button">
<!-- FIXME GTK4 need an arrow -->
<property name="tooltip-text" translatable="yes">Screen Layout</property>
<signal name="notify::active" handler="on_menu_state_changed"/>
<property name="popover">
<object class="GtkPopover" id="layout_popover">
<signal name="notify::visible" handler="on_menu_state_changed"/>
<signal name="show" handler="update_ui"/>
<child>
<object class="GtkListBox" id="list_box">
......
......@@ -18,9 +18,8 @@ public class Highscore.ScreenLayoutSwitcher : Gtk.Box, HeaderBarWidget {
public ScreenLayout screen_layout { get; set; }
public bool view_bottom_screen { get; set; }
private bool is_menu_open;
public bool block_autohide {
get { return is_menu_open; }
public bool popover_visible {
get { return layout_popover.visible; }
}
static construct {
......@@ -80,8 +79,7 @@ public class Highscore.ScreenLayoutSwitcher : Gtk.Box, HeaderBarWidget {
[GtkCallback]
private void on_menu_state_changed () {
// FIXME GTK4 is_menu_open = layout_button.active;
notify_property ("block-autohide");
notify_property ("popover-visible");
}
[GtkCallback]
......
......@@ -42,9 +42,13 @@
<property name="visible">False</property>
<property name="icon-name">view-more-symbolic</property>
<property name="tooltip-text" translatable="yes">Menu</property>
<property name="menu-model">secondary_menu</property>
<property name="primary">True</property>
<signal name="notify::active" handler="update_fullscreen_box"/>
<property name="popover">
<object class="GtkPopoverMenu" id="secondary_menu_popover">
<property name="menu-model">secondary_menu</property>
<signal name="notify::visible" handler="update_fullscreen_box"/>
</object>
</property>
</object>
</child>
<child type="end">
......@@ -57,7 +61,7 @@
</child>
<child type="end">
<object class="HighscoreMediaMenuButton" id="media_button">
<signal name="notify::active" handler="update_fullscreen_box"/>
<signal name="notify::popover-visible" handler="update_fullscreen_box"/>
</object>
</child>
<child type="end">
......
......@@ -17,6 +17,8 @@ private class Highscore.DisplayView : Adw.Bin, UiView {
[GtkChild]
private unowned Gtk.MenuButton secondary_menu_button;
[GtkChild]
private unowned Gtk.PopoverMenu secondary_menu_popover;
[GtkChild]
private unowned Gtk.HeaderBar snapshots_header_bar;
[GtkChild]
private unowned MediaMenuButton media_button;
......@@ -109,15 +111,15 @@ private class Highscore.DisplayView : Adw.Bin, UiView {
return;
if (extra_widget != null) {
extra_widget.disconnect (extra_widget_notify_block_autohide_id);
extra_widget.disconnect (extra_widget_notify_popover_visible_id);
ingame_header_bar.remove (extra_widget);
extra_widget_notify_block_autohide_id = 0;
extra_widget_notify_popover_visible_id = 0;
}
_extra_widget = value;
if (extra_widget != null) {
extra_widget_notify_block_autohide_id = extra_widget.notify["block-autohide"].connect (update_fullscreen_box);
extra_widget_notify_popover_visible_id = extra_widget.notify["popover-visible"].connect (update_fullscreen_box);
ingame_header_bar.pack_end (extra_widget);
}
}
......@@ -133,7 +135,7 @@ private class Highscore.DisplayView : Adw.Bin, UiView {
private Gtk.MessageDialog quit_dialog;
private Gtk.MessageDialog restart_dialog;
private ulong extra_widget_notify_block_autohide_id;
private ulong extra_widget_notify_popover_visible_id;
private Game game;
......@@ -712,12 +714,9 @@ private class Highscore.DisplayView : Adw.Bin, UiView {
[GtkCallback]
private void update_fullscreen_box () {
var is_menu_open = false;
/* FIXME GTK4
media_button.active ||
secondary_menu_button.active ||
(extra_widget != null && extra_widget.block_autohide);
*/
var is_menu_open = media_button.popover_visible ||
secondary_menu_popover.visible ||
(extra_widget != null && extra_widget.popover_visible);
fullscreen_box.autohide = !is_menu_open &&
!is_showing_snapshots;
......
// This file is part of Highscore. License: GPL-3.0+.
public interface Highscore.HeaderBarWidget : Gtk.Widget {
public abstract bool block_autohide { get; }
public abstract bool popover_visible { get; }
}
......@@ -6,9 +6,9 @@
<object class="GtkMenuButton" id="menu_button">
<!-- FIXME GTK4 Need a dropdown arrow -->
<property name="tooltip-text" translatable="yes">Media</property>
<!-- FIXME GTK4 <property name="active" bind-source="HighscoreMediaMenuButton" bind-property="active" bind-flags="bidirectional"/>-->
<property name="popover">
<object class="GtkPopover" id="popover">
<property name="visible" bind-source="HighscoreMediaMenuButton" bind-property="popover-visible" bind-flags="bidirectional"/>
<style>
<class name="combo"/>
</style>
......
......@@ -9,7 +9,7 @@ private class Highscore.MediaMenuButton : Adw.Bin {
[GtkChild]
private unowned Gtk.ListBox list_box;
public bool active { get; set; }
public bool popover_visible { get; set; }
private MediaSet _media_set;
public MediaSet media_set {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment