[gnome-games/gnome-3-36] nintendo-ds-layout-switcher: Implement HeaderBarWidget
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/gnome-3-36] nintendo-ds-layout-switcher: Implement HeaderBarWidget
- Date: Tue, 18 Feb 2020 18:05:04 +0000 (UTC)
commit c97bdcb92e3c1c9a0c932450c6cf12f76c18eb8e
Author: sevagen <sevagenv gmail com>
Date: Tue Feb 18 13:53:01 2020 +0530
nintendo-ds-layout-switcher: Implement HeaderBarWidget
.../nintendo-ds/data/ui/nintendo-ds-layout-switcher.ui | 3 ++-
plugins/nintendo-ds/src/nintendo-ds-layout-switcher.vala | 15 ++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/plugins/nintendo-ds/data/ui/nintendo-ds-layout-switcher.ui
b/plugins/nintendo-ds/data/ui/nintendo-ds-layout-switcher.ui
index 1e3c4880..47aec5ff 100644
--- a/plugins/nintendo-ds/data/ui/nintendo-ds-layout-switcher.ui
+++ b/plugins/nintendo-ds/data/ui/nintendo-ds-layout-switcher.ui
@@ -29,10 +29,11 @@
</object>
</child>
<child>
- <object class="GtkMenuButton">
+ <object class="GtkMenuButton" id="layout_button">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="popover">layout_popover</property>
+ <signal name="notify::active" handler="on_menu_state_changed"/>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-display-discs">
<property name="accessible-name" translatable="yes">Screen Layout</property>
diff --git a/plugins/nintendo-ds/src/nintendo-ds-layout-switcher.vala
b/plugins/nintendo-ds/src/nintendo-ds-layout-switcher.vala
index 62eae1a0..9974cc64 100644
--- a/plugins/nintendo-ds/src/nintendo-ds-layout-switcher.vala
+++ b/plugins/nintendo-ds/src/nintendo-ds-layout-switcher.vala
@@ -1,12 +1,14 @@
// This file is part of GNOME Games. License: GPL-3.0+.
[GtkTemplate (ui = "/org/gnome/Games/plugins/nintendo-ds/ui/nintendo-ds-layout-switcher.ui")]
-private class Games.NintendoDsLayoutSwitcher : Gtk.Box {
+private class Games.NintendoDsLayoutSwitcher : Gtk.Box, HeaderBarWidget {
[GtkChild]
private Gtk.Revealer change_screen_revealer;
[GtkChild]
private Gtk.Image change_screen_image;
[GtkChild]
+ private Gtk.MenuButton layout_button;
+ [GtkChild]
private Gtk.Image layout_image;
[GtkChild]
private Gtk.Popover layout_popover;
@@ -17,6 +19,11 @@ private class Games.NintendoDsLayoutSwitcher : Gtk.Box {
public NintendoDsRunner runner { get; construct; }
+ private bool is_menu_open;
+ public bool block_autohide {
+ get { return is_menu_open; }
+ }
+
static construct {
var icon_theme = Gtk.IconTheme.get_default ();
icon_theme.add_resource_path ("/org/gnome/Games/plugins/nintendo-ds/icons");
@@ -43,6 +50,12 @@ private class Games.NintendoDsLayoutSwitcher : Gtk.Box {
Object (runner: runner);
}
+ [GtkCallback]
+ private void on_menu_state_changed () {
+ is_menu_open = layout_button.active;
+ notify_property ("block-autohide");
+ }
+
[GtkCallback]
private void update_ui () {
var layout = runner.screen_layout;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]