[gnome-shell-extensions/extension-live-disable: 4/11] apps-menu, places-menu, drive-menu: port to new extension API
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/extension-live-disable: 4/11] apps-menu, places-menu, drive-menu: port to new extension API
- Date: Tue, 2 Aug 2011 21:37:24 +0000 (UTC)
commit 6a33fd077da61545831f8b484b1f6e76a76b0b9b
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Tue Aug 2 23:29:27 2011 +0200
apps-menu, places-menu, drive-menu: port to new extension API
main() has been replaced by init(), enable() and disable()
committing together as changes are very similar in nature
extensions/apps-menu/extension.js | 16 ++++++++++++----
extensions/drive-menu/extension.js | 11 ++++++++---
extensions/places-menu/extension.js | 12 +++++++++---
3 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index a867986..e62c5c6 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -7,8 +7,6 @@ const PanelMenu = imports.ui.panelMenu;
const Shell = imports.gi.Shell;
const Lang = imports.lang;
const ICON_SIZE = 28;
-const Gettext = imports.gettext.domain('gnome-shell-extensions');
-const _ = Gettext.gettext;
let appsys = Shell.AppSystem.get_default();
@@ -89,9 +87,19 @@ ApplicationsButton.prototype = {
};
-function main(metadata) {
- let appsMenuButton = new ApplicationsButton();
+function init(metadata) {
+ // nothing to do here
+}
+
+let appsMenuButton;
+
+function enable() {
+ appsMenuButton = new ApplicationsButton();
Main.panel._leftBox.insert_actor(appsMenuButton.actor, 1);
Main.panel._leftBox.child_set(appsMenuButton.actor, { y_fill : true } );
Main.panel._menus.addMenu(appsMenuButton.menu);
+}
+
+function disable() {
+ appsMenuButton.destroy();
}
\ No newline at end of file
diff --git a/extensions/drive-menu/extension.js b/extensions/drive-menu/extension.js
index 20c78b4..04eb727 100644
--- a/extensions/drive-menu/extension.js
+++ b/extensions/drive-menu/extension.js
@@ -90,9 +90,14 @@ DriveMenu.prototype = {
}
// Put your extension initialization code here
-function main(metadata) {
+function init(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
+}
+
+function enable() {
+ Main.panel.addToStatusArea('drive-menu', new DriveMenu);
+}
- Panel.STANDARD_TRAY_ICON_ORDER.unshift('drive-menu');
- Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['drive-menu'] = DriveMenu;
+function disable() {
+ Main.panel.removeFromStatusArea('drive-menu');
}
diff --git a/extensions/places-menu/extension.js b/extensions/places-menu/extension.js
index 552e045..cd4724c 100644
--- a/extensions/places-menu/extension.js
+++ b/extensions/places-menu/extension.js
@@ -113,9 +113,15 @@ PlacesMenu.prototype = {
};
-function main(metadata) {
+function init(metadata) {
imports.gettext.bindtextdomain('gnome-shell-extensions', metadata.localedir);
-
Panel.STANDARD_TRAY_ICON_ORDER.unshift('places-menu');
- Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['places-menu'] = PlacesMenu;
+}
+
+function enable() {
+ Main.panel.addToStatusArea('places-menu', new PlacesMenu);
+}
+
+function disable() {
+ Main.panel.removeFromStatusArea('places-menu');
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]