1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3  * GData Client
4  * Copyright (C) Philip Withnall 2008–2010 <philip@tecnocode.co.uk>
5  *
6  * GData Client is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * GData Client is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with GData Client.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef GDATA_ENTRY_H
21 #define GDATA_ENTRY_H
22 
23 #include <glib.h>
24 #include <glib-object.h>
25 
26 #include <gdata/gdata-parsable.h>
27 #include <gdata/atom/gdata-category.h>
28 #include <gdata/atom/gdata-link.h>
29 #include <gdata/atom/gdata-author.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GDATA_TYPE_ENTRY		(gdata_entry_get_type ())
34 #define GDATA_ENTRY(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_ENTRY, GDataEntry))
35 #define GDATA_ENTRY_CLASS(k)		(G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_ENTRY, GDataEntryClass))
36 #define GDATA_IS_ENTRY(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_ENTRY))
37 #define GDATA_IS_ENTRY_CLASS(k)		(G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_ENTRY))
38 #define GDATA_ENTRY_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_ENTRY, GDataEntryClass))
39 
40 typedef struct _GDataEntryPrivate	GDataEntryPrivate;
41 
42 /**
43  * GDataEntry:
44  *
45  * All the fields in the #GDataEntry structure are private and should never be accessed directly.
46  */
47 typedef struct {
48 	GDataParsable parent;
49 	GDataEntryPrivate *priv;
50 } GDataEntry;
51 
52 /**
53  * GDataEntryClass:
54  * @parent: the parent class
55  * @get_entry_uri: a function to build the entry URI for the entry, given its entry ID; free the URI with g_free()
56  * @kind_term: the term for this entry's kind category (see the
57  * <ulink type="http" url="http://code.google.com/apis/gdata/docs/2.0/elements.html#Introduction">documentation on kinds</ulink>)
58  *
59  * The class structure for the #GDataEntry type.
60  */
61 typedef struct {
62 	GDataParsableClass parent;
63 
64 	gchar *(*get_entry_uri) (const gchar *id); /* G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC */
65 	const gchar *kind_term;
66 
67 	/*< private >*/
68 	/* Padding for future expansion */
69 	void (*_g_reserved0) (void);
70 	void (*_g_reserved1) (void);
71 	void (*_g_reserved2) (void);
72 	void (*_g_reserved3) (void);
73 	void (*_g_reserved4) (void);
74 	void (*_g_reserved5) (void);
75 	void (*_g_reserved6) (void);
76 	void (*_g_reserved7) (void);
77 } GDataEntryClass;
78 
79 GType gdata_entry_get_type (void) G_GNUC_CONST;
80 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDataEntry, g_object_unref)
81 
82 GDataEntry *gdata_entry_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
83 
84 const gchar *gdata_entry_get_title (GDataEntry *self) G_GNUC_PURE;
85 void gdata_entry_set_title (GDataEntry *self, const gchar *title);
86 const gchar *gdata_entry_get_summary (GDataEntry *self) G_GNUC_PURE;
87 void gdata_entry_set_summary (GDataEntry *self, const gchar *summary);
88 const gchar *gdata_entry_get_id (GDataEntry *self) G_GNUC_PURE;
89 const gchar *gdata_entry_get_etag (GDataEntry *self) G_GNUC_PURE;
90 gint64 gdata_entry_get_updated (GDataEntry *self);
91 gint64 gdata_entry_get_published (GDataEntry *self);
92 void gdata_entry_add_category (GDataEntry *self, GDataCategory *category);
93 GList *gdata_entry_get_categories (GDataEntry *self) G_GNUC_PURE;
94 const gchar *gdata_entry_get_content (GDataEntry *self) G_GNUC_PURE;
95 void gdata_entry_set_content (GDataEntry *self, const gchar *content);
96 const gchar *gdata_entry_get_content_uri (GDataEntry *self) G_GNUC_PURE;
97 void gdata_entry_set_content_uri (GDataEntry *self, const gchar *content_uri);
98 void gdata_entry_add_link (GDataEntry *self, GDataLink *_link);
99 gboolean gdata_entry_remove_link (GDataEntry *self, GDataLink *_link);
100 GDataLink *gdata_entry_look_up_link (GDataEntry *self, const gchar *rel) G_GNUC_PURE;
101 GList *gdata_entry_look_up_links (GDataEntry *self, const gchar *rel) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
102 void gdata_entry_add_author (GDataEntry *self, GDataAuthor *author);
103 GList *gdata_entry_get_authors (GDataEntry *self) G_GNUC_PURE;
104 const gchar *gdata_entry_get_rights (GDataEntry *self) G_GNUC_PURE;
105 void gdata_entry_set_rights (GDataEntry *self, const gchar *rights);
106 
107 gboolean gdata_entry_is_inserted (GDataEntry *self) G_GNUC_PURE;
108 
109 G_END_DECLS
110 
111 #endif /* !GDATA_ENTRY_H */
112