From c37ec5f71fcb7aec2a6da0334179a22cbc88f322 Mon Sep 17 00:00:00 2001 From: Thomas Liebetraut Date: Fri, 1 Nov 2013 22:27:31 +0100 Subject: [PATCH] hg graft commit "Cleaner menu structure, nicer custom entry field" --- src/extension.js | 28 +++++++++++++++++----------- src/stylesheet.css | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 src/stylesheet.css diff --git a/src/extension.js b/src/extension.js index 4e2483e..77b83be 100644 --- a/src/extension.js +++ b/src/extension.js @@ -145,11 +145,26 @@ const TeaTime = new Lang.Class({ this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this._settings.connect("changed::" + Utils.TEATIME_STEEP_TIMES_KEY, Lang.bind(this, this._updateTeaList)); + + this.teaItemCont = new PopupMenu.PopupMenuSection(); + this.menu.addMenuItem(this.teaItemCont); + + let bottom = new PopupMenu.PopupMenuSection(); + this._customEntry = new St.Entry({ style_class: 'teatime-custom-entry', + track_hover: true, + hint_text: "Custom..." }); + this._customEntry.get_clutter_text().set_max_length(10); + this._customEntry.get_clutter_text().connect("key-press-event", Lang.bind(this, this._createCustomTimer)); + bottom.box.add(this._customEntry); + bottom.actor.set_style("padding: 0px 18px;") + + this.menu.addMenuItem(bottom); + this._updateTeaList(); }, _updateTeaList : function(config, output) { // make sure the menu is empty - this.menu.removeAll(); + this.teaItemCont.removeAll(); // fill with new teas let list = this._settings.get_value(Utils.TEATIME_STEEP_TIMES_KEY).unpack(); @@ -160,17 +175,8 @@ const TeaTime = new Lang.Class({ menuItem.connect('activate', Lang.bind(this, function() { this._initCountdown(time); })); - this.menu.addMenuItem(menuItem); + this.teaItemCont.addMenuItem(menuItem); } - let bottom = new PopupMenu.PopupMenuSection(); - this._customEntry = new St.Entry({ style_class: 'teatime-custom-entry', - track_hover: true, - hint_text: "Custom..." }); - this._customEntry.get_clutter_text().set_max_length(10); - this._customEntry.get_clutter_text().connect("key-press-event", Lang.bind(this, this._createCustomTimer)); - bottom.box.add(this._customEntry); - bottom.actor.set_style("padding: 0px 20px;") - this.menu.addMenuItem(bottom); }, _createCustomTimer: function(text, event) { if (event.get_key_symbol() == Clutter.KEY_Enter || diff --git a/src/stylesheet.css b/src/stylesheet.css new file mode 100644 index 0000000..ae478f8 --- /dev/null +++ b/src/stylesheet.css @@ -0,0 +1,34 @@ +.teatime-custom-entry { + color: rgb(128, 128, 128); + caret-color: rgb(128, 128, 128); + font-size: 12pt; + caret-size: 1px; + selected-color: white; + padding: 4px 4px; + + border: 2px solid rgba(245,245,245,0.2); + background-gradient-start: rgba(5,5,6,0.1); + background-gradient-end: rgba(254,254,254,0.1); + background-gradient-direction: vertical; + transition-duration: 300; + box-shadow: inset 0px 2px 4px rgba(0,0,0,0.6); + border-radius: 5px; +} + +.teatime-custom-entry:hover, +.teatime-custom-entry:focus + { + color: rgb(64, 64, 64); + caret-color: rgb(64, 64, 64); + border: 2px solid rgb(136,138,133); + background-gradient-start: rgb(200,200,200); + background-gradient-end: white; + background-gradient-direction: vertical; + box-shadow: inset 0px 2px 4px rgba(0,0,0,0.6); + transition-duration: 300; +} + +.teatime-custom-entry:focus { + font-weight: bold; + transition-duration: 0; +}