[gnome-clocks] header-bar: Use binding intruction from libadwaita
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] header-bar: Use binding intruction from libadwaita
- Date: Fri, 7 Jan 2022 17:23:45 +0000 (UTC)
commit d18eed41f04a2f0953e3061882d4d4dd127c034e
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Tue Dec 14 00:00:08 2021 +0100
header-bar: Use binding intruction from libadwaita
data/ui/header-bar.ui | 5 ++---
data/ui/window.ui | 3 +++
src/header-bar.vala | 8 +-------
3 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/data/ui/header-bar.ui b/data/ui/header-bar.ui
index 1a2e2514..e69315ea 100644
--- a/data/ui/header-bar.ui
+++ b/data/ui/header-bar.ui
@@ -17,13 +17,13 @@
</section>
</menu>
<template class="ClocksHeaderBar" parent="AdwBin">
+ <property name="title-visible" bind-source="view_switcher_title" bind-flags="sync-create"/>
<child>
<object class="AdwHeaderBar">
<property name="centering_policy">strict</property>
<child type="title">
<object class="AdwViewSwitcherTitle" id="view_switcher_title">
- <property name="stack" bind-source="ClocksHeaderBar" bind-property="stack"
bind-flags="sync-create">ignore-me</property>
- <signal name="notify::title-visible" handler="title_visible_changed"/>
+ <property name="stack" bind-source="ClocksHeaderBar" bind-property="stack"
bind-flags="sync-create"/>
<property name="title" translatable="yes">Clocks</property>
</object>
</child>
@@ -78,5 +78,4 @@
</object>
</child>
</template>
- <object class="AdwViewStack" id="ignore-me"></object>
</interface>
diff --git a/data/ui/window.ui b/data/ui/window.ui
index bca54f85..ae6509ee 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -81,6 +81,9 @@
<child>
<object class="AdwViewSwitcherBar" id="switcher_bar">
<property name="stack">stack</property>
+ <binding name="reveal">
+ <lookup name="title-visible">header_bar</lookup>
+ </binding>
</object>
</child>
</object>
diff --git a/src/header-bar.vala b/src/header-bar.vala
index ab5c59be..3eb8f9ba 100644
--- a/src/header-bar.vala
+++ b/src/header-bar.vala
@@ -47,16 +47,10 @@ public class Clocks.HeaderBar : Adw.Bin {
public Adw.ViewStack stack { get; set; }
public Adw.ViewSwitcherBar switcher_bar { get; set; }
public string? new_label { get; set; }
+ public bool title_visible { get; set; }
private ButtonMode _button_mode;
[GtkChild]
private unowned Adw.ViewStack start_button_stack;
- [GtkChild]
- private unowned Adw.ViewSwitcherTitle view_switcher_title;
-
- [GtkCallback]
- private void title_visible_changed () {
- switcher_bar.reveal = view_switcher_title.title_visible;
- }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]