[gnome-shell/wip/rstrode/login-screen-extensions: 42/134] extensionPrefs: Inherit from Gtk.Application
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/rstrode/login-screen-extensions: 42/134] extensionPrefs: Inherit from Gtk.Application
- Date: Thu, 26 Aug 2021 19:30:59 +0000 (UTC)
commit 5bf66f5ea18150f9e41390687ca64f296622f8ff
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue May 28 23:22:37 2019 +0200
extensionPrefs: Inherit from Gtk.Application
Extension preferences Application class is just a container for a GtkApplication
so instead of using composition we can inherit from the base GObject class.
Also replace signal connections with vfunc's.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/631
js/extensionPrefs/main.js | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/js/extensionPrefs/main.js b/js/extensionPrefs/main.js
index 2b4ce57535..94a5b12fe8 100644
--- a/js/extensionPrefs/main.js
+++ b/js/extensionPrefs/main.js
@@ -17,18 +17,16 @@ function stripPrefix(string, prefix) {
return string;
}
-var Application = class {
- constructor() {
+var Application = GObject.registerClass({
+ GTypeName: 'ExtensionPrefs_Application'
+}, class Application extends Gtk.Application {
+ _init() {
GLib.set_prgname('gnome-shell-extension-prefs');
- this.application = new Gtk.Application({
+ super._init({
application_id: 'org.gnome.shell.ExtensionPrefs',
flags: Gio.ApplicationFlags.HANDLES_COMMAND_LINE
});
- this.application.connect('activate', this._onActivate.bind(this));
- this.application.connect('command-line', this._onCommandLine.bind(this));
- this.application.connect('startup', this._onStartup.bind(this));
-
this._extensionPrefsModules = {};
this._startupUuid = null;
@@ -84,7 +82,7 @@ var Application = class {
visible: true }));
if (this._skipMainWindow) {
- this.application.add_window(dialog);
+ this.add_window(dialog);
if (this._window)
this._window.destroy();
this._window = dialog;
@@ -206,8 +204,8 @@ var Application = class {
return scroll;
}
- _buildUI(app) {
- this._window = new Gtk.ApplicationWindow({ application: app,
+ _buildUI() {
+ this._window = new Gtk.ApplicationWindow({ application: this,
window_position: Gtk.WindowPosition.CENTER });
this._window.set_default_size(800, 500);
@@ -295,17 +293,19 @@ var Application = class {
this._loaded = true;
}
- _onActivate() {
+ vfunc_activate() {
this._window.present();
}
- _onStartup(app) {
- this._buildUI(app);
+ vfunc_startup() {
+ super.vfunc_startup();
+
+ this._buildUI();
this._scanExtensions();
}
- _onCommandLine(app, commandLine) {
- app.activate();
+ vfunc_command_line(commandLine) {
+ this.activate();
let args = commandLine.get_arguments();
if (args.length) {
@@ -325,7 +325,7 @@ var Application = class {
}
return 0;
}
-};
+});
var Expander = GObject.registerClass({
Properties: {
@@ -631,6 +631,5 @@ function main(argv) {
Gettext.bindtextdomain(Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
Gettext.textdomain(Config.GETTEXT_PACKAGE);
- let app = new Application();
- app.application.run(argv);
+ new Application().run(argv);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]