[hamster-applet] add fact using dbus not the command line



commit fcba25ea93d3e51d6b0a7d079cc006408bc66ccf
Author: Toms BauÄis <toms baugis gmail com>
Date:   Sat Jul 9 17:11:55 2011 +0300

    add fact using dbus not the command line

 src/shell_extension/extension.js |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/shell_extension/extension.js b/src/shell_extension/extension.js
index 20b6ef5..29cef8f 100644
--- a/src/shell_extension/extension.js
+++ b/src/shell_extension/extension.js
@@ -35,6 +35,7 @@ const HamsterIface = {
     methods: [
 		{ name: 'GetTodaysFacts', inSignature: '', outSignature: 'a(iiissisasii)'},
 		{ name: 'StopTracking', inSignature: 'i'},
+		{ name: 'AddFact', inSignature: 'siib', outSignature: 'i'},
     ],
     signals: [
         {name: 'TagsChanged', inSignature: ''},
@@ -316,19 +317,18 @@ HamsterButton.prototype = {
 		let date = new Date()
 		date = new Date(date.setUTCMinutes(date.getUTCMinutes() - date.getTimezoneOffset())); // getting back to UTC
 
-		let epochSeconds = date.getTime() / 1000;
+		let epochSeconds = Math.floor(date.getTime() / 1000);
 		this._proxy.StopTrackingRemote(epochSeconds);
 	},
 
 	_onActivityEntry: function() {
 		let text = this._activityEntry._textEntry.get_text();
-		let cmdline = 'hamster-cli start "' + text + '"';
-		try {
-			Util.trySpawnCommandLine(cmdline);
-			this._activityLabel.set_text(' ' + text);
-		} catch (e) {
-			global.log('_onActivityEntry(): got exception: ' + e);
-		}
+
+		let date = new Date()
+		date = new Date(date.setUTCMinutes(date.getUTCMinutes() - date.getTimezoneOffset())); // getting back to UTC
+		let epochSeconds = Math.floor(date.getTime() / 1000);
+
+		this._proxy.AddFactRemote(text, epochSeconds, 0, false)
 	},
 
 	_onGlobalKeyBinding: function() {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]