[gnome-characters] SearchProvider: use proper startup notification for launching search
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-characters] SearchProvider: use proper startup notification for launching search
- Date: Wed, 4 Mar 2015 02:54:57 +0000 (UTC)
commit 2d2752bebd952ccf208a43fd7e3ec3bef900335f
Author: Giovanni Campagna <scampa giovanni gmail com>
Date: Tue Mar 3 01:58:08 2015 -0800
SearchProvider: use proper startup notification for launching search
This code was copied from gnome-weather, which explicitly tries to
avoid Gdk/Gtk+ in the background service (so that it could be
one day launched as a user service from systemd). But gnome-characters
initializes Gtk+ anyway to handle the clipboard, there is no
reason for degraded operation.
In particular, this gives a nice spinner while gnome-characters
starts up (which is almost invisible, but it can become visible
on a slow disk and cold cache)
https://bugzilla.gnome.org/show_bug.cgi?id=745508
src/searchProvider.js | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/searchProvider.js b/src/searchProvider.js
index 4e11421..5a40c30 100644
--- a/src/searchProvider.js
+++ b/src/searchProvider.js
@@ -17,6 +17,7 @@
// with Gnome Weather; if not, write to the Free Software Foundation,
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const Lang = imports.lang;
@@ -116,7 +117,13 @@ const SearchProvider = new Lang.Class({
},
_getPlatformData: function(timestamp) {
- return {'desktop-startup-id': new GLib.Variant('s', '_TIME' + timestamp) };
+ let display = Gdk.Display.get_default();
+ let context = display.get_app_launch_context();
+ context.set_timestamp(timestamp);
+
+ let app = Gio.DesktopAppInfo.new('org.gnome.Characters.desktop');
+ let id = context.get_startup_notify_id(app, []);
+ return {'desktop-startup-id': new GLib.Variant('s', id) };
},
_activateAction: function(action, parameter, timestamp) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]