[gnome-documents] search-provider: always forward the shell timestamp



commit 57797e5054428e6ca02504480a73ca4ed24b8be2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Apr 1 12:28:29 2013 -0400

    search-provider: always forward the shell timestamp
    
    When we're launched from a shell search, use the timestamp we're passed
    to show the main window, to ensure the Documents window will get WM
    focus.

 src/application.js         |   13 +++++++++----
 src/shellSearchProvider.js |    4 ++--
 2 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 165fc5b..dcc6493 100644
--- a/src/application.js
+++ b/src/application.js
@@ -94,6 +94,7 @@ const Application = new Lang.Class({
 
     _init: function() {
         this.minersRunning = [];
+        this._activationTimestamp = Gdk.CURRENT_TIME;
 
         Gettext.bindtextdomain('gnome-documents', Path.LOCALE_DIR);
         Gettext.textdomain('gnome-documents');
@@ -481,8 +482,10 @@ const Application = new Lang.Class({
     },
 
     vfunc_activate: function() {
-        if (this._mainWindow)
-            this._mainWindow.window.present();
+        if (this._mainWindow) {
+            this._mainWindow.window.present_with_time(this._activationTimestamp);
+            this._activationTimestamp = Gdk.CURRENT_TIME;
+        }
     },
 
     vfunc_command_line: function(cmdline) {
@@ -521,9 +524,10 @@ const Application = new Lang.Class({
         Mainloop.idle_add(Lang.bind(this, this._clearState));
     },
 
-    _onActivateResult: function(provider, urn, terms) {
+    _onActivateResult: function(provider, urn, terms, timestamp) {
         this._createWindow();
         modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
+        this._activationTimestamp = timestamp;
         this.activate();
 
         searchController.setString(terms.join(' '));
@@ -544,12 +548,13 @@ const Application = new Lang.Class({
         }
     },
 
-    _onLaunchSearch: function(provider, terms) {
+    _onLaunchSearch: function(provider, terms, timestamp) {
         this._createWindow();
         modeController.setWindowMode(WindowMode.WindowMode.OVERVIEW);
         searchController.setString(terms.join(' '));
         this.change_action_state('search', GLib.Variant.new('b', true));
 
+        this._activationTimestamp = timestamp;
         this.activate();
     }
 });
diff --git a/src/shellSearchProvider.js b/src/shellSearchProvider.js
index 3db0352..a43dc76 100644
--- a/src/shellSearchProvider.js
+++ b/src/shellSearchProvider.js
@@ -461,11 +461,11 @@ const ShellSearchProvider = new Lang.Class({
     },
 
     ActivateResult: function(id, terms, timestamp) {
-        this.emit('activate-result', id, terms);
+        this.emit('activate-result', id, terms, timestamp);
     },
 
     LaunchSearch: function(terms, timestamp) {
-        this.emit('launch-search', terms);
+        this.emit('launch-search', terms, timestamp);
     }
 });
 Signals.addSignalMethods(ShellSearchProvider.prototype);


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