Restructure desklet.js

This commit is contained in:
Raymundo Cassani 2020-05-23 10:50:04 -04:00
parent d1c8e88e9f
commit fffb518ede

View File

@ -26,15 +26,35 @@ MyDesklet.prototype = {
}, },
setupUI: function(){ setupUI: function(){
// initialize size
// create the clutter elements
// type of system variable to graph
var type = this.type; var type = this.type;
// creates container for one child // creates container for one child
this.window = new St.Bin(); this.window = new St.Bin();
// creates a label with text // creates a label to present text
this.text = new St.Label({text: "Hello Desktop ".concat(type)}); this.text = new St.Label();
// adds label to container // adds label to container
this.window.add_actor(this.text); this.window.add_actor(this.text);
// Sets the container as content actor of the desklet // Sets the container as content actor of the desklet
this.setContent(this.window); this.setContent(this.window);
// set decoration settings
// set initial values
this.update();
}, },
update: function() {
// console log
global.log("update SMG");
// do the graph
var type = this.type;
// add text to label
this.text.set_text("Hello Desktop2 ".concat(type));
}
}; };