[gnome-music/wip/jfelder/gtk4-v3: 15/118] headerbars: Fix title widget
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/gtk4-v3: 15/118] headerbars: Fix title widget
- Date: Thu, 3 Feb 2022 01:07:13 +0000 (UTC)
commit 52c42fbda858abaca083b5c569b7e63ad393f0c1
Author: Marinus Schraal <mschraal gnome org>
Date: Mon Jun 8 01:10:24 2020 +0200
headerbars: Fix title widget
data/ui/HeaderBar.ui | 2 +-
data/ui/SearchHeaderBar.ui | 2 +-
gnomemusic/widgets/headerbar.py | 7 ++++---
gnomemusic/widgets/searchheaderbar.py | 5 +++--
4 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/data/ui/HeaderBar.ui b/data/ui/HeaderBar.ui
index 9e46b7036..505c9175d 100644
--- a/data/ui/HeaderBar.ui
+++ b/data/ui/HeaderBar.ui
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.10 -->
<template class="HeaderBar" parent="AdwBin">
<child>
- <object class="AdwHeaderBar">
+ <object class="AdwHeaderBar" id="_headerbar">
<property name="visible">True</property>
<property name="vexpand">False</property>
<style>
diff --git a/data/ui/SearchHeaderBar.ui b/data/ui/SearchHeaderBar.ui
index ecead5017..4b1f8bae5 100644
--- a/data/ui/SearchHeaderBar.ui
+++ b/data/ui/SearchHeaderBar.ui
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.10 -->
<template class="SearchHeaderBar" parent="AdwBin">
<child>
- <object class="AdwHeaderBar">
+ <object class="AdwHeaderBar" id="_headerbar">
<property name="visible">True</property>
<property name="vexpand">False</property>
<style>
diff --git a/gnomemusic/widgets/headerbar.py b/gnomemusic/widgets/headerbar.py
index 27b28012c..d059eec50 100644
--- a/gnomemusic/widgets/headerbar.py
+++ b/gnomemusic/widgets/headerbar.py
@@ -92,6 +92,7 @@ class HeaderBar(Adw.Bin):
_select_button = Gtk.Template.Child()
_cancel_button = Gtk.Template.Child()
_back_button = Gtk.Template.Child()
+ _headerbar = Gtk.Template.Child()
_menu_button = Gtk.Template.Child()
search_mode_active = GObject.Property(type=bool, default=False)
@@ -214,11 +215,11 @@ class HeaderBar(Adw.Bin):
def _update(self):
if self.props.selection_mode:
- self.props.custom_title = self._selection_menu
+ self._headerbar.props.title_widget = self._selection_menu
elif self.props.state != HeaderBar.State.MAIN:
- self.props.custom_title = None
+ self._headerbar.props.title_widget = None
else:
- self.props.custom_title = self._stack_switcher
+ self._headerbar.props.title_widget = self._stack_switcher
self._back_button.props.visible = (
not self.props.selection_mode
diff --git a/gnomemusic/widgets/searchheaderbar.py b/gnomemusic/widgets/searchheaderbar.py
index 4c8f10cea..ab596e76c 100644
--- a/gnomemusic/widgets/searchheaderbar.py
+++ b/gnomemusic/widgets/searchheaderbar.py
@@ -43,6 +43,7 @@ class SearchHeaderBar(Adw.Bin):
__gtype_name__ = "SearchHeaderBar"
+ _headerbar = Gtk.Template.Child()
_search_button = Gtk.Template.Child()
_select_button = Gtk.Template.Child()
_cancel_button = Gtk.Template.Child()
@@ -164,9 +165,9 @@ class SearchHeaderBar(Adw.Bin):
def _update(self):
if self.props.selection_mode:
- self.props.custom_title = self._selection_menu
+ self._headerbar.props.title_widget = self._selection_menu
else:
- self.props.custom_title = self._entry
+ self._headerbar.props.title_widget = self._entry
def _on_selection_mode_allowed_changed(self, widget, data):
if self.props.selection_mode_allowed:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]