fix the fix for older gnome-shells

This commit is contained in:
Olaf Leidinger 2013-11-03 22:54:06 +01:00
parent a113f7a859
commit 4129d0f968

View File

@ -119,15 +119,23 @@ 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) });
if (this.actor instanceof St.BoxLayout) {
// will be used for gnome-shell 3.10 and possibly above where this.actor is BoxLayout
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 { } else {
this.tealabel = new St.Label({ text: sTeaname + "\t\t" + Utils.formatTime(nBrewtime) }); this.actor2 = new St.BoxLayout({ style_class: 'popup-menu-item',
this.actor.add(this.tealabel, { expand: true }); reactive: true,
track_hover: true,
can_focus: true,
accessible_role: imports.gi.Atk.Role.MENU_ITEM });
this.actor2.add(this.tealabel, { expand: true });
this.actor2.add(this.timelabel);
this.addActor(this.actor2, {expand: true});
} }
} }
}); });