[gnome-books/wip/hadess/gnome-books: 1/10] all: Remove gnome-online-accounts, libzapojit, libgdata deps



commit 13e2e8dd86e59aa8bb1fbfd10b5bdebffcb66321
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 24 12:28:42 2019 +0100

    all: Remove gnome-online-accounts, libzapojit, libgdata deps

 flatpak/org.gnome.Books.json          |  50 ---
 meson.build                           |   3 -
 src/Makefile-lib.am                   |   5 +-
 src/application.js                    | 181 ----------
 src/documents.js                      | 541 +----------------------------
 src/main.js                           |   1 -
 src/meson.build                       |   5 -
 src/miners.js                         |  59 ----
 src/notifications.js                  |  37 --
 src/org.gnome.Books.src.gresource.xml |   2 -
 src/search.js                         | 133 +------
 src/selections.js                     |   1 -
 src/sharing.js                        | 629 ----------------------------------
 13 files changed, 7 insertions(+), 1640 deletions(-)
---
diff --git a/flatpak/org.gnome.Books.json b/flatpak/org.gnome.Books.json
index cfc72e04..482af8ec 100644
--- a/flatpak/org.gnome.Books.json
+++ b/flatpak/org.gnome.Books.json
@@ -36,26 +36,6 @@
                  "/share/vala",
                  "*.la", "*.a" ],
     "modules": [
-        {
-            "name": "librest",
-            "sources": [
-                {
-                    "type": "archive",
-                    "url": "https://download.gnome.org/sources/rest/0.8/rest-0.8.1.tar.xz";,
-                    "sha256": "0513aad38e5d3cedd4ae3c551634e3be1b9baaa79775e53b2dba9456f15b01c9"
-                }
-            ]
-        },
-        {
-            "name": "gnome-online-accounts",
-            "config-opts": [ "--disable-telepathy", "--disable-documentation", "--disable-backend", 
"--disable-Werror" ],
-            "sources": [
-                {
-                    "type": "git",
-                    "url": "https://gitlab.gnome.org/GNOME/gnome-online-accounts.git";
-                }
-            ]
-        },
         {
             "name": "gnome-desktop",
             "buildsystem": "meson",
@@ -67,36 +47,6 @@
                 }
             ]
         },
-        {
-            "name": "liboauth",
-            "config-opts": [ "--enable-nss" ],
-            "sources": [
-                {
-                    "type": "archive",
-                    "url": "http://netix.dl.sourceforge.net/project/liboauth/liboauth-1.0.3.tar.gz";,
-                    "sha256": "0df60157b052f0e774ade8a8bac59d6e8d4b464058cc55f9208d72e41156811f"
-                }
-            ]
-        },
-        {
-            "name": "libgdata",
-            "config-opts": [ "--disable-always-build-tests", "--disable-Werror", "--disable-static" ],
-            "sources": [
-                {
-                    "type": "git",
-                    "url": "https://gitlab.gnome.org/GNOME/libgdata.git";
-                }
-            ]
-        },
-        {
-            "name": "libzapojit",
-            "sources": [
-                {
-                    "type": "git",
-                    "url": "https://gitlab.gnome.org/GNOME/libzapojit.git";
-                }
-            ]
-        },
         {
             "name": "popplerdata",
             "no-autogen": true,
diff --git a/meson.build b/meson.build
index 2aa3e231..20370b1e 100644
--- a/meson.build
+++ b/meson.build
@@ -75,10 +75,7 @@ books_deps = [
 ]
 
 # we just check their existence for gir
-dependency('libgdata')
 dependency('libgepub-0.6')
-dependency('goa-1.0')
-dependency('zapojit-0.0')
 
 # Although GTK+ 3.10 includes hi-dpi functionality, it does not require a cairo with
 # cairo_surface_set_device_scale(), which we also need if we're to support hi-dpi,
diff --git a/src/Makefile-lib.am b/src/Makefile-lib.am
index f858a957..3185b411 100644
--- a/src/Makefile-lib.am
+++ b/src/Makefile-lib.am
@@ -60,13 +60,10 @@ GdPrivate_1_0_gir_LIBS = libgdprivate-1.0.la
 GdPrivate_1_0_gir_CFLAGS = $(AM_CPPFLAGS) $(gdprivate_cflags)
 GdPrivate_1_0_gir_SCANNERFLAGS = --warn-all --symbol-prefix=gd --identifier-prefix=Gd
 GdPrivate_1_0_gir_INCLUDES = \
-   GData-0.0 \
    GnomeDesktop-3.0 \
-   Goa-1.0 \
    Gtk-3.0 \
    EvinceDocument-3.0 \
-   EvinceView-3.0 \
-   Zpj-0.0
+   EvinceView-3.0
 
 GdPrivate_1_0_gir_FILES = \
     $(addprefix $(srcdir)/,$(gdprivate_source_h)) \
diff --git a/src/application.js b/src/application.js
index e3b286cb..5e063ad1 100644
--- a/src/application.js
+++ b/src/application.js
@@ -26,7 +26,6 @@ const _ = imports.gettext.gettext;
 const EvDoc = imports.gi.EvinceDocument;
 const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
-const Goa = imports.gi.Goa;
 const Gtk = imports.gi.Gtk;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
@@ -36,7 +35,6 @@ const TrackerControl = imports.gi.TrackerControl;
 const ChangeMonitor = imports.changeMonitor;
 const Format = imports.format;
 const MainWindow = imports.mainWindow;
-const Miners = imports.miners;
 const Notifications = imports.notifications;
 const Properties = imports.properties;
 const Query = imports.query;
@@ -52,7 +50,6 @@ const WindowMode = imports.windowMode;
 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
@@ -126,42 +123,6 @@ var Application = new Lang.Class({
                              _("Show the version of the program"), null);
     },
 
-    _initGettingStarted: function() {
-        let manager = TrackerControl.MinerManager.new_full(false);
-
-        let languages = GLib.get_language_names();
-        let files = languages.map(
-            function(language) {
-                return Gio.File.new_for_path(pkg.pkgdatadir + '/getting-started/' + language +
-                    '/gnome-documents-getting-started.pdf');
-            });
-
-        this.gettingStartedLocation = null;
-
-        for (let i in files) {
-            try {
-                let info = files[i].query_info(Gio.FILE_ATTRIBUTE_STANDARD_TYPE,
-                                               Gio.FileQueryInfoFlags.NONE,
-                                               null);
-            } catch (e) {
-                continue;
-            }
-
-            this.gettingStartedLocation = files[i].get_parent();
-
-            try {
-                manager.index_file(files[i], null);
-            } catch (e) {
-                logError(e, 'Error indexing the getting started PDF');
-            }
-
-            break;
-        }
-
-        if (!this.gettingStartedLocation)
-            log('Can\'t find a valid getting started PDF document');
-    },
-
     _nightModeCreateHook: function(action) {
         settings.connect('changed::night-mode', Lang.bind(this,
             function() {
@@ -201,130 +162,6 @@ var Application = new Lang.Class({
         settings.set_value('night-mode', GLib.Variant.new('b', !state.get_boolean()));
     },
 
-    _createMiners: function(callback) {
-        let count = 3;
-
-        this.gdataMiner = new Miners.GDataMiner(Lang.bind(this,
-            function() {
-                count--;
-                if (count == 0)
-                    callback();
-            }));
-
-        this.owncloudMiner = new Miners.OwncloudMiner(Lang.bind(this,
-            function() {
-                count--;
-                if (count == 0)
-                    callback();
-            }));
-
-        this.zpjMiner = new Miners.ZpjMiner(Lang.bind(this,
-            function() {
-                count--;
-                if (count == 0)
-                    callback();
-            }));
-    },
-
-    _refreshMinerNow: function(miner) {
-        let env = GLib.getenv('DOCUMENTS_DISABLE_MINERS');
-        if (env)
-            return false;
-
-        if (!miner)
-            return false;
-
-        this.minersRunning.push(miner);
-        this.emit('miners-changed');
-
-        miner._cancellable = new Gio.Cancellable();
-        miner.RefreshDBRemote(['documents'], miner._cancellable, Lang.bind(this,
-            function(res, error) {
-                this.minersRunning = this.minersRunning.filter(
-                    function(element) {
-                        return element != miner;
-                    });
-                this.emit('miners-changed');
-
-                if (error) {
-                    if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED))
-                        logError(error, 'Error updating the cache');
-
-                    return;
-                }
-
-                Mainloop.timeout_add_seconds(MINER_REFRESH_TIMEOUT,
-                                             Lang.bind(this, function() {
-                                                 this._refreshMinerNow(miner);
-                                             }));
-            }));
-
-        return false;
-    },
-
-    _refreshMiners: function() {
-        if (sourceManager.hasProviderType('google')) {
-            try {
-                // startup a refresh of the gdocs cache
-                this._refreshMinerNow(this.gdataMiner);
-            } catch (e) {
-                logError(e, 'Unable to start GData miner');
-            }
-        }
-
-        if (sourceManager.hasProviderType('owncloud')) {
-            try {
-                // startup a refresh of the owncloud cache
-                this._refreshMinerNow(this.owncloudMiner);
-            } catch (e) {
-                logError(e, 'Unable to start Owncloud miner');
-            }
-        }
-
-        if (sourceManager.hasProviderType('windows_live')) {
-            try {
-                // startup a refresh of the skydrive cache
-                this._refreshMinerNow(this.zpjMiner);
-            } catch (e) {
-                logError(e, 'Unable to start Zpj miner');
-            }
-        }
-    },
-
-    _startMiners: function() {
-        this._createMiners(Lang.bind(this,
-            function() {
-                this._refreshMiners();
-
-                this._sourceAddedId = sourceManager.connect('item-added',
-                                                            Lang.bind(this, this._refreshMiners));
-                this._sourceRemovedId = sourceManager.connect('item-removed',
-                                                              Lang.bind(this, this._refreshMiners));
-            }));
-    },
-
-    _stopMiners: function() {
-        if (this._sourceAddedId != 0) {
-            sourceManager.disconnect(this._sourceAddedId);
-            this._sourceAddedId = 0;
-        }
-
-        if (this._sourceRemovedId != 0) {
-            sourceManager.disconnect(this._sourceRemovedId);
-            this._sourceRemovedId = 0;
-        }
-
-        this.minersRunning.forEach(Lang.bind(this,
-            function(miner) {
-                miner._cancellable.cancel();
-            }));
-        this.minersRunning = [];
-
-        this.gdataMiner = null;
-        this.owncloudMiner = null;
-        this.zpjMiner = null;
-    },
-
     _themeChanged: function(gtkSettings) {
         let screen = Gdk.Screen.get_default();
 
@@ -367,15 +204,6 @@ var Application = new Lang.Class({
             return;
         }
 
-        if (!application.isBooks) {
-            try {
-                goaClient = Goa.Client.new_sync(null);
-            } catch (e) {
-                logError(e, 'Unable to create the GOA client');
-                return;
-            }
-        }
-
         connectionQueue = new TrackerController.TrackerConnectionQueue();
         changeMonitor = new ChangeMonitor.TrackerChangeMonitor();
 
@@ -414,9 +242,6 @@ var Application = new Lang.Class({
         if (this._mainWindow)
             return;
 
-        if (!this.isBooks)
-            this._initGettingStarted();
-
         notificationManager = new Notifications.NotificationManager();
         this._mainWindow = new MainWindow.MainWindow(this);
         this._mainWindow.connect('destroy', Lang.bind(this, this._onWindowDestroy));
@@ -427,9 +252,6 @@ var Application = new Lang.Class({
         } catch (e) {
             logError(e, 'Unable to connect to the tracker extractor');
         }
-
-        // start miners
-        this._startMiners();
     },
 
     vfunc_dbus_register: function(connection, path) {
@@ -500,9 +322,6 @@ var Application = new Lang.Class({
         selectionController.setSelection(null);
         notificationManager = null;
 
-        // stop miners
-        this._stopMiners();
-
         if (this._extractPriority)
             this._extractPriority.ClearRdfTypesRemote();
     },
diff --git a/src/documents.js b/src/documents.js
index a5c25fc7..396243a1 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -28,11 +28,9 @@ const Gio = imports.gi.Gio;
 const Gd = imports.gi.Gd;
 const GdPrivate = imports.gi.GdPrivate;
 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;
 
 const Lang = imports.lang;
@@ -867,18 +865,6 @@ var LocalDocument = new Lang.Class({
     populateFromCursor: function(cursor) {
         this.parent(cursor);
         this.uriToLoad = this.uri;
-
-        if (!Application.application.gettingStartedLocation)
-            return;
-
-        let file = Gio.File.new_for_uri(this.uri);
-        if (file.has_parent(Application.application.gettingStartedLocation)) {
-            // Translators: Documents ships a "Getting Started with Documents"
-            // tutorial PDF. The "GNOME" string below is displayed as the author name
-            // of that document, and doesn't normally need to be translated.
-            this.author = _("GNOME");
-            this.name = this.title = _("Getting Started with Documents");
-        }
     },
 
     createThumbnail: function(callback) {
@@ -971,489 +957,6 @@ var LocalDocument = new Lang.Class({
     }
 });
 
-const GOOGLE_PREFIX = 'google:drive:';
-
-const GoogleDocument = new Lang.Class({
-    Name: 'GoogleDocument',
-    Extends: DocCommon,
-
-    _init: function(cursor) {
-        this._failedThumbnailing = false;
-
-        this.parent(cursor);
-
-        // overridden
-        this.defaultAppName = _("Google Docs");
-        this.sourceName = _("Google");
-    },
-
-    createGDataEntry: function(cancellable, callback) {
-        let source = Application.sourceManager.getItemById(this.resourceUrn);
-
-        let authorizer = new GData.GoaAuthorizer({ goa_object: source.object });
-        let service = new GData.DocumentsService({ authorizer: authorizer });
-        let gdata_id = this.identifier.substring(GOOGLE_PREFIX.length);
-
-        service.query_single_entry_async
-            (GData.DocumentsService.get_primary_authorization_domain(),
-             gdata_id, null,
-             GData.DocumentsText,
-             cancellable, Lang.bind(this,
-                 function(object, res) {
-                     let entry = null;
-                     let exception = null;
-
-                     try {
-                         entry = object.query_single_entry_finish(res);
-                     } catch (e) {
-                         exception = e;
-                     }
-
-                     callback(entry, service, exception);
-                 }));
-    },
-
-    downloadImpl: function(localFile, cancellable, callback) {
-        this.createGDataEntry(cancellable, Lang.bind(this,
-            function(entry, service, error) {
-                if (error) {
-                    callback(false, error);
-                    return;
-                }
-
-                Utils.debug('Created GDataEntry for ' + this.id);
-
-                let inputStream;
-
-                try {
-                    inputStream = entry.download(service, 'pdf', cancellable);
-                } catch(e) {
-                    callback(false, e);
-                    return;
-                }
-
-                localFile.replace_async(null,
-                                        false,
-                                        Gio.FileCreateFlags.PRIVATE,
-                                        GLib.PRIORITY_DEFAULT,
-                                        cancellable,
-                                        Lang.bind(this,
-                    function(object, res) {
-                        let outputStream;
-
-                        try {
-                            outputStream = object.replace_finish(res);
-                        } catch (e) {
-                            callback(false, e);
-                            return;
-                        }
-
-                        outputStream.splice_async(inputStream,
-                                                  Gio.OutputStreamSpliceFlags.CLOSE_SOURCE |
-                                                  Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
-                                                  GLib.PRIORITY_DEFAULT,
-                                                  cancellable,
-                                                  Lang.bind(this,
-                            function(object, res) {
-                                try {
-                                    object.splice_finish(res);
-                                } catch (e) {
-                                    callback(false, e);
-                                    return;
-                                }
-
-                                callback(false, null);
-                            }));
-                    }));
-            }))
-    },
-
-    createThumbnail: function(callback) {
-        this.createGDataEntry(null, Lang.bind(this,
-            function(entry, service, exception) {
-                if (exception) {
-                    callback(false);
-                    return;
-                }
-
-                let uri = entry.get_thumbnail_uri();
-                if (!uri) {
-                    callback(false);
-                    return;
-                }
-
-                let authorizationDomain = GData.DocumentsService.get_primary_authorization_domain();
-                let inputStream = new GData.DownloadStream({ service: service,
-                                                             authorization_domain: authorizationDomain,
-                                                             download_uri: uri });
-
-                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 downloadFile = Gio.File.new_for_path(path);
-                downloadFile.replace_async
-                    (null, false, Gio.FileCreateFlags.PRIVATE, GLib.PRIORITY_DEFAULT, null, Lang.bind(this,
-                        function(source, res) {
-                            let outputStream;
-
-                            try {
-                                outputStream = downloadFile.replace_finish(res);
-                            } catch (e) {
-                                callback(false);
-                                return;
-                            }
-
-                            outputStream.splice_async(inputStream,
-                                Gio.OutputStreamSpliceFlags.CLOSE_SOURCE | 
Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
-                                GLib.PRIORITY_DEFAULT, null, Lang.bind(this,
-                                    function(source, res) {
-                                        try {
-                                            outputStream.splice_finish(res);
-                                        } catch (e) {
-                                            callback(false);
-                                            return;
-                                        }
-
-                                        callback(true);
-                                    }));
-                        }));
-            }));
-    },
-
-    updateTypeDescription: function() {
-        let description;
-
-        if (this.collection)
-            description = _("Collection");
-        else if (this.rdfType.indexOf('nfo#Spreadsheet') != -1)
-            description = _("Spreadsheet");
-        else if (this.rdfType.indexOf('nfo#Presentation') != -1)
-            description = _("Presentation");
-        else if (this.rdfType.indexOf('nfo#EBook') != -1)
-            description = _("e-Book");
-        else
-            description = _("Document");
-
-        this.typeDescription = description;
-    },
-
-    populateFromCursor: function(cursor) {
-        this.shared = cursor.get_boolean(Query.QueryColumns.SHARED);
-
-        this.parent(cursor);
-
-        let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "google"]);
-
-        let identifierHash = GLib.compute_checksum_for_string(GLib.ChecksumType.SHA1, this.identifier, -1);
-        let localFilename = identifierHash + ".pdf";
-
-        let localPath = GLib.build_filenamev([localDir, localFilename]);
-        let localFile = Gio.File.new_for_path(localPath);
-        this.uriToLoad = localFile.get_uri();
-    },
-
-    canEdit: function() {
-        return !this.collection;
-    },
-
-    canShare: function() {
-        return true;
-    },
-
-    canTrash: function() {
-        return false;
-    },
-
-    getSourceLink: function() {
-        let uri = 'http://docs.google.com/';
-        return [ uri, this.sourceName ];
-    }
-});
-
-const OWNCLOUD_PREFIX = 'owncloud:';
-
-const OwncloudDocument = new Lang.Class({
-    Name: 'OwncloudDocument',
-    Extends: DocCommon,
-
-    _init: function(cursor) {
-        this._failedThumbnailing = true;
-
-        this.parent(cursor);
-
-        // overridden
-        this.sourceName = _("ownCloud");
-
-        if (this.mimeType)
-            this.defaultApp = Gio.app_info_get_default_for_type(this.mimeType, true);
-
-        if (this.defaultApp)
-            this.defaultAppName = this.defaultApp.get_name();
-    },
-
-    populateFromCursor: function(cursor) {
-        this.parent(cursor);
-
-        let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "owncloud"]);
-
-        let identifierHash = this.identifier.substring(OWNCLOUD_PREFIX.length);
-        let filenameStripped = GdPrivate.filename_strip_extension(this.filename);
-        let extension = this.filename.substring(filenameStripped.length);
-        let localFilename = identifierHash + extension;
-
-        let localPath = GLib.build_filenamev([localDir, localFilename]);
-        let localFile = Gio.File.new_for_path(localPath);
-        this.uriToLoad = localFile.get_uri();
-    },
-
-    createThumbnail: function(callback) {
-        GdPrivate.queue_thumbnail_job_for_file_async(this._file, Lang.bind(this,
-            function(object, res) {
-                let thumbnailed = false;
-
-                try {
-                    thumbnailed = GdPrivate.queue_thumbnail_job_for_file_finish(res);
-                } catch (e) {
-                    /* We don't care about reporting errors here, just fail the
-                     * thumbnail.
-                     */
-                }
-
-                callback(thumbnailed);
-            }));
-    },
-
-    updateTypeDescription: function() {
-        let description = '';
-
-        if (this.collection)
-            description = _("Collection");
-        else if (this.mimeType)
-            description = Gio.content_type_get_description(this.mimeType);
-
-        this.typeDescription = description;
-    },
-
-    downloadImpl: function(localFile, cancellable, callback) {
-        let remoteFile = Gio.File.new_for_uri(this.uri);
-        remoteFile.read_async(GLib.PRIORITY_DEFAULT, cancellable, Lang.bind(this,
-            function(object, res) {
-                let inputStream;
-
-                try {
-                    inputStream = object.read_finish(res);
-                } catch (e) {
-                    callback(false, e);
-                    return;
-                }
-
-                localFile.replace_async(null,
-                                        false,
-                                        Gio.FileCreateFlags.PRIVATE,
-                                        GLib.PRIORITY_DEFAULT,
-                                        cancellable,
-                                        Lang.bind(this,
-                    function(object, res) {
-                        let outputStream;
-
-                        try {
-                            outputStream = object.replace_finish(res);
-                        } catch (e) {
-                            callback(false, e);
-                            return;
-                        }
-
-                        outputStream.splice_async(inputStream,
-                                                  Gio.OutputStreamSpliceFlags.CLOSE_SOURCE |
-                                                  Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
-                                                  GLib.PRIORITY_DEFAULT,
-                                                  cancellable,
-                                                  Lang.bind(this,
-                            function(object, res) {
-                                try {
-                                    object.splice_finish(res);
-                                } catch (e) {
-                                    callback(false, e);
-                                    return;
-                                }
-
-                                callback(false, null);
-                            }));
-                    }));
-            }));
-    },
-
-    canEdit: function() {
-        return false;
-    },
-
-    canShare: function() {
-        return false;
-    },
-
-    canTrash: function() {
-        return false;
-    },
-
-    getSourceLink: function() {
-        let source = Application.sourceManager.getItemById(this.resourceUrn);
-        let account = source.object.get_account();
-        let presentationIdentity = account.presentation_identity;
-        let uri ='https://' + presentationIdentity + '/';
-        return [ uri, presentationIdentity ];
-    }
-});
-
-const SKYDRIVE_PREFIX = 'windows-live:skydrive:';
-
-const SkydriveDocument = new Lang.Class({
-    Name: 'SkydriveDocument',
-    Extends: DocCommon,
-
-    _init: function(cursor) {
-        this._failedThumbnailing = true;
-
-        this.parent(cursor);
-
-        // overridden
-        this.defaultAppName = _("OneDrive");
-        this.sourceName = _("OneDrive");
-    },
-
-    populateFromCursor: function(cursor) {
-        this.parent(cursor);
-
-        let localDir = GLib.build_filenamev([GLib.get_user_cache_dir(), "gnome-documents", "skydrive"]);
-
-        let identifierHash = GLib.compute_checksum_for_string(GLib.ChecksumType.SHA1, this.identifier, -1);
-        let filenameStripped = GdPrivate.filename_strip_extension(this.filename);
-        let extension = this.filename.substring(filenameStripped.length);
-        let localFilename = identifierHash + extension;
-
-        let localPath = GLib.build_filenamev([localDir, localFilename]);
-        let localFile = Gio.File.new_for_path(localPath);
-        this.uriToLoad = localFile.get_uri();
-    },
-
-    _createZpjEntry: function(cancellable, callback) {
-        let source = Application.sourceManager.getItemById(this.resourceUrn);
-
-        let authorizer = new Zpj.GoaAuthorizer({ goa_object: source.object });
-        let service = new Zpj.Skydrive({ authorizer: authorizer });
-        let zpj_id = this.identifier.substring(SKYDRIVE_PREFIX.length);
-
-        service.query_info_from_id_async
-            (zpj_id, cancellable,
-             Lang.bind(this,
-                 function(object, res) {
-                     let entry = null;
-                     let exception = null;
-
-                     try {
-                         entry = object.query_info_from_id_finish(res);
-                     } catch (e) {
-                         exception = e;
-                     }
-
-                     callback(entry, service, exception);
-                 }));
-    },
-
-    downloadImpl: function(localFile, cancellable, callback) {
-        this._createZpjEntry(cancellable, Lang.bind(this,
-            function(entry, service, error) {
-                if (error) {
-                    callback(false, error);
-                    return;
-                }
-
-                Utils.debug('Created ZpjEntry for ' + this.id);
-
-                service.download_file_to_stream_async(entry, cancellable, Lang.bind(this,
-                    function(object, res) {
-                        let inputStream;
-
-                        try {
-                            inputStream = object.download_file_to_stream_finish(res);
-                        } catch (e) {
-                            callback(false, e);
-                            return;
-                        }
-
-                        localFile.replace_async(null,
-                                                false,
-                                                Gio.FileCreateFlags.PRIVATE,
-                                                GLib.PRIORITY_DEFAULT,
-                                                cancellable,
-                                                Lang.bind(this,
-                            function(object, res) {
-                                let outputStream;
-
-                                try {
-                                    outputStream = object.replace_finish(res);
-                                } catch (e) {
-                                    callback(false, e);
-                                    return;
-                                }
-
-                                outputStream.splice_async(inputStream,
-                                                          Gio.OutputStreamSpliceFlags.CLOSE_SOURCE |
-                                                          Gio.OutputStreamSpliceFlags.CLOSE_TARGET,
-                                                          GLib.PRIORITY_DEFAULT,
-                                                          cancellable,
-                                                          Lang.bind(this,
-                                    function(object, res) {
-                                        try {
-                                            object.splice_finish(res);
-                                        } catch (e) {
-                                            callback(false, e);
-                                            return;
-                                        }
-
-                                        callback(false, null);
-                                    }));
-                            }));
-                    }));
-            }));
-    },
-
-    updateTypeDescription: function() {
-        let description;
-
-        if (this.collection)
-            description = _("Collection");
-        else if (this.rdfType.indexOf('nfo#Spreadsheet') != -1)
-            description = _("Spreadsheet");
-        else if (this.rdfType.indexOf('nfo#Presentation') != -1)
-            description = _("Presentation");
-        else if (this.rdfType.indexOf('nfo#EBook') != -1)
-            description = _("e-Book");
-        else
-            description = _("Document");
-
-        this.typeDescription = description;
-    },
-
-    canEdit: function() {
-        return false;
-    },
-
-    canShare: function() {
-        return false;
-    },
-
-    canTrash: function() {
-        return false;
-    },
-
-    getSourceLink: function() {
-        let uri = 'https://onedrive.live.com';
-        return [ uri, this.sourceName ];
-    }
-});
-
 var DocumentManager = new Lang.Class({
     Name: 'DocumentManager',
     Extends: Manager.BaseManager,
@@ -1507,33 +1010,11 @@ var DocumentManager = new Lang.Class({
             }));
     },
 
-    _identifierIsGoogle: function(identifier) {
-        return (identifier &&
-                (identifier.indexOf(GOOGLE_PREFIX) != -1));
-    },
-
-    _identifierIsOwncloud: function(identifier) {
-        return (identifier &&
-                (identifier.indexOf(OWNCLOUD_PREFIX) != -1));
-    },
-
-    _identifierIsSkydrive: function(identifier) {
-        return (identifier &&
-                (identifier.indexOf(SKYDRIVE_PREFIX) != -1));
-    },
-
     createDocumentFromCursor: function(cursor) {
         let identifier = cursor.get_string(Query.QueryColumns.IDENTIFIER)[0];
         let doc;
 
-        if (this._identifierIsGoogle(identifier))
-            doc = new GoogleDocument(cursor);
-        else if (this._identifierIsOwncloud(identifier))
-            doc = new OwncloudDocument(cursor);
-        else if (this._identifierIsSkydrive(identifier))
-            doc = new SkydriveDocument(cursor);
-        else
-            doc = new LocalDocument(cursor);
+        doc = new LocalDocument(cursor);
 
         return doc;
     },
@@ -1602,25 +1083,7 @@ var DocumentManager = new Lang.Class({
 
     _humanizeError: function(error) {
         let message = error.message;
-        if (error.domain == GData.ServiceError) {
-            switch (error.code) {
-            case GData.ServiceError.NETWORK_ERROR:
-                message = _("Please check the network connection.");
-                break;
-            case GData.ServiceError.PROXY_ERROR:
-                message = _("Please check the network proxy settings.");
-                break;
-            case GData.ServiceError.AUTHENTICATION_REQUIRED:
-                message = _("Unable to sign in to the document service.");
-                break;
-            case GData.ServiceError.NOT_FOUND:
-                message = _("Unable to locate this document.");
-                break;
-            default:
-                message = _("Hmm, something is fishy (%d).").format(error.code);
-                break;
-            }
-        } else if (error.domain == Gio.IOErrorEnum) {
+        if (error.domain == Gio.IOErrorEnum) {
             switch (error.code) {
             case Gio.IOErrorEnum.NOT_SUPPORTED:
                 if (Application.application.isBooks)
diff --git a/src/main.js b/src/main.js
index 2aceb54e..9e790d35 100644
--- a/src/main.js
+++ b/src/main.js
@@ -31,7 +31,6 @@ pkg.require({ 'EvinceDocument': '3.0',
               'Gepub': '0.6',
               'Gio': '2.0',
               'GLib': '2.0',
-              'Goa': '1.0',
               'Gtk': '3.0',
               'GObject': '2.0',
               'Tracker': '2.0',
diff --git a/src/meson.build b/src/meson.build
index 0243f780..21f273de 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -55,7 +55,6 @@ resource_data = files(
   'mainToolbar.js',
   'mainWindow.js',
   'manager.js',
-  'miners.js',
   'notifications.js',
   'overview.js',
   'password.js',
@@ -67,7 +66,6 @@ resource_data = files(
   'searchbar.js',
   'search.js',
   'selections.js',
-  'sharing.js',
   'shellSearchProvider.js',
   'testentry.js',
   'trackerController.js',
@@ -141,13 +139,10 @@ libgdprivate = shared_library(
 )
 
 gir_incs = [
-  'GData-0.0',
   'GnomeDesktop-3.0',
-  'Goa-1.0',
   'Gtk-3.0',
   'EvinceDocument-3.0',
   'EvinceView-3.0',
-  'Zpj-0.0'
 ]
 
 gnome.generate_gir(
diff --git a/src/notifications.js b/src/notifications.js
index 6e542b09..4bee22d3 100644
--- a/src/notifications.js
+++ b/src/notifications.js
@@ -174,7 +174,6 @@ const IndexingNotification = new Lang.Class({
 
     _init: function() {
         this._closed = false;
-        this._timeoutId = 0;
 
         try {
             this._manager = TrackerControl.MinerManager.new_full(false);
@@ -208,50 +207,14 @@ const IndexingNotification = new Lang.Class({
             }
         }
 
-        if (Application.application.minersRunning.length > 0)
-            isIndexingRemote = true;
-
         if (isIndexingLocal) {
             this._display(_("Your documents are being indexed"),
                           _("Some documents might not be available during this process"));
-        } else if (isIndexingRemote) {
-            this._removeTimeout();
-            this._timeoutId = Mainloop.timeout_add_seconds(REMOTE_MINER_TIMEOUT, Lang.bind(this, 
this._onTimeoutExpired));
         } else {
             this._destroy(false);
         }
     },
 
-    _onTimeoutExpired: function() {
-        this._timeoutId = 0;
-
-        let primary = null;
-        let miner = null;
-
-        if (Application.application.minersRunning.length == 1) {
-            miner = Application.application.minersRunning[0];
-        }
-
-        if (miner && miner.DisplayName) {
-            // Translators: %s refers to an online account provider, e.g.
-            // "Google", or "Windows Live".
-            primary = _("Fetching documents from %s").format(miner.DisplayName);
-        } else {
-            primary = _("Fetching documents from online accounts");
-        }
-
-        this._display(primary, null);
-
-        return false;
-    },
-
-    _removeTimeout: function() {
-        if (this._timeoutId != 0) {
-            Mainloop.source_remove(this._timeoutId);
-            this._timeoutId = 0;
-        }
-    },
-
     _buildWidget: function() {
         this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL,
                                      column_spacing: 12 });
diff --git a/src/org.gnome.Books.src.gresource.xml b/src/org.gnome.Books.src.gresource.xml
index 7c929db8..e30969b3 100644
--- a/src/org.gnome.Books.src.gresource.xml
+++ b/src/org.gnome.Books.src.gresource.xml
@@ -14,7 +14,6 @@
     <file>mainToolbar.js</file>
     <file>mainWindow.js</file>
     <file>manager.js</file>
-    <file>miners.js</file>
     <file>notifications.js</file>
     <file>overview.js</file>
     <file>password.js</file>
@@ -27,7 +26,6 @@
     <file>searchbar.js</file>
     <file>search.js</file>
     <file>selections.js</file>
-    <file>sharing.js</file>
     <file>shellSearchProvider.js</file>
     <file>testentry.js</file>
     <file>trackerController.js</file>
diff --git a/src/search.js b/src/search.js
index f4b3c98f..c574bac3 100644
--- a/src/search.js
+++ b/src/search.js
@@ -318,7 +318,6 @@ const SearchMatchManager = new Lang.Class({
 
 var SearchSourceStock = {
     ALL: 'all',
-    LOCAL: 'local'
 };
 
 const TRACKER_SCHEMA = 'org.freedesktop.Tracker.Miner.Files';
@@ -332,28 +331,12 @@ const Source = new Lang.Class({
         this.name = null;
         this.icon = null;
 
-        if (params.object) {
-            this.object = params.object;
-            let account = params.object.get_account();
-
-            this.id = 'gd:goa-account:' + account.id;
-            this.name = account.provider_name;
-            this.icon = Gio.icon_new_for_string(account.provider_icon);
-        } else {
-            this.id = params.id;
-            this.name = params.name;
-        }
+        this.id = params.id;
+        this.name = params.name;
 
         this.builtin = params.builtin;
     },
 
-    _getGettingStartedLocations: function() {
-        if (Application.application.gettingStartedLocation)
-            return Application.application.gettingStartedLocation;
-        else
-            return [];
-    },
-
     _getTrackerLocations: function() {
         let settings = new Gio.Settings({ schema_id: TRACKER_SCHEMA });
         let locations = settings.get_strv(TRACKER_KEY_RECURSIVE_DIRECTORIES);
@@ -402,9 +385,7 @@ const Source = new Lang.Class({
 
     _buildFilterLocal: function() {
         let locations = this._getBuiltinLocations();
-        locations = locations.concat(
-            this._getTrackerLocations(),
-            this._getGettingStartedLocations());
+        locations = this._getTrackerLocations();
 
         let filters = [];
         locations.forEach(Lang.bind(this,
@@ -423,11 +404,8 @@ const Source = new Lang.Class({
     getFilter: function() {
         let filters = [];
 
-        if (this.id == SearchSourceStock.LOCAL) {
-            filters.push(this._buildFilterLocal());
-        } else if (this.id == SearchSourceStock.ALL) {
+        if (this.id == SearchSourceStock.ALL) {
             filters.push(this._buildFilterLocal());
-            filters.push(this._manager.getFilterNotLocal());
         } else {
             filters.push(this._buildFilterResource());
         }
@@ -458,65 +436,9 @@ const SourceManager = new Lang.Class({
                                   builtin: true });
         this.addItem(source);
 
-        source = new Source({ id: SearchSourceStock.LOCAL,
-        // Translators: this refers to local documents
-                              name: _("Local"),
-                              builtin: true });
-        this.addItem(source);
-
-        if (!Application.application.isBooks) {
-            Application.goaClient.connect('account-added', Lang.bind(this, this._refreshGoaAccounts));
-            Application.goaClient.connect('account-changed', Lang.bind(this, this._refreshGoaAccounts));
-            Application.goaClient.connect('account-removed', Lang.bind(this, this._refreshGoaAccounts));
-
-            this._refreshGoaAccounts();
-        }
-
         this.setActiveItemById(SearchSourceStock.ALL);
     },
 
-    _refreshGoaAccounts: function() {
-        let newItems = {};
-        let newSources = new Map();
-        let accounts = Application.goaClient.get_accounts();
-
-        accounts.forEach(Lang.bind(this,
-            function(object) {
-                if (!object.get_account())
-                    return;
-
-                if (!object.get_documents())
-                    return;
-
-                let source = new Source({ object: object });
-
-                let otherSources = newSources.get(source.name);
-                if (!otherSources)
-                    otherSources = [];
-
-                otherSources.push(source);
-                newSources.set(source.name, otherSources);
-                newItems[source.id] = source;
-            }));
-
-        // Ensure an unique name for GOA accounts from the same provider
-        newSources.forEach(function(sources, name) {
-            if (sources.length == 1)
-                return;
-
-            sources.forEach(function(source) {
-                let account = source.object.get_account();
-                // Translators: the first %s is an online account provider name,
-                // e.g. "Google". The second %s is the identity used to log in,
-                // e.g. "foo gmail com".
-                source.name = _("%s (%s)").format(account.provider_name,
-                                                  account.presentation_identity);
-            });
-        });
-
-        this.processNewItems(newItems);
-    },
-
     getFilter: function(flags) {
         let item;
 
@@ -534,53 +456,6 @@ const SourceManager = new Lang.Class({
 
         return filter;
     },
-
-    getFilterNotLocal: function() {
-        let sources = this.getItems();
-        let filters = [];
-
-        for (let idx in sources) {
-            let source = sources[idx];
-            if (!source.builtin)
-                filters.push(source.getFilter());
-        }
-
-        if (filters.length == 0)
-            filters.push('false');
-
-        return '(' + filters.join(' || ') + ')';
-    },
-
-    hasOnlineSources: function() {
-        let hasOnline = false;
-        this.forEachItem(
-            function(source) {
-                if (source.object)
-                    hasOnline = true;
-            });
-
-        return hasOnline;
-    },
-
-    hasProviderType: function(providerType) {
-        let items = this.getForProviderType(providerType);
-        return (items.length > 0);
-    },
-
-    getForProviderType: function(providerType) {
-        let items = [];
-        this.forEachItem(Lang.bind(this,
-            function(source) {
-                if (!source.object)
-                    return;
-
-                let account = source.object.get_account();
-                if (account.provider_type == providerType)
-                    items.push(source);
-            }));
-
-        return items;
-    }
 });
 
 var OFFSET_STEP = 50;
diff --git a/src/selections.js b/src/selections.js
index bf45d23b..47cc96e2 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -33,7 +33,6 @@ const Mainloop = imports.mainloop;
 const Notifications = imports.notifications;
 const Properties = imports.properties;
 const Query = imports.query;
-const Sharing = imports.sharing;
 const TrackerUtils = imports.trackerUtils;
 const WindowMode = imports.windowMode;
 



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