[libgdata] core: Allow the GDataFeed type to be passed to _gdata_feed_new()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] core: Allow the GDataFeed type to be passed to _gdata_feed_new()
- Date: Fri, 12 Dec 2014 23:34:10 +0000 (UTC)
commit 18edbc4e90f582bc67b08f6158c97666ebd8acaf
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Dec 12 23:15:45 2014 +0000
core: Allow the GDataFeed type to be passed to _gdata_feed_new()
This will be used internally later to support constructing custom empty
feeds for pagination purposes.
https://bugzilla.gnome.org/show_bug.cgi?id=741345
gdata/gdata-batch-operation.c | 3 ++-
gdata/gdata-feed.c | 14 ++++++++++----
gdata/gdata-private.h | 5 ++++-
3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/gdata/gdata-batch-operation.c b/gdata/gdata-batch-operation.c
index 1959f90..feb6128 100644
--- a/gdata/gdata-batch-operation.c
+++ b/gdata/gdata-batch-operation.c
@@ -616,7 +616,8 @@ gdata_batch_operation_run (GDataBatchOperation *self, GCancellable *cancellable,
/* Build the request */
g_get_current_time (&updated);
- feed = _gdata_feed_new ("Batch operation feed", "batch1", updated.tv_sec);
+ feed = _gdata_feed_new (GDATA_TYPE_FEED, "Batch operation feed",
+ "batch1", updated.tv_sec);
g_hash_table_iter_init (&iter, priv->operations);
while (g_hash_table_iter_next (&iter, &op_id, (gpointer*) &op) == TRUE) {
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index 0cc6c73..68ed7a0 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -647,26 +647,32 @@ post_parse_json (GDataParsable *parsable, gpointer user_data, GError **error)
/*
* _gdata_feed_new:
+ * @feed_type: the type of #GDataFeed subclass
* @title: the feed's title
* @id: the feed's ID
* @updated: when the feed was last updated
*
- * Creates a new #GDataFeed with the bare minimum of data to be valid.
+ * Creates a new #GDataFeed or subclass with the bare minimum of data to be
+ * valid.
*
* Return value: a new #GDataFeed
*
- * Since: 0.6.0
+ * Since: UNRELEASED
*/
GDataFeed *
-_gdata_feed_new (const gchar *title, const gchar *id, gint64 updated)
+_gdata_feed_new (GType feed_type,
+ const gchar *title,
+ const gchar *id,
+ gint64 updated)
{
GDataFeed *feed;
+ g_return_val_if_fail (g_type_is_a (feed_type, GDATA_TYPE_FEED), NULL);
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (id != NULL, NULL);
g_return_val_if_fail (updated >= 0, NULL);
- feed = g_object_new (GDATA_TYPE_FEED, NULL);
+ feed = g_object_new (feed_type, NULL);
feed->priv->title = g_strdup (title);
feed->priv->id = g_strdup (id);
feed->priv->updated = updated;
diff --git a/gdata/gdata-private.h b/gdata/gdata-private.h
index ed19520..f470561 100644
--- a/gdata/gdata-private.h
+++ b/gdata/gdata-private.h
@@ -89,7 +89,10 @@ G_GNUC_INTERNAL void _gdata_parsable_string_append_escaped (GString *xml_string,
G_GNUC_INTERNAL gboolean _gdata_parsable_is_constructed_from_xml (GDataParsable *self);
#include "gdata-feed.h"
-G_GNUC_INTERNAL GDataFeed *_gdata_feed_new (const gchar *title, const gchar *id, gint64 updated)
G_GNUC_WARN_UNUSED_RESULT;
+G_GNUC_INTERNAL GDataFeed *_gdata_feed_new (GType feed_type,
+ const gchar *title,
+ const gchar *id,
+ gint64 updated) G_GNUC_WARN_UNUSED_RESULT;
G_GNUC_INTERNAL GDataFeed *_gdata_feed_new_from_xml (GType feed_type, const gchar *xml, gint length, GType
entry_type,
GDataQueryProgressCallback progress_callback, gpointer
progress_user_data,
GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]