From 4fffb16ced90baac12aab642f7f420d4723bf740 Mon Sep 17 00:00:00 2001 From: Olaf Leidinger Date: Sun, 3 Nov 2013 17:24:02 +0100 Subject: [PATCH] make brewing time right-aligned --- src/extension.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index 682e8c7..f55af6b 100644 --- a/src/extension.js +++ b/src/extension.js @@ -112,6 +112,21 @@ const TeaTimeFullscreenNotification = new Lang.Class({ }) +const PopupTeaMenuItem = new Lang.Class({ + Name: 'PopupTeaMenuItem', + Extends: PopupMenu.PopupBaseMenuItem, + + _init: function (sTeaname, nBrewtime, params) { + this.parent(params); + + this.tealabel = new St.Label({ text: sTeaname }); + this.timelabel = new St.Label({ text: Utils.formatTime(nBrewtime) }); + this.actor.add(this.tealabel, { expand: true }); + this.actor.add(this.timelabel); + } +}); + + const TeaTime = new Lang.Class({ Name : 'TeaTime', Extends : PanelMenu.Button, @@ -156,7 +171,7 @@ const TeaTime = new Lang.Class({ for (let teaname in list) { let time = list[teaname].get_uint32(); - let menuItem = new PopupMenu.PopupMenuItem(_(teaname) + ": " + Utils.formatTime(time)); + let menuItem = new PopupTeaMenuItem(_(teaname), time); menuItem.connect('activate', Lang.bind(this, function() { this._initCountdown(time); }));