Update desklet every x seconds
This commit is contained in:
parent
fffb518ede
commit
b78361b3e9
@ -1,5 +1,9 @@
|
|||||||
const Desklet = imports.ui.desklet;
|
const Desklet = imports.ui.desklet;
|
||||||
const Settings = imports.ui.settings;
|
const Settings = imports.ui.settings;
|
||||||
|
const Mainloop = imports.mainloop;
|
||||||
|
const Lang = imports.lang;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
|
|
||||||
@ -55,6 +59,12 @@ MyDesklet.prototype = {
|
|||||||
var type = this.type;
|
var type = this.type;
|
||||||
// add text to label
|
// add text to label
|
||||||
this.text.set_text("Hello Desktop2 ".concat(type));
|
this.text.set_text("Hello Desktop2 ".concat(type));
|
||||||
|
// call this.update() in 5 seconds
|
||||||
|
this.timeout = Mainloop.timeout_add_seconds(5, Lang.bind(this, this.update));
|
||||||
|
},
|
||||||
|
|
||||||
|
on_desklet_removed: function() {
|
||||||
|
Mainloop.source_remove(this.timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user