get_thumbnail_uri


Description:

[ Version ( since = "0.13.1" ) ]
public unowned string? get_thumbnail_uri ()

Gets the URI of the thumbnail for the DocumentsDocument.

If no thumbnail exists for the document, null will be returned.

The thumbnail may then be downloaded using a DownloadStream.

Downloading a Document Thumbnail:

GDataDocumentsService *service;
const gchar *thumbnail_uri;
GCancellable *cancellable;
GdkPixbuf *pixbuf;
GError *error = NULL;

service = get_my_documents_service ();
thumbnail_uri = gdata_documents_document_get_thumbnail_uri (my_document);
cancellable = g_cancellable_new ();

/* Prepare a download stream */
download_stream = GDATA_DOWNLOAD_STREAM (gdata_download_stream_new (GDATA_SERVICE (service), NULL, thumbnail_uri, cancellable));

/* Download into a new GdkPixbuf. This can be cancelled using 'cancellable'. */
pixbuf = gdk_pixbuf_new_from_stream (G_INPUT_STREAM (download_stream), NULL, &error);

if (error != NULL) {
/* Handle the error. */
g_error_free (error);
}

g_object_unref (download_stream);
g_object_unref (cancellable);

/* Do something with the GdkPixbuf. */

g_object_unref (pixbuf);

Parameters:

this

a DocumentsDocument

Returns:

the URI of the document's thumbnail, or null




2022 vala-language.org