extensionPrefs: Add standard app elements

In order to turn the extensions-prefs tool into a proper GNOME app, it
should follow basic app patterns, so add a primary menu and about dialog.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1968
This commit is contained in:
Florian Müllner 2019-11-30 06:51:35 +01:00
parent b47879d0a7
commit 872c84a1c3
2 changed files with 55 additions and 0 deletions

View File

@ -8,6 +8,7 @@ const Format = imports.format;
const _ = Gettext.gettext; const _ = Gettext.gettext;
const Config = imports.misc.config;
const ExtensionUtils = imports.misc.extensionUtils; const ExtensionUtils = imports.misc.extensionUtils;
const { loadInterfaceXML } = imports.misc.fileUtils; const { loadInterfaceXML } = imports.misc.fileUtils;
@ -84,6 +85,11 @@ var ExtensionsWindow = GObject.registerClass({
this._mainBox.set_focus_vadjustment(this._scrolledWindow.vadjustment); this._mainBox.set_focus_vadjustment(this._scrolledWindow.vadjustment);
let action;
action = new Gio.SimpleAction({ name: 'show-about' });
action.connect('activate', this._showAbout.bind(this));
this.add_action(action);
this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' }); this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' });
this._settings.bind('disable-user-extensions', this._settings.bind('disable-user-extensions',
this._killSwitch, 'active', this._killSwitch, 'active',
@ -159,6 +165,26 @@ var ExtensionsWindow = GObject.registerClass({
return true; return true;
} }
_showAbout() {
let aboutDialog = new Gtk.AboutDialog({
authors: [
'Florian Müllner <fmuellner@gnome.org>',
'Jasper St. Pierre <jstpierre@mecheye.net>',
'Didier Roche <didrocks@ubuntu.com>',
],
translator_credits: _('translator-credits'),
program_name: _('Shell Extensions'),
comments: _('Manage your GNOME Extensions'),
license_type: Gtk.License.GPL_2_0,
logo_icon_name: 'org.gnome.Extensions',
version: Config.PACKAGE_VERSION,
transient_for: this,
modal: true,
});
aboutDialog.present();
}
_buildErrorUI(row, exc) { _buildErrorUI(row, exc) {
let scroll = new Gtk.ScrolledWindow({ let scroll = new Gtk.ScrolledWindow({
hscrollbar_policy: Gtk.PolicyType.NEVER, hscrollbar_policy: Gtk.PolicyType.NEVER,

View File

@ -2,6 +2,18 @@
<!-- Generated with glade 3.22.0 --> <!-- Generated with glade 3.22.0 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<menu id="primary-menu">
<section>
<item>
<attribute name="label" translatable="yes">Help</attribute>
<attribute name="action">win.show-help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">About Extensions</attribute>
<attribute name="action">win.show-about</attribute>
</item>
</section>
</menu>
<object class="GtkPopover" id="infoPopover"> <object class="GtkPopover" id="infoPopover">
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
@ -60,6 +72,23 @@
</child> </child>
</object> </object>
</child> </child>
<child>
<object class="GtkMenuButton" id="menuButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="menu_model">primary-menu</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child> <child>
<object class="GtkSwitch" id="killSwitch"> <object class="GtkSwitch" id="killSwitch">
<property name="visible">True</property> <property name="visible">True</property>