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
This commit is contained in:
Giovanni Campagna
2011-08-02 23:29:27 +02:00
parent 2732f6d2c2
commit 6a33fd077d
3 changed files with 30 additions and 11 deletions
+12 -4
View File
@@ -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();
}
+9 -4
View File
@@ -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);
Panel.STANDARD_TRAY_ICON_ORDER.unshift('drive-menu');
Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION['drive-menu'] = DriveMenu;
}
function enable() {
Main.panel.addToStatusArea('drive-menu', new DriveMenu);
}
function disable() {
Main.panel.removeFromStatusArea('drive-menu');
}
+9 -3
View File
@@ -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');
}