[polari] mainWindow: Refresh user list button



commit 0b7aa7307ba3e2a3b8af2406a8256a0637ad8212
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Mar 17 23:36:31 2022 +0100

    mainWindow: Refresh user list button
    
    To fit the current design patterns[0], add an icon to the text label,
    so that it gets the same flat styling as all the other headerbar
    elements.
    
    [0] https://blogs.gnome.org/alexm/2021/09/10/cleaning-up-header-bars/
    
    Part-of: <https://gitlab.gnome.org/GNOME/polari/-/merge_requests/250>

 data/org.gnome.Polari.data.gresource.xml |  1 +
 data/resources/main-window.ui            |  9 +++++----
 data/resources/people-symbolic.svg       |  2 ++
 data/resources/style.css                 |  4 ----
 src/mainWindow.js                        | 19 +------------------
 5 files changed, 9 insertions(+), 26 deletions(-)
---
diff --git a/data/org.gnome.Polari.data.gresource.xml b/data/org.gnome.Polari.data.gresource.xml
index 715d2200..5fa758ea 100644
--- a/data/org.gnome.Polari.data.gresource.xml
+++ b/data/org.gnome.Polari.data.gresource.xml
@@ -5,6 +5,7 @@
     <file alias="data/networks.json">resources/networks.json</file>
     <file alias="gtk/help-overlay.ui" preprocess="xml-stripblanks">resources/help-overlay.ui</file>
     <file alias="gtk/menus.ui" preprocess="xml-stripblanks">resources/menus.ui</file>
+    <file alias="icons/scalable/status/people-symbolic.svg" 
preprocess="xml-stripblanks">resources/people-symbolic.svg</file>
     <file alias="icons/scalable/status/polari-user-notify-symbolic.svg" 
preprocess="xml-stripblanks">resources/polari-user-notify-symbolic.svg</file>
     <file alias="ui/connection-details.ui" 
preprocess="xml-stripblanks">resources/connection-details.ui</file>
     <file alias="ui/connection-properties.ui" 
preprocess="xml-stripblanks">resources/connection-properties.ui</file>
diff --git a/data/resources/main-window.ui b/data/resources/main-window.ui
index e9e79fe5..b64891a3 100644
--- a/data/resources/main-window.ui
+++ b/data/resources/main-window.ui
@@ -157,10 +157,11 @@
                 <property name="focus-on-click">False</property>
                 <property name="action-name">app.user-list</property>
                 <property name="tooltip-text" translatable="yes">Show connected users</property>
-                <style>
-                  <class name="polari-user-list-button"/>
-                  <class name="text-button"/>
-                </style>
+                <property name="child">
+                  <object class="AdwButtonContent">
+                    <property name="icon-name">people-symbolic</property>
+                  </object>
+                </property>
               </object>
             </child>
           </object>
diff --git a/data/resources/people-symbolic.svg b/data/resources/people-symbolic.svg
new file mode 100644
index 00000000..953172da
--- /dev/null
+++ b/data/resources/people-symbolic.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"; height="16px" viewBox="0 0 16 16" width="16px"><path d="m 5 1 c 
-1.378906 0 -2.5 1.121094 -2.5 2.5 c 0 1.382812 1.121094 2.5 2.5 2.5 c 1.382812 0 2.5 -1.117188 2.5 -2.5 c 0 
-1.378906 -1.117188 -2.5 -2.5 -2.5 z m 6 3 c -1.378906 0 -2.5 1.121094 -2.5 2.5 c 0 1.382812 1.121094 2.5 2.5 
2.5 c 1.382812 0 2.5 -1.117188 2.5 -2.5 c 0 -1.378906 -1.117188 -2.5 -2.5 -2.5 z m -8 3 c -1.660156 0 -3 
1.339844 -3 3 v 2 c 0 0.554688 0.445312 1 1 1 h 4.078125 c 0 -2.042969 1.582031 -3.734375 3.578125 -3.90625 c 
-0.589844 -0.535156 -0.980469 -1.257812 -1.109375 -2.042969 c -0.175781 -0.03125 -0.359375 -0.050781 
-0.546875 -0.050781 z m 6 3 c -1.660156 0 -3 1.339844 -3 3 v 2 c 0 0.554688 0.445312 1 1 1 h 8 c 0.554688 0 1 
-0.445312 1 -1 v -2 c 0 -1.660156 -1.335938 -3 -3 -3 z m 0 0" fill="#2e3436"/></svg>
diff --git a/data/resources/style.css b/data/resources/style.css
index 78d3c4bc..72d98c1f 100644
--- a/data/resources/style.css
+++ b/data/resources/style.css
@@ -139,10 +139,6 @@ treeview.polari-server-room-list {
 .titlebar > separator:dir(rtl) { margin-right: -1px; }
 .titlebar > headerbar:first-child:dir(rtl) { margin-left: 1px; }
 
-.polari-user-list-button {
-    padding: 0px 4px;
-}
-
 .polari-setup-page {
     padding: 0 0 48px 0;
 }
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 0d01f5d5..c7582eac 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -75,20 +75,6 @@ class FixedSizeFrame extends Gtk.Widget {
     }
 });
 
-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(
 class MainWindow extends Gtk.ApplicationWindow {
     static [Gtk.template] = 'resource:///org/gnome/Polari/ui/main-window.ui';
@@ -160,9 +146,6 @@ class MainWindow extends Gtk.ApplicationWindow {
         this._roomStack.connect('notify::view-height',
             () => this.notify('view-height'));
 
-        // 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));
@@ -392,7 +375,7 @@ class MainWindow extends Gtk.ApplicationWindow {
             '%d users', numMembers), numMembers);
         this._showUserListButton.update_property(
             [Gtk.AccessibleProperty.LABEL], [accessibleName]);
-        this._showUserListButton.label = `${numMembers}`;
+        this._showUserListButton.child.label = `${numMembers}`;
     }
 
     _updateTitlebar() {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]