/usr/share/gtk-doc/html/gdata/GDataDocumentsDocument.html is in libgdata-doc 0.17.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GDataDocumentsDocument: GData Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GData Reference Manual">
<link rel="up" href="ch16.html" title="Google Documents API">
<link rel="prev" href="GDataDocumentsEntry.html" title="GDataDocumentsEntry">
<link rel="next" href="GDataDocumentsFolder.html" title="GDataDocumentsFolder">
<meta name="generator" content="GTK-Doc V1.24.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#GDataDocumentsDocument.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
<a href="#GDataDocumentsDocument.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces"> <span class="dim">|</span>
<a href="#GDataDocumentsDocument.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch16.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GDataDocumentsEntry.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GDataDocumentsFolder.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GDataDocumentsDocument"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GDataDocumentsDocument.top_of_page"></a>GDataDocumentsDocument</span></h2>
<p>GDataDocumentsDocument — GData documents document object</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GDataDocumentsDocument.stability-level"></a><h2>Stability Level</h2>
<acronym title="The intention of a Stable interface is to enable arbitrary third parties to
develop applications to these interfaces, release them, and have confidence that
they will run on all minor releases of the product (after the one in which the
interface was introduced, and within the same major release). Even at a major
release, incompatible changes are expected to be rare, and to have strong
justifications.
"><span class="acronym">Stable</span></acronym>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="returnvalue">GDataDocumentsDocument</span></a> *
</td>
<td class="function_name">
<a class="link" href="GDataDocumentsDocument.html#gdata-documents-document-new" title="gdata_documents_document_new ()">gdata_documents_document_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="returnvalue">GDataDownloadStream</span></a> *
</td>
<td class="function_name">
<a class="link" href="GDataDocumentsDocument.html#gdata-documents-document-download" title="gdata_documents_document_download ()">gdata_documents_document_download</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="GDataDocumentsDocument.html#gdata-documents-document-get-download-uri" title="gdata_documents_document_get_download_uri ()">gdata_documents_document_get_download_uri</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="GDataDocumentsDocument.html#gdata-documents-document-get-thumbnail-uri" title="gdata_documents_document_get_thumbnail_uri ()">gdata_documents_document_get_thumbnail_uri</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GDataDocumentsDocument.html#GDataDocumentsDocument-struct" title="GDataDocumentsDocument">GDataDocumentsDocument</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GDataDocumentsDocument.html#GDataDocumentsDocumentClass" title="GDataDocumentsDocumentClass">GDataDocumentsDocumentClass</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
<span class="lineart">╰──</span> <a class="link" href="GDataParsable.html" title="GDataParsable">GDataParsable</a>
<span class="lineart">╰──</span> <a class="link" href="GDataEntry.html" title="GDataEntry">GDataEntry</a>
<span class="lineart">╰──</span> <a class="link" href="GDataDocumentsEntry.html" title="GDataDocumentsEntry">GDataDocumentsEntry</a>
<span class="lineart">╰──</span> GDataDocumentsDocument
<span class="lineart">├──</span> <a class="link" href="GDataDocumentsDrawing.html" title="GDataDocumentsDrawing">GDataDocumentsDrawing</a>
<span class="lineart">├──</span> <a class="link" href="GDataDocumentsPdf.html" title="GDataDocumentsPdf">GDataDocumentsPdf</a>
<span class="lineart">├──</span> <a class="link" href="GDataDocumentsPresentation.html" title="GDataDocumentsPresentation">GDataDocumentsPresentation</a>
<span class="lineart">├──</span> <a class="link" href="GDataDocumentsSpreadsheet.html" title="GDataDocumentsSpreadsheet">GDataDocumentsSpreadsheet</a>
<span class="lineart">╰──</span> <a class="link" href="GDataDocumentsText.html" title="GDataDocumentsText">GDataDocumentsText</a>
</pre>
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GDataDocumentsDocument implements
<a class="link" href="GDataAccessHandler.html" title="GDataAccessHandler">GDataAccessHandler</a>.</p>
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include <gdata/services/documents/gdata-documents-document.h>
</pre>
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.description"></a><h2>Description</h2>
<p><a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> is a subclass of <a class="link" href="GDataDocumentsEntry.html" title="GDataDocumentsEntry"><span class="type">GDataDocumentsEntry</span></a> to represent an arbitrary Google Documents document (i.e. an arbitrary file which
isn't a Google Documents presentation, text document, PDF, drawing or spreadsheet). It is subclassed by <a class="link" href="GDataDocumentsPresentation.html" title="GDataDocumentsPresentation"><span class="type">GDataDocumentsPresentation</span></a>, <a class="link" href="GDataDocumentsText.html" title="GDataDocumentsText"><span class="type">GDataDocumentsText</span></a>,
<a class="link" href="GDataDocumentsPdf.html" title="GDataDocumentsPdf"><span class="type">GDataDocumentsPdf</span></a>, <a class="link" href="GDataDocumentsDrawing.html" title="GDataDocumentsDrawing"><span class="type">GDataDocumentsDrawing</span></a> and <a class="link" href="GDataDocumentsSpreadsheet.html" title="GDataDocumentsSpreadsheet"><span class="type">GDataDocumentsSpreadsheet</span></a>, which represent those specific types of Google Document, respectively.</p>
<p><a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> used to be abstract, but was made instantiable in version 0.13.0 to allow for arbitrary file uploads. This can be achieved
by setting <a class="link" href="GDataDocumentsUploadQuery.html#GDataDocumentsUploadQuery--convert" title="The “convert” property"><span class="type">“convert”</span></a> to <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> when making an upload using <a class="link" href="GDataDocumentsService.html#gdata-documents-service-upload-document-resumable" title="gdata_documents_service_upload_document_resumable ()"><code class="function">gdata_documents_service_upload_document_resumable()</code></a>. See the
documentation for <a class="link" href="GDataDocumentsUploadQuery.html" title="GDataDocumentsUploadQuery"><span class="type">GDataDocumentsUploadQuery</span></a> for an example.</p>
<p>It should be noted that <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> should only be used to represent arbitrary files; its subclasses should be used any time a standard
Google Document (spreadsheet, text document, presentation, etc.) is to be represented.</p>
<p>For more details of Google Documents' GData API, see the</p>
<a class="ulink" href="https://developers.google.com/google-apps/documents-list/" target="_top">online documentation</a>.
<div class="example">
<a name="id-1.5.5.7.9.7"></a><p class="title"><b>Example 33. Downloading a Document</b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">GDataDocumentsService</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">service</span><span class="symbol">;</span>
<span class="usertype">GDataDocumentsDocument</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">document</span><span class="symbol">;</span>
<span class="usertype">GFile</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">destination_file</span><span class="symbol">;</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">download_format</span><span class="symbol">;</span>
<span class="usertype">GDataDownloadStream</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">download_stream</span><span class="symbol">;</span>
<span class="usertype">GFileOutputStream</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">output_stream</span><span class="symbol">;</span>
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="comment">/* Create a service and retrieve the document to download and the file and format to save the download in */</span>
<span class="normal">service </span><span class="symbol">=</span><span class="normal"> </span><span class="function">create_youtube_service</span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">document </span><span class="symbol">=</span><span class="normal"> </span><span class="function">get_document_to_download</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="normal">destination_file </span><span class="symbol">=</span><span class="normal"> </span><span class="function">query_user_for_destination_file</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="normal">download_format </span><span class="symbol">=</span><span class="normal"> </span><span class="function">query_user_for_download_format</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="comment">/* Create the download stream */</span>
<span class="normal">download_stream </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDataDocumentsDocument.html#gdata-documents-document-download">gdata_documents_document_download</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">,</span><span class="normal"> service</span><span class="symbol">,</span><span class="normal"> download_format</span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error creating download stream: %s"</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">destination_file</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="cbracket">}</span>
<span class="comment">/* Create the file output stream */</span>
<span class="normal">output_stream </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gio/unstable/GFile.html#g-file-replace">g_file_replace</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">destination_file</span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#FALSE:CAPS">FALSE</a></span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/gio/unstable/GFile.html#G-FILE-CREATE-REPLACE-DESTINATION:CAPS">G_FILE_CREATE_REPLACE_DESTINATION</a></span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">destination_file</span><span class="symbol">);</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error creating destination file: %s"</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">download_stream</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="cbracket">}</span>
<span class="comment">/* Download the document. This should almost always be done asynchronously. */</span>
<span class="function"><a href="https://developer.gnome.org/gio/unstable/GOutputStream.html#g-output-stream-splice">g_output_stream_splice</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_OUTPUT_STREAM</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">output_stream</span><span class="symbol">),</span><span class="normal"> </span><span class="function">G_INPUT_STREAM</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">download_stream</span><span class="symbol">),</span>
<span class="normal"> <a href="https://developer.gnome.org/gio/unstable/GOutputStream.html#G-OUTPUT-STREAM-SPLICE-CLOSE-SOURCE:CAPS">G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE</a> </span><span class="symbol">|</span><span class="normal"> <a href="https://developer.gnome.org/gio/unstable/GOutputStream.html#G-OUTPUT-STREAM-SPLICE-CLOSE-TARGET:CAPS">G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET</a></span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">output_stream</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">download_stream</span><span class="symbol">);</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error downloading document: %s"</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="cbracket">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="example-break"><p>Each document accessible through the service has an access control list (ACL) which defines the level of access to the document to each user, and
which users the document is shared with. For more information about ACLs for documents, see the <a class="ulink" href="https://developers.google.com/google-apps/documents-list/#managing_sharing_permissions_of_resources_via_access_control_lists_acls" target="_top">online
documentation on sharing documents</a>.</p>
<div class="example">
<a name="id-1.5.5.7.9.9"></a><p class="title"><b>Example 34. Retrieving the Access Control List for a Document</b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">GDataDocumentsService</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">service</span><span class="symbol">;</span>
<span class="usertype">GDataDocumentsDocument</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">document</span><span class="symbol">;</span>
<span class="usertype">GDataFeed</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">acl_feed</span><span class="symbol">;</span>
<span class="usertype">GDataAccessRule</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">rule</span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">new_rule</span><span class="symbol">;</span>
<span class="usertype">GDataLink</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">acl_link</span><span class="symbol">;</span>
<span class="usertype">GList</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">i</span><span class="symbol">;</span>
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="comment">/* Create a service and retrieve a document to work on */</span>
<span class="normal">service </span><span class="symbol">=</span><span class="normal"> </span><span class="function">create_documents_service</span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">document </span><span class="symbol">=</span><span class="normal"> </span><span class="function">get_document</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="comment">/* Query the service for the ACL for the given document */</span>
<span class="normal">acl_feed </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDataAccessHandler.html#gdata-access-handler-get-rules">gdata_access_handler_get_rules</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDATA_ACCESS_HANDLER</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">),</span><span class="normal"> </span><span class="function">GDATA_SERVICE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">),</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error getting ACL feed for document: %s"</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="cbracket">}</span>
<span class="comment">/* Iterate through the ACL */</span>
<span class="keyword">for</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDataFeed.html#gdata-feed-get-entries">gdata_feed_get_entries</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">acl_feed</span><span class="symbol">);</span><span class="normal"> i </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span><span class="normal"> i </span><span class="symbol">=</span><span class="normal"> i</span><span class="symbol">-></span><span class="normal">next</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">scope_value</span><span class="symbol">;</span>
<span class="normal"> rule </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GDATA_ACCESS_RULE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">i</span><span class="symbol">-></span><span class="normal">data</span><span class="symbol">);</span>
<span class="normal"> </span><span class="comment">/* Do something with the access rule here. As an example, we update the rule applying to </span><span class="url"><a href="test@gmail.com">test@gmail.com</a></span><span class="comment"> and delete all</span>
<span class="comment"> * the other rules. We then insert another rule for </span><span class="url"><a href="example@gmail.com">example@gmail.com</a></span><span class="comment"> below. */</span>
<span class="normal"> </span><span class="function"><a href="GDataAccessRule.html#gdata-access-rule-get-scope">gdata_access_rule_get_scope</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">,</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">scope_value</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scope_value </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a> </span><span class="symbol">&&</span><span class="normal"> </span><span class="function">strcmp</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">scope_value</span><span class="symbol">,</span><span class="normal"> </span><span class="string">"test@gmail.com"</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">0</span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="usertype">GDataAccessRule</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">updated_rule</span><span class="symbol">;</span>
<span class="normal"> </span><span class="comment">/* Update the rule to make </span><span class="url"><a href="test@gmail.com">test@gmail.com</a></span><span class="comment"> a writer (full read/write access to the document, but they can't change</span>
<span class="comment"> * the ACL or delete the document). */</span>
<span class="normal"> </span><span class="function"><a href="GDataAccessRule.html#gdata-access-rule-set-role">gdata_access_rule_set_role</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">,</span><span class="normal"> <a href="GDataDocumentsEntry.html#GDATA-DOCUMENTS-ACCESS-ROLE-WRITER:CAPS">GDATA_DOCUMENTS_ACCESS_ROLE_WRITER</a></span><span class="symbol">);</span>
<span class="normal"> updated_rule </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GDATA_ACCESS_RULE</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GDataService.html#gdata-service-update-entry">gdata_service_update_entry</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDATA_SERVICE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">),</span><span class="normal"> </span><span class="function">GDATA_ENTRY</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">),</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">));</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error updating access rule for %s: %s"</span><span class="symbol">,</span><span class="normal"> scope_value</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">acl_feed</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">updated_rule</span><span class="symbol">);</span>
<span class="normal"> </span><span class="cbracket">}</span><span class="normal"> </span><span class="keyword">else</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="comment">/* Delete any rule which doesn't apply to </span><span class="url"><a href="test@gmail.com">test@gmail.com</a></span><span class="comment"> */</span>
<span class="normal"> </span><span class="function"><a href="GDataService.html#gdata-service-delete-entry">gdata_service_delete_entry</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDATA_SERVICE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">),</span><span class="normal"> </span><span class="function">GDATA_ENTRY</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">),</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error deleting access rule for %s: %s"</span><span class="symbol">,</span><span class="normal"> scope_value</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">acl_feed</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="normal"> </span><span class="cbracket">}</span>
<span class="cbracket">}</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">acl_feed</span><span class="symbol">);</span>
<span class="comment">/* Create and insert a new access rule for </span><span class="url"><a href="example@gmail.com">example@gmail.com</a></span><span class="comment"> which allows them read-only access to the document. */</span>
<span class="normal">rule </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDataAccessRule.html#gdata-access-rule-new">gdata_access_rule_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">);</span>
<span class="function"><a href="GDataAccessRule.html#gdata-access-rule-set-role">gdata_access_rule_set_role</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">,</span><span class="normal"> <a href="GDataDocumentsEntry.html#GDATA-DOCUMENTS-ACCESS-ROLE-READER:CAPS">GDATA_DOCUMENTS_ACCESS_ROLE_READER</a></span><span class="symbol">);</span>
<span class="function"><a href="GDataAccessRule.html#gdata-access-rule-set-scope">gdata_access_rule_set_scope</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">,</span><span class="normal"> <a href="GDataAccessRule.html#GDATA-ACCESS-SCOPE-USER:CAPS">GDATA_ACCESS_SCOPE_USER</a></span><span class="symbol">,</span><span class="normal"> </span><span class="string">"example@gmail.com"</span><span class="symbol">);</span>
<span class="normal">acl_link </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDataEntry.html#gdata-entry-look-up-link">gdata_entry_look_up_link</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDATA_ENTRY</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">),</span><span class="normal"> <a href="GDataAccessHandler.html#GDATA-LINK-ACCESS-CONTROL-LIST:CAPS">GDATA_LINK_ACCESS_CONTROL_LIST</a></span><span class="symbol">);</span>
<span class="normal">new_rule </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GDATA_ACCESS_RULE</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GDataService.html#gdata-service-insert-entry">gdata_service_insert_entry</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDATA_SERVICE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">),</span><span class="normal"> </span><span class="function"><a href="GDataLink.html#gdata-link-get-uri">gdata_link_get_uri</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">acl_link</span><span class="symbol">),</span><span class="normal"> </span><span class="function">GDATA_ENTRY</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">),</span>
<span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">));</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">rule</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">document</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">);</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Message-Logging.html#g-error">g_error</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"Error inserting access rule: %s"</span><span class="symbol">,</span><span class="normal"> error</span><span class="symbol">-></span><span class="normal">message</span><span class="symbol">);</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="normal"> </span><span class="keyword">return</span><span class="symbol">;</span>
<span class="cbracket">}</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">acl_link</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="example-break">
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gdata-documents-document-new"></a><h3>gdata_documents_document_new ()</h3>
<pre class="programlisting"><a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="returnvalue">GDataDocumentsDocument</span></a> *
gdata_documents_document_new (<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *id</code></em>);</pre>
<p>Creates a new <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> with the given entry ID (<a class="link" href="GDataEntry.html#GDataEntry--id" title="The “id” property"><span class="type">“id”</span></a>).</p>
<div class="refsect3">
<a name="gdata-documents-document-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p> the entry's ID (not the document ID), or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdata-documents-document-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>; unref with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix15.html#api-index-0.13.0">0.13.0</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gdata-documents-document-download"></a><h3>gdata_documents_document_download ()</h3>
<pre class="programlisting"><a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="returnvalue">GDataDownloadStream</span></a> *
gdata_documents_document_download (<em class="parameter"><code><a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> *self</code></em>,
<em class="parameter"><code><a class="link" href="GDataDocumentsService.html" title="GDataDocumentsService"><span class="type">GDataDocumentsService</span></a> *service</code></em>,
<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *export_format</code></em>,
<em class="parameter"><code><a href="https://developer.gnome.org/gio/unstable/GCancellable.html#GCancellable-struct"><span class="type">GCancellable</span></a> *cancellable</code></em>,
<em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Downloads and returns the document file represented by the <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a>. If the document doesn't exist, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, but no error
is set in <em class="parameter"><code>error</code></em>
.</p>
<p><em class="parameter"><code>export_format</code></em>
should be the file extension of the desired output format for the document, from the list accepted by Google Documents. For example:
<a class="link" href="GDataDocumentsPresentation.html#GDATA-DOCUMENTS-PRESENTATION-PDF:CAPS" title="GDATA_DOCUMENTS_PRESENTATION_PDF"><code class="literal">GDATA_DOCUMENTS_PRESENTATION_PDF</code></a>, <a class="link" href="GDataDocumentsSpreadsheet.html#GDATA-DOCUMENTS-SPREADSHEET-ODS:CAPS" title="GDATA_DOCUMENTS_SPREADSHEET_ODS"><code class="literal">GDATA_DOCUMENTS_SPREADSHEET_ODS</code></a> or <a class="link" href="GDataDocumentsText.html#GDATA-DOCUMENTS-TEXT-ODT:CAPS" title="GDATA_DOCUMENTS_TEXT_ODT"><code class="literal">GDATA_DOCUMENTS_TEXT_ODT</code></a>.</p>
<p>If <em class="parameter"><code>self</code></em>
is a <a class="link" href="GDataDocumentsSpreadsheet.html" title="GDataDocumentsSpreadsheet"><span class="type">GDataDocumentsSpreadsheet</span></a>, only the first grid, or sheet, in the spreadsheet will be downloaded for some export formats. To download
a specific a specific grid, use <a class="link" href="GDataDocumentsSpreadsheet.html#gdata-documents-spreadsheet-get-download-uri" title="gdata_documents_spreadsheet_get_download_uri ()"><code class="function">gdata_documents_spreadsheet_get_download_uri()</code></a> with <a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="type">GDataDownloadStream</span></a> to download the grid manually. See the</p>
<a class="ulink" href="https://developers.google.com/google-apps/documents-list/#downloading_spreadsheets" target="_top">GData protocol
specification</a> for more information.
<p>To get the content type of the downloaded file, <a class="link" href="GDataDownloadStream.html#gdata-download-stream-get-content-type" title="gdata_download_stream_get_content_type ()"><code class="function">gdata_download_stream_get_content_type()</code></a> can be called on the returned <a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="type">GDataDownloadStream</span></a>.
Calling <a class="link" href="GDataDownloadStream.html#gdata-download-stream-get-content-length" title="gdata_download_stream_get_content_length ()"><code class="function">gdata_download_stream_get_content_length()</code></a> on the stream will not return a meaningful result, however, as the stream is encoded in chunks,
rather than by content length.</p>
<p>In order to cancel the download, a <a href="https://developer.gnome.org/gio/unstable/GCancellable.html#GCancellable-struct"><span class="type">GCancellable</span></a> passed in to <em class="parameter"><code>cancellable</code></em>
must be cancelled using <a href="https://developer.gnome.org/gio/unstable/GCancellable.html#g-cancellable-cancel"><code class="function">g_cancellable_cancel()</code></a>. Cancelling the individual
<a href="https://developer.gnome.org/gio/unstable/GInputStream.html#GInputStream-struct"><span class="type">GInputStream</span></a> operations on the <a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="type">GDataDownloadStream</span></a> will not cancel the entire download; merely the read or close operation in question. See the
<a class="link" href="GDataDownloadStream.html#GDataDownloadStream--cancellable" title="The “cancellable” property"><span class="type">“cancellable”</span></a> for more details.</p>
<p>If <em class="parameter"><code>service</code></em>
isn't authenticated, a <a class="link" href="GDataService.html#GDATA-SERVICE-ERROR-AUTHENTICATION-REQUIRED:CAPS"><code class="literal">GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED</code></a> will be returned.</p>
<p>If there is an error getting the document, a <a class="link" href="GDataService.html#GDATA-SERVICE-ERROR-PROTOCOL-ERROR:CAPS"><code class="literal">GDATA_SERVICE_ERROR_PROTOCOL_ERROR</code></a> error will be returned.</p>
<div class="refsect3">
<a name="gdata-documents-document-download.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>service</p></td>
<td class="parameter_description"><p>a <a class="link" href="GDataDocumentsService.html" title="GDataDocumentsService"><span class="type">GDataDocumentsService</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>export_format</p></td>
<td class="parameter_description"><p>the format in which the document should be exported</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> a <a href="https://developer.gnome.org/gio/unstable/GCancellable.html#GCancellable-struct"><span class="type">GCancellable</span></a> for the entire download stream, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdata-documents-document-download.returns"></a><h4>Returns</h4>
<p> a <a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="type">GDataDownloadStream</span></a> to download the document with, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>; unref with <a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix10.html#api-index-0.8.0">0.8.0</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gdata-documents-document-get-download-uri"></a><h3>gdata_documents_document_get_download_uri ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
gdata_documents_document_get_download_uri
(<em class="parameter"><code><a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> *self</code></em>,
<em class="parameter"><code>const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *export_format</code></em>);</pre>
<p>Builds and returns the download URI for the given <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> in the desired format. Note that directly downloading the document using
this URI isn't possible, as authentication is required. You should instead use <a class="link" href="GDataDownloadStream.html#gdata-download-stream-new" title="gdata_download_stream_new ()"><code class="function">gdata_download_stream_new()</code></a> with the URI, and use the resulting
<a href="https://developer.gnome.org/gio/unstable/GInputStream.html#GInputStream-struct"><span class="type">GInputStream</span></a>.</p>
<p><em class="parameter"><code>export_format</code></em>
should be the file extension of the desired output format for the document, from the list accepted by Google Documents. For example:
<a class="link" href="GDataDocumentsPresentation.html#GDATA-DOCUMENTS-PRESENTATION-PDF:CAPS" title="GDATA_DOCUMENTS_PRESENTATION_PDF"><code class="literal">GDATA_DOCUMENTS_PRESENTATION_PDF</code></a>, <a class="link" href="GDataDocumentsSpreadsheet.html#GDATA-DOCUMENTS-SPREADSHEET-ODS:CAPS" title="GDATA_DOCUMENTS_SPREADSHEET_ODS"><code class="literal">GDATA_DOCUMENTS_SPREADSHEET_ODS</code></a> or <a class="link" href="GDataDocumentsText.html#GDATA-DOCUMENTS-TEXT-ODT:CAPS" title="GDATA_DOCUMENTS_TEXT_ODT"><code class="literal">GDATA_DOCUMENTS_TEXT_ODT</code></a>.</p>
<div class="refsect3">
<a name="gdata-documents-document-get-download-uri.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>export_format</p></td>
<td class="parameter_description"><p>the format in which the document should be exported when downloaded</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdata-documents-document-get-download-uri.returns"></a><h4>Returns</h4>
<p> the download URI; free with <a href="https://developer.gnome.org/glib/unstable/glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a></p>
</div>
<p class="since">Since: <a class="link" href="ix09.html#api-index-0.7.0">0.7.0</a></p>
</div>
<hr>
<div class="refsect2">
<a name="gdata-documents-document-get-thumbnail-uri"></a><h3>gdata_documents_document_get_thumbnail_uri ()</h3>
<pre class="programlisting">const <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
gdata_documents_document_get_thumbnail_uri
(<em class="parameter"><code><a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> *self</code></em>);</pre>
<p>Gets the URI of the thumbnail for the <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a>. If no thumbnail exists for the document, <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned.</p>
<p>The thumbnail may then be downloaded using a <a class="link" href="GDataDownloadStream.html" title="GDataDownloadStream"><span class="type">GDataDownloadStream</span></a>.</p>
<div class="example">
<a name="id-1.5.5.7.10.5.6"></a><p class="title"><b>Example 35. Downloading a Document Thumbnail</b></p>
<div class="example-contents">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="usertype">GDataDocumentsService</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">service</span><span class="symbol">;</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">thumbnail_uri</span><span class="symbol">;</span>
<span class="usertype">GCancellable</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">cancellable</span><span class="symbol">;</span>
<span class="usertype">GdkPixbuf</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">pixbuf</span><span class="symbol">;</span>
<span class="usertype">GError</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">error </span><span class="symbol">=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">;</span>
<span class="normal">service </span><span class="symbol">=</span><span class="normal"> </span><span class="function">get_my_documents_service</span><span class="normal"> </span><span class="symbol">();</span>
<span class="normal">thumbnail_uri </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="GDataDocumentsDocument.html#gdata-documents-document-get-thumbnail-uri">gdata_documents_document_get_thumbnail_uri</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">my_document</span><span class="symbol">);</span>
<span class="normal">cancellable </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/gio/unstable/GCancellable.html#g-cancellable-new">g_cancellable_new</a></span><span class="normal"> </span><span class="symbol">();</span>
<span class="comment">/* Prepare a download stream */</span>
<span class="normal">download_stream </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GDATA_DOWNLOAD_STREAM</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="GDataDownloadStream.html#gdata-download-stream-new">gdata_download_stream_new</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">GDATA_SERVICE</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">service</span><span class="symbol">),</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> thumbnail_uri</span><span class="symbol">,</span><span class="normal"> cancellable</span><span class="symbol">));</span>
<span class="comment">/* Download into a new GdkPixbuf. This can be cancelled using 'cancellable'. */</span>
<span class="normal">pixbuf </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="http://library.gnome.org/devel/gdk-pixbuf/unstable/gdk-pixbuf-File-Loading.html#gdk-pixbuf-new-from-stream">gdk_pixbuf_new_from_stream</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">G_INPUT_STREAM</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">download_stream</span><span class="symbol">),</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">,</span><span class="normal"> </span><span class="symbol">&</span><span class="normal">error</span><span class="symbol">);</span>
<span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error </span><span class="symbol">!=</span><span class="normal"> <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS">NULL</a></span><span class="symbol">)</span><span class="normal"> </span><span class="cbracket">{</span>
<span class="normal"> </span><span class="comment">/* Handle the error. */</span>
<span class="normal"> </span><span class="function"><a href="https://developer.gnome.org/glib/unstable/glib-Error-Reporting.html#g-error-free">g_error_free</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">error</span><span class="symbol">);</span>
<span class="cbracket">}</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">download_stream</span><span class="symbol">);</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">cancellable</span><span class="symbol">);</span>
<span class="comment">/* Do something with the GdkPixbuf. */</span>
<span class="function"><a href="https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">pixbuf</span><span class="symbol">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="example-break"><div class="refsect3">
<a name="gdata-documents-document-get-thumbnail-uri.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gdata-documents-document-get-thumbnail-uri.returns"></a><h4>Returns</h4>
<p> the URI of the document's thumbnail, or <a href="https://developer.gnome.org/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="ix16.html#api-index-0.13.1">0.13.1</a></p>
</div>
</div>
<div class="refsect1">
<a name="GDataDocumentsDocument.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GDataDocumentsDocument-struct"></a><h3>GDataDocumentsDocument</h3>
<pre class="programlisting">typedef struct _GDataDocumentsDocument GDataDocumentsDocument;</pre>
<p>All the fields in the <a class="link" href="GDataDocumentsDocument.html" title="GDataDocumentsDocument"><span class="type">GDataDocumentsDocument</span></a> structure are private and should never be accessed directly.</p>
<p class="since">Since: <a class="link" href="ix09.html#api-index-0.7.0">0.7.0</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GDataDocumentsDocumentClass"></a><h3>GDataDocumentsDocumentClass</h3>
<pre class="programlisting">typedef struct {
} GDataDocumentsDocumentClass;
</pre>
<p>All the fields in the <a class="link" href="GDataDocumentsDocument.html#GDataDocumentsDocumentClass" title="GDataDocumentsDocumentClass"><span class="type">GDataDocumentsDocumentClass</span></a> structure are private and should never be accessed directly.</p>
<p class="since">Since: <a class="link" href="ix09.html#api-index-0.7.0">0.7.0</a></p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24.1</div>
</body>
</html>
|