extensions-app: Use AdwPreferencesPage and AdwPreferencesGroup

Give consistent styling and sizing to extensions lists.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1997>
This commit is contained in:
Romain Vigier 2021-10-18 15:18:11 +02:00 committed by Florian Müllner
parent 1359cedc00
commit ab5977713b
3 changed files with 26 additions and 63 deletions

View File

@ -89,7 +89,6 @@
<child> <child>
<object class="GtkLabel" id="descriptionLabel"> <object class="GtkLabel" id="descriptionLabel">
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<property name="max-width-chars">60</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="yalign">0</property> <property name="yalign">0</property>
</object> </object>
@ -171,7 +170,6 @@
<property name="visible">False</property> <property name="visible">False</property>
<property name="selectable">True</property> <property name="selectable">True</property>
<property name="wrap">True</property> <property name="wrap">True</property>
<property name="max-width-chars">60</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<layout> <layout>
<property name="column">1</property> <property name="column">1</property>

View File

@ -124,57 +124,23 @@
<object class="GtkStackPage"> <object class="GtkStackPage">
<property name="name">main</property> <property name="name">main</property>
<property name="child"> <property name="child">
<object class="GtkScrolledWindow" id="scrolledWindow"> <object class="AdwPreferencesPage">
<property name="hscrollbar-policy">never</property>
<child> <child>
<object class="GtkViewport"> <object class="AdwPreferencesGroup" id="userGroup">
<property name="scroll-to-focus">True</property> <property name="title" translatable="yes">Manually Installed</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="halign">center</property>
<property name="margin-start">36</property>
<property name="margin-end">36</property>
<property name="margin-top">36</property>
<property name="margin-bottom">36</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible"
bind-source="userList"
bind-property="visible"
bind-flags="sync-create"/>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Manually Installed</property>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child> <child>
<object class="GtkListBox" id="userList"> <object class="GtkListBox" id="userList">
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<property name="margin-bottom">24</property>
<style> <style>
<class name="content"/> <class name="content"/>
</style> </style>
</object> </object>
</child> </child>
<child>
<object class="GtkLabel">
<property name="visible"
bind-source="systemList"
bind-property="visible"
bind-flags="sync-create"/>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Built-In</property>
<style>
<class name="heading"/>
</style>
</object> </object>
</child> </child>
<child>
<object class="AdwPreferencesGroup" id="systemGroup">
<property name="title" translatable="yes">Built-In</property>
<child> <child>
<object class="GtkListBox" id="systemList"> <object class="GtkListBox" id="systemList">
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
@ -186,8 +152,6 @@
</object> </object>
</child> </child>
</object> </object>
</child>
</object>
</property> </property>
</object> </object>
</child> </child>

View File

@ -74,10 +74,11 @@ var ExtensionsWindow = GObject.registerClass({
GTypeName: 'ExtensionsWindow', GTypeName: 'ExtensionsWindow',
Template: 'resource:///org/gnome/Extensions/ui/extensions-window.ui', Template: 'resource:///org/gnome/Extensions/ui/extensions-window.ui',
InternalChildren: [ InternalChildren: [
'userGroup',
'userList', 'userList',
'systemGroup',
'systemList', 'systemList',
'mainStack', 'mainStack',
'scrolledWindow',
'searchBar', 'searchBar',
'searchButton', 'searchButton',
'searchEntry', 'searchEntry',
@ -316,10 +317,10 @@ var ExtensionsWindow = GObject.registerClass({
} }
_syncListVisibility() { _syncListVisibility() {
this._userList.visible = [...this._userList].length > 1; this._userGroup.visible = [...this._userList].length > 1;
this._systemList.visible = [...this._systemList].length > 1; this._systemGroup.visible = [...this._systemList].length > 1;
if (this._userList.visible || this._systemList.visible) if (this._userGroup.visible || this._systemGroup.visible)
this._mainStack.visible_child_name = 'main'; this._mainStack.visible_child_name = 'main';
else else
this._mainStack.visible_child_name = 'placeholder'; this._mainStack.visible_child_name = 'placeholder';