1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /*
3 * GData Client
4 * Copyright (C) Philip Withnall 2009, 2010, 2014, 2015 <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 /**
21 * SECTION:gdata-calendar-feed
22 * @short_description: GData Calendar feed object
23 * @stability: Stable
24 * @include: gdata/services/calendar/gdata-calendar-feed.h
25 *
26 * #GDataCalendarFeed is a subclass of #GDataFeed to represent a results feed from Google Calendar. It adds a couple of
27 * properties which are specific to the Google Calendar API.
28 */
29
30 #include <glib.h>
31 #include <libxml/parser.h>
32
33 #include "gdata-calendar-feed.h"
34 #include "gdata-feed.h"
35 #include "gdata-private.h"
36
37 static void gdata_calendar_feed_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
38
39 enum {
40 PROP_TIMEZONE = 1,
41 PROP_TIMES_CLEANED
42 };
43
G_DEFINE_TYPE(GDataCalendarFeed,gdata_calendar_feed,GDATA_TYPE_FEED)44 G_DEFINE_TYPE (GDataCalendarFeed, gdata_calendar_feed, GDATA_TYPE_FEED)
45
46 static void
47 gdata_calendar_feed_class_init (GDataCalendarFeedClass *klass)
48 {
49 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
50
51 gobject_class->get_property = gdata_calendar_feed_get_property;
52
53 /**
54 * GDataCalendarFeed:timezone:
55 *
56 * The timezone in which the feed's times are given. This is a timezone name in tz database notation: <ulink type="http"
57 * url="http://en.wikipedia.org/wiki/Tz_database#Names_of_time_zones">reference</ulink>.
58 *
59 * Since: 0.3.0
60 * Deprecated: 0.17.2: Unsupported by the online API any more. There
61 * is no replacement; this will always return %NULL.
62 */
63 g_object_class_install_property (gobject_class, PROP_TIMEZONE,
64 g_param_spec_string ("timezone",
65 "Timezone", "The timezone in which the feed's times are given.",
66 NULL,
67 G_PARAM_DEPRECATED |
68 G_PARAM_READABLE |
69 G_PARAM_STATIC_STRINGS));
70
71 /**
72 * GDataCalendarFeed:times-cleaned:
73 *
74 * The number of times the feed has been completely cleared of entries.
75 *
76 * Since: 0.3.0
77 * Deprecated: 0.17.2: Unsupported by the online API any more. There
78 * is no replacement; this will always return 0.
79 */
80 g_object_class_install_property (gobject_class, PROP_TIMES_CLEANED,
81 g_param_spec_uint ("times-cleaned",
82 "Times cleaned", "The number of times the feed has been completely cleared of entries.",
83 0, G_MAXUINT, 0,
84 G_PARAM_DEPRECATED |
85 G_PARAM_READABLE |
86 G_PARAM_STATIC_STRINGS));
87 }
88
89 static void
gdata_calendar_feed_init(GDataCalendarFeed * self)90 gdata_calendar_feed_init (GDataCalendarFeed *self)
91 {
92 /* Nothing to see here. */
93 }
94
95 static void
gdata_calendar_feed_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)96 gdata_calendar_feed_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
97 {
98 GDataCalendarFeed *self = GDATA_CALENDAR_FEED (object);
99
100 switch (property_id) {
101 case PROP_TIMEZONE:
102 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
103 g_value_set_string (value,
104 gdata_calendar_feed_get_timezone (self));
105 G_GNUC_END_IGNORE_DEPRECATIONS
106 break;
107 case PROP_TIMES_CLEANED:
108 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
109 g_value_set_uint (value,
110 gdata_calendar_feed_get_times_cleaned (self));
111 G_GNUC_END_IGNORE_DEPRECATIONS
112 break;
113 default:
114 /* We don't have any other property... */
115 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
116 break;
117 }
118 }
119
120 /**
121 * gdata_calendar_feed_get_timezone:
122 * @self: a #GDataCalendarFeed
123 *
124 * Gets the #GDataCalendarFeed:timezone property.
125 *
126 * Return value: the feed's timezone, or %NULL
127 *
128 * Since: 0.3.0
129 * Deprecated: 0.17.2: Unsupported by the online API any more. There is no
130 * replacement; this will always return %NULL.
131 */
132 const gchar *
gdata_calendar_feed_get_timezone(GDataCalendarFeed * self)133 gdata_calendar_feed_get_timezone (GDataCalendarFeed *self)
134 {
135 /* Not supported any more by version 3 of the API. */
136 g_return_val_if_fail (GDATA_IS_CALENDAR_FEED (self), NULL);
137 return NULL;
138 }
139
140 /**
141 * gdata_calendar_feed_get_times_cleaned:
142 * @self: a #GDataCalendarFeed
143 *
144 * Gets the #GDataCalendarFeed:times-cleaned property.
145 *
146 * Return value: the number of times the feed has been totally emptied
147 *
148 * Since: 0.3.0
149 * Deprecated: 0.17.2: Unsupported by the online API any more. There is no
150 * replacement; this will always return %NULL.
151 */
152 guint
gdata_calendar_feed_get_times_cleaned(GDataCalendarFeed * self)153 gdata_calendar_feed_get_times_cleaned (GDataCalendarFeed *self)
154 {
155 /* Not supported any more by version 3 of the API. */
156 g_return_val_if_fail (GDATA_IS_CALENDAR_FEED (self), 0);
157 return 0;
158 }
159