Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added clear history button

  • Loading branch information...
commit d64cb644b2a6fb7f426cce3f33a78b6d362a30e9 1 parent 1d77a7c
@jcrussell authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 extension.js
View
10 extension.js
@@ -67,6 +67,10 @@ ActivityRecorder.prototype = {
// Refresh the menu (with updated times) every time it opens
this.menu.connect('open-state-changed', Lang.bind(this, this._onMenuOpenStateChanged));
+ this._reset();
+ },
+
+ _reset: function() {
// Setup state
this._usage = {};
this._updateState();
@@ -101,9 +105,13 @@ ActivityRecorder.prototype = {
if(count == 0) {
menu.addMenuItem(new PopupMenu.PopupMenuItem("Insufficient History... get to work!"));
}
- else { // Add Total
+ else { // Add Total and Reset
menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
menu.addMenuItem(new TotalUsageMenuItem(makeTimeStrFromMins(total)));
+
+ item = new PopupMenu.PopupMenuItem(_("Clear History"));
+ item.connect('activate', Lang.bind(this, this._reset));
+ this.menu.addMenuItem(item);
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.