1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3 * GData Client
4 * Copyright (C) Thibault Saunier 2009 <saunierthibault@gmail.com>
5 * Copyright (C) Philip Withnall 2010 <philip@tecnocode.co.uk>
6 * Copyright (C) Cosimo Cecchi 2012 <cosimoc@gnome.org>
7 * Copyright (C) Red Hat, Inc. 2016
8 *
9 * GData Client is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * GData Client is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GData Client. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 /**
24 * SECTION:gdata-documents-pdf
25 * @short_description: GData Documents pdf object
26 * @stability: Stable
27 * @include: gdata/services/documents/gdata-documents-pdf.h
28 *
29 * #GDataDocumentsPdf is a subclass of #GDataDocumentsDocument to represent a PDF document from Google Documents.
30 *
31 * For more details of Google Drive's GData API, see the
32 * <ulink type="http" url="https://developers.google.com/drive/v2/web/about-sdk">online documentation</ulink>.
33 *
34 * Since: 0.13.3
35 */
36
37 #include <config.h>
38 #include <glib.h>
39
40 #include "gdata-documents-pdf.h"
41 #include "gdata-documents-utils.h"
42 #include "gdata-parser.h"
43 #include "gdata-private.h"
44
45 static void gdata_documents_pdf_constructed (GObject *object);
46
G_DEFINE_TYPE(GDataDocumentsPdf,gdata_documents_pdf,GDATA_TYPE_DOCUMENTS_DOCUMENT)47 G_DEFINE_TYPE (GDataDocumentsPdf, gdata_documents_pdf, GDATA_TYPE_DOCUMENTS_DOCUMENT)
48
49 static void
50 gdata_documents_pdf_class_init (GDataDocumentsPdfClass *klass)
51 {
52 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
53 GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass);
54
55 gobject_class->constructed = gdata_documents_pdf_constructed;
56 entry_class->kind_term = "http://schemas.google.com/docs/2007#pdf";
57 }
58
59 static void
gdata_documents_pdf_init(GDataDocumentsPdf * self)60 gdata_documents_pdf_init (GDataDocumentsPdf *self)
61 {
62 /* Why am I writing it? */
63 }
64
65 static void
gdata_documents_pdf_constructed(GObject * object)66 gdata_documents_pdf_constructed (GObject *object)
67 {
68 G_OBJECT_CLASS (gdata_documents_pdf_parent_class)->constructed (object);
69
70 if (!_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)))
71 gdata_documents_utils_add_content_type (GDATA_DOCUMENTS_ENTRY (object), "application/pdf");
72 }
73
74 /**
75 * gdata_documents_pdf_new:
76 * @id: (allow-none): the entry's ID (not the document ID of the pdf document), or %NULL
77 *
78 * Creates a new #GDataDocumentsPdf with the given entry ID (#GDataEntry:id).
79 *
80 * Return value: (transfer full): a new #GDataDocumentsPdf, or %NULL; unref with g_object_unref()
81 *
82 * Since: 0.13.3
83 */
84 GDataDocumentsPdf *
gdata_documents_pdf_new(const gchar * id)85 gdata_documents_pdf_new (const gchar *id)
86 {
87 return GDATA_DOCUMENTS_PDF (g_object_new (GDATA_TYPE_DOCUMENTS_PDF, "id", id, NULL));
88 }
89