[gnome-documents/gnome-3-28] application: Synchronously initialize the getting started PDF
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/gnome-3-28] application: Synchronously initialize the getting started PDF
- Date: Thu, 14 Jun 2018 09:04:19 +0000 (UTC)
commit f52375e47e546163e7f37dff0ad0322e0a64a766
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Jun 6 20:22:33 2018 +0200
application: Synchronously initialize the getting started PDF
The getting started PDF is only useful when the user runs the
application, and is not needed by the search provider. Therefore, its
initialization needs to be removed from the common startup shared
between the application and the search provider.
However, creating the MainWindow starts the TrackerControllers. The PDF
needs to be initialized before that happens to let the
TrackerControllers include it in their queries. Synchronously
initializing the PDF makes it easier to enforce this; and since this
is happening before the UI is brought up, there's no question of
blocking it.
https://bugzilla.gnome.org/show_bug.cgi?id=791518
src/application.js | 44 ++++++++++++++++----------------------------
1 file changed, 16 insertions(+), 28 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 8d168588..02cba422 100644
--- a/src/application.js
+++ b/src/application.js
@@ -138,40 +138,28 @@ var Application = new Lang.Class({
this.gettingStartedLocation = null;
- function checkNextFile(obj) {
- let file = files.shift();
- if (!file) {
- log('Can\'t find a valid getting started PDF document');
- return;
+ for (let i in files) {
+ try {
+ let info = files[i].query_info(Gio.FILE_ATTRIBUTE_STANDARD_TYPE,
+ Gio.FileQueryInfoFlags.NONE,
+ null);
+ } catch (e) {
+ continue;
}
- file.query_info_async(Gio.FILE_ATTRIBUTE_STANDARD_TYPE,
- Gio.FileQueryInfoFlags.NONE,
- GLib.PRIORITY_DEFAULT,
- null,
- Lang.bind(this,
- function(object, res) {
- try {
- let info = object.query_info_finish(res);
- } catch (e) {
- checkNextFile.apply(this);
- return;
- }
+ this.gettingStartedLocation = files[i].get_parent();
- this.gettingStartedLocation = file.get_parent();
+ try {
+ manager.index_file(files[i], null);
+ } catch (e) {
+ logError(e, 'Error indexing the getting started PDF');
+ }
- manager.index_file_async(file, null,
- function(object, res) {
- try {
- manager.index_file_finish(res);
- } catch (e) {
- logError(e, 'Error indexing the getting started PDF');
- }
- });
- }));
+ break;
}
- checkNextFile.apply(this);
+ if (!this.gettingStartedLocation)
+ log('Can\'t find a valid getting started PDF document');
},
_nightModeCreateHook: function(action) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]