mirror of
https://github.com/oleid/gnome-shell-teatime.git
synced 2022-04-29 18:53:50 +00:00
hg graft commit "Cleaner menu structure, nicer custom entry field"
This commit is contained in:
parent
6162e04028
commit
c37ec5f71f
@ -145,11 +145,26 @@ const TeaTime = new Lang.Class({
|
|||||||
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
|
||||||
this._settings.connect("changed::" + Utils.TEATIME_STEEP_TIMES_KEY,
|
this._settings.connect("changed::" + Utils.TEATIME_STEEP_TIMES_KEY,
|
||||||
Lang.bind(this, this._updateTeaList));
|
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();
|
this._updateTeaList();
|
||||||
},
|
},
|
||||||
_updateTeaList : function(config, output) {
|
_updateTeaList : function(config, output) {
|
||||||
// make sure the menu is empty
|
// make sure the menu is empty
|
||||||
this.menu.removeAll();
|
this.teaItemCont.removeAll();
|
||||||
|
|
||||||
// fill with new teas
|
// fill with new teas
|
||||||
let list = this._settings.get_value(Utils.TEATIME_STEEP_TIMES_KEY).unpack();
|
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() {
|
menuItem.connect('activate', Lang.bind(this, function() {
|
||||||
this._initCountdown(time);
|
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) {
|
_createCustomTimer: function(text, event) {
|
||||||
if (event.get_key_symbol() == Clutter.KEY_Enter ||
|
if (event.get_key_symbol() == Clutter.KEY_Enter ||
|
||||||
|
34
src/stylesheet.css
Normal file
34
src/stylesheet.css
Normal file
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user