~ubuntu-branches/ubuntu/oneiric/libgdata/oneiric-backports

« back to all changes in this revision

Viewing changes to gdata/services/documents/gdata-documents-service.c

  • Committer: Package Import Robot
  • Author(s): Evan Broder
  • Date: 2011-11-15 21:59:48 UTC
  • mfrom: (4.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20111115215948-e17s889ocgu5fv4f
Tags: 0.10.1-1~oneiric1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
229
229
        return g_quark_from_static_string ("gdata-documents-service-error-quark");
230
230
}
231
231
 
232
 
static void gdata_documents_service_dispose (GObject *object);
233
 
static void gdata_documents_service_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
234
 
static void notify_authenticated_cb (GObject *service, GParamSpec *pspec, GObject *self);
235
 
static void notify_proxy_uri_cb (GObject *service, GParamSpec *pspec, GObject *self);
236
 
 
237
 
struct _GDataDocumentsServicePrivate {
238
 
        GDataService *spreadsheet_service;
239
 
};
240
 
 
241
 
enum {
242
 
        PROP_SPREADSHEET_SERVICE = 1
243
 
};
244
 
 
 
232
static GList *get_authorization_domains (void);
 
233
 
 
234
_GDATA_DEFINE_AUTHORIZATION_DOMAIN (documents, "writely", "https://docs.google.com/feeds/")
 
235
_GDATA_DEFINE_AUTHORIZATION_DOMAIN (spreadsheets, "wise", "https://spreadsheets.google.com/feeds/")
245
236
G_DEFINE_TYPE_WITH_CODE (GDataDocumentsService, gdata_documents_service, GDATA_TYPE_SERVICE, G_IMPLEMENT_INTERFACE (GDATA_TYPE_BATCHABLE, NULL))
246
237
 
247
238
static void
248
239
gdata_documents_service_class_init (GDataDocumentsServiceClass *klass)
249
240
{
250
 
        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
251
241
        GDataServiceClass *service_class = GDATA_SERVICE_CLASS (klass);
252
 
 
253
 
        g_type_class_add_private (klass, sizeof (GDataDocumentsServicePrivate));
254
 
 
255
 
        gobject_class->get_property = gdata_documents_service_get_property;
256
 
        gobject_class->dispose = gdata_documents_service_dispose;
257
 
 
258
 
        service_class->service_name = "writely";
259
242
        service_class->feed_type = GDATA_TYPE_DOCUMENTS_FEED;
260
 
 
261
 
        /**
262
 
         * GDataService:spreadsheet-service:
263
 
         *
264
 
         * Another service for spreadsheets, required to be able to handle downloads.
265
 
         *
266
 
         * For more details about the spreadsheet downloads handling, see the
267
 
         * <ulink type="http" url="http://groups.google.com/group/Google-Docs-Data-APIs/browse_thread/thread/bfc50e94e303a29a?pli=1">
268
 
         * online explanation about the problem</ulink>.
269
 
         *
270
 
         * Since: 0.4.0
271
 
         **/
272
 
        g_object_class_install_property (gobject_class, PROP_SPREADSHEET_SERVICE,
273
 
                                         g_param_spec_object ("spreadsheet-service",
274
 
                                                              "Spreadsheet service", "Another service for spreadsheets.",
275
 
                                                              GDATA_TYPE_SERVICE,
276
 
                                                              G_PARAM_READABLE));
 
243
        service_class->get_authorization_domains = get_authorization_domains;
277
244
}
278
245
 
279
246
static void
280
247
gdata_documents_service_init (GDataDocumentsService *self)
281
248
{
282
 
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_SERVICE, GDataDocumentsServicePrivate);
283
 
        g_signal_connect (self, "notify::authenticated", G_CALLBACK (notify_authenticated_cb), NULL);
284
 
        g_signal_connect (self, "notify::proxy-uri", G_CALLBACK (notify_proxy_uri_cb), NULL);
285
 
}
286
 
 
287
 
static void
288
 
gdata_documents_service_dispose (GObject *object)
289
 
{
290
 
        GDataDocumentsServicePrivate *priv = GDATA_DOCUMENTS_SERVICE (object)->priv;
291
 
 
292
 
        if (priv->spreadsheet_service != NULL)
293
 
                g_object_unref (priv->spreadsheet_service);
294
 
        priv->spreadsheet_service = NULL;
295
 
 
296
 
        G_OBJECT_CLASS (gdata_documents_service_parent_class)->dispose (object);
297
 
}
298
 
 
299
 
static void
300
 
gdata_documents_service_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
301
 
{
302
 
        GDataDocumentsServicePrivate *priv = GDATA_DOCUMENTS_SERVICE (object)->priv;
303
 
 
304
 
        switch (property_id) {
305
 
                case PROP_SPREADSHEET_SERVICE:
306
 
                        g_value_set_object (value, priv->spreadsheet_service);
307
 
                        break;
308
 
                default:
309
 
                        /* We don't have any other property... */
310
 
                        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
311
 
                        break;
312
 
        }
 
249
        /* Nothing to see here */
 
250
}
 
251
 
 
252
static GList *
 
253
get_authorization_domains (void)
 
254
{
 
255
        GList *authorization_domains = NULL;
 
256
 
 
257
        authorization_domains = g_list_prepend (authorization_domains, get_documents_authorization_domain ());
 
258
        authorization_domains = g_list_prepend (authorization_domains, get_spreadsheets_authorization_domain ());
 
259
 
 
260
        return authorization_domains;
313
261
}
314
262
 
315
263
/**
316
264
 * gdata_documents_service_new:
317
 
 * @client_id: your application's client ID
 
265
 * @authorizer: (allow-none): a #GDataAuthorizer to authorize the service's requests, or %NULL
318
266
 *
319
 
 * Creates a new #GDataDocumentsService. The @client_id must be unique for your application, and as registered with Google.
 
267
 * Creates a new #GDataDocumentsService using the given #GDataAuthorizer. If @authorizer is %NULL, all requests are made as an unauthenticated user.
320
268
 *
321
269
 * Return value: a new #GDataDocumentsService, or %NULL; unref with g_object_unref()
322
270
 *
323
 
 * Since: 0.4.0
324
 
 **/
 
271
 * Since: 0.9.0
 
272
 */
325
273
GDataDocumentsService *
326
 
gdata_documents_service_new (const gchar *client_id)
 
274
gdata_documents_service_new (GDataAuthorizer *authorizer)
327
275
{
328
 
        g_return_val_if_fail (client_id != NULL, NULL);
 
276
        g_return_val_if_fail (authorizer == NULL || GDATA_IS_AUTHORIZER (authorizer), NULL);
329
277
 
330
278
        return g_object_new (GDATA_TYPE_DOCUMENTS_SERVICE,
331
 
                             "client-id", client_id,
 
279
                             "authorizer", authorizer,
332
280
                             NULL);
333
281
}
334
282
 
335
283
/**
 
284
 * gdata_documents_service_get_primary_authorization_domain:
 
285
 *
 
286
 * The primary #GDataAuthorizationDomain for interacting with Google Documents. This will not normally need to be used, as it's used internally
 
287
 * by the #GDataDocumentsService methods. However, if using the plain #GDataService methods to implement custom queries or requests which libgdata
 
288
 * does not support natively, then this domain may be needed to authorize the requests.
 
289
 *
 
290
 * The domain never changes, and is interned so that pointer comparison can be used to differentiate it from other authorization domains.
 
291
 *
 
292
 * Return value: (transfer none): the service's authorization domain
 
293
 *
 
294
 * Since: 0.9.0
 
295
 */
 
296
GDataAuthorizationDomain *
 
297
gdata_documents_service_get_primary_authorization_domain (void)
 
298
{
 
299
        return get_documents_authorization_domain ();
 
300
}
 
301
 
 
302
/**
 
303
 * gdata_documents_service_get_spreadsheet_authorization_domain:
 
304
 *
 
305
 * The #GDataAuthorizationDomain for interacting with spreadsheet data. This will not normally need to be used, as it's automatically used internally
 
306
 * by the #GDataDocumentsService methods. However, if using the plain #GDataService methods to implement custom queries or requests which libgdata
 
307
 * does not support natively, then this domain may be needed to authorize the requests which pertain to the Google Spreadsheets Data API, such as
 
308
 * requests to download or upload spreadsheet documents.
 
309
 *
 
310
 * The domain never changes, and is interned so that pointer comparison can be used to differentiate it from other authorization domains.
 
311
 *
 
312
 * Return value: (transfer none): the service's authorization domain
 
313
 *
 
314
 * Since: 0.9.0
 
315
 */
 
316
GDataAuthorizationDomain *
 
317
gdata_documents_service_get_spreadsheet_authorization_domain (void)
 
318
{
 
319
        return get_spreadsheets_authorization_domain ();
 
320
}
 
321
 
 
322
/**
336
323
 * gdata_documents_service_query_documents:
337
324
 * @self: a #GDataDocumentsService
338
325
 * @query: (allow-none): a #GDataDocumentsQuery with the query parameters, or %NULL
339
 
 * @cancellable: optional #GCancellable object, or %NULL
340
 
 * @progress_callback: (scope call): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL
 
326
 * @cancellable: (allow-none): optional #GCancellable object, or %NULL
 
327
 * @progress_callback: (allow-none) (scope call) (closure progress_user_data): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL
341
328
 * @progress_user_data: (closure): data to pass to the @progress_callback function
342
329
 * @error: a #GError, or %NULL
343
330
 *
364
351
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
365
352
 
366
353
        /* Ensure we're authenticated first */
367
 
        if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 
354
        if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)),
 
355
                                                       get_documents_authorization_domain ()) == FALSE) {
368
356
                g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
369
357
                                     _("You must be authenticated to query documents."));
370
358
                return NULL;
376
364
        else
377
365
                request_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
378
366
 
379
 
        feed = gdata_service_query (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query), GDATA_TYPE_DOCUMENTS_ENTRY, cancellable,
380
 
                                    progress_callback, progress_user_data, error);
 
367
        feed = gdata_service_query (GDATA_SERVICE (self), get_documents_authorization_domain (), request_uri, GDATA_QUERY (query),
 
368
                                    GDATA_TYPE_DOCUMENTS_ENTRY, cancellable, progress_callback, progress_user_data, error);
381
369
        g_free (request_uri);
382
370
 
383
371
        return GDATA_DOCUMENTS_FEED (feed);
384
372
}
385
373
 
386
374
/**
387
 
 * gdata_documents_service_query_documents_async: (skip)
 
375
 * gdata_documents_service_query_documents_async:
388
376
 * @self: a #GDataDocumentsService
389
377
 * @query: (allow-none): a #GDataDocumentsQuery with the query parameters, or %NULL
390
 
 * @cancellable: optional #GCancellable object, or %NULL
391
 
 * @progress_callback: a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL
392
 
 * @progress_user_data: data to pass to the @progress_callback function
 
378
 * @cancellable: (allow-none): optional #GCancellable object, or %NULL
 
379
 * @progress_callback: (allow-none) (closure progress_user_data): a #GDataQueryProgressCallback to call when an entry is loaded, or %NULL
 
380
 * @progress_user_data: (closure): data to pass to the @progress_callback function
 
381
 * @destroy_progress_user_data: (allow-none): the function to call when @progress_callback will not be called any more, or %NULL. This function will be
 
382
 * called with @progress_user_data as a parameter and can be used to free any memory allocated for it.
393
383
 * @callback: a #GAsyncReadyCallback to call when authentication is finished
394
384
 * @user_data: (closure): data to pass to the @callback function
395
385
 *
399
389
 * For more details, see gdata_documents_service_query_documents(), which is the synchronous version of this function,
400
390
 * and gdata_service_query_async(), which is the base asynchronous query function.
401
391
 *
402
 
 * Since: 0.4.0
 
392
 * Since: 0.9.1
403
393
 **/
404
394
void
405
395
gdata_documents_service_query_documents_async (GDataDocumentsService *self, GDataDocumentsQuery *query, GCancellable *cancellable,
406
396
                                               GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 
397
                                               GDestroyNotify destroy_progress_user_data,
407
398
                                               GAsyncReadyCallback callback, gpointer user_data)
408
399
{
409
400
        gchar *request_uri;
414
405
        g_return_if_fail (callback != NULL);
415
406
 
416
407
        /* Ensure we're authenticated first */
417
 
        if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
418
 
                g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data,
419
 
                                                     GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
420
 
                                                     _("You must be authenticated to query documents."));
 
408
        if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)),
 
409
                                                       get_documents_authorization_domain ()) == FALSE) {
 
410
                GSimpleAsyncResult *result = g_simple_async_result_new (G_OBJECT (self), callback, user_data, gdata_service_query_async);
 
411
                g_simple_async_result_set_error (result, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED, "%s",
 
412
                                                 _("You must be authenticated to query documents."));
 
413
                g_simple_async_result_complete_in_idle (result);
 
414
                g_object_unref (result);
 
415
 
421
416
                return;
422
417
        }
423
418
 
424
419
        request_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
425
 
        gdata_service_query_async (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query), GDATA_TYPE_DOCUMENTS_ENTRY,
426
 
                                   cancellable, progress_callback, progress_user_data, callback, user_data);
 
420
        gdata_service_query_async (GDATA_SERVICE (self), get_documents_authorization_domain (), request_uri, GDATA_QUERY (query),
 
421
                                   GDATA_TYPE_DOCUMENTS_ENTRY, cancellable, progress_callback, progress_user_data,
 
422
                                   destroy_progress_user_data, callback, user_data);
427
423
        g_free (request_uri);
428
424
}
429
425
 
430
 
/*
431
 
 * To upload spreadsheet documents, another token is needed since the service for it is "wise" as apposed to "writely" for other operations.
432
 
 * This callback aims to authenticate to this service as a private property (@priv->spreadsheet_service) of #GDataDocumentsService.
433
 
 */
434
 
static void
435
 
notify_authenticated_cb (GObject *service, GParamSpec *pspec, GObject *self)
436
 
{
437
 
        GDataService *spreadsheet_service;
438
 
        GDataDocumentsServicePrivate *priv = GDATA_DOCUMENTS_SERVICE (service)->priv;
439
 
 
440
 
        if (priv->spreadsheet_service != NULL)
441
 
                g_object_unref (priv->spreadsheet_service);
442
 
 
443
 
        spreadsheet_service = g_object_new (GDATA_TYPE_SERVICE, "client-id", gdata_service_get_client_id (GDATA_SERVICE (service)), NULL);
444
 
        GDATA_SERVICE_GET_CLASS (spreadsheet_service)->service_name = "wise";
445
 
        gdata_service_authenticate (spreadsheet_service, gdata_service_get_username (GDATA_SERVICE (service)),
446
 
                                    gdata_service_get_password (GDATA_SERVICE (service)), NULL, NULL);
447
 
        priv->spreadsheet_service = spreadsheet_service;
448
 
}
449
 
 
450
 
/* Sets the proxy on @spreadsheet_service when it is set on the service */
451
 
static void
452
 
notify_proxy_uri_cb (GObject *service, GParamSpec *pspec, GObject *self)
453
 
{
454
 
        SoupURI *proxy_uri;
455
 
 
456
 
        if (GDATA_DOCUMENTS_SERVICE (self)->priv->spreadsheet_service == NULL)
457
 
                return;
458
 
 
459
 
        proxy_uri = gdata_service_get_proxy_uri (GDATA_SERVICE (service));
460
 
        gdata_service_set_proxy_uri (GDATA_DOCUMENTS_SERVICE (self)->priv->spreadsheet_service, proxy_uri);
461
 
}
462
 
 
463
426
static GDataUploadStream *
464
427
upload_update_document (GDataDocumentsService *self, GDataDocumentsDocument *document, const gchar *slug, const gchar *content_type,
465
428
                        const gchar *method, const gchar *upload_uri, GCancellable *cancellable)
473
436
                content_type = "application/x-vnd.oasis.opendocument.spreadsheet";
474
437
 
475
438
        /* We need streaming file I/O: GDataUploadStream */
476
 
        return GDATA_UPLOAD_STREAM (gdata_upload_stream_new (GDATA_SERVICE (self), method, upload_uri, GDATA_ENTRY (document), slug, content_type,
477
 
                                                             cancellable));
 
439
        return GDATA_UPLOAD_STREAM (gdata_upload_stream_new (GDATA_SERVICE (self), get_documents_authorization_domain (), method, upload_uri,
 
440
                                                             GDATA_ENTRY (document), slug, content_type, cancellable));
478
441
}
479
442
 
480
443
/**
522
485
        g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
523
486
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
524
487
 
525
 
        if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 
488
        if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)),
 
489
                                                       get_documents_authorization_domain ()) == FALSE) {
526
490
                g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
527
491
                                     _("You must be authenticated to upload documents."));
528
492
                return NULL;
582
546
        g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
583
547
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
584
548
 
585
 
        if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 
549
        if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)),
 
550
                                                       get_documents_authorization_domain ()) == FALSE) {
586
551
                g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
587
552
                                     _("You must be authenticated to update documents."));
588
553
                return NULL;
664
629
 * @self: an authenticated #GDataDocumentsService
665
630
 * @entry: the #GDataDocumentsEntry to move
666
631
 * @folder: the #GDataDocumentsFolder to move @entry into
667
 
 * @cancellable: optional #GCancellable object, or %NULL
 
632
 * @cancellable: (allow-none): optional #GCancellable object, or %NULL
668
633
 * @error: a #GError, or %NULL
669
634
 *
670
635
 * Add the given @entry to the specified @folder, and return an updated #GDataDocumentsEntry for @entry. If the @entry is already in another folder, it
693
658
        g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
694
659
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
695
660
 
696
 
        if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 
661
        if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)),
 
662
                                                       get_documents_authorization_domain ()) == FALSE) {
697
663
                g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
698
664
                                     _("You must be authenticated to move documents and folders."));
699
665
                return NULL;
703
669
        folder_id = gdata_documents_entry_get_document_id (GDATA_DOCUMENTS_ENTRY (folder));
704
670
        g_assert (folder_id != NULL);
705
671
        uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/folders/private/full/folder%3A", folder_id, NULL);
706
 
        message = _gdata_service_build_message (GDATA_SERVICE (self), SOUP_METHOD_POST, uri, NULL, TRUE);
 
672
        message = _gdata_service_build_message (GDATA_SERVICE (self), get_documents_authorization_domain (), SOUP_METHOD_POST, uri, NULL, TRUE);
707
673
        g_free (uri);
708
674
 
709
675
        /* Append the data */
775
741
 * @self: a #GDataDocumentsService
776
742
 * @entry: the #GDataDocumentsEntry to add to @folder
777
743
 * @folder: the #GDataDocumentsFolder to add @entry to
778
 
 * @cancellable: optional #GCancellable object, or %NULL
 
744
 * @cancellable: (allow-none): optional #GCancellable object, or %NULL
779
745
 * @callback: a #GAsyncReadyCallback to call when the operation is finished, or %NULL
780
746
 * @user_data: (closure): data to pass to the @callback function
781
747
 *
850
816
 * @self: a #GDataDocumentsService
851
817
 * @entry: the #GDataDocumentsEntry to remove
852
818
 * @folder: the #GDataDocumentsFolder from which we should remove @entry
853
 
 * @cancellable: optional #GCancellable object, or %NULL
 
819
 * @cancellable: (allow-none): optional #GCancellable object, or %NULL
854
820
 * @error: a #GError, or %NULL
855
821
 *
856
822
 * Remove the given @entry from @folder, and return an updated #GDataDocumentsEntry for @entry. @entry will remain a member of any other folders it's
877
843
        g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
878
844
        g_return_val_if_fail (error == NULL || *error == NULL, NULL);
879
845
 
880
 
        if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 
846
        if (gdata_authorizer_is_authorized_for_domain (gdata_service_get_authorizer (GDATA_SERVICE (self)),
 
847
                                                       get_documents_authorization_domain ()) == FALSE) {
881
848
                g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
882
849
                                     _("You must be authenticated to move documents and folders."));
883
850
                return NULL;
890
857
        g_assert (entry_id != NULL);
891
858
 
892
859
        if (GDATA_IS_DOCUMENTS_PRESENTATION (entry)) {
893
 
                uri = _gdata_service_build_uri (FALSE, "http://docs.google.com/feeds/folders/private/full/folder%%3A%s/presentation%%3A%s",
 
860
                uri = _gdata_service_build_uri ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/presentation%%3A%s",
894
861
                                                folder_id, entry_id);
895
862
        } else if (GDATA_IS_DOCUMENTS_SPREADSHEET (entry)) {
896
 
                uri = _gdata_service_build_uri (FALSE, "http://docs.google.com/feeds/folders/private/full/folder%%3A%s/spreadsheet%%3A%s",
 
863
                uri = _gdata_service_build_uri ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/spreadsheet%%3A%s",
897
864
                                                folder_id, entry_id);
898
865
        } else if (GDATA_IS_DOCUMENTS_TEXT (entry)) {
899
 
                uri = _gdata_service_build_uri (FALSE, "http://docs.google.com/feeds/folders/private/full/folder%%3A%s/document%%3A%s",
 
866
                uri = _gdata_service_build_uri ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/document%%3A%s",
900
867
                                                folder_id, entry_id);
901
868
        } else if (GDATA_IS_DOCUMENTS_FOLDER (entry)) {
902
 
                uri = _gdata_service_build_uri (FALSE, "http://docs.google.com/feeds/folders/private/full/folder%%3A%s/folder%%3A%s",
 
869
                uri = _gdata_service_build_uri ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/folder%%3A%s",
903
870
                                                folder_id, entry_id);
904
871
        } else {
905
872
                g_assert_not_reached ();
906
873
        }
907
874
 
908
 
        message = _gdata_service_build_message (GDATA_SERVICE (self), SOUP_METHOD_DELETE, uri, gdata_entry_get_etag (GDATA_ENTRY (entry)), TRUE);
 
875
        message = _gdata_service_build_message (GDATA_SERVICE (self), get_documents_authorization_domain (), SOUP_METHOD_DELETE, uri,
 
876
                                                gdata_entry_get_etag (GDATA_ENTRY (entry)), TRUE);
909
877
        g_free (uri);
910
878
 
911
879
        /* Send the message */
929
897
 
930
898
        /* Google's servers don't return an updated copy of the entry, so we have to query for it again.
931
899
         * See: http://code.google.com/p/gdata-issues/issues/detail?id=1380 */
932
 
        return GDATA_DOCUMENTS_ENTRY (gdata_service_query_single_entry (GDATA_SERVICE (self), gdata_entry_get_id (GDATA_ENTRY (entry)), NULL,
 
900
        return GDATA_DOCUMENTS_ENTRY (gdata_service_query_single_entry (GDATA_SERVICE (self), get_documents_authorization_domain (),
 
901
                                                                        gdata_entry_get_id (GDATA_ENTRY (entry)), NULL,
933
902
                                                                        G_OBJECT_TYPE (entry), cancellable, error));
934
903
}
935
904
 
972
941
 * @self: a #GDataDocumentsService
973
942
 * @entry: the #GDataDocumentsEntry to remove from @folder
974
943
 * @folder: the #GDataDocumentsFolder to remove @entry from
975
 
 * @cancellable: optional #GCancellable object, or %NULL
 
944
 * @cancellable: (allow-none): optional #GCancellable object, or %NULL
976
945
 * @callback: a #GAsyncReadyCallback to call when the operation is finished, or %NULL
977
946
 * @user_data: (closure): data to pass to the @callback function
978
947
 *
1070
1039
        /* Otherwise return the default upload URI */
1071
1040
        return g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
1072
1041
}
1073
 
 
1074
 
GDataService *
1075
 
_gdata_documents_service_get_spreadsheet_service (GDataDocumentsService *self)
1076
 
{
1077
 
        g_return_val_if_fail (GDATA_IS_DOCUMENTS_SERVICE (self), NULL);
1078
 
        return self->priv->spreadsheet_service;
1079
 
}