history: Fix HistoryManager

Make GSettings support optional, refactor text entry handling,
fix some off-by-one bugs in the management itself, use Params
for parsing, fix other typos and bugs.

https://bugzilla.gnome.org/show_bug.cgi?id=642793
This commit is contained in:
Jasper St. Pierre
2011-02-28 12:22:12 -05:00
parent 8ce97961b4
commit 75ae209653
3 changed files with 70 additions and 53 deletions

View File

@ -234,21 +234,10 @@ __proto__: ModalDialog.ModalDialog.prototype,
this._commandCompleter = new CommandCompleter();
this._group.connect('notify::visible', Lang.bind(this._commandCompleter, this._commandCompleter.update));
this._history = new History.HistoryManager(HISTORY_KEY);
this._history.connect('changed', Lang.bind(this, function(history, text) {
this._entryText.set_text(text);
}));
this._history = new History.HistoryManager({ gsettingsKey: HISTORY_KEY,
entry: this._entryText });
this._entryText.connect('key-press-event', Lang.bind(this, function(o, e) {
let symbol = e.get_key_symbol();
if (symbol == Clutter.Down) {
this._history.nextItem(o.get_text());
return true;
}
if (symbol == Clutter.Up) {
this._history.prevItem(o.get_text());
return true;
}
if (symbol == Clutter.Return || symbol == Clutter.KP_Enter) {
if (Shell.get_event_state(e) & Clutter.ModifierType.CONTROL_MASK)
this._run(o.get_text(), true);