[gnome-documents/gnome-3-16] sharing: Adapt to changes in nao:identifier syntax for Google items



commit 55fb3aab3b471e1e0009239bc7575671f2a35ee2
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jun 3 18:12:04 2015 +0200

    sharing: Adapt to changes in nao:identifier syntax for Google items
    
    Let's mark the createGDataEntry method as public. Sharing the code has
    obvious benefits as illustrated by this commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748300

 src/documents.js |    6 +++---
 src/sharing.js   |   26 ++++++++++----------------
 2 files changed, 13 insertions(+), 19 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 73bbee2..2c95d34 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -783,7 +783,7 @@ const GoogleDocument = new Lang.Class({
         this.sourceName = _("Google");
     },
 
-    _createGDataEntry: function(cancellable, callback) {
+    createGDataEntry: function(cancellable, callback) {
         let source = Application.sourceManager.getItemById(this.resourceUrn);
 
         let authorizer = new GData.GoaAuthorizer({ goa_object: source.object });
@@ -810,7 +810,7 @@ const GoogleDocument = new Lang.Class({
     },
 
     load: function(passwd, cancellable, callback) {
-        this._createGDataEntry(cancellable, Lang.bind(this,
+        this.createGDataEntry(cancellable, Lang.bind(this,
             function(entry, service, exception) {
                 if (exception) {
                     // try loading from the most recent cache, if any
@@ -842,7 +842,7 @@ const GoogleDocument = new Lang.Class({
     },
 
     createThumbnail: function(callback) {
-        this._createGDataEntry(null, Lang.bind(this,
+        this.createGDataEntry(null, Lang.bind(this,
             function(entry, service, exception) {
                 if (exception) {
                     callback(false);
diff --git a/src/sharing.js b/src/sharing.js
index ba6c90d..b4e57bf 100644
--- a/src/sharing.js
+++ b/src/sharing.js
@@ -81,7 +81,16 @@ const SharingDialog = new Lang.Class({
 
         this._entry = null;
         this._feed = null;
-        this._createGDataEntry();
+
+        this._doc.createGDataEntry(null, Lang.bind(this,
+            function(entry, service, exception) {
+                if (exception) {
+                    log("Error getting GData Entry " + exception.message);
+                    return;
+                }
+                this._entry = entry;
+                this._refreshEntryACL();
+            }));
 
         this._docShare = DocumentShareState.UNKNOWN;
         this._pubEdit = false;
@@ -326,21 +335,6 @@ const SharingDialog = new Lang.Class({
         }
     },
 
-    // Get the id of the selected doc from the sourceManager, give auth info to Google, and start the service
-    _createGDataEntry: function() {
-        // Query the service for the entry related to the doc
-        this._service.query_single_entry_async(GData.DocumentsService.get_primary_authorization_domain(),
-            this._doc.identifier, null, GData.DocumentsText, null, Lang.bind(this,
-                function(object, res) {
-                    try {
-                        this._entry = object.query_single_entry_finish(res);
-                        this._refreshEntryACL();
-                    } catch (e) {
-                        log("Error getting GData Entry " + e.message);
-                    }
-                }));
-    },
-
     // Return a feed containing the acl related to the entry
     _refreshEntryACL: function() {
         this._entry.get_rules_async(this._service, null, null, Lang.bind(this,


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