diff --git a/README.md b/README.md index 2d86acdf..1587a97d 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,6 @@ GSettings key. Shows a status menu for rapid unmount and power off of external storage devices (i.e. pendrives) - * example - - A minimal example illustrating how to write extensions. - * launch-new-instance Changes application icons to always launch a new instance when activated. diff --git a/extensions/example/extension.js b/extensions/example/extension.js deleted file mode 100644 index b55a9b84..00000000 --- a/extensions/example/extension.js +++ /dev/null @@ -1,49 +0,0 @@ -// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- -// Sample extension code, makes clicking on the panel show a message -const St = imports.gi.St; -const Mainloop = imports.mainloop; - -const Gettext = imports.gettext.domain('gnome-shell-extensions'); -const _ = Gettext.gettext; - -const Main = imports.ui.main; - -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const Convenience = Me.imports.convenience; - -function _showHello() { - let settings = Convenience.getSettings(); - let text = settings.get_string('hello-text') || _("Hello, world!"); - - let label = new St.Label({ style_class: 'helloworld-label', text: text }); - let monitor = Main.layoutManager.primaryMonitor; - global.stage.add_actor(label); - label.set_position(Math.floor (monitor.width / 2 - label.width / 2), Math.floor(monitor.height / 2 - label.height / 2)); - Mainloop.timeout_add(3000, () => { label.destroy(); }); -} - -// Put your extension initialization code here -function init(metadata) { - log ('Example extension initalized'); - - Convenience.initTranslations(); -} - -let signalId; - -function enable() { - log ('Example extension enabled'); - - Main.panel.actor.reactive = true; - signalId = Main.panel.actor.connect('button-release-event', _showHello); -} - -function disable() { - log ('Example extension disabled'); - - if (signalId) { - Main.panel.actor.disconnect(signalId); - signalId = 0; - } -} diff --git a/extensions/example/meson.build b/extensions/example/meson.build deleted file mode 100644 index c55a7830..00000000 --- a/extensions/example/meson.build +++ /dev/null @@ -1,8 +0,0 @@ -extension_data += configure_file( - input: metadata_name + '.in', - output: metadata_name, - configuration: metadata_conf -) - -extension_sources += files('prefs.js') -extension_schemas += files(metadata_conf.get('gschemaname') + '.gschema.xml') diff --git a/extensions/example/metadata.json.in b/extensions/example/metadata.json.in deleted file mode 100644 index 56f96552..00000000 --- a/extensions/example/metadata.json.in +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extension-id": "@extension_id@", - "uuid": "@uuid@", - "settings-schema": "@gschemaname@", - "gettext-domain": "@gettext_domain@", - "name": "Hello, World!", - "description": "An example extension to show how it works. Shows Hello, world when clicking on the top panel.", - "shell-version": [ "@shell_current@" ], - "url": "@url@" -} diff --git a/extensions/example/org.gnome.shell.extensions.example.gschema.xml b/extensions/example/org.gnome.shell.extensions.example.gschema.xml deleted file mode 100644 index 1f562f3d..00000000 --- a/extensions/example/org.gnome.shell.extensions.example.gschema.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - '' - Alternative greeting text. - If not empty, it contains the text that will be shown when clicking on the panel. - - - diff --git a/extensions/example/prefs.js b/extensions/example/prefs.js deleted file mode 100644 index c5023fd9..00000000 --- a/extensions/example/prefs.js +++ /dev/null @@ -1,54 +0,0 @@ -// -*- mode: js2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- - -const GLib = imports.gi.GLib; -const GObject = imports.gi.GObject; -const Gio = imports.gi.Gio; -const Gtk = imports.gi.Gtk; - -const Gettext = imports.gettext.domain('gnome-shell-extensions'); -const _ = Gettext.gettext; - -const ExtensionUtils = imports.misc.extensionUtils; -const Me = ExtensionUtils.getCurrentExtension(); -const Convenience = Me.imports.convenience; - -function init() { - Convenience.initTranslations(); -} - -const ExamplePrefsWidget = GObject.registerClass( -class ExamplePrefsWidget extends Gtk.Grid { - _init(params) { - super._init(params); - this.margin = 12; - this.row_spacing = this.column_spacing = 6; - this.set_orientation(Gtk.Orientation.VERTICAL); - - this.add(new Gtk.Label({ label: '' + _("Message") + '', - use_markup: true, - halign: Gtk.Align.START })); - - let entry = new Gtk.Entry({ hexpand: true, - margin_bottom: 12 }); - this.add(entry); - - this._settings = Convenience.getSettings(); - this._settings.bind('hello-text', entry, 'text', Gio.SettingsBindFlags.DEFAULT); - - // TRANSLATORS: Example is the name of the extension, should not be - // translated - let primaryText = _("Example aims to show how to build well behaved \ -extensions for the Shell and as such it has little functionality on its own.\n\ -Nevertheless it’s possible to customize the greeting message."); - - this.add(new Gtk.Label({ label: primaryText, - wrap: true, xalign: 0 })); - } -}); - -function buildPrefsWidget() { - let widget = new ExamplePrefsWidget(); - widget.show_all(); - - return widget; -} diff --git a/extensions/example/stylesheet.css b/extensions/example/stylesheet.css deleted file mode 100644 index a8dc980f..00000000 --- a/extensions/example/stylesheet.css +++ /dev/null @@ -1,8 +0,0 @@ -/* Example stylesheet */ -.helloworld-label { - font-size: 36px; - font-weight: bold; - color: #ffffff; - background-color: rgba(10,10,10,0.7); - border-radius: 5px; -} diff --git a/meson.build b/meson.build index 67e71ff8..4991ba7e 100644 --- a/meson.build +++ b/meson.build @@ -51,7 +51,6 @@ default_extensions += [ all_extensions = default_extensions all_extensions += [ 'auto-move-windows', - 'example', 'native-window-placement', 'user-theme' ]