Add more data about origin application to the "Launched" signal.
authorMichal Hruby <michal.mhr@gmail.com>
Mon, 7 Feb 2011 20:25:33 +0000 (21:25 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 8 Feb 2011 04:39:07 +0000 (23:39 -0500)
This will help applications such as zeitgeist's datahub to collect
more complete information about application launches, as the "actor"
of a launch is important for zeitgeist's magic to work properly.

gio/gdesktopappinfo.c

index 1fe5ecf..987f073 100644 (file)
@@ -943,6 +943,7 @@ notify_desktop_launch (GDBusConnection  *session_bus,
   GVariantBuilder extras_variant;
   GList *iter;
   const char *desktop_file_id;
+  const char *gio_desktop_file;
 
   if (session_bus == NULL)
     return;
@@ -957,6 +958,18 @@ notify_desktop_launch (GDBusConnection  *session_bus,
                           "startup-id",
                           g_variant_new ("s",
                                          sn_id));
+  gio_desktop_file = g_getenv ("GIO_LAUNCHED_DESKTOP_FILE");
+  if (gio_desktop_file != NULL)
+    g_variant_builder_add (&extras_variant, "{sv}",
+                          "origin-desktop-file",
+                          g_variant_new_bytestring (gio_desktop_file));
+  g_variant_builder_add (&extras_variant, "{sv}",
+                        "origin-prgname",
+                        g_variant_new_bytestring (g_get_prgname ()));
+  g_variant_builder_add (&extras_variant, "{sv}",
+                        "origin-pid",
+                        g_variant_new ("x",
+                                       (gint64)getpid ()));
 
   if (info->filename)
     desktop_file_id = info->filename;