[polari] mainWindow: Use Adw.HeaderBar
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] mainWindow: Use Adw.HeaderBar
- Date: Sat, 19 Mar 2022 15:19:36 +0000 (UTC)
commit 19d6cedd2a5576e98a1752a583f969d2c8229591
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Feb 16 18:07:03 2022 +0100
mainWindow: Use Adw.HeaderBar
We are using the split headerbar pattern, which becomes a lot more
convenient with libadwaita's headerbar subclass.
Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/250>
data/resources/main-window.ui | 14 ++++++++------
src/mainWindow.js | 23 -----------------------
2 files changed, 8 insertions(+), 29 deletions(-)
---
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index 355f8d17..fb9e5775 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -39,11 +39,12 @@
<child type="titlebar">
<object class="GtkBox">
<child>
- <object class="GtkHeaderBar" id="titlebarLeft">
+ <object class="AdwHeaderBar" id="titlebarLeft">
<property name="hexpand">False</property>
- <child type="title">
+ <property name="show-end-title-buttons">False</property>
+ <property name="title-widget">
<object class="GtkLabel"/>
- </child>
+ </property>
<child type="start">
<object class="GtkButton" id="joinButton">
<property name="halign">end</property>
@@ -76,7 +77,8 @@
</object>
</child>
<child>
- <object class="GtkHeaderBar" id="titlebarRight">
+ <object class="AdwHeaderBar" id="titlebarRight">
+ <property name="show-start-title-buttons">False</property>
<property name="hexpand">True</property>
<!-- Use a custom title widget to enable markup for subtitles
(for URLs in channel topics); other than that, we want
@@ -84,7 +86,7 @@
be hidden, but is always included in the size request.
We replicate this by using a stack which will only ever show
its first child, but still consider the second one's size -->
- <child type="title">
+ <property name="title-widget">
<object class="GtkStack">
<property name="margin-start">24</property>
<property name="margin-end">24</property>
@@ -151,7 +153,7 @@
</object>
</child>
</object>
- </child>
+ </property>
<child type="end">
<object class="GtkToggleButton" id="showUserListButton">
<property name="focus-on-click">False</property>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index fa3bf59a..1451fc4b 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -78,8 +78,6 @@ export default GObject.registerClass(
class MainWindow extends Gtk.ApplicationWindow {
static [Gtk.template] = 'resource:///org/gnome/Polari/ui/main-window.ui';
static [Gtk.internalChildren] = [
- 'titlebarRight',
- 'titlebarLeft',
'joinButton',
'showUserListButton',
'userListPopover',
@@ -115,7 +113,6 @@ class MainWindow extends Gtk.ApplicationWindow {
_lastActiveRoom = null;
_settings = new Gio.Settings({ schema_id: 'org.gnome.Polari' });
- _gtkSettings = Gtk.Settings.get_default();
_currentSize = [-1, -1];
_isMaximized = false;
@@ -172,10 +169,6 @@ class MainWindow extends Gtk.ApplicationWindow {
this._userListAction.change_state(GLib.Variant.new('b', false));
});
- this._gtkSettings.connect('notify::gtk-decoration-layout',
- this._updateDecorations.bind(this));
- this._updateDecorations();
-
this.connect('notify::maximized',
() => (this._isMaximized = this.maximized));
this.connect('notify::fullscreened',
@@ -261,22 +254,6 @@ class MainWindow extends Gtk.ApplicationWindow {
return layoutStr.split(',').filter(s => s !== 'menu').join(',');
}
- _updateDecorations() {
- let layoutLeft = null;
- let layoutRight = null;
-
- let layout = this._gtkSettings.gtk_decoration_layout;
- if (layout) {
- let [buttonsLeft, buttonsRight] = layout.split(':');
-
- layoutLeft = `${this._filterFallbackAppMenu(buttonsLeft)}:`;
- layoutRight = `:${this._filterFallbackAppMenu(buttonsRight)}`;
- }
-
- this._titlebarLeft.set_decoration_layout(layoutLeft);
- this._titlebarRight.set_decoration_layout(layoutRight);
- }
-
// eslint-disable-next-line camelcase
get active_room() {
return this._room;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]