Reputation: 755
How to write code in on_applet_clicked
function that show GtkPopover
with example content? gtk_popover_new ()
and what next with this?
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);
}
Upvotes: 0
Views: 209
Reputation: 8815
You cannot use GTK+ within the Cinnamon window manager UI elements.
GTK+ is a client-side, application toolkit; it cannot be used inside a window manager.
If you want to use a menu for an applet, you'll have to use a PopupMenu
instance by importing it as:
const PopupMenu = imports.ui.popupMenu;
and populate it with PopupMenuItem
instances and their subclasses.
Upvotes: 1