[libgdata] freebase: Add GType for GDataFreebaseSearchResultItem
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] freebase: Add GType for GDataFreebaseSearchResultItem
- Date: Tue, 23 Dec 2014 10:17:11 +0000 (UTC)
commit 2a939fd913db3ade85e7f71850bbd009690273d4
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Oct 5 19:26:59 2014 +0200
freebase: Add GType for GDataFreebaseSearchResultItem
Making it a boxed type makes it friendly to bindings, as there's
some more embedded knowledge about how to deal with this type
memory-wise.
https://bugzilla.gnome.org/show_bug.cgi?id=737936
docs/reference/gdata-sections.txt | 1 +
gdata/gdata.symbols | 1 +
.../freebase/gdata-freebase-search-result.c | 21 ++++++++++++++++++++
.../freebase/gdata-freebase-search-result.h | 2 +
4 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gdata-sections.txt b/docs/reference/gdata-sections.txt
index 2dce568..b3fdcb0 100644
--- a/docs/reference/gdata-sections.txt
+++ b/docs/reference/gdata-sections.txt
@@ -2749,6 +2749,7 @@ gdata_freebase_search_result_item_get_notable_name
gdata_freebase_search_result_item_get_score
<SUBSECTION Standard>
gdata_freebase_search_result_get_type
+gdata_freebase_search_result_item_get_type
GDATA_FREEBASE_SEARCH_RESULT
GDATA_FREEBASE_SEARCH_RESULT_CLASS
GDATA_FREEBASE_SEARCH_RESULT_GET_CLASS
diff --git a/gdata/gdata.symbols b/gdata/gdata.symbols
index 8854a65..7ae3e95 100644
--- a/gdata/gdata.symbols
+++ b/gdata/gdata.symbols
@@ -1050,6 +1050,7 @@ gdata_freebase_search_result_new
gdata_freebase_search_result_get_num_items
gdata_freebase_search_result_get_total_hits
gdata_freebase_search_result_get_item
+gdata_freebase_search_result_item_get_type
gdata_freebase_search_result_item_get_mid
gdata_freebase_search_result_item_get_id
gdata_freebase_search_result_item_get_name
diff --git a/gdata/services/freebase/gdata-freebase-search-result.c
b/gdata/services/freebase/gdata-freebase-search-result.c
index 02f416c..d2576e7 100644
--- a/gdata/services/freebase/gdata-freebase-search-result.c
+++ b/gdata/services/freebase/gdata-freebase-search-result.c
@@ -59,6 +59,10 @@ struct _GDataFreebaseSearchResultPrivate {
static void gdata_freebase_search_result_finalize (GObject *self);
static gboolean parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error);
+static GDataFreebaseSearchResultItem * item_copy (const GDataFreebaseSearchResultItem *item);
+static void item_free (GDataFreebaseSearchResultItem *item);
+
+G_DEFINE_BOXED_TYPE (GDataFreebaseSearchResultItem, gdata_freebase_search_result_item, item_copy, item_free)
G_DEFINE_TYPE (GDataFreebaseSearchResult, gdata_freebase_search_result, GDATA_TYPE_FREEBASE_RESULT)
@@ -92,6 +96,23 @@ item_free (GDataFreebaseSearchResultItem *item)
g_slice_free (GDataFreebaseSearchResultItem, item);
}
+static GDataFreebaseSearchResultItem *
+item_copy (const GDataFreebaseSearchResultItem *item)
+{
+ GDataFreebaseSearchResultItem *copy;
+
+ copy = item_new ();
+ copy->mid = g_strdup (item->mid);
+ copy->id = g_strdup (item->id);
+ copy->name = g_strdup (item->name);
+ copy->lang = g_strdup (item->lang);
+ copy->notable_id = g_strdup (item->notable_id);
+ copy->notable_name = g_strdup (item->notable_name);
+ copy->score = item->score;
+
+ return copy;
+}
+
static void
gdata_freebase_search_result_init (GDataFreebaseSearchResult *self)
{
diff --git a/gdata/services/freebase/gdata-freebase-search-result.h
b/gdata/services/freebase/gdata-freebase-search-result.h
index 8173f75..e687caf 100644
--- a/gdata/services/freebase/gdata-freebase-search-result.h
+++ b/gdata/services/freebase/gdata-freebase-search-result.h
@@ -28,6 +28,7 @@
G_BEGIN_DECLS
+#define GDATA_TYPE_FREEBASE_SEARCH_RESULT_ITEM (gdata_freebase_search_result_item_get_type ())
#define GDATA_TYPE_FREEBASE_SEARCH_RESULT (gdata_freebase_search_result_get_type ())
#define GDATA_FREEBASE_SEARCH_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o),
GDATA_TYPE_FREEBASE_SEARCH_RESULT, GDataFreebaseSearchResult))
#define GDATA_FREEBASE_SEARCH_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k),
GDATA_TYPE_FREEBASE_SEARCH_RESULT, GDataFreebaseSearchResultClass))
@@ -76,6 +77,7 @@ typedef struct {
void (*_g_reserved1) (void);
} GDataFreebaseSearchResultClass;
+GType gdata_freebase_search_result_item_get_type (void) G_GNUC_CONST;
GType gdata_freebase_search_result_get_type (void) G_GNUC_CONST;
GDataFreebaseSearchResult *gdata_freebase_search_result_new (void) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]