From 408152b06067fc299e91e307a208a811ba466502 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:29:44 +0000 Subject: import gnome-documents-3.22.2-8.el7 --- diff --git a/SOURCES/gnome-documents-getting-started.patch b/SOURCES/gnome-documents-getting-started.patch new file mode 100644 index 0000000..78a4bf3 --- /dev/null +++ b/SOURCES/gnome-documents-getting-started.patch @@ -0,0 +1,478 @@ +From e7f496a155da98fe6321b157b83c878001ea8fb8 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 7 Dec 2017 20:11:39 +0100 +Subject: [PATCH 1/7] application: Insert the getting started PDF only when + showing a window + +The startup is shared between the application and the search provider. +There is no need to initialize the getting started PDF for the search +provider, since it is only useful when the user runs the application. + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/application.js | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/application.js b/src/application.js +index 40506d48627b..73cb01767240 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -488,9 +488,6 @@ var Application = new Lang.Class({ + accels: ['f'] } + ]; + +- if (!this.isBooks) +- this._initGettingStarted(); +- + Utils.populateActionGroup(this, this._actionEntries, 'app'); + }, + +@@ -498,6 +495,9 @@ var Application = new Lang.Class({ + if (this._mainWindow) + return; + ++ if (!this.isBooks) ++ this._initGettingStarted(); ++ + notificationManager = new Notifications.NotificationManager(); + this._connectActionsToMode(); + this._mainWindow = new MainWindow.MainWindow(this); +-- +2.14.3 + + +From c98d19eaf7aeb20eea90d93ba1a0c9c112a2a3e7 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 7 Dec 2017 20:53:10 +0100 +Subject: [PATCH 2/7] application: Make window creation complete asynchronously + +Creating MainWindow starts the TrackerControllers. The getting started +PDF needs to be located before that happens, to let the +TrackerControllers include it in their queries. Since, locating the PDF +is an asynchronous operation, the overall _createWindow method also +needs to complete asynchronously. + +This doesn't make any user-visible changes, but sets the stage for the +subsequent patches. + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/application.js | 81 ++++++++++++++++++++++++++++++++++++------------------ + 1 file changed, 54 insertions(+), 27 deletions(-) + +diff --git a/src/application.js b/src/application.js +index 73cb01767240..b80f22ddd03a 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -491,9 +491,16 @@ var Application = new Lang.Class({ + Utils.populateActionGroup(this, this._actionEntries, 'app'); + }, + +- _createWindow: function() { +- if (this._mainWindow) ++ _createWindow: function(callback) { ++ if (this._mainWindow) { ++ Mainloop.idle_add(Lang.bind(this, ++ function() { ++ callback(); ++ return GLib.SOURCE_REMOVE; ++ })); ++ + return; ++ } + + if (!this.isBooks) + this._initGettingStarted(); +@@ -512,6 +519,20 @@ var Application = new Lang.Class({ + + // start miners + this._startMiners(); ++ ++ Mainloop.idle_add(Lang.bind(this, ++ function() { ++ callback(); ++ return GLib.SOURCE_REMOVE; ++ })); ++ }, ++ ++ _presentWindow: function() { ++ if (!this._mainWindow) ++ throw(new Error('this._mainWindow == null')); ++ ++ this._mainWindow.present_with_time(this._activationTimestamp); ++ this._activationTimestamp = Gdk.CURRENT_TIME; + }, + + vfunc_dbus_register: function(connection, path) { +@@ -554,12 +575,14 @@ var Application = new Lang.Class({ + + vfunc_activate: function() { + if (!this._mainWindow) { +- this._createWindow(); +- modeController.setWindowMode(WindowMode.WindowMode.DOCUMENTS); ++ this._createWindow(Lang.bind(this, ++ function() { ++ modeController.setWindowMode(WindowMode.WindowMode.DOCUMENTS); ++ this._presentWindow(); ++ })); ++ } else { ++ this._presentWindow(); + } +- +- this._mainWindow.present_with_time(this._activationTimestamp); +- this._activationTimestamp = Gdk.CURRENT_TIME; + }, + + _clearState: function() { +@@ -598,22 +621,24 @@ var Application = new Lang.Class({ + }, + + _onActivateResult: function(provider, urn, terms, timestamp) { +- this._createWindow(); +- modeController.setWindowMode(WindowMode.WindowMode.PREVIEW_EV); +- +- let doc = documentManager.getItemById(urn); +- if (doc) { +- doActivate.apply(this, [doc]); +- } else { +- let job = new TrackerUtils.SingleItemJob(urn, queryBuilder); +- job.run(Query.QueryFlags.UNFILTERED, Lang.bind(this, +- function(cursor) { +- if (cursor) +- doc = documentManager.addDocumentFromCursor(cursor); ++ this._createWindow(Lang.bind(this, ++ function() { ++ modeController.setWindowMode(WindowMode.WindowMode.PREVIEW_EV); + ++ let doc = documentManager.getItemById(urn); ++ if (doc) { + doActivate.apply(this, [doc]); +- })); +- } ++ } else { ++ let job = new TrackerUtils.SingleItemJob(urn, queryBuilder); ++ job.run(Query.QueryFlags.UNFILTERED, Lang.bind(this, ++ function(cursor) { ++ if (cursor) ++ doc = documentManager.addDocumentFromCursor(cursor); ++ ++ doActivate.apply(this, [doc]); ++ })); ++ } ++ })); + + function doActivate(doc) { + documentManager.setActiveItem(doc); +@@ -637,13 +662,15 @@ var Application = new Lang.Class({ + }, + + _onLaunchSearch: function(provider, terms, timestamp) { +- this._createWindow(); +- modeController.setWindowMode(WindowMode.WindowMode.DOCUMENTS); +- searchController.setString(terms.join(' ')); +- this.change_action_state('search', GLib.Variant.new('b', true)); ++ this._createWindow(Lang.bind(this, ++ function() { ++ modeController.setWindowMode(WindowMode.WindowMode.DOCUMENTS); ++ searchController.setString(terms.join(' ')); ++ this.change_action_state('search', GLib.Variant.new('b', true)); + +- this._activationTimestamp = timestamp; +- this.activate(); ++ this._activationTimestamp = timestamp; ++ this.activate(); ++ })); + }, + + getScaleFactor: function() { +-- +2.14.3 + + +From 935d00626f3a3481e9ae13c0eadb146c10d9625a Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 8 Dec 2017 17:13:52 +0100 +Subject: [PATCH 3/7] application: Tie the catch block more tightly to the + failure site + +Having a lot of code inside a try statement makes it harder to follow +the error handling logic. The catch statements are far away from the +code that can throw an exception, so it is difficult to match them +together. Let's reduce the size of the try blocks by only using them +for fallible operations. + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/application.js | 22 ++++++++++++---------- + 1 file changed, 12 insertions(+), 10 deletions(-) + +diff --git a/src/application.js b/src/application.js +index b80f22ddd03a..8f9b6276ac0a 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -149,19 +149,21 @@ var Application = new Lang.Class({ + function(object, res) { + try { + let info = object.query_info_finish(res); +- this.gettingStartedLocation = file.get_parent(); +- +- manager.index_file_async(file, null, +- function(object, res) { +- try { +- manager.index_file_finish(res); +- } catch (e) { +- log('Error indexing the getting started PDF: ' + e.message); +- } +- }); + } catch (e) { + checkNextFile.apply(this); ++ return; + } ++ ++ this.gettingStartedLocation = file.get_parent(); ++ ++ manager.index_file_async(file, null, ++ function(object, res) { ++ try { ++ manager.index_file_finish(res); ++ } catch (e) { ++ log('Error indexing the getting started PDF: ' + e.message); ++ } ++ }); + })); + } + +-- +2.14.3 + + +From 2362a9b4b6e518ccc04d6d6c6d16f837e3df038d Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 8 Dec 2017 17:29:56 +0100 +Subject: [PATCH 4/7] application: Shuffle some code around + +Having the _initGettingStarted method take care of the isBooks +condition will make it easier to chain it with the window creation. + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/application.js | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/application.js b/src/application.js +index 8f9b6276ac0a..81ae382770df 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -127,6 +127,9 @@ var Application = new Lang.Class({ + }, + + _initGettingStarted: function() { ++ if (this.isBooks) ++ return; ++ + let manager = TrackerControl.MinerManager.new_full(false); + + let languages = GLib.get_language_names(); +@@ -504,8 +507,7 @@ var Application = new Lang.Class({ + return; + } + +- if (!this.isBooks) +- this._initGettingStarted(); ++ this._initGettingStarted(); + + notificationManager = new Notifications.NotificationManager(); + this._connectActionsToMode(); +-- +2.14.3 + + +From 4f5d1073d2049422b36c4b809a3f2ae6e8db3f4c Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 8 Dec 2017 17:36:49 +0100 +Subject: [PATCH 5/7] application: Create the window only after detecting the + PDF + +This ensures that the TrackerControllers are started after the getting +started PDF has been initialized, so that it can be included in their +queries. + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/application.js | 55 +++++++++++++++++++++++++++++++++--------------------- + 1 file changed, 34 insertions(+), 21 deletions(-) + +diff --git a/src/application.js b/src/application.js +index 81ae382770df..3c7110323dc3 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -126,9 +126,16 @@ var Application = new Lang.Class({ + _("Show the version of the program"), null); + }, + +- _initGettingStarted: function() { +- if (this.isBooks) ++ _initGettingStarted: function(callback) { ++ if (this.isBooks) { ++ Mainloop.idle_add(Lang.bind(this, ++ function() { ++ callback(); ++ return GLib.SOURCE_REMOVE; ++ })); ++ + return; ++ } + + let manager = TrackerControl.MinerManager.new_full(false); + +@@ -145,6 +152,7 @@ var Application = new Lang.Class({ + let file = files.shift(); + if (!file) { + log('Can\'t find a valid getting started PDF document'); ++ callback(); + return; + } + +@@ -166,11 +174,17 @@ var Application = new Lang.Class({ + } catch (e) { + log('Error indexing the getting started PDF: ' + e.message); + } ++ ++ callback(); + }); + })); + } + +- checkNextFile.apply(this); ++ Mainloop.idle_add(Lang.bind(this, ++ function() { ++ checkNextFile.apply(this); ++ return GLib.SOURCE_REMOVE; ++ })); + }, + + _fullscreenCreateHook: function(action) { +@@ -507,27 +521,26 @@ var Application = new Lang.Class({ + return; + } + +- this._initGettingStarted(); +- +- notificationManager = new Notifications.NotificationManager(); +- this._connectActionsToMode(); +- this._mainWindow = new MainWindow.MainWindow(this); +- this._mainWindow.connect('destroy', Lang.bind(this, this._onWindowDestroy)); +- +- try { +- this._extractPriority = TrackerExtractPriority(); +- this._extractPriority.SetRdfTypesRemote(['nfo:Document']); +- } catch (e) { +- log('Unable to connect to the tracker extractor: ' + e.toString()); +- } ++ this.hold(); ++ this._initGettingStarted(Lang.bind(this, ++ function() { ++ this.release(); ++ notificationManager = new Notifications.NotificationManager(); ++ this._connectActionsToMode(); ++ this._mainWindow = new MainWindow.MainWindow(this); ++ this._mainWindow.connect('destroy', Lang.bind(this, this._onWindowDestroy)); ++ ++ try { ++ this._extractPriority = TrackerExtractPriority(); ++ this._extractPriority.SetRdfTypesRemote(['nfo:Document']); ++ } catch (e) { ++ log('Unable to connect to the tracker extractor: ' + e.toString()); ++ } + +- // start miners +- this._startMiners(); ++ // start miners ++ this._startMiners(); + +- Mainloop.idle_add(Lang.bind(this, +- function() { + callback(); +- return GLib.SOURCE_REMOVE; + })); + }, + +-- +2.14.3 + + +From 95a69188445605be846adb94054a792c09b5e997 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Tue, 12 Dec 2017 16:35:22 +0100 +Subject: [PATCH 6/7] trackerController: Don't submit queries until started + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/trackerController.js | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/trackerController.js b/src/trackerController.js +index 05b7e89f1586..55f1343f1417 100644 +--- a/src/trackerController.js ++++ b/src/trackerController.js +@@ -283,6 +283,10 @@ const TrackerController = new Lang.Class({ + return; + + this.sortBy = sortBy; ++ ++ if (!this._isStarted) ++ return; ++ + this._refreshInternal(RefreshFlags.RESET_OFFSET); + }, + +-- +2.14.3 + + +From 9e57889aeaa9d56ca61059012cccc37a9145f92c Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 8 Dec 2017 20:47:17 +0100 +Subject: [PATCH 7/7] trackerController: Assert against premature queries + +The TrackerControllers are only supposed to issue their queries once +all the pieces of the application that are necessary to formulate them +have been initialized. This is indicated by the invocation of the start +method. For example, if the queries are submitted before the detection +of the getting started PDF has completed, then they won't have the +path to PDF and it will be missing from the UI. + +Throwing an exception forces one to think about the details surrounding +each query submission path, as opposed to having the silently dropping +the request. + +https://bugzilla.gnome.org/show_bug.cgi?id=791518 +--- + src/trackerController.js | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/trackerController.js b/src/trackerController.js +index 55f1343f1417..e45f3a7fc5c3 100644 +--- a/src/trackerController.js ++++ b/src/trackerController.js +@@ -234,7 +234,8 @@ const TrackerController = new Lang.Class({ + }, + + _refreshInternal: function(flags) { +- this._isStarted = true; ++ if (!this._isStarted) ++ throw(new Error('!this._isStarted')); + + if (flags & RefreshFlags.RESET_OFFSET) + this._offsetController.resetOffset(); +@@ -294,6 +295,7 @@ const TrackerController = new Lang.Class({ + if (this._isStarted) + return; + ++ this._isStarted = true; + this._refreshInternal(RefreshFlags.NONE); + } + }); +-- +2.14.3 + diff --git a/SOURCES/gnome-documents-new-gjs-gtk.patch b/SOURCES/gnome-documents-new-gjs-gtk.patch new file mode 100644 index 0000000..ba5219d --- /dev/null +++ b/SOURCES/gnome-documents-new-gjs-gtk.patch @@ -0,0 +1,1381 @@ +From b146e88462f01e7d3ce7d0bbb64739f02b2fa0f5 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Tue, 4 Apr 2017 20:08:51 +0200 +Subject: [PATCH 01/12] lokview: Adjust the LOKDocView detection to work with + GJS 1.48.0 + +https://bugzilla.redhat.com/show_bug.cgi?id=1517704 +--- + src/lokview.js | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/lokview.js b/src/lokview.js +index 3311b602f0f9..b55c91485999 100644 +--- a/src/lokview.js ++++ b/src/lokview.js +@@ -19,8 +19,10 @@ + * + */ + ++let LOKDocView; ++ + try { +- const LOKDocView = imports.gi.LOKDocView; ++ LOKDocView = imports.gi.LOKDocView; + } catch(e) { + // LOKDocView will be undefined, and we'll + // use this to warn when LO files can't be opened +-- +2.14.3 + + +From f830328f845a7f3cff93745b2d8baab576f679b1 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Mon, 31 Jul 2017 00:31:03 +0100 +Subject: [PATCH 02/12] Use 'var' for classes that are exported + +This avoids warnings with the new GJS. + +https://bugzilla.gnome.org/show_bug.cgi?id=785568 +--- + src/application.js | 44 ++++++++++++++++++++++---------------------- + src/changeMonitor.js | 4 ++-- + src/documents.js | 4 ++-- + src/embed.js | 2 +- + src/epubview.js | 2 +- + src/errorBox.js | 2 +- + src/evinceview.js | 2 +- + src/lokview.js | 2 +- + src/mainToolbar.js | 2 +- + src/mainWindow.js | 2 +- + src/manager.js | 4 ++-- + src/notifications.js | 2 +- + src/preview.js | 8 ++++---- + src/properties.js | 2 +- + src/query.js | 6 +++--- + src/search.js | 14 +++++++------- + src/searchbar.js | 2 +- + src/selections.js | 4 ++-- + src/shellSearchProvider.js | 14 +++++++------- + src/trackerController.js | 8 ++++---- + src/trackerUtils.js | 2 +- + src/view.js | 2 +- + src/windowMode.js | 4 ++-- + 23 files changed, 69 insertions(+), 69 deletions(-) + +diff --git a/src/application.js b/src/application.js +index f9e8b6ae9863..3163a36fa95e 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -49,30 +49,30 @@ const Utils = imports.utils; + const WindowMode = imports.windowMode; + + // used globally +-let application = null; +-let connection = null; +-let connectionQueue = null; +-let goaClient = null; +-let settings = null; ++var application = null; ++var connection = null; ++var connectionQueue = null; ++var goaClient = null; ++var settings = null; + + // used by the application, but not by the search provider +-let changeMonitor = null; ++var changeMonitor = null; + let cssProvider = null; +-let documentManager = null; +-let modeController = null; +-let notificationManager = null; +-let offsetCollectionsController = null; +-let offsetDocumentsController = null; +-let offsetSearchController = null; +-let queryBuilder = null; +-let searchController = null; +-let searchMatchManager = null; +-let searchTypeManager = null; +-let selectionController = null; +-let sourceManager = null; +-let trackerCollectionsController = null; +-let trackerDocumentsController = null; +-let trackerSearchController = null; ++var documentManager = null; ++var modeController = null; ++var notificationManager = null; ++var offsetCollectionsController = null; ++var offsetDocumentsController = null; ++var offsetSearchController = null; ++var queryBuilder = null; ++var searchController = null; ++var searchMatchManager = null; ++var searchTypeManager = null; ++var selectionController = null; ++var sourceManager = null; ++var trackerCollectionsController = null; ++var trackerDocumentsController = null; ++var trackerSearchController = null; + + const TrackerExtractPriorityIface = ' \ + \ +@@ -92,7 +92,7 @@ function TrackerExtractPriority() { + + const MINER_REFRESH_TIMEOUT = 60; /* seconds */ + +-const Application = new Lang.Class({ ++var Application = new Lang.Class({ + Name: 'Application', + Extends: Gtk.Application, + +diff --git a/src/changeMonitor.js b/src/changeMonitor.js +index 594a232bb76f..ab0e570d0141 100644 +--- a/src/changeMonitor.js ++++ b/src/changeMonitor.js +@@ -43,7 +43,7 @@ function TrackerResourcesService() { + '/org/freedesktop/Tracker1/Resources'); + } + +-const ChangeEventType = { ++var ChangeEventType = { + CHANGED: 0, + CREATED: 1, + DELETED: 2 +@@ -84,7 +84,7 @@ const ChangeEvent = new Lang.Class({ + const CHANGE_MONITOR_TIMEOUT = 500; // msecs + const CHANGE_MONITOR_MAX_ITEMS = 500; // items + +-const TrackerChangeMonitor = new Lang.Class({ ++var TrackerChangeMonitor = new Lang.Class({ + Name: 'TrackerChangeMonitor', + + _init: function() { +diff --git a/src/documents.js b/src/documents.js +index 7ff1c96444c1..92c8a269b8e1 100644 +--- a/src/documents.js ++++ b/src/documents.js +@@ -789,7 +789,7 @@ const DocCommon = new Lang.Class({ + }); + Signals.addSignalMethods(DocCommon.prototype); + +-const LocalDocument = new Lang.Class({ ++var LocalDocument = new Lang.Class({ + Name: 'LocalDocument', + Extends: DocCommon, + +@@ -1432,7 +1432,7 @@ const SkydriveDocument = new Lang.Class({ + } + }); + +-const DocumentManager = new Lang.Class({ ++var DocumentManager = new Lang.Class({ + Name: 'DocumentManager', + Extends: Manager.BaseManager, + +diff --git a/src/embed.js b/src/embed.js +index 5014b3895276..47258712c6bc 100644 +--- a/src/embed.js ++++ b/src/embed.js +@@ -32,7 +32,7 @@ const GLib = imports.gi.GLib; + const Gtk = imports.gi.Gtk; + const _ = imports.gettext.gettext; + +-const Embed = new Lang.Class({ ++var Embed = new Lang.Class({ + Name: 'Embed', + Extends: Gtk.Box, + +diff --git a/src/epubview.js b/src/epubview.js +index 12f392225d6f..032b7bac51c2 100644 +--- a/src/epubview.js ++++ b/src/epubview.js +@@ -35,7 +35,7 @@ function isEpub(mimeType) { + return (mimeType == 'application/epub+zip'); + } + +-const EPUBView = new Lang.Class({ ++var EPUBView = new Lang.Class({ + Name: 'EPUBView', + Extends: Preview.Preview, + +diff --git a/src/errorBox.js b/src/errorBox.js +index 95ec791ab7e5..8fdf154cb4ae 100644 +--- a/src/errorBox.js ++++ b/src/errorBox.js +@@ -26,7 +26,7 @@ const Lang = imports.lang; + + const _ICON_SIZE = 128; + +-const ErrorBox = new Lang.Class({ ++var ErrorBox = new Lang.Class({ + Name: 'ErrorBox', + Extends: Gtk.Grid, + +diff --git a/src/evinceview.js b/src/evinceview.js +index 3e0070bb785c..874a94fbcdc1 100644 +--- a/src/evinceview.js ++++ b/src/evinceview.js +@@ -40,7 +40,7 @@ const WindowMode = imports.windowMode; + + const _FULLSCREEN_TOOLBAR_TIMEOUT = 2; // seconds + +-const EvinceView = new Lang.Class({ ++var EvinceView = new Lang.Class({ + Name: 'EvinceView', + Extends: Preview.Preview, + +diff --git a/src/lokview.js b/src/lokview.js +index b55c91485999..49bacabd28e7 100644 +--- a/src/lokview.js ++++ b/src/lokview.js +@@ -97,7 +97,7 @@ function isOpenDocumentFormat(mimeType) { + return false; + } + +-const LOKView = new Lang.Class({ ++var LOKView = new Lang.Class({ + Name: 'LOKView', + Extends: Preview.Preview, + +diff --git a/src/mainToolbar.js b/src/mainToolbar.js +index 14772c3482c8..6e7f972af57e 100644 +--- a/src/mainToolbar.js ++++ b/src/mainToolbar.js +@@ -32,7 +32,7 @@ const Lang = imports.lang; + const Application = imports.application; + const Searchbar = imports.searchbar; + +-const MainToolbar = new Lang.Class({ ++var MainToolbar = new Lang.Class({ + Name: 'MainToolbar', + Extends: Gtk.Box, + +diff --git a/src/mainWindow.js b/src/mainWindow.js +index 0cac142b1609..b3a9e890ecc8 100644 +--- a/src/mainWindow.js ++++ b/src/mainWindow.js +@@ -37,7 +37,7 @@ const _CONFIGURE_ID_TIMEOUT = 100; // msecs + const _WINDOW_MIN_WIDTH = 600; + const _WINDOW_MIN_HEIGHT = 500; + +-const MainWindow = new Lang.Class({ ++var MainWindow = new Lang.Class({ + Name: 'MainWindow', + Extends: Gtk.ApplicationWindow, + +diff --git a/src/manager.js b/src/manager.js +index 7252b31e1762..c7749e5754c6 100644 +--- a/src/manager.js ++++ b/src/manager.js +@@ -25,7 +25,7 @@ const GLib = imports.gi.GLib; + const Lang = imports.lang; + const Signals = imports.signals; + +-const BaseManager = new Lang.Class({ ++var BaseManager = new Lang.Class({ + Name: 'BaseManager', + + _init: function(title, actionId, context) { +@@ -174,7 +174,7 @@ const BaseManager = new Lang.Class({ + }); + Signals.addSignalMethods(BaseManager.prototype); + +-const BaseModel = new Lang.Class({ ++var BaseModel = new Lang.Class({ + Name: 'BaseModel', + Extends: Gio.Menu, + +diff --git a/src/notifications.js b/src/notifications.js +index 834d0790ebc0..3fd4d4ebd4dc 100644 +--- a/src/notifications.js ++++ b/src/notifications.js +@@ -325,7 +325,7 @@ const IndexingNotification = new Lang.Class({ + } + }); + +-const NotificationManager = new Lang.Class({ ++var NotificationManager = new Lang.Class({ + Name: 'NotificationManager', + Extends: Gd.Notification, + +diff --git a/src/preview.js b/src/preview.js +index 29ca3f197f20..db657deba82c 100644 +--- a/src/preview.js ++++ b/src/preview.js +@@ -19,7 +19,7 @@ const Utils = imports.utils; + const _ICON_SIZE = 32; + const _PDF_LOADER_TIMEOUT = 400; + +-const Preview = new Lang.Class({ ++var Preview = new Lang.Class({ + Name: 'Preview', + Extends: Gtk.Stack, + +@@ -245,7 +245,7 @@ const Preview = new Lang.Class({ + } + }); + +-const PreviewToolbar = new Lang.Class({ ++var PreviewToolbar = new Lang.Class({ + Name: 'PreviewToolbar', + Extends: MainToolbar.MainToolbar, + +@@ -310,7 +310,7 @@ const PreviewToolbar = new Lang.Class({ + const _AUTO_HIDE_TIMEOUT = 2; + const PREVIEW_NAVBAR_MARGIN = 30; + +-const PreviewNavControls = new Lang.Class({ ++var PreviewNavControls = new Lang.Class({ + Name: 'PreviewNavControls', + + _init: function(preview, overlay) { +@@ -506,7 +506,7 @@ const PreviewNavControls = new Lang.Class({ + } + }); + +-const PreviewSearchbar = new Lang.Class({ ++var PreviewSearchbar = new Lang.Class({ + Name: 'PreviewSearchbar', + Extends: Searchbar.Searchbar, + +diff --git a/src/properties.js b/src/properties.js +index 80a142bcf1d5..3647ef35b51b 100644 +--- a/src/properties.js ++++ b/src/properties.js +@@ -35,7 +35,7 @@ const Lang = imports.lang; + + const _TITLE_ENTRY_TIMEOUT = 200; + +-const PropertiesDialog = new Lang.Class({ ++var PropertiesDialog = new Lang.Class({ + Name: 'PropertiesDialog', + Extends: Gtk.Dialog, + +diff --git a/src/query.js b/src/query.js +index 9d45b9fa9088..744527bf96fb 100644 +--- a/src/query.js ++++ b/src/query.js +@@ -26,7 +26,7 @@ const GLib = imports.gi.GLib; + const Lang = imports.lang; + const Search = imports.search; + +-const QueryColumns = { ++var QueryColumns = { + URN: 0, + URI: 1, + FILENAME: 2, +@@ -41,7 +41,7 @@ const QueryColumns = { + DATE_CREATED: 11 + }; + +-const QueryFlags = { ++var QueryFlags = { + NONE: 0, + UNFILTERED: 1 << 0, + COLLECTIONS: 1 << 1, +@@ -52,7 +52,7 @@ const QueryFlags = { + const LOCAL_BOOKS_COLLECTIONS_IDENTIFIER = 'gb:collection:local:'; + const LOCAL_DOCUMENTS_COLLECTIONS_IDENTIFIER = 'gd:collection:local:'; + +-const QueryBuilder = new Lang.Class({ ++var QueryBuilder = new Lang.Class({ + Name: 'QueryBuilder', + + _init: function(context) { +diff --git a/src/search.js b/src/search.js +index 681002010b34..54e16c2a9b96 100644 +--- a/src/search.js ++++ b/src/search.js +@@ -99,7 +99,7 @@ const SearchType = new Lang.Class({ + } + }); + +-const SearchTypeStock = { ++var SearchTypeStock = { + ALL: 'all', + COLLECTIONS: 'collections', + PDF: 'pdf', +@@ -201,7 +201,7 @@ const SearchTypeManager = new Lang.Class({ + } + }); + +-const SearchMatchStock = { ++var SearchMatchStock = { + ALL: 'all', + TITLE: 'title', + AUTHOR: 'author', +@@ -316,7 +316,7 @@ const SearchMatchManager = new Lang.Class({ + } + }); + +-const SearchSourceStock = { ++var SearchSourceStock = { + ALL: 'all', + LOCAL: 'local' + }; +@@ -556,7 +556,7 @@ const SourceManager = new Lang.Class({ + } + }); + +-const OFFSET_STEP = 50; ++var OFFSET_STEP = 50; + + const OffsetController = new Lang.Class({ + Name: 'OffsetController', +@@ -628,7 +628,7 @@ const OffsetController = new Lang.Class({ + }); + Signals.addSignalMethods(OffsetController.prototype); + +-const OffsetCollectionsController = new Lang.Class({ ++var OffsetCollectionsController = new Lang.Class({ + Name: 'OffsetCollectionsController', + Extends: OffsetController, + +@@ -649,7 +649,7 @@ const OffsetCollectionsController = new Lang.Class({ + } + }); + +-const OffsetDocumentsController = new Lang.Class({ ++var OffsetDocumentsController = new Lang.Class({ + Name: 'OffsetDocumentsController', + Extends: OffsetController, + +@@ -662,7 +662,7 @@ const OffsetDocumentsController = new Lang.Class({ + } + }); + +-const OffsetSearchController = new Lang.Class({ ++var OffsetSearchController = new Lang.Class({ + Name: 'OffsetSearchController', + Extends: OffsetController, + +diff --git a/src/searchbar.js b/src/searchbar.js +index c560063a7034..9131d1369bf7 100644 +--- a/src/searchbar.js ++++ b/src/searchbar.js +@@ -30,7 +30,7 @@ const Application = imports.application; + const Manager = imports.manager; + const Utils = imports.utils; + +-const Searchbar = new Lang.Class({ ++var Searchbar = new Lang.Class({ + Name: 'Searchbar', + Extends: Gtk.SearchBar, + +diff --git a/src/selections.js b/src/selections.js +index ecfd3ec694c7..3693ad8b0448 100644 +--- a/src/selections.js ++++ b/src/selections.js +@@ -793,7 +793,7 @@ const OrganizeCollectionDialog = new Lang.Class({ + } + }); + +-const SelectionController = new Lang.Class({ ++var SelectionController = new Lang.Class({ + Name: 'SelectionController', + + _init: function() { +@@ -858,7 +858,7 @@ Signals.addSignalMethods(SelectionController.prototype); + + const _SELECTION_TOOLBAR_DEFAULT_WIDTH = 500; + +-const SelectionToolbar = new Lang.Class({ ++var SelectionToolbar = new Lang.Class({ + Name: 'SelectionToolbar', + Extends: Gtk.ActionBar, + Template: 'resource:///org/gnome/Documents/ui/selection-toolbar.ui', +diff --git a/src/shellSearchProvider.js b/src/shellSearchProvider.js +index 0dd54f1dd2a9..6fb9763546b2 100644 +--- a/src/shellSearchProvider.js ++++ b/src/shellSearchProvider.js +@@ -33,12 +33,12 @@ const Query = imports.query; + const TrackerUtils = imports.trackerUtils; + const Utils = imports.utils; + +-let documentManager = null; +-let queryBuilder = null; +-let searchMatchManager = null; +-let searchTypeManager = null; +-let searchController = null; +-let sourceManager = null; ++var documentManager = null; ++var queryBuilder = null; ++var searchMatchManager = null; ++var searchTypeManager = null; ++var searchController = null; ++var sourceManager = null; + + const SEARCH_PROVIDER_IFACE = 'org.gnome.Shell.SearchProvider2'; + const SEARCH_PROVIDER_PATH = '/org/gnome/Documents/SearchProvider'; +@@ -348,7 +348,7 @@ const FetchIdsJob = new Lang.Class({ + } + }); + +-const ShellSearchProvider = new Lang.Class({ ++var ShellSearchProvider = new Lang.Class({ + Name: 'ShellSearchProvider', + + _init: function() { +diff --git a/src/trackerController.js b/src/trackerController.js +index 836f7c4ae024..05b7e89f1586 100644 +--- a/src/trackerController.js ++++ b/src/trackerController.js +@@ -37,7 +37,7 @@ const QueryType = { + UPDATE_BLANK: 2 + }; + +-const TrackerConnectionQueue = new Lang.Class({ ++var TrackerConnectionQueue = new Lang.Class({ + Name: 'TrackerConnectionQueue', + + _init: function() { +@@ -295,7 +295,7 @@ const TrackerController = new Lang.Class({ + }); + Signals.addSignalMethods(TrackerController.prototype); + +-const TrackerCollectionsController = new Lang.Class({ ++var TrackerCollectionsController = new Lang.Class({ + Name: 'TrackerCollectionsController', + Extends: TrackerController, + +@@ -329,7 +329,7 @@ const TrackerCollectionsController = new Lang.Class({ + }, + }); + +-const TrackerDocumentsController = new Lang.Class({ ++var TrackerDocumentsController = new Lang.Class({ + Name: 'TrackerDocumentsController', + Extends: TrackerController, + +@@ -348,7 +348,7 @@ const TrackerDocumentsController = new Lang.Class({ + }, + }); + +-const TrackerSearchController = new Lang.Class({ ++var TrackerSearchController = new Lang.Class({ + Name: 'TrackerSearchController', + Extends: TrackerController, + +diff --git a/src/trackerUtils.js b/src/trackerUtils.js +index 97f236956535..f54fb2d66577 100644 +--- a/src/trackerUtils.js ++++ b/src/trackerUtils.js +@@ -40,7 +40,7 @@ function setEditedName(newTitle, docId, callback) { + + } + +-const SingleItemJob = new Lang.Class({ ++var SingleItemJob = new Lang.Class({ + Name: 'SingleItemJob', + + _init: function(urn, queryBuilder) { +diff --git a/src/view.js b/src/view.js +index 286654fe668e..6ec4abf90fb3 100644 +--- a/src/view.js ++++ b/src/view.js +@@ -728,7 +728,7 @@ const ViewContainer = new Lang.Class({ + } + }); + +-const View = new Lang.Class({ ++var View = new Lang.Class({ + Name: 'View', + Extends: Gtk.Overlay, + +diff --git a/src/windowMode.js b/src/windowMode.js +index d8527c52f436..0d062c66c1f3 100644 +--- a/src/windowMode.js ++++ b/src/windowMode.js +@@ -22,7 +22,7 @@ + const Lang = imports.lang; + const Signals = imports.signals; + +-const WindowMode = { ++var WindowMode = { + NONE: 0, + DOCUMENTS: 1, + PREVIEW_EV: 2, +@@ -33,7 +33,7 @@ const WindowMode = { + SEARCH: 7, + }; + +-const ModeController = new Lang.Class({ ++var ModeController = new Lang.Class({ + Name: 'ModeController', + + _init: function() { +-- +2.14.3 + + +From b73c93e420a88e739fbbc4e16ea9d887560f4b46 Mon Sep 17 00:00:00 2001 +From: Jeremy Bicha +Date: Sun, 6 Aug 2017 21:01:59 -0400 +Subject: [PATCH 03/12] Use 'var' for more classes that are exported + +This avoids warnings with the new GJS. + +https://bugzilla.gnome.org/show_bug.cgi?id=785568 +--- + src/notifications.js | 4 ++-- + src/presentation.js | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/notifications.js b/src/notifications.js +index 3fd4d4ebd4dc..b1b947f52231 100644 +--- a/src/notifications.js ++++ b/src/notifications.js +@@ -34,7 +34,7 @@ const Signals = imports.signals; + + const DELETE_TIMEOUT = 10; // seconds + +-const DeleteNotification = new Lang.Class({ ++var DeleteNotification = new Lang.Class({ + Name: 'DeleteNotification', + + _init: function(docs) { +@@ -110,7 +110,7 @@ const DeleteNotification = new Lang.Class({ + } + }); + +-const PrintNotification = new Lang.Class({ ++var PrintNotification = new Lang.Class({ + Name: 'PrintNotification', + + _init: function(printOp, doc) { +diff --git a/src/presentation.js b/src/presentation.js +index 5a4535cec098..741f01e5a6c1 100644 +--- a/src/presentation.js ++++ b/src/presentation.js +@@ -29,7 +29,7 @@ const Utils = imports.utils; + + const Application = imports.application; + +-const PresentationWindow = new Lang.Class({ ++var PresentationWindow = new Lang.Class({ + Name: 'PresentationWindow', + Extends: Gtk.Window, + +@@ -225,7 +225,7 @@ const PresentationOutputChooser = new Lang.Class({ + }); + Utils.addJSSignalMethods(PresentationOutputChooser.prototype); + +-const PresentationOutputs = new Lang.Class({ ++var PresentationOutputs = new Lang.Class({ + Name: 'PresentationOutputs', + + _init: function() { +-- +2.14.3 + + +From 054ea2802f7187622d81051832c90a9080b7db58 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Wed, 29 Nov 2017 19:02:20 +0100 +Subject: [PATCH 04/12] Use 'var' for more classes that are exported + +This avoids warnings with GJS 1.50. + +https://bugzilla.gnome.org/show_bug.cgi?id=785568 +--- + src/edit.js | 2 +- + src/mainToolbar.js | 2 +- + src/password.js | 2 +- + src/places.js | 2 +- + src/presentation.js | 2 +- + src/search.js | 2 +- + src/searchbar.js | 2 +- + src/sharing.js | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/edit.js b/src/edit.js +index c07abe6e4a88..93e6545472ae 100644 +--- a/src/edit.js ++++ b/src/edit.js +@@ -32,7 +32,7 @@ const WindowMode = imports.windowMode; + + const _BLANK_URI = "about:blank"; + +-const EditView = new Lang.Class({ ++var EditView = new Lang.Class({ + Name: 'EditView', + Extends: Preview.Preview, + +diff --git a/src/mainToolbar.js b/src/mainToolbar.js +index 6e7f972af57e..f356de3bbdc8 100644 +--- a/src/mainToolbar.js ++++ b/src/mainToolbar.js +@@ -130,7 +130,7 @@ var MainToolbar = new Lang.Class({ + } + }); + +-const OverviewToolbar = new Lang.Class({ ++var OverviewToolbar = new Lang.Class({ + Name: 'OverviewToolbar', + Extends: MainToolbar, + +diff --git a/src/password.js b/src/password.js +index 09be1676c3dd..5a179be92982 100644 +--- a/src/password.js ++++ b/src/password.js +@@ -26,7 +26,7 @@ const Application = imports.application; + + const Lang = imports.lang; + +-const PasswordDialog = new Lang.Class({ ++var PasswordDialog = new Lang.Class({ + Name: 'PasswordDialog', + Extends: Gtk.Dialog, + +diff --git a/src/places.js b/src/places.js +index 5023b80ed62e..220cd3119a82 100644 +--- a/src/places.js ++++ b/src/places.js +@@ -25,7 +25,7 @@ const Application = imports.application; + + const Lang = imports.lang; + +-const PlacesDialog = new Lang.Class({ ++var PlacesDialog = new Lang.Class({ + Name: 'PlacesDialog', + Extends: Gtk.Dialog, + +diff --git a/src/presentation.js b/src/presentation.js +index 741f01e5a6c1..33b3322cf6ac 100644 +--- a/src/presentation.js ++++ b/src/presentation.js +@@ -111,7 +111,7 @@ var PresentationWindow = new Lang.Class({ + } + }); + +-const PresentationOutputChooser = new Lang.Class({ ++var PresentationOutputChooser = new Lang.Class({ + Name: 'PresentationOutputChooser', + Extends: Gtk.Dialog, + +diff --git a/src/search.js b/src/search.js +index 54e16c2a9b96..ff26a225a9e2 100644 +--- a/src/search.js ++++ b/src/search.js +@@ -42,7 +42,7 @@ function initSearch(context) { + context.queryBuilder = new Query.QueryBuilder(context); + }; + +-const SearchState = new Lang.Class({ ++var SearchState = new Lang.Class({ + Name: 'SearchState', + + _init: function(searchMatch, searchType, source, str) { +diff --git a/src/searchbar.js b/src/searchbar.js +index 9131d1369bf7..30a29cef5a03 100644 +--- a/src/searchbar.js ++++ b/src/searchbar.js +@@ -146,7 +146,7 @@ const Dropdown = new Lang.Class({ + } + }); + +-const OverviewSearchbar = new Lang.Class({ ++var OverviewSearchbar = new Lang.Class({ + Name: 'OverviewSearchbar', + Extends: Searchbar, + +diff --git a/src/sharing.js b/src/sharing.js +index 9af15ab224bb..88958d539522 100644 +--- a/src/sharing.js ++++ b/src/sharing.js +@@ -68,7 +68,7 @@ const DocumentUpdateType = { + DELETE_SHARE_LINK: 4 + }; + +-const SharingDialog = new Lang.Class({ ++var SharingDialog = new Lang.Class({ + Name: 'SharingDialog', + Extends: Gtk.Dialog, + +-- +2.14.3 + + +From 422982b395b63218c77a013645efdd815ba00977 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Wed, 29 Nov 2017 19:15:24 +0100 +Subject: [PATCH 05/12] Explicitly specify the Gepub API version + +--- + src/main.js | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/main.js b/src/main.js +index 78f1475f6164..8ed772004b39 100644 +--- a/src/main.js ++++ b/src/main.js +@@ -28,6 +28,7 @@ pkg.initSubmodule('src'); + pkg.require({ 'EvinceDocument': '3.0', + 'Gd': '1.0', + 'GdPrivate': '1.0', ++ 'Gepub': '0.4', + 'Gio': '2.0', + 'GLib': '2.0', + 'Goa': '1.0', +-- +2.14.3 + + +From 715ca106de7e6aee57b91b000b9dca7b79fb0dc5 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Sun, 27 Nov 2016 13:16:51 +0100 +Subject: [PATCH 06/12] notifications: don't use GdNotification + +These days we can just use a GtkRevealer with the right style class. +--- + src/notifications.js | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/src/notifications.js b/src/notifications.js +index b1b947f52231..c9217ec89f78 100644 +--- a/src/notifications.js ++++ b/src/notifications.js +@@ -327,17 +327,20 @@ const IndexingNotification = new Lang.Class({ + + var NotificationManager = new Lang.Class({ + Name: 'NotificationManager', +- Extends: Gd.Notification, ++ Extends: Gtk.Revealer, + + _init: function() { +- this.parent({ timeout: -1, +- show_close_button: false, +- halign: Gtk.Align.CENTER, ++ this.parent({ halign: Gtk.Align.CENTER, + valign: Gtk.Align.START }); ++ ++ let frame = new Gtk.Frame(); ++ frame.get_style_context().add_class('app-notification'); ++ this.add(frame); ++ + this._grid = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL, + row_spacing: 6 }); + +- this.add(this._grid); ++ frame.add(this._grid); + + // add indexing monitor notification + this._indexingNotification = new IndexingNotification(); +@@ -348,13 +351,14 @@ var NotificationManager = new Lang.Class({ + notification.widget.connect('destroy', Lang.bind(this, this._onWidgetDestroy)); + + this.show_all(); ++ this.reveal_child = true; + }, + + _onWidgetDestroy: function() { + let children = this._grid.get_children(); + + if (children.length == 0) +- this.hide(); ++ this.reveal_child = false; + } + }); + Signals.addSignalMethods(NotificationManager.prototype); +-- +2.14.3 + + +From 9fc3185bb6cf4fcd4ae382bdab5cac403b73fbae Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Sat, 11 Feb 2017 15:22:02 -0800 +Subject: [PATCH 07/12] notifications: don't use signal decorator + +We don't have any signal, and these override GObject methods. +--- + src/notifications.js | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/src/notifications.js b/src/notifications.js +index c9217ec89f78..843ccdd2d74b 100644 +--- a/src/notifications.js ++++ b/src/notifications.js +@@ -30,7 +30,6 @@ const WindowMode = imports.windowMode; + + const Lang = imports.lang; + const Mainloop = imports.mainloop; +-const Signals = imports.signals; + + const DELETE_TIMEOUT = 10; // seconds + +@@ -361,4 +360,3 @@ var NotificationManager = new Lang.Class({ + this.reveal_child = false; + } + }); +-Signals.addSignalMethods(NotificationManager.prototype); +-- +2.14.3 + + +From 64bbf0e96ac3fe46a02ce4e42b4f533cfd0f9213 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Sat, 1 Apr 2017 15:28:59 -0700 +Subject: [PATCH 08/12] application: remove unused signal argument + +--- + src/application.js | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/application.js b/src/application.js +index 3163a36fa95e..fc71ffa153d0 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -303,7 +303,7 @@ var Application = new Lang.Class({ + return false; + + this.minersRunning.push(miner); +- this.emitJS('miners-changed', this.minersRunning); ++ this.emitJS('miners-changed'); + + miner._cancellable = new Gio.Cancellable(); + miner.RefreshDBRemote(['documents'], miner._cancellable, Lang.bind(this, +@@ -312,7 +312,7 @@ var Application = new Lang.Class({ + function(element) { + return element != miner; + }); +- this.emitJS('miners-changed', this.minersRunning); ++ this.emitJS('miners-changed'); + + if (error) { + if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) +-- +2.14.3 + + +From 25150ca9b99b83ccd306efc626a878fef708e93d Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi +Date: Sat, 1 Apr 2017 15:41:03 -0700 +Subject: [PATCH 09/12] Remove Utils.addJSSignalMethods() + +We can use GObject signals and remove this quirk. +--- + src/application.js | 10 ++++++---- + src/embed.js | 4 ++-- + src/evinceview.js | 21 ++++++++++++++------- + src/notifications.js | 2 +- + src/presentation.js | 11 +++++++---- + src/searchbar.js | 7 ++++--- + src/utils.js | 7 ------- + 7 files changed, 34 insertions(+), 28 deletions(-) + +diff --git a/src/application.js b/src/application.js +index fc71ffa153d0..40506d48627b 100644 +--- a/src/application.js ++++ b/src/application.js +@@ -95,6 +95,9 @@ const MINER_REFRESH_TIMEOUT = 60; /* seconds */ + var Application = new Lang.Class({ + Name: 'Application', + Extends: Gtk.Application, ++ Signals: { ++ 'miners-changed': {} ++ }, + + _init: function(isBooks) { + this.minersRunning = []; +@@ -303,7 +306,7 @@ var Application = new Lang.Class({ + return false; + + this.minersRunning.push(miner); +- this.emitJS('miners-changed'); ++ this.emit('miners-changed'); + + miner._cancellable = new Gio.Cancellable(); + miner.RefreshDBRemote(['documents'], miner._cancellable, Lang.bind(this, +@@ -312,7 +315,7 @@ var Application = new Lang.Class({ + function(element) { + return element != miner; + }); +- this.emitJS('miners-changed'); ++ this.emit('miners-changed'); + + if (error) { + if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) +@@ -386,6 +389,7 @@ var Application = new Lang.Class({ + function(miner) { + miner._cancellable.cancel(); + })); ++ this.minersRunning = []; + + this.gdataMiner = null; + this.owncloudMiner = null; +@@ -570,7 +574,6 @@ var Application = new Lang.Class({ + trackerSearchController.disconnectAll(); + selectionController.disconnectAll(); + modeController.disconnectAll(); +- this.disconnectAllJS(); + + // reset state + documentManager.clearRowRefs(); +@@ -659,4 +662,3 @@ var Application = new Lang.Class({ + return window; + } + }); +-Utils.addJSSignalMethods(Application.prototype); +diff --git a/src/embed.js b/src/embed.js +index 47258712c6bc..a028f2a0b6ce 100644 +--- a/src/embed.js ++++ b/src/embed.js +@@ -129,8 +129,8 @@ var Embed = new Lang.Class({ + // pack the toolbar + this._toolbar = this._view.createToolbar(); + if (this._toolbar.searchbar) +- this._toolbar.searchbar.connectJS('activate-result', +- Lang.bind(this, this._onActivateResult)); ++ this._toolbar.searchbar.connect('activate-result', ++ Lang.bind(this, this._onActivateResult)); + this._titlebar.add(this._toolbar); + } + }, +diff --git a/src/evinceview.js b/src/evinceview.js +index 874a94fbcdc1..b1ef1b9e0046 100644 +--- a/src/evinceview.js ++++ b/src/evinceview.js +@@ -24,6 +24,7 @@ const EvView = imports.gi.EvinceView; + const GdPrivate = imports.gi.GdPrivate; + const Gio = imports.gi.Gio; + const GLib = imports.gi.GLib; ++const GObject = imports.gi.GObject; + const Gtk = imports.gi.Gtk; + const _ = imports.gettext.gettext; + +@@ -43,6 +44,11 @@ const _FULLSCREEN_TOOLBAR_TIMEOUT = 2; // seconds + var EvinceView = new Lang.Class({ + Name: 'EvinceView', + Extends: Preview.Preview, ++ Signals: { ++ 'search-changed': { ++ param_types: [GObject.TYPE_BOOLEAN] ++ } ++ }, + + _init: function(overlay, mainWindow) { + this._model = null; +@@ -331,7 +337,7 @@ var EvinceView = new Lang.Class({ + this._showPresentation(); + } else { + let chooser = new Presentation.PresentationOutputChooser(outputs); +- chooser.connectJS('output-activated', Lang.bind(this, ++ chooser.connect('output-activated', Lang.bind(this, + function(chooser, output) { + if (output) { + this._showPresentation(output); +@@ -450,7 +456,7 @@ var EvinceView = new Lang.Class({ + this._fsToolbar.setModel(this._model); + this.overlay.add_overlay(this._fsToolbar); + +- this._fsToolbar.connectJS('show-controls', Lang.bind(this, ++ this._fsToolbar.connect('show-controls', Lang.bind(this, + function() { + this.controlsVisible = true; + })); +@@ -571,7 +577,7 @@ var EvinceView = new Lang.Class({ + // FIXME: ev_job_find_get_results() returns a GList ** + // and thus is not introspectable + GdPrivate.ev_view_find_changed(this._evView, job, page); +- this.emitJS('search-changed', job.has_results()); ++ this.emit('search-changed', job.has_results()); + }, + + _loadMetadata: function() { +@@ -636,7 +642,6 @@ var EvinceView = new Lang.Class({ + return this._evView; + } + }); +-Utils.addJSSignalMethods(EvinceView.prototype); + + const EvinceViewNavControls = new Lang.Class({ + Name: 'EvinceViewNavControls', +@@ -734,7 +739,7 @@ const EvinceViewSearchbar = new Lang.Class({ + _init: function(preview) { + this.parent(preview); + +- this.preview.connectJS('search-changed', Lang.bind(this, this._onSearchChanged)); ++ this.preview.connect('search-changed', Lang.bind(this, this._onSearchChanged)); + this._onSearchChanged(this.preview, false); + }, + +@@ -762,6 +767,9 @@ const EvinceViewSearchbar = new Lang.Class({ + const EvinceViewFullscreenToolbar = new Lang.Class({ + Name: 'EvinceViewFullscreenToolbar', + Extends: Gtk.Revealer, ++ Signals: { ++ 'show-controls': {} ++ }, + + _init: function(previewView) { + this.parent({ valign: Gtk.Align.START }); +@@ -782,7 +790,7 @@ const EvinceViewFullscreenToolbar = new Lang.Class({ + function(actionGroup, actionName, value) { + let state = value.get_boolean(); + if (state) +- this.emitJS('show-controls'); ++ this.emit('show-controls'); + })); + + signalIds.push(signalId); +@@ -814,4 +822,3 @@ const EvinceViewFullscreenToolbar = new Lang.Class({ + Application.application.change_action_state('search', GLib.Variant.new('b', false)); + } + }); +-Utils.addJSSignalMethods(EvinceViewFullscreenToolbar.prototype); +diff --git a/src/notifications.js b/src/notifications.js +index 843ccdd2d74b..914bbb8db431 100644 +--- a/src/notifications.js ++++ b/src/notifications.js +@@ -185,7 +185,7 @@ const IndexingNotification = new Lang.Class({ + return; + } + +- Application.application.connectJS('miners-changed', Lang.bind(this, this._checkNotification)); ++ Application.application.connect('miners-changed', Lang.bind(this, this._checkNotification)); + Application.modeController.connect('window-mode-changed', Lang.bind(this, this._checkNotification)); + }, + +diff --git a/src/presentation.js b/src/presentation.js +index 33b3322cf6ac..36290d0d4abc 100644 +--- a/src/presentation.js ++++ b/src/presentation.js +@@ -25,7 +25,6 @@ const Gtk = imports.gi.Gtk; + const _ = imports.gettext.gettext; + + const Lang = imports.lang; +-const Utils = imports.utils; + + const Application = imports.application; + +@@ -114,6 +113,11 @@ var PresentationWindow = new Lang.Class({ + var PresentationOutputChooser = new Lang.Class({ + Name: 'PresentationOutputChooser', + Extends: Gtk.Dialog, ++ Signals: { ++ 'output-activated': { ++ param_types: [GnomeDesktop.RROutputInfo.$gtype] ++ } ++ }, + + _init: function(outputs) { + let toplevel = Application.application.get_windows()[0]; +@@ -185,7 +189,7 @@ var PresentationOutputChooser = new Lang.Class({ + return; + + this.output = output; +- this.emitJS('output-activated', this.output); ++ this.emit('output-activated', this.output); + this.close(); + }, + +@@ -196,7 +200,7 @@ var PresentationOutputChooser = new Lang.Class({ + _createWindow: function() { + this.connect('response', Lang.bind(this, + function(widget, response) { +- this.emitJS('output-activated', null); ++ this.emit('output-activated', null); + })); + + let frame = new Gtk.Frame({ shadow_type: Gtk.ShadowType.IN }); +@@ -223,7 +227,6 @@ var PresentationOutputChooser = new Lang.Class({ + contentArea.pack_start(frame, true, false, 0); + } + }); +-Utils.addJSSignalMethods(PresentationOutputChooser.prototype); + + var PresentationOutputs = new Lang.Class({ + Name: 'PresentationOutputs', +diff --git a/src/searchbar.js b/src/searchbar.js +index 30a29cef5a03..2dc23d1900eb 100644 +--- a/src/searchbar.js ++++ b/src/searchbar.js +@@ -28,11 +28,13 @@ const Lang = imports.lang; + + const Application = imports.application; + const Manager = imports.manager; +-const Utils = imports.utils; + + var Searchbar = new Lang.Class({ + Name: 'Searchbar', + Extends: Gtk.SearchBar, ++ Signals: { ++ 'activate-result': {} ++ }, + + _init: function() { + this.searchChangeBlocked = false; +@@ -94,7 +96,7 @@ var Searchbar = new Lang.Class({ + + let keyval = event.get_keyval()[1]; + if (this.search_mode_enabled && keyval == Gdk.KEY_Return) { +- this.emitJS('activate-result'); ++ this.emit('activate-result'); + return true; + } + +@@ -115,7 +117,6 @@ var Searchbar = new Lang.Class({ + this.searchEntry.set_text(''); + } + }); +-Utils.addJSSignalMethods(Searchbar.prototype); + + const Dropdown = new Lang.Class({ + Name: 'Dropdown', +diff --git a/src/utils.js b/src/utils.js +index dfdcd974ad6d..bb45adfd7fae 100644 +--- a/src/utils.js ++++ b/src/utils.js +@@ -114,13 +114,6 @@ function debug(str) { + log('DEBUG: ' + str); + } + +-function addJSSignalMethods(proto) { +- proto.connectJS = Signals._connect; +- proto.disconnectJS = Signals._disconnect; +- proto.emitJS = Signals._emit; +- proto.disconnectAllJS = Signals._disconnectAll; +-} +- + function actionToggleCallback(action) { + let state = action.get_state(); + action.change_state(GLib.Variant.new('b', !state.get_boolean())); +-- +2.14.3 + + +From 5857b6f0bfa45c4f596f717aabe6797f2e8b1f62 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 7 Dec 2017 14:32:31 +0100 +Subject: [PATCH 10/12] preview: Use 'var' for exported constant + +This avoids warnings with GJS 1.50. + +https://bugzilla.gnome.org/show_bug.cgi?id=785568 +--- + src/preview.js | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/preview.js b/src/preview.js +index db657deba82c..fb1116b8a804 100644 +--- a/src/preview.js ++++ b/src/preview.js +@@ -308,7 +308,7 @@ var PreviewToolbar = new Lang.Class({ + }); + + const _AUTO_HIDE_TIMEOUT = 2; +-const PREVIEW_NAVBAR_MARGIN = 30; ++var PREVIEW_NAVBAR_MARGIN = 30; + + var PreviewNavControls = new Lang.Class({ + Name: 'PreviewNavControls', +-- +2.14.3 + + +From cc612448f5afc3b80c5da6acde4f33eb4747eb3c Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 14 Dec 2017 14:36:49 +0100 +Subject: [PATCH 11/12] notifications, query: Use 'var' for exported constant + +This avoids warnings with GJS 1.50. + +https://bugzilla.gnome.org/show_bug.cgi?id=785568 +--- + src/notifications.js | 2 +- + src/query.js | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/notifications.js b/src/notifications.js +index 914bbb8db431..6a6c773b6cbe 100644 +--- a/src/notifications.js ++++ b/src/notifications.js +@@ -31,7 +31,7 @@ const WindowMode = imports.windowMode; + const Lang = imports.lang; + const Mainloop = imports.mainloop; + +-const DELETE_TIMEOUT = 10; // seconds ++var DELETE_TIMEOUT = 10; // seconds + + var DeleteNotification = new Lang.Class({ + Name: 'DeleteNotification', +diff --git a/src/query.js b/src/query.js +index 744527bf96fb..1c156f1febee 100644 +--- a/src/query.js ++++ b/src/query.js +@@ -49,8 +49,8 @@ var QueryFlags = { + SEARCH: 1 << 3 + }; + +-const LOCAL_BOOKS_COLLECTIONS_IDENTIFIER = 'gb:collection:local:'; +-const LOCAL_DOCUMENTS_COLLECTIONS_IDENTIFIER = 'gd:collection:local:'; ++var LOCAL_BOOKS_COLLECTIONS_IDENTIFIER = 'gb:collection:local:'; ++var LOCAL_DOCUMENTS_COLLECTIONS_IDENTIFIER = 'gd:collection:local:'; + + var QueryBuilder = new Lang.Class({ + Name: 'QueryBuilder', +-- +2.14.3 + + +From 7c8a381977467d0468423475207b83fce6a14a7f Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 14 Dec 2017 14:25:31 +0100 +Subject: [PATCH 12/12] documents, query: Use the standard dialect of + String.prototype.replace + +The Gecko-specific dialect doesn't work with GJS 1.50. + +https://bugzilla.gnome.org/show_bug.cgi?id=791613 +--- + src/documents.js | 2 +- + src/query.js | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/documents.js b/src/documents.js +index 92c8a269b8e1..9f8b54edaf76 100644 +--- a/src/documents.js ++++ b/src/documents.js +@@ -274,7 +274,7 @@ const DocCommon = new Lang.Class({ + }, + + _sanitizeTitle: function() { +- this.name = this.name.replace('Microsoft Word - ', '', 'g'); ++ this.name = this.name.replace(/Microsoft Word - /g, ''); + }, + + populateFromCursor: function(cursor) { +diff --git a/src/query.js b/src/query.js +index 1c156f1febee..554ce1357a1c 100644 +--- a/src/query.js ++++ b/src/query.js +@@ -199,7 +199,7 @@ var QueryBuilder = new Lang.Class({ + + buildSingleQuery: function(flags, resource) { + let sparql = this._buildQueryInternal(false, flags, null); +- sparql = sparql.replace('?urn', '<' + resource + '>', 'g'); ++ sparql = sparql.replace(/\?urn/g, '<' + resource + '>'); + + return this._createQuery(sparql); + }, +@@ -223,7 +223,7 @@ var QueryBuilder = new Lang.Class({ + 'tracker:coalesce(nfo:fileLastModified(?urn), nie:contentLastModified(?urn)) AS ?mtime ' + + 'WHERE { ?urn nie:isPartOf ?collUrn } ' + + 'ORDER BY DESC (?mtime)' + +- 'LIMIT 4').replace('?collUrn', '<' + resource + '>'); ++ 'LIMIT 4').replace(/\?collUrn/, '<' + resource + '>'); + + return this._createQuery(sparql); + }, +@@ -234,7 +234,7 @@ var QueryBuilder = new Lang.Class({ + ('SELECT ' + + '?urn ' + + 'WHERE { ?urn a nfo:DataContainer . ?docUrn nie:isPartOf ?urn }' +- ).replace('?docUrn', '<' + resource + '>'); ++ ).replace(/\?docUrn/, '<' + resource + '>'); + + return this._createQuery(sparql); + }, +-- +2.14.3 + diff --git a/SPECS/gnome-documents.spec b/SPECS/gnome-documents.spec index fa178cc..5e0557b 100644 --- a/SPECS/gnome-documents.spec +++ b/SPECS/gnome-documents.spec @@ -1,10 +1,11 @@ %define evince_version 3.13.3 +%define gjs_version 1.50.2-3 %define gnome_online_miners_version 3.22.0-2 %define gtk3_version 3.19.1 Name: gnome-documents Version: 3.22.2 -Release: 5%{?dist} +Release: 8%{?dist} Summary: A document manager application for GNOME License: GPLv2+ @@ -18,6 +19,13 @@ Source0: https://download.gnome.org/sources/%{name}/3.22/%{name}-%{versio # https://bugzilla.redhat.com/show_bug.cgi?id=1444437 Patch0: gnome-documents-skydrive-printing-and-lok-fixes.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1517770 +# https://bugzilla.redhat.com/show_bug.cgi?id=1517704 +Patch1: gnome-documents-new-gjs-gtk.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=1517770 +Patch2: gnome-documents-getting-started.patch + BuildRequires: autoconf automake libtool BuildRequires: gnome-common BuildRequires: yelp-tools @@ -25,7 +33,7 @@ BuildRequires: pkgconfig(evince-document-3.0) >= %{evince_version} BuildRequires: pkgconfig(evince-view-3.0) >= %{evince_version} BuildRequires: pkgconfig(webkit2gtk-4.0) BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version} -BuildRequires: pkgconfig(gjs-1.0) +BuildRequires: pkgconfig(gjs-1.0) >= %{gjs_version} BuildRequires: pkgconfig(tracker-control-1.0) >= 0.17.0 BuildRequires: pkgconfig(tracker-sparql-1.0) >= 0.17.0 BuildRequires: pkgconfig(goa-1.0) @@ -43,6 +51,7 @@ BuildRequires: poppler-utils BuildRequires: docbook-style-xsl Requires: evince-libs%{?_isa} >= %{evince_version} +Requires: gjs >= %{gjs_version} Requires: gtk3%{?_isa} >= %{gtk3_version} Requires: gnome-online-miners >= %{gnome_online_miners_version} Requires: libgepub%{?_isa} @@ -62,6 +71,8 @@ Summary: Common libraries and data files for %{name} %prep %setup -q %patch0 -p1 +%patch1 -p1 +%patch2 -p1 %build autoreconf --force --install @@ -123,6 +134,24 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || : %{_libdir}/gnome-documents/ %changelog +* Tue Dec 12 2017 Debarshi Ray - 3.22.2-8 +- Initialize the getting started PDF only when presenting a UI, and before any + SPARQL has been submitted +- Suppress WARNINGs from GJS 1.50.0 by using var instead of let/const for + exported symbols +- Use the standard dialect of String.prototype.replace + Resolves: #1517770 + +* Wed Dec 06 2017 Debarshi Ray - 3.22.2-7 +- Suppress WARNINGs from GJS 1.50.0 about replacing GObject signal methods + Resolves: #1517770 + +* Mon Nov 27 2017 Debarshi Ray - 3.22.2-6 +- Adjust the LOKDocView detection to work with GJS 1.48.0 +- Suppress WARNINGs from GJS 1.50.0 by using var instead of let/const for + exported symbols + Resolves: #1517704 + * Fri Jun 09 2017 Debarshi Ray - 3.22.2-5 - Fix CRITICALs on invoking the application when a primary instance is present Resolves: #1436566