File 0002-application-Instantiate-ShellSearchProvider-only-whe.patch of Package gnome-documents.5361
From 930073387bf3f37152a5bee7971f27e7e447c44e Mon Sep 17 00:00:00 2001
From: Debarshi Ray <debarshir@gnome.org>
Date: Thu, 8 Jun 2017 16:12:15 +0200
Subject: [PATCH 02/18] application: Instantiate ShellSearchProvider only when
registering
Now that the --version flag was implemented using the
handle_local_options virtual method, it is possible that the
Application may exit without ever touching D-Bus. So it is a tad
wasteful to instantiate the ShellSearchProvider when it is never going
to be used. Since we are unreffing it in dbus_register, we might as
well create it in dbus_register.
https://bugzilla.gnome.org/show_bug.cgi?id=783548
Backported by Mike Gorse <mgorse@suse.com>
---
diff -urp gnome-documents-3.20.1.orig/src/application.js gnome-documents-3.20.1/src/application.js
--- gnome-documents-3.20.1.orig/src/application.js 2017-07-26 16:18:57.662130198 -0500
+++ gnome-documents-3.20.1/src/application.js 2017-07-26 16:19:45.938328556 -0500
@@ -107,6 +107,7 @@ const Application = new Lang.Class({
this.minersRunning = [];
this._activationTimestamp = Gdk.CURRENT_TIME;
this._extractPriority = null;
+ this._searchProvider = null;
this.isBooks = isBooks;
@@ -124,10 +125,6 @@ const Application = new Lang.Class({
this.parent({ application_id: appid,
inactivity_timeout: 12000 });
-
- this._searchProvider = new ShellSearchProvider.ShellSearchProvider();
- this._searchProvider.connect('activate-result', Lang.bind(this, this._onActivateResult));
- this._searchProvider.connect('launch-search', Lang.bind(this, this._onLaunchSearch));
},
_initGettingStarted: function() {
@@ -677,6 +674,10 @@ const Application = new Lang.Class({
vfunc_dbus_register: function(connection, path) {
this.parent(connection, path);
+ this._searchProvider = new ShellSearchProvider.ShellSearchProvider();
+ this._searchProvider.connect('activate-result', Lang.bind(this, this._onActivateResult));
+ this._searchProvider.connect('launch-search', Lang.bind(this, this._onLaunchSearch));
+
this._searchProvider.export(connection);
return true;
},
diff -urp gnome-documents-3.20.1.orig/src/application.js.orig gnome-documents-3.20.1/src/application.js.orig
--- gnome-documents-3.20.1.orig/src/application.js.orig 2016-08-17 03:40:05.000000000 -0500
+++ gnome-documents-3.20.1/src/application.js.orig 2017-07-26 16:18:40.854061073 -0500
@@ -682,7 +682,10 @@ const Application = new Lang.Class({
},
vfunc_dbus_unregister: function(connection, path) {
- this._searchProvider.unexport(connection);
+ if (this._searchProvider != null) {
+ this._searchProvider.unexport(connection);
+ this._searchProvider = null;
+ }
this.parent(connection, path);
},