[sushi] application: Port to Gtk.Application
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sushi] application: Port to Gtk.Application
- Date: Thu, 19 Jul 2012 02:30:43 +0000 (UTC)
commit 7e15fa6ced4c283a0045122c1465840c9ba13c37
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jul 18 21:18:18 2012 -0400
application: Port to Gtk.Application
https://bugzilla.gnome.org/show_bug.cgi?id=680221
src/js/ui/application.js | 13 +++++--------
src/js/ui/main.js | 7 +++----
2 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/src/js/ui/application.js b/src/js/ui/application.js
index c63c68b..a15df13 100644
--- a/src/js/ui/application.js
+++ b/src/js/ui/application.js
@@ -53,16 +53,14 @@ const SushiIface = <interface name={SUSHI_DBUS_NAME}>
const Application = new Lang.Class({
Name: 'Application',
+ Extends: Gtk.Application,
_init : function(args) {
- Gio.bus_own_name(SushiIface.name,
- Gio.BusNameOwnerFlags.NONE,
- null,
- Lang.bind(this, this._onNameAcquired),
- Lang.bind(this, this._onNameLost));
+ this.parent({ application_id: SUSHI_DBUS_NAME });
},
- _onNameAcquired : function() {
+ vfunc_startup : function() {
+ this.parent();
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(SushiIface, this);
this._dbusImpl.export(Gio.DBus.session, SUSHI_DBUS_PATH);
@@ -70,8 +68,7 @@ const Application = new Lang.Class({
this._createMainWindow();
},
- _onNameLost : function() {
- this.quit();
+ vfunc_activate : function() {
},
_createMainWindow : function() {
diff --git a/src/js/ui/main.js b/src/js/ui/main.js
index 3298d72..2492271 100644
--- a/src/js/ui/main.js
+++ b/src/js/ui/main.js
@@ -36,14 +36,12 @@ const Format = imports.util.format;
const Utils = imports.ui.utils;
const Tweener = imports.ui.tweener;
-function run() {
+function run(argv) {
Gettext.bindtextdomain('sushi', Path.LOCALE_DIR);
String.prototype.format = Format.format;
GLib.set_application_name('Sushi');
- let application = new Application.Application();
-
let slowdownEnv = GLib.getenv('SUSHI_SLOWDOWN_FACTOR');
if (slowdownEnv) {
let factor = parseFloat(slowdownEnv);
@@ -53,5 +51,6 @@ function run() {
Tweener.init();
- Gtk.main();
+ let application = new Application.Application();
+ return application.run(null);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]