[gnome-tweaks/ewlsh/add-extensions-warning] Add notice for Extensions removal.




commit 19a8477f81998a28564d3aac1184c1c638529a92
Author: Evan Welsh <contact evanwelsh com>
Date:   Tue Dec 1 16:49:53 2020 -0600

    Add notice for Extensions removal.
    
    Instruct users that GNOME Extensions is the new location for extensions
    management and provide links for them.

 data/meson.build                  |  6 ++++++
 data/org.gnome.tweaks.gschema.xml | 10 ++++++++++
 gtweak/app.py                     | 33 +++++++++++++++++++++++++++++++++
 meson-postinstall.py              |  2 ++
 4 files changed, 51 insertions(+)
---
diff --git a/data/meson.build b/data/meson.build
index c16d64a..fd6d5da 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -23,6 +23,12 @@ gui_data = [
 ]
 install_data(gui_data, install_dir: pkgdatadir)
 
+# Install the settings schema file
+install_data(
+  'org.gnome.tweaks.gschema.xml',
+  install_dir: 'share/glib-2.0/schemas'
+)
+
 install_data ('org.gnome.tweaks.svg',
   install_dir: join_paths(datadir, 'icons', 'hicolor', 'scalable', 'apps'))
 install_data ('org.gnome.tweaks-symbolic.svg',
diff --git a/data/org.gnome.tweaks.gschema.xml b/data/org.gnome.tweaks.gschema.xml
new file mode 100644
index 0000000..1fe0237
--- /dev/null
+++ b/data/org.gnome.tweaks.gschema.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+    <schema path="/org/gnome/tweaks/" id="org.gnome.tweaks" gettext-domain="org.gnome.tweaks">
+        <key type="b" name="show-extensions-notice">
+            <default>true</default>
+            <summary>Show Extensions Notice</summary>
+            <description>When first installed the user should be notified that extensions support has moved 
to a dedicated app, Extensions.</description>
+        </key>
+    </schema>
+</schemalist>
diff --git a/gtweak/app.py b/gtweak/app.py
index a38cd98..572fd4a 100644
--- a/gtweak/app.py
+++ b/gtweak/app.py
@@ -15,6 +15,24 @@ from gtweak.tweakview import Window
 from gtweak.utils import SchemaList
 from gtweak.gshellwrapper import GnomeShellFactory
 
+class ExtensionNotice(Gtk.MessageDialog):
+    def __init__(self, modal, transient_for):
+        Gtk.Dialog.__init__(self, modal=modal, transient_for=transient_for)
+
+        self.add_button(_("_Continue"), Gtk.ResponseType.NONE)
+
+        self.set_markup("<b>{0}</b>".format(_("Extensions Has Moved")))
+
+        self.format_secondary_markup(
+            "{0}\n\n{1}".format(
+                _("Extensions management has been moved to {0}.").format(
+                    '<a 
href="https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/subprojects/extensions-app/README.md";>GNOME 
Extensions</a>',
+                ),
+                _("We recommend downloading GNOME Extensions from {0} if your distribution does not include 
it.").format(
+                    '<a href="https://flathub.org/apps/details/org.gnome.Extensions";>Flathub</a>'
+                )
+            )
+        )
 
 class GnomeTweaks(Gtk.Application):
 
@@ -23,6 +41,8 @@ class GnomeTweaks(Gtk.Application):
         Gtk.Application.__init__(self, application_id="org.gnome.tweaks")
         self.win = None
 
+        self._settings = Gio.Settings.new('org.gnome.tweaks')
+
     def do_activate(self):
         if not self.win:
             model = TweakModel()
@@ -31,6 +51,10 @@ class GnomeTweaks(Gtk.Application):
             self.win.back_button.props.visible = False
         self.win.present()
 
+        if self._settings.get_boolean('show-extensions-notice'):
+            self.show_extensions_notice()
+            self._settings.set_boolean('show-extensions-notice', False)
+
     def do_startup(self):
         Gtk.Application.do_startup(self)
 
@@ -93,3 +117,12 @@ class GnomeTweaks(Gtk.Application):
 
     def quit_cb(self, action, parameter):
         self.quit()
+
+    def show_extensions_notice(self):
+        extensionsdialog = ExtensionNotice(
+            modal=True,
+            transient_for=self.win
+        )
+
+        extensionsdialog.run()
+        extensionsdialog.destroy()
diff --git a/meson-postinstall.py b/meson-postinstall.py
index 115d8e0..2f7f0b1 100755
--- a/meson-postinstall.py
+++ b/meson-postinstall.py
@@ -11,6 +11,8 @@ destdir = environ.get('DESTDIR', '')
 
 # Package managers set this so we don't need to run
 if not destdir:
+    print("Installing new Schemas")
+    call(['glib-compile-schemas', path.join(datadir, 'glib-2.0/schemas')])
     print('Updating icon cache...')
     call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])
 


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