When I try to open a GtkWindow from a cinnamon applet, the entire desktop freezes.
No errors in the ~/.cinnamon/glass.log
file.
const Gtk = imports.gi.Gtk;
function MyApplet(orientation)
{
this._init(orientation);
}
MyApplet.prototype =
{
__proto__: Applet.IconApplet.prototype,
_init: function(orientation)
{
Applet.IconApplet.prototype._init.call(this, orientation);
try {
this.set_applet_icon_name("dialog-question");
this.set_applet_tooltip("test");
}
catch (e) {
global.logError(e);
};
},
on_applet_clicked: function(event)
{
Gtk.init(null, 0);
let mwindow = new Gtk.Window ({type : Gtk.WindowType.TOPLEVEL});
mwindow.title = "Hello World!";
mwindow.connect ("destroy", function(){Gtk.main_quit()});
mwindow.show();
Gtk.main();
}
};
function main(metadata, orientation)
{
let myApplet = new MyApplet(orientation);
return myApplet;
}
The code is executed until Gtk.main()
then no window is displayed and the desktop get frozen.
Anyone knows how to make it work correctly?