[polari] mainWindow: Ensure user-list button is at least as wide as high
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] mainWindow: Ensure user-list button is at least as wide as high
- Date: Sat, 4 Sep 2021 00:53:06 +0000 (UTC)
commit 91a2493df0a68c657c1a33627184db003f0c6565
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Aug 20 06:13:23 2021 +0200
mainWindow: Ensure user-list button is at least as wide as high
For rooms with few users, the button looks too narrow. We used to use
a ::size-allocate hack to make the button at least as wide as icon
buttons, now in GTK4 we can use a cleaner approach and implement a small
layout manager that requests a width that is at least equal to the height.
Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/235>
src/mainWindow.js | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index d3f7a86e..32f29251 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -77,6 +77,20 @@ export const FixedSizeFrame = GObject.registerClass({
}
});
+export const HeaderBarButtonLayout = GObject.registerClass(
+class ButtonBinLayout extends Gtk.BinLayout {
+ vfunc_measure(widget, orientation, forSize) {
+ const [min, nat] = super.vfunc_measure(widget, orientation, forSize);
+ if (orientation === Gtk.Orientation.VERTICAL)
+ return [min, nat, -1, -1];
+
+ let [, height] = widget.measure(Gtk.Orientation.VERTICAL, -1);
+ const padding = widget.get_style_context().get_padding();
+ height -= padding.left + padding.right;
+ return [min, Math.max(nat, height), -1, -1];
+ }
+});
+
export default GObject.registerClass({
Template: 'resource:///org/gnome/Polari/ui/main-window.ui',
InternalChildren: [
@@ -157,6 +171,9 @@ export default GObject.registerClass({
this._commandOutputQueue, 'margin-bottom',
GObject.BindingFlags.SYNC_CREATE);
+ // Make sure user-list button is at least as wide as icon buttons
+ this._showUserListButton.layout_manager = new HeaderBarButtonLayout();
+
this._accountsMonitor = AccountsMonitor.getDefault();
this._accountsChangedId = this._accountsMonitor.connect(
'accounts-changed', this._onAccountsChanged.bind(this));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]