Created
March 10, 2011 07:19
-
-
Save yurenju/863697 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const St = imports.gi.St; | |
const Mainloop = imports.mainloop; | |
const PanelMenu = imports.ui.panelMenu; | |
const PopupMenu = imports.ui.popupMenu; | |
const Main = imports.ui.main; | |
function HelloWorldButton() { | |
this._init(); | |
} | |
HelloWorldButton.prototype = { | |
__proto__: PanelMenu.Button.prototype, | |
_init: function() { | |
PanelMenu.Button.prototype._init.call(this, 0.0); | |
let button = new St.Button({label:"Hello World"}); | |
let item; | |
this.actor.set_child(button); | |
item = new PopupMenu.PopupMenuItem("row 1"); | |
this.menu.addMenuItem(item); | |
item = new PopupMenu.PopupMenuItem("row 2"); | |
this.menu.addMenuItem(item); | |
}, | |
}; | |
function main() { | |
let helloworld = new HelloWorldButton(); | |
Main.panel._leftBox.add(helloworld.actor); | |
Main.panel._menus.addMenu(helloworld.menu); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment