Hello community, here is the log from the commit of package gnome-documents for openSUSE:Factory checked in at 2017-04-29 10:51:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gnome-documents (Old) and /work/SRC/openSUSE:Factory/.gnome-documents.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gnome-documents" Sat Apr 29 10:51:35 2017 rev:48 rq:490932 version:3.24.1 Changes: -------- --- /work/SRC/openSUSE:Factory/gnome-documents/gnome-documents.changes 2017-03-29 13:24:06.012451201 +0200 +++ /work/SRC/openSUSE:Factory/.gnome-documents.new/gnome-documents.changes 2017-04-29 10:51:37.172372999 +0200 @@ -1,0 +2,13 @@ +Mon Apr 24 17:03:17 UTC 2017 - [email protected] + +- Update to version 3.24.1: + + Use LOKDocView for pre-OOXML MS Office formats. + + Unbreak opening in external application. + + Fix regression that prevented comics from being previewed. + + Make sure that load jobs are cancelled. + + Fix double menus in fullscreened evince view. + + Support fullscreening the e-pub view. + + Don't leak the URI when thumbnailing. + + Updated translations. + +------------------------------------------------------------------- Old: ---- gnome-documents-3.24.0.tar.xz New: ---- gnome-documents-3.24.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gnome-documents.spec ++++++ --- /var/tmp/diff_new_pack.HFgUhM/_old 2017-04-29 10:51:37.976259434 +0200 +++ /var/tmp/diff_new_pack.HFgUhM/_new 2017-04-29 10:51:37.980258869 +0200 @@ -17,7 +17,7 @@ Name: gnome-documents -Version: 3.24.0 +Version: 3.24.1 Release: 0 Summary: Document Manager for GNOME License: GPL-2.0+ @@ -41,7 +41,7 @@ BuildRequires: pkgconfig(gnome-desktop-3.0) BuildRequires: pkgconfig(goa-1.0) >= 3.2.0 BuildRequires: pkgconfig(gobject-introspection-1.0) >= 1.31.6 -BuildRequires: pkgconfig(gtk+-3.0) >= 3.19.1 +BuildRequires: pkgconfig(gtk+-3.0) >= 3.22.10 BuildRequires: pkgconfig(libgdata) >= 0.13.3 BuildRequires: pkgconfig(libgepub) >= 0.4 BuildRequires: pkgconfig(libsoup-2.4) >= 2.41.3 ++++++ gnome-documents-3.24.0.tar.xz -> gnome-documents-3.24.1.tar.xz ++++++ ++++ 1633 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/NEWS new/gnome-documents-3.24.1/NEWS --- old/gnome-documents-3.24.0/NEWS 2017-03-22 16:12:39.000000000 +0100 +++ new/gnome-documents-3.24.1/NEWS 2017-04-12 12:37:16.000000000 +0200 @@ -1,3 +1,15 @@ +3.24.1 - "I'm About to Dance" +============================= + +- Use LOKDocView for pre-OOXML MS Office formats (Pranav Kant) +- Unbreak opening in external application +- Fix regression that prevented comics from being previewed +- Make sure that load jobs are cancelled +- Fix double menus in fullscreened evince view +- Support fullscreening the e-pub view +- Don't leak the URI when thumbnailing +- Translation updates + 3.24.0 - "Must be the V" ======================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/configure.ac new/gnome-documents-3.24.1/configure.ac --- old/gnome-documents-3.24.0/configure.ac 2017-03-22 16:09:33.000000000 +0100 +++ new/gnome-documents-3.24.1/configure.ac 2017-04-12 12:31:27.000000000 +0200 @@ -1,6 +1,6 @@ dnl -*- mode: m4 -*- AC_PREREQ(2.63) -AC_INIT([gnome-documents],[3.24.0],[],[gnome-documents]) +AC_INIT([gnome-documents],[3.24.1],[],[gnome-documents]) AC_CONFIG_HEADERS([config/config.h]) AC_CONFIG_SRCDIR([src/main.js]) @@ -52,7 +52,7 @@ EVINCE_MIN_VERSION=3.13.3 WEBKITGTK_MIN_VERSION=2.6.0 GLIB_MIN_VERSION=2.39.3 -GTK_MIN_VERSION=3.19.1 +GTK_MIN_VERSION=3.22.10 GOBJECT_INTROSPECTION_MIN_VERSION=1.31.6 GDATA_MIN_VERSION=0.13.3 GOA_MIN_VERSION=3.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/help/lv/filter.page new/gnome-documents-3.24.1/help/lv/filter.page --- old/gnome-documents-3.24.0/help/lv/filter.page 2017-03-22 16:14:05.000000000 +0100 +++ new/gnome-documents-3.24.1/help/lv/filter.page 2017-04-12 12:38:26.000000000 +0200 @@ -30,10 +30,7 @@ <terms> <item> <title>Avoti</title> - <p>Choose to search documents that are <gui>Local</gui>, accessed through - <link href="help:gnome-help/online-accounts">online accounts</link> with - <gui>Google</gui>, <gui>OneDrive</gui>, <gui>ownCloud</gui>, or - <gui>All</gui>.</p> + <p>Izvēlieties meklēt dokumentus, kas ir <gui>Lokāli</gui>, pieejami caur<link href="help:gnome-help/online-accounts">tiešsaistes kontiem</link> ar <gui>Google</gui>, <gui>OneDrive</gui>, <gui>ownCloud</gui> vai <gui>All</gui>.</p> </item> <item> <title>Tips</title> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/help/lv/lv.po new/gnome-documents-3.24.1/help/lv/lv.po --- old/gnome-documents-3.24.0/help/lv/lv.po 2017-03-12 19:17:26.000000000 +0100 +++ new/gnome-documents-3.24.1/help/lv/lv.po 2017-04-12 12:28:42.000000000 +0200 @@ -5,21 +5,21 @@ # Dāgs Ādams Grīnbergs <[email protected]>, 2011. # Matīss Jānis Āboltiņš http://www.mja.lv/, 2011. # Viesturs Ružāns <[email protected]>, 2011. -# Rūdofls Mazurs <[email protected]>, 2011, 2012, 2013, 2014, 2016. +# Rūdofls Mazurs <[email protected]>, 2011, 2012, 2013, 2014, 2016, 2017. # Peteris Krisjanis <[email protected]>, 2012. msgid "" msgstr "" "Project-Id-Version: gnome-user-docs master\n" -"POT-Creation-Date: 2016-03-12 21:08+0000\n" -"PO-Revision-Date: 2016-03-13 11:39+0200\n" +"POT-Creation-Date: 2017-04-02 06:42+0000\n" +"PO-Revision-Date: 2017-04-09 14:59+0200\n" "Last-Translator: Rūdolfs Mazurs <[email protected]>\n" "Language-Team: Latvian <[email protected]>\n" "Language: lv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : " -"2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 :" +" 2);\n" "X-Generator: Lokalize 2.0\n" #. (itstool) path: p/link @@ -177,17 +177,14 @@ #. (itstool) path: page/p #: C/filter.page:29 -#| msgid "" -#| "<link xref=\"search\">Open the search</link> and click the <media type=" -#| "\"image\" src=\"media/go-down.png\">down</media> button next to the " -#| "search bar to limit the scope of the search in these categories:" msgid "" "<link xref=\"search\">Open the search</link> and click the <_:media-1/> " "button next to the search bar to limit the scope of the search in these " "categories:" msgstr "" -"<link xref=\"search\">Atveriet meklēšanu</link> un spiediet <_:media-1/> pogu " -"pie meklēšanas joslas, lai ierobežotu meklēšanas tvērumu uz šīm kategorijām:" +"<link xref=\"search\">Atveriet meklēšanu</link> un spiediet <_:media-1/> " +"pogu pie meklēšanas joslas, lai ierobežotu meklēšanas tvērumu uz šīm " +"kategorijām:" #. (itstool) path: item/title #: C/filter.page:36 @@ -196,8 +193,13 @@ #. (itstool) path: item/p #: C/filter.page:37 +#| msgid "" +#| "Chose to search documents that are <gui>Local</gui>, accessed through " +#| "<link href=\"help:gnome-help/online-accounts\">online accounts</link> " +#| "with <gui>Google</gui>, <gui>OneDrive</gui>, <gui>ownCloud</gui>, or " +#| "<gui>All</gui>." msgid "" -"Chose to search documents that are <gui>Local</gui>, accessed through <link " +"Choose to search documents that are <gui>Local</gui>, accessed through <link " "href=\"help:gnome-help/online-accounts\">online accounts</link> with " "<gui>Google</gui>, <gui>OneDrive</gui>, <gui>ownCloud</gui>, or <gui>All</" "gui>." @@ -335,16 +337,12 @@ #. (itstool) path: page/p #: C/info.page:42 -#| msgid "" -#| "When a document is created, it contains with <em>metadata</em>. " -#| "<app>Documents</app> displays the following metadata for each document:" msgid "" "When a document is created, it contains <em>metadata</em>. <app>Documents</" "app> displays the following metadata for each document:" msgstr "" -"Kad dokuments ir izveidots, tas satur <em>metadatus</em>. <app>Dokumenti</app>" -" " -"katram dokumentam attēlo šos metadatus:" +"Kad dokuments ir izveidots, tas satur <em>metadatus</em>. <app>Dokumenti</" +"app> katram dokumentam attēlo šos metadatus:" #. (itstool) path: item/p #: C/info.page:47 @@ -574,17 +572,12 @@ #. (itstool) path: note/p #: C/search.page:52 -#| msgid "" -#| "You can restrict or filter the search results by clicking the <media type=" -#| "\"image\" src=\"media/go-down.png\">down</media> button and selecting " -#| "various <link xref=\"filter\">filters</link>." msgid "" "You can restrict or filter the search results by clicking the <_:media-1/> " "button and selecting various <link xref=\"filter\">filters</link>." msgstr "" "Jūs varat ierobežot vai filtrēt meklēšanas rezultātus, spiežot <_:media-1/> " -"pogu un " -"izvēloties dažādus <link xref=\"filter\">filtrus</link>." +"pogu un izvēloties dažādus <link xref=\"filter\">filtrus</link>." #. (itstool) path: info/desc #: C/viewgrid.page:29 @@ -640,9 +633,6 @@ #. (itstool) path: page/p #: C/view.page:42 -#| msgid "" -#| "When you open <app>Documents</app>, all of your documents, those stored " -#| "locally as well as online, are displayed as thumbnails." msgid "" "When you open <app>Documents</app>, documents which are stored locally in " "one of the standard folders such as <file>Documents</file> or " @@ -721,25 +711,24 @@ #. (itstool) path: item/p #: C/view-add.page:41 -#| msgid "Click the <gui>+</gui> button in the button bar." msgid "Click on <gui>Search</gui> to open the panel." msgstr "Spiediet pogu <gui>Meklēt</gui>, lai atvērtu paneli." #. (itstool) path: item/p #: C/view-add.page:44 -#| msgid "Press the list button in the top-right corner of the window." msgid "" "Press the button in the bottom-right of the window which will open " "<gui>Search Locations</gui>." msgstr "" -"Spiediet pogu loga augšējā labajā stūrī, kas atvērs <gui>Meklēšanas vietas<" -"/gui>." +"Spiediet pogu loga augšējā labajā stūrī, kas atvērs <gui>Meklēšanas vietas</" +"gui>." #. (itstool) path: item/p #: C/view-add.page:48 msgid "Press <gui style=\"button\">+</gui> to add a new search location." msgstr "" -"Spiediet <gui style=\"button\">+</gui>, lai pievienotu jaunu meklēšanas vietu." +"Spiediet <gui style=\"button\">+</gui>, lai pievienotu jaunu meklēšanas " +"vietu." #. (itstool) path: item/p #: C/view-add.page:51 @@ -747,9 +736,8 @@ "Select the folder that you want to add and press <gui style=\"button\">OK</" "gui> to add the folder." msgstr "" -"Izvēlieties mapi, ko vēlaties pievienot, un spiediet <gui style=\"button\">" -"Labi</" -"gui>, lai pievienotu mapi." +"Izvēlieties mapi, ko vēlaties pievienot, un spiediet <gui style=\"button" +"\">Labi</gui>, lai pievienotu mapi." #. (itstool) path: page/p #: C/view-add.page:63 @@ -760,3 +748,4 @@ msgstr "" "Jaunas mapes pievienošana ļaus arī citām lietotnēm meklēt tajā mapē. Diemžēl " "nevar noteikt, kuras lietotnes tas ietekmēs, tās nepārbaudot." + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/po/da.po new/gnome-documents-3.24.1/po/da.po --- old/gnome-documents-3.24.0/po/da.po 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/po/da.po 2017-04-05 13:37:01.000000000 +0200 @@ -13,7 +13,7 @@ "Report-Msgid-Bugs-To: " "http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-documents&keywords=I18N+L10N&component=general\n" "POT-Creation-Date: 2016-10-22 20:50+0000\n" -"PO-Revision-Date: 2016-09-13 01:22+0200\n" +"PO-Revision-Date: 2017-03-25 17:37+0100\n" "Last-Translator: Kris Thomsen\n" "Language-Team: Danish <[email protected]>\n" "Language: da\n" @@ -285,7 +285,7 @@ #: ../data/ui/help-overlay.ui.h:13 msgctxt "shortcut window" msgid "Copy selected text to clipboard" -msgstr "Kopiér den markerede tekst til udklipsholder" +msgstr "Kopiér den markerede tekst til udklipsholder" #: ../data/ui/help-overlay.ui.h:14 msgctxt "shortcut window" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/application.js new/gnome-documents-3.24.1/src/application.js --- old/gnome-documents-3.24.0/src/application.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/application.js 2017-04-12 12:28:20.000000000 +0200 @@ -95,6 +95,9 @@ const Application = new Lang.Class({ Name: 'Application', Extends: Gtk.Application, + Signals: { + 'miners-changed': {} + }, _init: function(isBooks) { this.minersRunning = []; @@ -194,9 +197,9 @@ _onActionHelp: function() { try { - Gtk.show_uri(this._mainWindow.get_screen(), - 'help:gnome-documents', - Gtk.get_current_event_time()); + Gtk.show_uri_on_window(this._mainWindow, + 'help:gnome-documents', + Gtk.get_current_event_time()); } catch (e) { logError(e, 'Unable to display help'); } @@ -241,7 +244,7 @@ return false; this.minersRunning.push(miner); - this.emitJS('miners-changed', this.minersRunning); + this.emit('miners-changed'); miner._cancellable = new Gio.Cancellable(); miner.RefreshDBRemote(['documents'], miner._cancellable, Lang.bind(this, @@ -250,7 +253,7 @@ function(element) { return element != miner; }); - this.emitJS('miners-changed', this.minersRunning); + this.emit('miners-changed'); if (error) { if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED)) @@ -324,6 +327,7 @@ function(miner) { miner._cancellable.cancel(); })); + this.minersRunning = []; this.gdataMiner = null; this.owncloudMiner = null; @@ -481,7 +485,6 @@ trackerSearchController.disconnectAll(); selectionController.disconnectAll(); modeController.disconnectAll(); - this.disconnectAllJS(); // reset state documentManager.clearRowRefs(); @@ -564,4 +567,3 @@ return window; } }); -Utils.addJSSignalMethods(Application.prototype); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/documents.js new/gnome-documents-3.24.1/src/documents.js --- old/gnome-documents-3.24.0/src/documents.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/documents.js 2017-04-12 12:28:20.000000000 +0200 @@ -30,6 +30,7 @@ const Gdk = imports.gi.Gdk; const GData = imports.gi.GData; const GLib = imports.gi.GLib; +const GnomeDesktop = imports.gi.GnomeDesktop; const Gtk = imports.gi.Gtk; const Zpj = imports.gi.Zpj; const _ = imports.gettext.gettext; @@ -362,6 +363,10 @@ } }, + load: function() { + log('Error: DocCommon implementations must override load'); + }, + canEdit: function() { log('Error: DocCommon implementations must override canEdit'); }, @@ -630,7 +635,7 @@ })); }, - open: function(screen, timestamp) { + open: function(parent, timestamp) { if (!this.defaultAppName) return; @@ -640,7 +645,7 @@ if (this.defaultApp) this.defaultApp.launch_uris( [ this.uri ], null); else - Gtk.show_uri(screen, this.uri, timestamp); + Gtk.show_uri_on_window(parent, this.uri, timestamp); } catch (e) { logError(e, 'Unable to show URI ' + this.uri); } @@ -914,12 +919,10 @@ authorization_domain: authorizationDomain, download_uri: uri }); - let checksum = new GLib.Checksum(GLib.ChecksumType.MD5); - checksum.update(this.uri, -1); - let dirPath = GLib.build_filenamev([GLib.get_user_cache_dir(), "thumbnails", "normal"]); + let path = GnomeDesktop.desktop_thumbnail_path_for_uri (this.uri, + GnomeDesktop.DesktopThumbnailSize.NORMAL); + let dirPath = GLib.path_get_dirname(path); GLib.mkdir_with_parents(dirPath, 448); - let basename = checksum.get_string() + '.png'; - let path = GLib.build_filenamev([dirPath, basename]) let downloadFile = Gio.File.new_for_path(path); downloadFile.replace_async @@ -1055,6 +1058,8 @@ } }); +const SKYDRIVE_PREFIX = 'windows-live:skydrive:'; + const SkydriveDocument = new Lang.Class({ Name: 'SkydriveDocument', Extends: DocCommon, @@ -1074,9 +1079,7 @@ let authorizer = new Zpj.GoaAuthorizer({ goa_object: source.object }); let service = new Zpj.Skydrive({ authorizer: authorizer }); - - const zpj_prefix = "windows-live:skydrive:"; - let zpj_id = this.identifier.substring(zpj_prefix.length); + let zpj_id = this.identifier.substring(SKYDRIVE_PREFIX.length); service.query_info_from_id_async (zpj_id, cancellable, @@ -1227,7 +1230,7 @@ _identifierIsSkydrive: function(identifier) { return (identifier && - (identifier.indexOf('windows-live:skydrive:') != -1)); + (identifier.indexOf(SKYDRIVE_PREFIX) != -1)); }, createDocumentFromCursor: function(cursor) { @@ -1354,6 +1357,8 @@ return; } + logError(error, 'Unable to load document'); + // Translators: %s is the title of a document let message = _("Oops! Unable to load “%s”").format(doc.name); let exception = this._humanizeError(error); @@ -1384,6 +1389,15 @@ Application.modeController.setWindowMode(windowMode); }, + _loadActiveItem: function(passwd) { + let doc = this.getActiveItem(); + + this._loaderCancellable = new Gio.Cancellable(); + this._requestPreview(doc); + this.emit('load-started', doc); + doc.load(passwd, this._loaderCancellable, Lang.bind(this, this._onDocumentLoaded)); + }, + reloadActiveItem: function(passwd) { let doc = this.getActiveItem(); @@ -1396,10 +1410,7 @@ // cleanup any state we have for previously loaded model this._clearActiveDocModel(); - this._loaderCancellable = new Gio.Cancellable(); - this._requestPreview(doc); - this.emit('load-started', doc); - doc.load(passwd, this._loaderCancellable, Lang.bind(this, this._onDocumentLoaded)); + this._loadActiveItem(passwd); }, removeItemById: function(id) { @@ -1455,10 +1466,7 @@ let recentManager = Gtk.RecentManager.get_default(); recentManager.add_item(doc.uri); - this._loaderCancellable = new Gio.Cancellable(); - this._requestPreview(doc); - this.emit('load-started', doc); - doc.load(null, this._loaderCancellable, Lang.bind(this, this._onDocumentLoaded)); + this._loadActiveItem(null); } return retval; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/embed.js new/gnome-documents-3.24.1/src/embed.js --- old/gnome-documents-3.24.0/src/embed.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/embed.js 2017-04-05 13:37:01.000000000 +0200 @@ -137,8 +137,8 @@ this._toolbar = this.view.createToolbar(this._stack); 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._window.get_titlebar().add(this._toolbar); } }, @@ -214,13 +214,9 @@ }, getMainToolbar: function() { - let windowMode = Application.modeController.getWindowMode(); - - if (windowMode == WindowMode.WindowMode.PREVIEW_EV) { - let fullscreen = this._view.view.fullscreen; - if (fullscreen) - return this._view.view.getFullscreenToolbar(); - } + if (this._view.view.canFullscreen && + this._view.view.fullscreen) + return this._view.view.getFullscreenToolbar(); return this._view.toolbar; }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/epubview.js new/gnome-documents-3.24.1/src/epubview.js --- old/gnome-documents-3.24.0/src/epubview.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/epubview.js 2017-04-12 12:28:20.000000000 +0200 @@ -72,6 +72,9 @@ this.getAction('find-next').enabled = hasResults; })); + view.connect('button-release-event', Lang.bind(this, + this._onButtonReleaseEvent)); + return view; }, @@ -114,6 +117,19 @@ this._metadata.set_int('page', pageNumber); }, + _onButtonReleaseEvent: function(widget, event) { + let button = event.get_button()[1]; + let clickCount = event.get_click_count()[1]; + + if (button == 1 + && clickCount == 1) + this.queueControlsFlip(); + else + this.cancelControlsFlip(); + + return false; + }, + goPrev: function() { this._epubdoc.go_prev(); }, @@ -134,6 +150,10 @@ return this._epubdoc ? this._epubdoc.get_n_pages() : 0; }, + get canFullscreen() { + return true; + }, + search: function(str) { this.parent(str); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/evinceview.js new/gnome-documents-3.24.1/src/evinceview.js --- old/gnome-documents-3.24.0/src/evinceview.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/evinceview.js 2017-04-05 13:37:01.000000000 +0200 @@ -32,7 +32,6 @@ const Application = imports.application; const Documents = imports.documents; -const FullscreenAction = imports.fullscreenAction; const Places = imports.places; const Presentation = imports.presentation; const Preview = imports.preview; @@ -46,30 +45,13 @@ _init: function(overlay, mainWindow) { this._model = null; this._jobFind = null; - this._controlsFlipId = 0; - this._controlsVisible = false; this._pageChanged = false; this._hasSelection = false; this._viewSelectionChanged = false; - this._fsToolbar = null; this.parent(overlay, mainWindow); - let fullscreenAction = new FullscreenAction.FullscreenAction({ window: mainWindow }); - fullscreenAction.connect('notify::state', Lang.bind(this, this._onFullscreenChanged)); - this.actionGroup.add_action(fullscreenAction); - Application.application.set_accels_for_action('view.fullscreen', ['F11']); - this.getAction('bookmark-page').enabled = false; - - let nightModeId = Application.application.connect('action-state-changed::night-mode', - Lang.bind(this, this._updateNightMode)); - - this.connect('destroy', Lang.bind(this, - function() { - Application.application.disconnect(nightModeId); - fullscreenAction.change_state(new GLib.Variant('b', false)); - })); }, _copy: function() { @@ -118,7 +100,7 @@ _findStateChanged: function(action) { let toolbar = this.toolbar; if (this.fullscreen) - toolbar = this._fsToolbar.toolbar; + toolbar = this.getFullscreenToolbar().toolbar; if (action.state.get_boolean()) { toolbar.searchbar.reveal(); @@ -273,12 +255,12 @@ }, onLoadFinished: function(manager, doc, docModel) { - this.parent(manager, doc, docModel); - this.controlsVisible = false; this._lastSearch = ''; this._model = docModel; + this.parent(manager, doc, docModel); + if (Application.application.isBooks) docModel.set_sizing_mode(EvView.SizingMode.FIT_PAGE); else @@ -286,7 +268,6 @@ docModel.set_continuous(false); docModel.set_page_layout(EvView.PageLayout.AUTOMATIC); - this._updateNightMode(); this._model.connect('page-changed', Lang.bind(this, this._onPageChanged)); @@ -312,7 +293,7 @@ this._evView.set_model(this._model); this.navControls.setModel(this._model); - this.toolbar.setModel(this._model); + this.toolbar.updateTitle(); this.set_visible_child_full('view', Gtk.StackTransitionType.NONE); this.grab_focus(); @@ -379,7 +360,7 @@ 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); @@ -404,7 +385,7 @@ this._hasSelection = hasSelection; this._viewSelectionChanged = true; if (!hasSelection) - this._cancelControlsFlip(); + this.cancelControlsFlip(); }, _uriRewrite: function(uri) { @@ -471,70 +452,6 @@ this.getAction('zoom-out').enabled = this._evView.can_zoom_out; }, - _syncControlsVisible: function() { - if (this._controlsVisible) { - if (this._fsToolbar) - this._fsToolbar.reveal(); - } else { - if (this._fsToolbar) - this._fsToolbar.conceal(); - } - }, - - _onFullscreenChanged: function(action) { - let fullscreen = action.state.get_boolean(); - - this.toolbar.visible = !fullscreen; - this.toolbar.sensitive = !fullscreen; - - if (fullscreen) { - // create fullscreen toolbar (hidden by default) - this._fsToolbar = new EvinceViewFullscreenToolbar(this); - this._fsToolbar.setModel(this._model); - this.overlay.add_overlay(this._fsToolbar); - - this._fsToolbar.connectJS('show-controls', Lang.bind(this, - function() { - this.controlsVisible = true; - })); - - Application.application.set_accels_for_action('view.fullscreen', - ['F11', 'Escape']); - } else { - this._fsToolbar.destroy(); - this._fsToolbar = null; - - Application.application.set_accels_for_action('view.fullscreen', ['F11']); - } - - this._syncControlsVisible(); - }, - - _flipControlsTimeout: function() { - this._controlsFlipId = 0; - let visible = this.controlsVisible; - this.controlsVisible = !visible; - - return false; - }, - - _cancelControlsFlip: function() { - if (this._controlsFlipId != 0) { - Mainloop.source_remove(this._controlsFlipId); - this._controlsFlipId = 0; - } - }, - - _queueControlsFlip: function() { - if (this._controlsFlipId) - return; - - let settings = Gtk.Settings.get_default(); - let doubleClick = settings.gtk_double_click_time; - - this._controlsFlipId = Mainloop.timeout_add(doubleClick, Lang.bind(this, this._flipControlsTimeout)); - }, - _onButtonPressEvent: function(widget, event) { let button = event.get_button()[1]; @@ -555,9 +472,9 @@ if (button == 1 && clickCount == 1 && !this._viewSelectionChanged) - this._queueControlsFlip(); + this.queueControlsFlip(); else - this._cancelControlsFlip(); + this.cancelControlsFlip(); this._viewSelectionChanged = false; @@ -575,21 +492,6 @@ this._pageChanged = false; }, - get controlsVisible() { - return this._controlsVisible; - }, - - set controlsVisible(visible) { - // reset any pending timeout, as we're about to change controls state - this._cancelControlsFlip(); - - if (this._controlsVisible == visible) - return; - - this._controlsVisible = visible; - this._syncControlsVisible(); - }, - search: function(str) { this._evView.find_search_changed(); @@ -642,21 +544,10 @@ return metadata; }, - _updateNightMode: function() { - if (this._model && !Application.application.isBooks) { - let nightMode = Application.settings.get_boolean('night-mode'); - this._model.set_inverted_colors(nightMode); - } - }, - getModel: function() { return this._model; }, - getFullscreenToolbar: function() { - return this._fsToolbar; - }, - goPrev: function() { this._evView.previous_page(); }, @@ -677,8 +568,13 @@ return this._model ? this._model.document.get_n_pages() : 0; }, - get fullscreen() { - return this.getAction('fullscreen').state.get_boolean(); + get canFullscreen() { + return true; + }, + + set nightMode(v) { + if (this._model && !Application.application.isBooks) + this._model.set_inverted_colors(v); } }); @@ -725,99 +621,8 @@ _init: function(preview) { this.parent(preview); - this._fsStateId = 0; this._handleEvent = false; this.addSearchButton('view.find'); - - if (Application.application.isBooks) { - this._addFullscreenButton(); - this.addNightmodeButton(); - } - - this.connect('destroy', Lang.bind(this, function() { - if (this._fsStateId > 0) - this.preview.getAction('fullscreen').disconnect(this._fsStateId); - })); - }, - - _addFullscreenButton: function() { - this._fullscreenButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'view-fullscreen-symbolic' }), - tooltip_text: _("Fullscreen"), - action_name: 'view.fullscreen', - visible: true }); - this.toolbar.pack_end(this._fullscreenButton); - - let action = this.preview.getAction('fullscreen'); - this._fsStateId = action.connect('notify::state', Lang.bind(this, this._fullscreenStateChanged)); - this._fullscreenStateChanged(); - }, - - _fullscreenStateChanged: function() { - let action = this.preview.getAction('fullscreen'); - let fullscreen = action.state.get_boolean(); - - if (fullscreen) - this._fullscreenButton.image.icon_name = 'view-restore-symbolic'; - else - this._fullscreenButton.image.icon_name ='view-fullscreen-symbolic'; - }, - - setModel: function() { - this.updateTitle(); - } -}); - -const EvinceViewFullscreenToolbar = new Lang.Class({ - Name: 'EvinceViewFullscreenToolbar', - Extends: Gtk.Revealer, - - _init: function(previewView) { - this.parent({ valign: Gtk.Align.START }); - - this.toolbar = new EvinceViewToolbar(previewView); - - this.add(this.toolbar); - this.show(); - - // make controls show when a toolbar action is activated in fullscreen - let actionNames = ['gear-menu', 'find']; - let signalIds = []; - - actionNames.forEach(Lang.bind(this, function(actionName) { - let signalName = 'action-state-changed::' + actionName; - let signalId = previewView.actionGroup.connect(signalName, Lang.bind(this, - function(actionGroup, actionName, value) { - let state = value.get_boolean(); - if (state) - this.emitJS('show-controls'); - })); - - signalIds.push(signalId); - })); - - this.toolbar.connect('destroy', Lang.bind(this, function() { - signalIds.forEach(function(signalId) { - previewView.actionGroup.disconnect(signalId); - }); - })); - }, - - handleEvent: function(event) { - this.toolbar.handleEvent(event); - }, - - setModel: function(model) { - this.toolbar.setModel(model); - }, - - reveal: function() { - this.set_reveal_child(true); - }, - - conceal: function() { - this.set_reveal_child(false); - this.toolbar.preview.getAction('find').change_state(GLib.Variant.new('b', false)); } }); -Utils.addJSSignalMethods(EvinceViewFullscreenToolbar.prototype); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/lib/gd-pdf-loader.c new/gnome-documents-3.24.1/src/lib/gd-pdf-loader.c --- old/gnome-documents-3.24.0/src/lib/gd-pdf-loader.c 2016-12-14 16:23:03.000000000 +0100 +++ new/gnome-documents-3.24.1/src/lib/gd-pdf-loader.c 2017-04-12 12:28:20.000000000 +0200 @@ -223,11 +223,32 @@ } static void +ev_load_job_cancelled (EvJob *ev_job, + gpointer user_data) +{ + PdfLoadJob *job = user_data; + + if (job->cancelled_id > 0) { + g_cancellable_disconnect (job->cancellable, job->cancelled_id); + job->cancelled_id = 0; + } + + pdf_load_job_complete_error (job, + g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, + "Operation cancelled")); +} + +static void ev_load_job_done (EvJob *ev_job, gpointer user_data) { PdfLoadJob *job = user_data; + if (job->cancelled_id > 0) { + g_cancellable_disconnect (job->cancellable, job->cancelled_id); + job->cancelled_id = 0; + } + if (ev_job_is_failed (ev_job) || (ev_job->document == NULL)) { if (job->from_old_cache) { pdf_load_job_force_refresh_cache (job); @@ -254,6 +275,21 @@ pdf_load_job_complete_success (job); } +static gboolean +pdf_load_cancel_in_idle (gpointer user_data) +{ + EvJob *ev_job = user_data; + ev_job_cancel (ev_job); + return FALSE; +} + +static void +pdf_load_cancelled_cb (GCancellable *cancellable, + EvJob *ev_job) +{ + g_idle_add (pdf_load_cancel_in_idle, ev_job); +} + static void pdf_load_job_from_pdf (PdfLoadJob *job) { @@ -271,9 +307,16 @@ if (job->passwd != NULL) ev_job_load_set_password (EV_JOB_LOAD (ev_job), job->passwd); + g_signal_connect (ev_job, "cancelled", + G_CALLBACK (ev_load_job_cancelled), job); g_signal_connect (ev_job, "finished", G_CALLBACK (ev_load_job_done), job); + if (job->cancellable != NULL) + job->cancelled_id = + g_cancellable_connect (job->cancellable, + G_CALLBACK (pdf_load_cancelled_cb), ev_job, NULL); + ev_job_scheduler_push_job (ev_job, EV_JOB_PRIORITY_NONE); g_object_unref (ev_job); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/lib/gd-utils.c new/gnome-documents-3.24.1/src/lib/gd-utils.c --- old/gnome-documents-3.24.0/src/lib/gd-utils.c 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/lib/gd-utils.c 2017-04-12 12:28:20.000000000 +0200 @@ -41,10 +41,10 @@ { GSimpleAsyncResult *result = user_data; GFile *file = G_FILE (g_async_result_get_source_object (G_ASYNC_RESULT (result))); - GnomeDesktopThumbnailFactory *factory; - GFileInfo *info; - gchar *uri; - GdkPixbuf *pixbuf; + GnomeDesktopThumbnailFactory *factory = NULL; + GFileInfo *info = NULL; + gchar *uri = NULL; + GdkPixbuf *pixbuf = NULL; guint64 mtime; uri = g_file_get_uri (file); @@ -79,15 +79,15 @@ g_simple_async_result_set_op_res_gboolean (result, FALSE); } - g_object_unref (info); - g_object_unref (file); - g_object_unref (factory); - g_clear_object (&pixbuf); - out: g_simple_async_result_complete_in_idle (result); g_object_unref (result); + g_clear_object (&info); + g_object_unref (file); + g_clear_object (&factory); + g_clear_object (&pixbuf); + g_free (uri); return FALSE; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/lokview.js new/gnome-documents-3.24.1/src/lokview.js --- old/gnome-documents-3.24.0/src/lokview.js 2017-03-12 19:17:26.000000000 +0100 +++ new/gnome-documents-3.24.1/src/lokview.js 2017-04-12 12:28:20.000000000 +0200 @@ -40,7 +40,10 @@ const ZOOM_IN_FACTOR = 1.2; const ZOOM_OUT_FACTOR = (1.0/ZOOM_IN_FACTOR); -const openDocumentFormats = ['application/vnd.oasis.opendocument.text', +const openDocumentFormats = ['application/msword', + 'application/vnd.ms-excel', + 'application/vnd.ms-powerpoint', + 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-web', 'application/vnd.oasis.opendocument.text-master', @@ -63,9 +66,10 @@ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',]; - // These are the documents consisting of document parts. -const openDocumentPartFormats = ['application/vnd.oasis.opendocument.presentation', +const openDocumentPartFormats = ['application/vnd.ms-excel', + 'application/vnd.ms-powerpoint', + 'application/vnd.oasis.opendocument.presentation', 'application/vnd.oasis.opendocument.presentation-template', 'application/vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/mainToolbar.js new/gnome-documents-3.24.1/src/mainToolbar.js --- old/gnome-documents-3.24.0/src/mainToolbar.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/mainToolbar.js 2017-04-05 13:37:01.000000000 +0200 @@ -95,15 +95,6 @@ return searchButton; }, - addNightmodeButton: function() { - let nightmodeButton = new Gtk.ToggleButton({ image: new Gtk.Image ({ icon_name: 'display-brightness-symbolic' }), - tooltip_text: _("Night Mode"), - action_name: 'app.night-mode', - visible: true }); - this.toolbar.pack_end(nightmodeButton); - return nightmodeButton; - }, - addBackButton: function() { let backButton = new Gtk.Button({ image: new Gtk.Image({ icon_name: 'go-previous-symbolic' }), tooltip_text: _("Back"), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/notifications.js new/gnome-documents-3.24.1/src/notifications.js --- old/gnome-documents-3.24.0/src/notifications.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/notifications.js 2017-04-05 13:37:01.000000000 +0200 @@ -185,7 +185,7 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/presentation.js new/gnome-documents-3.24.1/src/presentation.js --- old/gnome-documents-3.24.0/src/presentation.js 2017-03-12 19:17:26.000000000 +0100 +++ new/gnome-documents-3.24.1/src/presentation.js 2017-04-05 13:37:01.000000000 +0200 @@ -114,6 +114,11 @@ const 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 +190,7 @@ return; this.output = output; - this.emitJS('output-activated', this.output); + this.emit('output-activated', this.output); this.close(); }, @@ -196,7 +201,7 @@ _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 +228,6 @@ contentArea.pack_start(frame, true, false, 0); } }); -Utils.addJSSignalMethods(PresentationOutputChooser.prototype); const PresentationOutputs = new Lang.Class({ Name: 'PresentationOutputs', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/preview.js new/gnome-documents-3.24.1/src/preview.js --- old/gnome-documents-3.24.0/src/preview.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/preview.js 2017-04-05 13:37:01.000000000 +0200 @@ -10,6 +10,7 @@ const Application = imports.application; const ErrorBox = imports.errorBox; +const FullscreenAction = imports.fullscreenAction; const MainToolbar = imports.mainToolbar; const Password = imports.password; const Properties = imports.properties; @@ -26,15 +27,17 @@ _init: function(overlay, mainWindow) { this._lastSearch = ''; this._loadShowId = 0; + this._controlsFlipId = 0; + this._controlsVisible = false; + this._fsStateId = 0; + this._fsToolbar = null; this.overlay = overlay; this.mainWindow = mainWindow; this.parent({ homogeneous: true, transition_type: Gtk.StackTransitionType.CROSSFADE }); - let actions = this.createActions().concat(this._getDefaultActions()); - this.actionGroup = new Gio.SimpleActionGroup(); - Utils.populateActionGroup(this.actionGroup, actions, 'view'); + this.actionGroup = this._createActionGroup(); this._errorBox = new ErrorBox.ErrorBox(); this.add_named(this._errorBox, 'error'); @@ -68,6 +71,9 @@ Lang.bind(this, this.onLoadError)); this._passwordNeededId = Application.documentManager.connect('password-needed', Lang.bind(this, this.onPasswordNeeded)); + + this._nightModeId = Application.application.connect('action-state-changed::night-mode', + Lang.bind(this, this._updateNightMode)); }, _getDefaultActions: function() { @@ -112,7 +118,92 @@ _openCurrent: function() { let doc = Application.documentManager.getActiveItem(); if (doc) - doc.open(this.mainWindow.get_screen(), Gtk.get_current_event_time()); + doc.open(this.mainWindow, Gtk.get_current_event_time()); + }, + + _updateNightMode: function() { + this.nightMode = Application.settings.get_boolean('night-mode'); + }, + + _onFullscreenChanged: function(action) { + let fullscreen = action.state.get_boolean(); + + this.toolbar.visible = !fullscreen; + this.getAction('gear-menu').change_state(GLib.Variant.new('b', false)); + + if (fullscreen) { + // create fullscreen toolbar (hidden by default) + this._fsToolbar = this.createFullscreenToolbar(); + this.overlay.add_overlay(this._fsToolbar); + + this._fsToolbar.connect('show-controls', Lang.bind(this, function() { + this.controlsVisible = true; + })); + + Application.application.set_accels_for_action('view.fullscreen', + ['F11', 'Escape']); + } else { + this._fsToolbar.destroy(); + this._fsToolbar = null; + + Application.application.set_accels_for_action('view.fullscreen', ['F11']); + } + + this._syncControlsVisible(); + }, + + getFullscreenToolbar: function() { + return this._fsToolbar; + }, + + get controlsVisible() { + return this._controlsVisible; + }, + + set controlsVisible(visible) { + // reset any pending timeout, as we're about to change controls state + this.cancelControlsFlip(); + + if (this._controlsVisible == visible) + return; + + this._controlsVisible = visible; + this._syncControlsVisible(); + }, + + _flipControlsTimeout: function() { + this._controlsFlipId = 0; + let visible = this.controlsVisible; + this.controlsVisible = !visible; + + return false; + }, + + queueControlsFlip: function() { + if (this._controlsFlipId) + return; + + let settings = Gtk.Settings.get_default(); + let doubleClick = settings.gtk_double_click_time; + + this._controlsFlipId = Mainloop.timeout_add(doubleClick, Lang.bind(this, this._flipControlsTimeout)); + }, + + cancelControlsFlip: function() { + if (this._controlsFlipId != 0) { + Mainloop.source_remove(this._controlsFlipId); + this._controlsFlipId = 0; + } + }, + + _syncControlsVisible: function() { + if (this._controlsVisible) { + if (this._fsToolbar) + this._fsToolbar.reveal(); + } else { + if (this._fsToolbar) + this._fsToolbar.conceal(); + } }, vfunc_destroy: function() { @@ -137,9 +228,39 @@ this.navControls = null; } + if (this._fsToolbar) { + this._fsToolbar.destroy(); + this._fsToolbar = null; + } + + if (this._fullscreenAction) { + this._fullscreenAction.change_state(new GLib.Variant('b', false)); + this._fullscreenAction.disconnect(this._fsStateId); + } + + if (this._nightModeId > 0) { + Application.application.disconnect(this._nightModeId); + this._nightModeId = 0; + } + this.parent(); }, + _createActionGroup: function() { + let actions = this.createActions().concat(this._getDefaultActions()); + let actionGroup = new Gio.SimpleActionGroup(); + Utils.populateActionGroup(actionGroup, actions, 'view'); + + if (this.canFullscreen) { + this._fullscreenAction = new FullscreenAction.FullscreenAction({ window: this.mainWindow }); + this._fsStateId = this._fullscreenAction.connect('notify::state', Lang.bind(this, this._onFullscreenChanged)); + actionGroup.add_action(this._fullscreenAction); + Application.application.set_accels_for_action('view.fullscreen', ['F11']); + } + + return actionGroup; + }, + createActions: function() { return []; }, @@ -152,6 +273,10 @@ this.findNext(); }, + createFullscreenToolbar: function() { + return new PreviewFullscreenToolbar(this); + }, + createToolbar: function() { return new PreviewToolbar(this); }, @@ -203,6 +328,7 @@ this.set_visible_child_name('view'); this.getAction('open-current').enabled = (doc.defaultAppName != null); + this._updateNightMode(); }, onLoadError: function(manager, doc, message, exception) { @@ -251,9 +377,20 @@ }, get fullscreen() { + if (!this.canFullscreen) + return false; + + return this.getAction('fullscreen').state.get_boolean(); + }, + + get canFullscreen() { return false; }, + set nightMode(v) { + // do nothing + }, + findPrev: function() { throw (new Error('Not implemented')); }, @@ -268,6 +405,7 @@ Extends: MainToolbar.MainToolbar, _init: function(preview) { + this._fsStateId = 0; this.preview = preview; this.parent(); @@ -282,8 +420,18 @@ action_name: 'view.gear-menu' }); this.toolbar.pack_end(menuButton); + if (this.preview.canFullscreen && Application.application.isBooks) { + this._addFullscreenButton(); + this._addNightmodeButton(); + } + this.updateTitle(); this.toolbar.show_all(); + + this.connect('destroy', Lang.bind(this, function() { + if (this._fsStateId > 0) + this.preview.getAction('fullscreen').disconnect(this._fsStateId); + })); }, _getPreviewMenu: function() { @@ -301,6 +449,37 @@ return menu; }, + _addNightmodeButton: function() { + let nightmodeButton = new Gtk.ToggleButton({ image: new Gtk.Image ({ icon_name: 'display-brightness-symbolic' }), + tooltip_text: _("Night Mode"), + action_name: 'app.night-mode', + visible: true }); + this.toolbar.pack_end(nightmodeButton); + return nightmodeButton; + }, + + _addFullscreenButton: function() { + this._fullscreenButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'view-fullscreen-symbolic' }), + tooltip_text: _("Fullscreen"), + action_name: 'view.fullscreen', + visible: true }); + this.toolbar.pack_end(this._fullscreenButton); + + let action = this.preview.getAction('fullscreen'); + this._fsStateId = action.connect('notify::state', Lang.bind(this, this._fullscreenStateChanged)); + this._fullscreenStateChanged(); + }, + + _fullscreenStateChanged: function() { + let action = this.preview.getAction('fullscreen'); + let fullscreen = action.state.get_boolean(); + + if (fullscreen) + this._fullscreenButton.image.icon_name = 'view-restore-symbolic'; + else + this._fullscreenButton.image.icon_name = 'view-fullscreen-symbolic'; + }, + createSearchbar: function() { return new PreviewSearchbar(this.preview); }, @@ -316,6 +495,58 @@ } }); +const PreviewFullscreenToolbar = new Lang.Class({ + Name: 'PreviewFullscreenToolbar', + Extends: Gtk.Revealer, + Signals: { + 'show-controls': {} + }, + + _init: function(preview) { + this.parent({ valign: Gtk.Align.START }); + + this.toolbar = preview.createToolbar(); + + this.add(this.toolbar); + this.show(); + + // make controls show when a toolbar action is activated in fullscreen + let actionNames = ['gear-menu', 'find']; + let signalIds = []; + + actionNames.forEach(Lang.bind(this, function(actionName) { + let signalName = 'action-state-changed::' + actionName; + let signalId = preview.actionGroup.connect(signalName, Lang.bind(this, + function(actionGroup, actionName, value) { + let state = value.get_boolean(); + if (state) + this.emit('show-controls'); + })); + + signalIds.push(signalId); + })); + + this.toolbar.connect('destroy', Lang.bind(this, function() { + signalIds.forEach(function(signalId) { + preview.actionGroup.disconnect(signalId); + }); + })); + }, + + handleEvent: function(event) { + this.toolbar.handleEvent(event); + }, + + reveal: function() { + this.set_reveal_child(true); + }, + + conceal: function() { + this.set_reveal_child(false); + this.toolbar.preview.getAction('find').change_state(GLib.Variant.new('b', false)); + } +}); + const _AUTO_HIDE_TIMEOUT = 2; const PREVIEW_NAVBAR_MARGIN = 30; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/searchbar.js new/gnome-documents-3.24.1/src/searchbar.js --- old/gnome-documents-3.24.0/src/searchbar.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/searchbar.js 2017-04-05 13:37:01.000000000 +0200 @@ -33,6 +33,9 @@ const Searchbar = new Lang.Class({ Name: 'Searchbar', Extends: Gtk.SearchBar, + Signals: { + 'activate-result': {} + }, _init: function() { this.searchChangeBlocked = false; @@ -71,7 +74,7 @@ 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; } @@ -92,7 +95,6 @@ this.searchEntry.set_text(''); } }); -Utils.addJSSignalMethods(Searchbar.prototype); const Dropdown = new Lang.Class({ Name: 'Dropdown', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/selections.js new/gnome-documents-3.24.1/src/selections.js --- old/gnome-documents-3.24.0/src/selections.js 2017-03-12 19:36:31.000000000 +0100 +++ new/gnome-documents-3.24.1/src/selections.js 2017-04-12 12:28:20.000000000 +0200 @@ -986,13 +986,17 @@ }, _onToolbarOpen: function(widget) { + let selection = Application.selectionController.getSelection(); this._overview.getAction('selection-mode').change_state(GLib.Variant.new('b', false)); - let selection = Application.selectionController.getSelection(); selection.forEach(Lang.bind(this, function(urn) { let doc = Application.documentManager.getItemById(urn); - doc.open(widget.get_screen(), Gtk.get_current_event_time()); + let toplevel = this.get_toplevel(); + if (!toplevel.is_toplevel()) + throw(new Error('Code should not be reached')); + + doc.open(toplevel, Gtk.get_current_event_time()); })); }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/gnome-documents-3.24.0/src/utils.js new/gnome-documents-3.24.1/src/utils.js --- old/gnome-documents-3.24.0/src/utils.js 2017-03-12 19:17:26.000000000 +0100 +++ new/gnome-documents-3.24.1/src/utils.js 2017-04-05 13:37:01.000000000 +0200 @@ -114,13 +114,6 @@ 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()));
