[tracker/tracker-0.10] tracker-needle: Make sure apps launch and don't show the desktop file
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] tracker-needle: Make sure apps launch and don't show the desktop file
- Date: Tue, 8 Feb 2011 14:35:52 +0000 (UTC)
commit 61a31572778813593b5dae4f2af23d9d230fae89
Author: Martyn Russell <martyn lanedo com>
Date: Sun Feb 6 11:48:47 2011 +0000
tracker-needle: Make sure apps launch and don't show the desktop file
Fixes GB#640623, Double-click on application result should start the application
src/tracker-needle/tracker-needle.vala | 27 +++++++++++++++++++++++++++
src/tracker-needle/tracker-query.vala | 12 ++++++------
2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 8366069..6280ba8 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -689,7 +689,34 @@ public class Tracker.Needle {
model.get (iter, col, out uri);
debug ("Selected uri:'%s'", uri);
+ // Bit of a hack for now if there is no URI scheme, we assume that
+ // the uri is actually a command line to launch.
+ if (uri.index_of ("://") < 1) {
+ var command = uri.split (" ");
+ debug ("Attempting to spawn_async() '%s'", command[0]);
+
+ Pid child_pid;
+ string[] argv = new string[1];
+ argv[0] = command[0];
+
+ try {
+ Process.spawn_async ("/usr/bin",
+ argv,
+ null, // environment
+ SpawnFlags.SEARCH_PATH,
+ null, // child_setup
+ out child_pid);
+ } catch (Error e) {
+ warning ("Could not launch '%s', %d->%s", command[0], e.code, GLib.strerror (e.code));
+ return;
+ }
+
+ debug ("Launched application with PID:%d", child_pid);
+ return;
+ }
+
try {
+ debug ("Attempting to launch application for uri:'%s'", uri);
AppInfo.launch_default_for_uri (uri, null);
} catch (GLib.Error e) {
warning ("Could not launch application: " + e.message);
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index cc9e23d..87c7fd8 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -82,15 +82,15 @@ public class Tracker.Query {
case Type.APPLICATIONS:
query = @"
SELECT
- ?urn
- nie:url(?urn)
- tracker:coalesce(nie:title(?urn), nfo:fileName(?urn), \"$unknown\")
+ ?urn
+ tracker:coalesce(nfo:softwareCmdLine(?urn), ?urn)
+ tracker:coalesce(nie:title(?urn), nfo:fileName(?urn), \"$unknown\")
nie:comment(?urn)
WHERE {
- ?urn a nfo:Software .
- ?urn fts:match \"$criteria_escaped\" .
+ ?urn a nfo:Software ;
+ fts:match \"$criteria_escaped\"
}
- ORDER BY DESC(fts:rank(?urn)) DESC(nie:title(?urn))
+ ORDER BY DESC(fts:rank(?urn)) DESC(nie:title(?urn))
OFFSET $offset LIMIT $limit
";
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]