如何在on_applet_clicked函数中编写代码,用示例内容显示GtkPopover?gtk_popover_new (),下一步是什么?
const Applet = imports.ui.applet;
const Util = imports.misc.util;
function MyApplet(orientation, panel_height, instance_id) {
this._init(orientation, panel_height, instance_id);
}
MyApplet.prototype = {
__proto__: Applet.IconApplet.prototype,
_init: function(orientation, panel_height, instance_id) {
Applet.IconApplet.prototype._init.call(this, orientation, panel_height, instance_id);
this.set_applet_icon_name("folder-system");
this.set_applet_tooltip(_("Click here to kill a window"));
},
on_applet_clicked: function() {
// here
}
};
function main(metadata, orientation, panel_height, instance_id) {
return new MyApplet(orientation, panel_height, instance_id);
}发布于 2016-08-03 05:34:20
您不能在Cinnamon窗口管理器UI元素中使用GTK+。
GTK+是一个客户端应用程序工具包;它不能在窗口管理器中使用。
如果要为小程序使用菜单,则必须使用PopupMenu实例,将其导入为:
const PopupMenu = imports.ui.popupMenu;并用PopupMenuItem实例及其子类填充它。
https://stackoverflow.com/questions/38710350
复制相似问题