extensions-app: Remember window state

It's good practice to save and reload the window size and
maximization state, and easy enough to implement, so let's
do that.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3115>
This commit is contained in:
Florian Müllner 2024-01-13 23:34:00 +01:00
parent 2d380a3995
commit 41b94ccf11
5 changed files with 35 additions and 2 deletions

View File

@ -48,3 +48,5 @@ configure_file(
subdir('icons')
subdir('metainfo')
install_data(base_id + '.gschema.xml', install_dir: schemadir)

View File

@ -0,0 +1,17 @@
<?<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema path="/org/gnome/Extensions/" id="org.gnome.Extensions">
<key name="window-width" type="i">
<default>800</default>
<summary>Window width</summary>
</key>
<key name="window-height" type="i">
<default>500</default>
<summary>Window height</summary>
</key>
<key name="window-maximized" type="b">
<default>false</default>
<summary>Window maximized</summary>
</key>
</schema>
</schemalist>

View File

@ -54,8 +54,6 @@
<property name="filter">searchFilter</property>
</object>
<template class="ExtensionsWindow" parent="AdwApplicationWindow">
<property name="default-width">800</property>
<property name="default-height">500</property>
<property name="title" translatable="yes">Extensions</property>
<child>
<object class="AdwToolbarView">

View File

@ -59,6 +59,20 @@ export const ExtensionsWindow = GObject.registerClass({
},
}]);
const settings = new Gio.Settings({
schema_id: 'org.gnome.Extensions',
});
settings.bind('window-width',
this, 'default-width',
Gio.SettingsBindFlags.DEFAULT);
settings.bind('window-height',
this, 'default-height',
Gio.SettingsBindFlags.DEFAULT);
settings.bind('window-maximized',
this, 'maximized',
Gio.SettingsBindFlags.DEFAULT);
this._searchEntry.connect('search-changed',
() => (this._searchFilter.search = this._searchEntry.text));
this._searchBar.connect('notify::search-mode-enabled',

View File

@ -44,6 +44,7 @@ desktopdir = join_paths(datadir, 'applications')
icondir = join_paths(datadir, 'icons')
localedir = join_paths(datadir, 'locale')
metainfodir = join_paths(datadir, 'metainfo')
schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
servicedir = join_paths(datadir, 'dbus-1', 'services')
gjs = find_program('gjs')
@ -64,6 +65,7 @@ if not meson.is_subproject()
subdir('po')
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true
)