[gnome-shell] extensionPrefs: Add standard app elements



commit 872c84a1c353b4f3b94f0a816aeb1a0595e00f01
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Nov 30 06:51:35 2019 +0100

    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

 js/extensionPrefs/main.js                 | 26 ++++++++++++++++++++++++++
 js/extensionPrefs/ui/extensions-window.ui | 29 +++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 74292957e1..4f7499703a 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -8,6 +8,7 @@ const Format = imports.format;
 
 const _ = Gettext.gettext;
 
+const Config = imports.misc.config;
 const ExtensionUtils = imports.misc.extensionUtils;
 const { loadInterfaceXML } = imports.misc.fileUtils;
 
@@ -84,6 +85,11 @@ var ExtensionsWindow = GObject.registerClass({
 
         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.bind('disable-user-extensions',
             this._killSwitch, 'active',
@@ -159,6 +165,26 @@ var ExtensionsWindow = GObject.registerClass({
         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) {
         let scroll = new Gtk.ScrolledWindow({
             hscrollbar_policy: Gtk.PolicyType.NEVER,
diff --git a/js/extensionPrefs/ui/extensions-window.ui b/js/extensionPrefs/ui/extensions-window.ui
index a3068033c3..29606c7ab6 100644
--- a/js/extensionPrefs/ui/extensions-window.ui
+++ b/js/extensionPrefs/ui/extensions-window.ui
@@ -2,6 +2,18 @@
 <!-- Generated with glade 3.22.0 -->
 <interface>
   <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">
     <child>
       <object class="GtkBox">
@@ -60,6 +72,23 @@
             </child>
           </object>
         </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>
           <object class="GtkSwitch" id="killSwitch">
             <property name="visible">True</property>


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