Hopefully make it work for gnome-shell 3.8 and older

This commit is contained in:
Olaf Leidinger 2013-11-03 22:30:50 +01:00
parent dad8aa2733
commit a113f7a859

View File

@ -119,10 +119,16 @@ const PopupTeaMenuItem = new Lang.Class({
_init: function (sTeaname, nBrewtime, params) { _init: function (sTeaname, nBrewtime, params) {
this.parent(params); this.parent(params);
if (this.actor instanceof St.BoxLayout) {
// will be used for gnome-shell 3.10 and possibly above
this.tealabel = new St.Label({ text: sTeaname }); this.tealabel = new St.Label({ text: sTeaname });
this.timelabel = new St.Label({ text: Utils.formatTime(nBrewtime) }); this.timelabel = new St.Label({ text: Utils.formatTime(nBrewtime) });
this.actor.add(this.tealabel, { expand: true }); this.actor.add(this.tealabel, { expand: true });
this.actor.add(this.timelabel); this.actor.add(this.timelabel);
} else {
this.tealabel = new St.Label({ text: sTeaname + "\t\t" + Utils.formatTime(nBrewtime) });
this.actor.add(this.tealabel, { expand: true });
}
} }
}); });
@ -164,12 +170,10 @@ const TeaTime = new Lang.Class({
this.teaItemCont = new PopupMenu.PopupMenuSection(); this.teaItemCont = new PopupMenu.PopupMenuSection();
/*******************/ /*******************/
// maybe one day the PopupImageMenuItem works^^
let head = new PopupMenu.PopupMenuSection(); let head = new PopupMenu.PopupMenuSection();
let settingsIcon = new St.Icon({ icon_name : 'gtk-preferences', icon_size: 15 }); let item = new PopupMenu.PopupMenuItem(_("Show settings")); //, 'gtk-preferences');
let item = new PopupMenu.PopupMenuItem(_("Show settings")); // item._icon.icon_size = 15;
item.actor.set_pack_start(true); // pack the icon in front of the text label
item.actor.add(settingsIcon);
item.connect('activate', Lang.bind(this, this._showPreferences)); item.connect('activate', Lang.bind(this, this._showPreferences));
head.addMenuItem(item); head.addMenuItem(item);