From e61159cfbf9795005f6aba99a14dd4b6d6e01e48 Mon Sep 17 00:00:00 2001 From: Amir Mohammadi <183.amir@gmail.com> Date: Sat, 24 Oct 2015 18:55:21 +0330 Subject: [PATCH] removes extension.js since it's generated from a template now. --- frontend/applet/gnome-shell/extension.js | 172 ----------------------- 1 file changed, 172 deletions(-) delete mode 100644 frontend/applet/gnome-shell/extension.js diff --git a/frontend/applet/gnome-shell/extension.js b/frontend/applet/gnome-shell/extension.js deleted file mode 100644 index c221069..0000000 --- a/frontend/applet/gnome-shell/extension.js +++ /dev/null @@ -1,172 +0,0 @@ -const Main = imports.ui.main; -const MainLoop = imports.mainloop; -const Lang = imports.lang; -const St = imports.gi.St; -const Clutter = imports.gi.Clutter; -const PanelMenu = imports.ui.panelMenu; -const Gio = imports.gi.Gio; -const PopupMenu = imports.ui.popupMenu; -const Gettext = imports.gettext; - -const _ = Gettext.gettext; - -const ApiIface = " "; -const ApiProxy = Gio.DBusProxy.makeProxyWrapper(ApiIface); - -const ActionsIface = ' '; -const ActionsProxy = Gio.DBusProxy.makeProxyWrapper(ActionsIface); - -const AppIface = ' '; -const AppProxy = Gio.DBusProxy.makeProxyWrapper(AppIface); - -const Gahshomar = new Lang.Class({ - Name: 'Gahshomar.Gahshomar', - Extends: PanelMenu.Button, - - _init: function() { - this.parent(0.0); - - this._bus_name = 'org.gahshomar.Gahshomar'; - this._object_path = '/org/gahshomar/Gahshomar'; - this._interface_name = 'org.gahshomar.Api'; - this._alive = false; - // add day label - this.label = new St.Label({y_expand: true, - y_align: Clutter.ActorAlign.CENTER }); - this.actor.add_actor(this.label); - - // add popopMenuItem - this.popopMenuItemDate = new PopupMenu.PopupMenuItem(_('Open Gahshomar')); - this.popopMenuItemDate.connect('activate', Lang.bind(this, this._onDatePressed)); - this.menu.addMenuItem(this.popopMenuItemDate); - - this.popopMenuItemQuit = new PopupMenu.PopupMenuItem(''); - this.popopMenuItemQuit.connect('activate', Lang.bind(this, this._onQuitPressed)); - this.menu.addMenuItem(this.popopMenuItemQuit); - - this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); - - MainLoop.timeout_add(1000, - Lang.bind(this, this._connect)); - }, - - _connect: function(){ - try { - Gio.DBus.session.watch_name(this._bus_name, - Gio.BusNameWatcherFlags.NONE, // no auto launch - Lang.bind(this, this._onGahshomarAppeared), - Lang.bind(this, this._onGahshomarVanished)); - return false - } - catch(err){ - return true - } - - }, - - _start: function() - { - if (! this._alive) - { - // this._proxy = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SESSION, - // Gio.DBusProxyFlags.NONE, null, this._bus_name, this._object_path, - // this._interface_name, null) - this._proxy = new ApiProxy(Gio.DBus.session, this._bus_name, - this._object_path); - this._actions_proxy = new ActionsProxy(Gio.DBus.session, this._bus_name, - this._object_path); - this._app_proxy = new AppProxy(Gio.DBus.session, this._bus_name, - this._object_path); - this._alive = true; - this._timeoutId = MainLoop.timeout_add(5000, - Lang.bind(this, this._update)); - this._update() - } - }, - - _stop: function() - { - if (this._alive) - { - MainLoop.source_remove(this._timeoutId); - this._alive = false; - this.label.set_text('') - this.popopMenuItemDate.label.set_text(_('Open Gahshomar')) - this.popopMenuItemQuit.label.set_text('') - } - }, - - _onGahshomarAppeared: function(owner) { - this._start(); - }, - - _onGahshomarVanished: function(oldOwner) { - this._stop(); - }, - - _onTimer: function() { - if (! this._alive) - { - return false; - } - this._update() - return this._alive; - }, - - _update: function() { - text = this._proxy.GetDaySync()[0] - if (text[0] == '۰') { - text = text.slice(1); - } - this.label.set_text(text) - text = this._proxy.GetDateSync()[0] - this.popopMenuItemDate.label.set_text(text) - // text = this._proxy.GetQuitStringSync()[0] - this.popopMenuItemQuit.label.set_text(_('Quit')) - // this.popopMenuItemQuit.label.set_text(gahshomarUserExtensionLocalePath) - }, - - _onDestroy: function() - { - this._stop(); - this._destroy(); - }, - - _destroy: function() { - this._proxy = null; - this.actor.destroy(); - }, - - _onDatePressed: function() { - if (! this._alive) - { - return false; - } - else - { - this._app_proxy.ActivateSync({}) - } - }, - - _onQuitPressed: function() { - this._actions_proxy.ActivateSync('quit', [], {}) - }, -}); - -let _indicator; - -function init(extensionMeta) { - // gahshomarUserExtensionLocalePath = extensionMeta.path + '/locale'; - gahshomarUserExtensionLocalePath = '${prefix}/share/locale'; -} - -function enable() { - Gettext.bindtextdomain("gahshomar", ''); - Gettext.textdomain("gahshomar"); - _indicator = new Gahshomar; - Main.panel.addToStatusArea('gahshomar-applet', _indicator); -} - -function disable() { - _indicator.destroy(); -}