From 634da1f8d2a324b4cfac9661a9fce20fcac24042 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 30 Mar 2021 15:35:40 +0200 Subject: remove deprecated freebase service --- docs/reference/gdata-docs.xml | 11 - docs/reference/gdata-sections.txt.in | 192 ---- docs/reference/meson.build | 1 - gdata/gdata-core.symbols | 71 -- gdata/gdata.h | 10 - gdata/services/freebase/gdata-freebase-query.c | 257 ----- gdata/services/freebase/gdata-freebase-query.h | 81 -- gdata/services/freebase/gdata-freebase-result.c | 203 ---- gdata/services/freebase/gdata-freebase-result.h | 81 -- .../freebase/gdata-freebase-search-query.c | 624 ------------ .../freebase/gdata-freebase-search-query.h | 106 -- .../freebase/gdata-freebase-search-result.c | 430 -------- .../freebase/gdata-freebase-search-result.h | 104 -- gdata/services/freebase/gdata-freebase-service.c | 507 ---------- gdata/services/freebase/gdata-freebase-service.h | 111 --- .../services/freebase/gdata-freebase-topic-query.c | 349 ------- .../services/freebase/gdata-freebase-topic-query.h | 84 -- .../freebase/gdata-freebase-topic-result.c | 1045 -------------------- .../freebase/gdata-freebase-topic-result.h | 135 --- gdata/services/freebase/meson.build | 58 -- gdata/services/meson.build | 1 - gdata/symbol.map | 71 -- po/POTFILES.in | 1 - 23 files changed, 4533 deletions(-) delete mode 100644 gdata/services/freebase/gdata-freebase-query.c delete mode 100644 gdata/services/freebase/gdata-freebase-query.h delete mode 100644 gdata/services/freebase/gdata-freebase-result.c delete mode 100644 gdata/services/freebase/gdata-freebase-result.h delete mode 100644 gdata/services/freebase/gdata-freebase-search-query.c delete mode 100644 gdata/services/freebase/gdata-freebase-search-query.h delete mode 100644 gdata/services/freebase/gdata-freebase-search-result.c delete mode 100644 gdata/services/freebase/gdata-freebase-search-result.h delete mode 100644 gdata/services/freebase/gdata-freebase-service.c delete mode 100644 gdata/services/freebase/gdata-freebase-service.h delete mode 100644 gdata/services/freebase/gdata-freebase-topic-query.c delete mode 100644 gdata/services/freebase/gdata-freebase-topic-query.h delete mode 100644 gdata/services/freebase/gdata-freebase-topic-result.c delete mode 100644 gdata/services/freebase/gdata-freebase-topic-result.h delete mode 100644 gdata/services/freebase/meson.build diff --git a/docs/reference/gdata-docs.xml b/docs/reference/gdata-docs.xml index a071a976..97418dc2 100644 --- a/docs/reference/gdata-docs.xml +++ b/docs/reference/gdata-docs.xml @@ -190,17 +190,6 @@ - - - Google Freebase API - - - - - - - - diff --git a/docs/reference/gdata-sections.txt.in b/docs/reference/gdata-sections.txt.in index 42139e44..0cb4ba44 100644 --- a/docs/reference/gdata-sections.txt.in +++ b/docs/reference/gdata-sections.txt.in @@ -2664,198 +2664,6 @@ GDATA_IS_TASKS_TASKLIST_CLASS GDATA_TYPE_TASKS_TASKLIST -
-gdata-freebase-service -GDataFreebaseService -GDataFreebaseService -GDataFreebaseServiceClass -gdata_freebase_service_new -gdata_freebase_service_get_primary_authorization_domain -gdata_freebase_service_query -gdata_freebase_service_query_async -gdata_freebase_service_get_topic -gdata_freebase_service_get_topic_async -gdata_freebase_service_search -gdata_freebase_service_search_async -gdata_freebase_service_get_image - -gdata_freebase_service_get_type -GDATA_FREEBASE_SERVICE -GDATA_FREEBASE_SERVICE_CLASS -GDATA_FREEBASE_SERVICE_GET_CLASS -GDATA_IS_FREEBASE_SERVICE -GDATA_IS_FREEBASE_SERVICE_CLASS -GDATA_TYPE_FREEBASE_SERVICE - -GDataFreebaseServicePrivate -
- -
-gdata-freebase-query -GDataFreebaseQuery -GDataFreebaseQuery -GDataFreebaseQueryClass -gdata_freebase_query_new -gdata_freebase_query_new_from_variant - -gdata_freebase_query_get_type -GDATA_FREEBASE_QUERY -GDATA_FREEBASE_QUERY_CLASS -GDATA_FREEBASE_QUERY_GET_CLASS -GDATA_IS_FREEBASE_QUERY -GDATA_IS_FREEBASE_QUERY_CLASS -GDATA_TYPE_FREEBASE_QUERY - -GDataFreebaseQueryPrivate -
- -
-gdata-freebase-result -GDataFreebaseResult -GDataFreebaseResult -GDataFreebaseResultClass -gdata_freebase_result_new -gdata_freebase_result_dup_variant - -gdata_freebase_result_get_type -GDATA_FREEBASE_RESULT -GDATA_FREEBASE_RESULT_CLASS -GDATA_FREEBASE_RESULT_GET_CLASS -GDATA_IS_FREEBASE_RESULT -GDATA_IS_FREEBASE_RESULT_CLASS -GDATA_TYPE_FREEBASE_RESULT - -GDataFreebaseResultPrivate -
- -
-gdata-freebase-topic-query -GDataFreebaseTopicQuery -GDataFreebaseTopicQuery -GDataFreebaseTopicQueryClass -gdata_freebase_topic_query_new -gdata_freebase_topic_query_set_filter -gdata_freebase_topic_query_get_filter -gdata_freebase_topic_query_set_language -gdata_freebase_topic_query_get_language - -gdata_freebase_topic_query_get_type -GDATA_FREEBASE_TOPIC_QUERY -GDATA_FREEBASE_TOPIC_QUERY_CLASS -GDATA_FREEBASE_TOPIC_QUERY_GET_CLASS -GDATA_IS_FREEBASE_TOPIC_QUERY -GDATA_IS_FREEBASE_TOPIC_QUERY_CLASS -GDATA_TYPE_FREEBASE_TOPIC_QUERY - -GDataFreebaseTopicQueryPrivate -
- -
-gdata-freebase-topic-result -GDataFreebaseTopicResult -GDataFreebaseTopicResult -GDataFreebaseTopicResultClass -gdata_freebase_topic_result_new -gdata_freebase_topic_result_dup_object -GDataFreebaseTopicObject -gdata_freebase_topic_object_ref -gdata_freebase_topic_object_unref -gdata_freebase_topic_object_list_properties -gdata_freebase_topic_object_get_id -gdata_freebase_topic_object_get_property_count -gdata_freebase_topic_object_get_property_hits -gdata_freebase_topic_object_get_property_value -GDataFreebaseTopicValue -gdata_freebase_topic_value_ref -gdata_freebase_topic_value_unref -gdata_freebase_topic_value_get_property -gdata_freebase_topic_value_get_text -gdata_freebase_topic_value_get_language -gdata_freebase_topic_value_get_creator -gdata_freebase_topic_value_get_timestamp -gdata_freebase_topic_value_get_value_type -gdata_freebase_topic_value_copy_value -gdata_freebase_topic_value_get_int -gdata_freebase_topic_value_get_double -gdata_freebase_topic_value_get_string -gdata_freebase_topic_value_get_object -gdata_freebase_topic_value_is_image - -gdata_freebase_topic_result_get_type -gdata_freebase_topic_object_get_type -gdata_freebase_topic_value_get_type -GDATA_FREEBASE_TOPIC_RESULT -GDATA_FREEBASE_TOPIC_RESULT_CLASS -GDATA_FREEBASE_TOPIC_RESULT_GET_CLASS -GDATA_IS_FREEBASE_TOPIC_RESULT -GDATA_IS_FREEBASE_TOPIC_RESULT_CLASS -GDATA_TYPE_FREEBASE_TOPIC_RESULT -GDATA_TYPE_FREEBASE_TOPIC_OBJECT -GDATA_TYPE_FREEBASE_TOPIC_VALUE - -GDataFreebaseTopicResultPrivate -
- -
-gdata-freebase-search-query -GDataFreebaseSearchQuery -GDataFreebaseSearchQuery -GDataFreebaseSearchQueryClass -gdata_freebase_search_query_new -gdata_freebase_search_query_set_language -gdata_freebase_search_query_get_language -gdata_freebase_search_query_set_stemmed -gdata_freebase_search_query_get_stemmed -GDataFreebaseSearchFilterType -gdata_freebase_search_query_open_filter -gdata_freebase_search_query_close_filter -gdata_freebase_search_query_add_filter -gdata_freebase_search_query_add_location - -gdata_freebase_search_query_get_type -GDATA_FREEBASE_SEARCH_QUERY -GDATA_FREEBASE_SEARCH_QUERY_CLASS -GDATA_FREEBASE_SEARCH_QUERY_GET_CLASS -GDATA_IS_FREEBASE_SEARCH_QUERY -GDATA_IS_FREEBASE_SEARCH_QUERY_CLASS -GDATA_TYPE_FREEBASE_SEARCH_QUERY -gdata_freebase_search_filter_type_get_type -GDATA_TYPE_FREEBASE_SEARCH_FILTER_TYPE - -GDataFreebaseSearchQueryPrivate -
- -
-gdata-freebase-search-result -GDataFreebaseSearchResult -GDataFreebaseSearchResult -GDataFreebaseSearchResultClass -GDataFreebaseSearchResultItem -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_mid -gdata_freebase_search_result_item_get_id -gdata_freebase_search_result_item_get_name -gdata_freebase_search_result_item_get_language -gdata_freebase_search_result_item_get_notable_id -gdata_freebase_search_result_item_get_notable_name -gdata_freebase_search_result_item_get_score - -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 -GDATA_IS_FREEBASE_SEARCH_RESULT -GDATA_IS_FREEBASE_SEARCH_RESULT_CLASS -GDATA_TYPE_FREEBASE_SEARCH_RESULT -GDATA_TYPE_FREEBASE_SEARCH_RESULT_ITEM - -GDataFreebaseSearchResultPrivate -
-
gdata-oauth2-authorizer GDataOAuth2Authorizer diff --git a/docs/reference/meson.build b/docs/reference/meson.build index 859ee121..11ed7900 100644 --- a/docs/reference/meson.build +++ b/docs/reference/meson.build @@ -26,7 +26,6 @@ ignore_headers = [ # FIXME: these files are created by enums workaround 'gdata-documents-enums-in.h', 'gdata-enums-in.h', - 'gdata-freebase-enums-in.h', 'gdata-media-enums-in.h', 'gdata-picasaweb-enums-in.h', 'gdata-youtube-enums-in.h', diff --git a/gdata/gdata-core.symbols b/gdata/gdata-core.symbols index 606df7c3..024cf2dc 100644 --- a/gdata/gdata-core.symbols +++ b/gdata/gdata-core.symbols @@ -1043,77 +1043,6 @@ gdata_tasks_service_update_task gdata_tasks_service_update_task_async gdata_tasks_service_update_tasklist gdata_tasks_service_update_tasklist_async -gdata_freebase_service_get_type -gdata_freebase_service_new -gdata_freebase_service_query -gdata_freebase_service_query_async -gdata_freebase_service_get_topic -gdata_freebase_service_get_topic_async -gdata_freebase_service_search -gdata_freebase_service_search_async -gdata_freebase_service_get_image -gdata_freebase_query_get_type -gdata_freebase_query_new -gdata_freebase_query_new_from_variant -gdata_freebase_search_filter_type_get_type -gdata_freebase_search_query_get_type -gdata_freebase_search_query_new -gdata_freebase_search_query_open_filter -gdata_freebase_search_query_close_filter -gdata_freebase_search_query_add_filter -gdata_freebase_search_query_add_location -gdata_freebase_search_query_set_language -gdata_freebase_search_query_get_language -gdata_freebase_search_query_set_stemmed -gdata_freebase_search_query_get_stemmed -gdata_freebase_search_result_get_type -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 -gdata_freebase_search_result_item_get_language -gdata_freebase_search_result_item_get_notable_name -gdata_freebase_search_result_item_get_notable_id -gdata_freebase_search_result_item_get_score -gdata_freebase_topic_query_get_type -gdata_freebase_topic_query_new -gdata_freebase_topic_query_set_filter -gdata_freebase_topic_query_get_filter -gdata_freebase_topic_query_set_language -gdata_freebase_topic_query_get_language -gdata_freebase_topic_object_get_type -gdata_freebase_topic_object_ref -gdata_freebase_topic_object_unref -gdata_freebase_topic_object_list_properties -gdata_freebase_topic_object_get_id -gdata_freebase_topic_object_get_property_count -gdata_freebase_topic_object_get_property_hits -gdata_freebase_topic_object_get_property_value -gdata_freebase_topic_value_get_type -gdata_freebase_topic_value_ref -gdata_freebase_topic_value_unref -gdata_freebase_topic_value_get_property -gdata_freebase_topic_value_get_text -gdata_freebase_topic_value_get_language -gdata_freebase_topic_value_get_creator -gdata_freebase_topic_value_get_timestamp -gdata_freebase_topic_value_get_value_type -gdata_freebase_topic_value_copy_value -gdata_freebase_topic_value_get_int -gdata_freebase_topic_value_get_double -gdata_freebase_topic_value_get_string -gdata_freebase_topic_value_get_object -gdata_freebase_topic_value_is_image -gdata_freebase_topic_result_get_type -gdata_freebase_topic_result_new -gdata_freebase_topic_result_dup_object -gdata_freebase_result_get_type -gdata_freebase_result_new -gdata_freebase_result_dup_variant gdata_oauth2_authorizer_get_type gdata_oauth2_authorizer_new gdata_oauth2_authorizer_new_for_authorization_domains diff --git a/gdata/gdata.h b/gdata/gdata.h index 0858accd..0b6ef6a5 100644 --- a/gdata/gdata.h +++ b/gdata/gdata.h @@ -151,14 +151,4 @@ #include #include -/* Google Freebase */ -#include -#include -#include -#include -#include -#include -#include -#include - #endif /* !GDATA_H */ diff --git a/gdata/services/freebase/gdata-freebase-query.c b/gdata/services/freebase/gdata-freebase-query.c deleted file mode 100644 index 78d5e196..00000000 --- a/gdata/services/freebase/gdata-freebase-query.c +++ /dev/null @@ -1,257 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-query - * @short_description: GData Freebase query object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-query.h - * - * #GDataFreebaseQuery represents a MQL query specific to the Google Freebase service. - * - * This implementation of #GDataQuery respects the gdata_query_set_max_results() call. - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -#include -#include -#include -#include -#include - -#include "gdata-freebase-query.h" -#include "gdata-query.h" -#include "gdata-parser.h" -#include "gdata-private.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -static void gdata_freebase_query_finalize (GObject *self); -static void gdata_freebase_query_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gdata_freebase_query_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec); -static void get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboolean *params_started); - -struct _GDataFreebaseQueryPrivate { - /* These params are here not in GDataQuery due of differently named query params for JSON protocols therefore need for different parse_uri */ - GVariant *variant; - JsonNode *query_node; -}; - -enum { - PROP_VARIANT = 1, -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseQuery, gdata_freebase_query, GDATA_TYPE_QUERY) - -static void -gdata_freebase_query_class_init (GDataFreebaseQueryClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - - gobject_class->finalize = gdata_freebase_query_finalize; - gobject_class->set_property = gdata_freebase_query_set_property; - gobject_class->get_property = gdata_freebase_query_get_property; - - query_class->get_query_uri = get_query_uri; - - /** - * GDataFreebaseQuery:variant: - * - * Variant containing the MQL query. The variant is a very generic container of type "a{smv}", - * containing (possibly nested) Freebase schema types and values. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_VARIANT, - g_param_spec_variant ("variant", - "Variant", - "Variant to construct the query from.", - G_VARIANT_TYPE ("a{smv}"), NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_DEPRECATED)); -} - -static void -gdata_freebase_query_init (GDataFreebaseQuery *self) -{ - self->priv = gdata_freebase_query_get_instance_private (self); - - /* https://developers.google.com/freebase/v1/search#cursor */ - _gdata_query_set_pagination_type (GDATA_QUERY (self), - GDATA_QUERY_PAGINATION_INDEXED); -} - -static void -gdata_freebase_query_finalize (GObject *self) -{ - GDataFreebaseQueryPrivate *priv = GDATA_FREEBASE_QUERY (self)->priv; - - if (priv->variant != NULL) - g_variant_unref (priv->variant); - if (priv->query_node != NULL) - json_node_free (priv->query_node); - /* Chain up to the parent class */ - G_OBJECT_CLASS (gdata_freebase_query_parent_class)->finalize (self); -} - -static void -gdata_freebase_query_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GDataFreebaseQueryPrivate *priv = GDATA_FREEBASE_QUERY (self)->priv; - - switch (prop_id) { - case PROP_VARIANT: - priv->variant = g_value_get_variant (value); - if (priv->variant) - priv->query_node = json_gvariant_serialize (priv->variant); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -gdata_freebase_query_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GDataFreebaseQueryPrivate *priv = GDATA_FREEBASE_QUERY (self)->priv; - - switch (prop_id) { - case PROP_VARIANT: - g_value_set_variant (value, priv->variant); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboolean *params_started) -{ - GDataFreebaseQueryPrivate *priv = GDATA_FREEBASE_QUERY (self)->priv; - const gchar *query; - -#define APPEND_SEP g_string_append_c (query_uri, (*params_started == FALSE) ? '?' : '&'); *params_started = TRUE; - - query = gdata_query_get_q (self); - - if (query != NULL) { - APPEND_SEP; - g_string_append (query_uri, "query="); - g_string_append (query_uri, query); - } else if (priv->query_node != NULL) { - JsonGenerator *generator; - JsonNode *copy; - gchar *json; - guint limit; - - copy = json_node_copy (priv->query_node); - - limit = gdata_query_get_max_results (self); - - if (limit > 0) { - JsonNode *limit_node; - JsonObject *object; - - limit_node = json_node_new (JSON_NODE_VALUE); - json_node_set_int (limit_node, limit); - - object = json_node_get_object (copy); - json_object_set_member (object, "limit", limit_node); - } - - generator = json_generator_new (); - json_generator_set_root (generator, copy); - json = json_generator_to_data (generator, NULL); - g_object_unref (generator); - - APPEND_SEP; - g_string_append (query_uri, "query="); - g_string_append (query_uri, json); - g_free (json); - } - - /* We don't chain up with parent class get_query_uri because it uses - * GData protocol parameters and they aren't compatible with newest API family - */ -#undef APPEND_SEP -} - -/** - * gdata_freebase_query_new: - * @mql: a MQL query string - * - * Creates a new #GDataFreebaseQuery with the MQL query provided in @mql. MQL - * is a JSON-based query language, analogous to SPARQL. To learn more about MQL, - * see the - * MQL overview and - * cookbook. - * - * For detailed information on Freebase schemas, The "Schema" - * section on the main site allows for natural search and navigation through the multiple data properties and domains. - * - * Return value: (transfer full): a new #GDataFreebaseQuery - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseQuery * -gdata_freebase_query_new (const gchar *mql) -{ - g_return_val_if_fail (mql != NULL, NULL); - - return g_object_new (GDATA_TYPE_FREEBASE_QUERY, "q", mql, NULL); -} - -/** - * gdata_freebase_query_new_from_variant: - * @variant: a variant containing the MQL query structure - * - * Creates a new #GDataFreebaseQuery with the MQL query provided in a serialized form as @variant - * of type "a{smv}" containing the JSON data tree of a MQL query. One convenient way - * to build the variant is using json_gvariant_serialize() from a #JsonNode. For more information - * about MQL, see gdata_freebase_query_new(). - * - * #GDataFreebaseQuery takes ownership on @variant, if it has a floating reference, it will be sunk. - * Otherwise an extra reference will be added. - * - * Return value: (transfer full): a new #GDataFreebaseQuery - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseQuery * -gdata_freebase_query_new_from_variant (GVariant *variant) -{ - g_return_val_if_fail (variant != NULL, NULL); - - return g_object_new (GDATA_TYPE_FREEBASE_QUERY, - "variant", g_variant_ref_sink (variant), - NULL); -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-query.h b/gdata/services/freebase/gdata-freebase-query.h deleted file mode 100644 index 28c10701..00000000 --- a/gdata/services/freebase/gdata-freebase-query.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_QUERY_H -#define GDATA_FREEBASE_QUERY_H - -#include -#include - -#include -#include - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#define GDATA_TYPE_FREEBASE_QUERY (gdata_freebase_query_get_type ()) -#define GDATA_FREEBASE_QUERY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_FREEBASE_QUERY, GDataFreebaseQuery)) -#define GDATA_FREEBASE_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_FREEBASE_QUERY, GDataFreebaseQueryClass)) -#define GDATA_IS_FREEBASE_QUERY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_QUERY)) -#define GDATA_IS_FREEBASE_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_QUERY)) -#define GDATA_FREEBASE_QUERY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_QUERY, GDataFreebaseQueryClass)) - -typedef struct _GDataFreebaseQueryPrivate GDataFreebaseQueryPrivate; - -/** - * GDataFreebaseQuery: - * - * All the fields in the #GDataFreebaseQuery structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataQuery parent; - /*< private >*/ - GDataFreebaseQueryPrivate *priv; -} GDataFreebaseQuery; - -/** - * GDataFreebaseQueryClass: - * - * All the fields in the #GDataFreebaseQueryClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - /*< private >*/ - GDataQueryClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataFreebaseQueryClass; - -GType gdata_freebase_query_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseQuery *gdata_freebase_query_new (const gchar *mql) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; -GDataFreebaseQuery *gdata_freebase_query_new_from_variant (GVariant *variant) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_QUERY_H */ diff --git a/gdata/services/freebase/gdata-freebase-result.c b/gdata/services/freebase/gdata-freebase-result.c deleted file mode 100644 index 41cf5064..00000000 --- a/gdata/services/freebase/gdata-freebase-result.c +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-result - * @short_description: GData Freebase result object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-result.h - * - * #GDataFreebaseResult is a subclass of #GDataEntry to represent the result of a Google Freebase MQL query. - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -#include -#include -#include -#include - -#include "gdata-freebase-result.h" -#include "gdata-private.h" -#include "gdata-types.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -#define URLBASE "https://www.googleapis.com/freebase/v1/" - -enum { - PROP_VARIANT = 1 -}; - -struct _GDataFreebaseResultPrivate { - GVariant *result; -}; - -static void gdata_freebase_result_finalize (GObject *self); -static void gdata_freebase_result_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec); -static gboolean parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error); -static const gchar *get_content_type (void); -static gchar *get_entry_uri (const gchar *id); - -G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseResult, gdata_freebase_result, GDATA_TYPE_ENTRY) - -static void -gdata_freebase_result_class_init (GDataFreebaseResultClass *klass) -{ - GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - GDataEntryClass *entry_class = GDATA_ENTRY_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->finalize = gdata_freebase_result_finalize; - gobject_class->get_property = gdata_freebase_result_get_property; - - parsable_class->parse_json = parse_json; - parsable_class->get_content_type = get_content_type; - entry_class->get_entry_uri = get_entry_uri; - - /** - * GDataFreebaseResult:variant: - * - * Variant containing the MQL result. The variant is a very generic container of type "a{smv}", - * containing (possibly nested) Freebase schema types and values. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_VARIANT, - g_param_spec_variant ("variant", - "Variant", "Variant holding the raw result.", - G_VARIANT_TYPE ("a{smv}"), NULL, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | - G_PARAM_DEPRECATED)); -} - -static void -gdata_freebase_result_init (GDataFreebaseResult *self) -{ - self->priv = gdata_freebase_result_get_instance_private (self); -} - -static void -gdata_freebase_result_finalize (GObject *self) -{ - GDataFreebaseResultPrivate *priv = GDATA_FREEBASE_RESULT (self)->priv; - - if (priv->result != NULL) - g_variant_unref (priv->result); - - G_OBJECT_CLASS (gdata_freebase_result_parent_class)->finalize (self); -} - -static void -gdata_freebase_result_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GDataFreebaseResultPrivate *priv = GDATA_FREEBASE_RESULT (self)->priv; - - switch (prop_id) { - case PROP_VARIANT: - g_value_set_variant (value, priv->result); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static gboolean -parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error) -{ - GDataFreebaseResultPrivate *priv = GDATA_FREEBASE_RESULT (parsable)->priv; - JsonNode *root, *node; - JsonObject *object; - - if (g_strcmp0 (json_reader_get_member_name (reader), "result") != 0) - return TRUE; - - g_object_get (reader, "root", &root, NULL); - object = json_node_get_object (root); - node = json_object_get_member (object, "result"); - - priv->result = g_variant_ref_sink (json_gvariant_deserialize (node, NULL, error)); - json_node_free (root); - - return (priv->result != NULL); -} - -static const gchar * -get_content_type (void) -{ - return "application/json"; -} - -static gchar * -get_entry_uri (const gchar *id) -{ - /* https://www.googleapis.com/freebase/v1/mqlread interface */ - return g_strconcat (URLBASE, id, NULL); -} - -/** - * gdata_freebase_result_new: - * - * Creates a new #GDataFreebaseResult. - * - * Return value: (transfer full): a new #GDataFreebaseResult; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseResult * -gdata_freebase_result_new (void) -{ - return g_object_new (GDATA_TYPE_FREEBASE_RESULT, NULL); -} - -/** - * gdata_freebase_result_dup_variant: - * @self: a #GDataFreebaseResult - * - * Gets the result serialized as a #GVariant of type "a{smv}", containing the JSON - * data tree. This variant can be alternatively processed through json_gvariant_serialize(). - * - * Returns: (allow-none) (transfer full): the serialized result, or %NULL; unref with g_variant_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GVariant * -gdata_freebase_result_dup_variant (GDataFreebaseResult *self) -{ - GDataFreebaseResultPrivate *priv; - - g_return_val_if_fail (GDATA_IS_FREEBASE_RESULT (self), NULL); - - priv = self->priv; - - if (priv->result == NULL) - return NULL; - - return g_variant_ref (priv->result); -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-result.h b/gdata/services/freebase/gdata-freebase-result.h deleted file mode 100644 index 1f4950ce..00000000 --- a/gdata/services/freebase/gdata-freebase-result.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_RESULT_H -#define GDATA_FREEBASE_RESULT_H - -#include -#include - -#include -#include - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#define GDATA_TYPE_FREEBASE_RESULT (gdata_freebase_result_get_type ()) -#define GDATA_FREEBASE_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_FREEBASE_RESULT, GDataFreebaseResult)) -#define GDATA_FREEBASE_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_FREEBASE_RESULT, GDataFreebaseResultClass)) -#define GDATA_IS_FREEBASE_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_RESULT)) -#define GDATA_IS_FREEBASE_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_RESULT)) -#define GDATA_FREEBASE_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_RESULT, GDataFreebaseResultClass)) - -typedef struct _GDataFreebaseResultPrivate GDataFreebaseResultPrivate; - -/** - * GDataFreebaseResult: - * - * All the fields in the #GDataFreebaseResult structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataEntry parent; - GDataFreebaseResultPrivate *priv; -} GDataFreebaseResult; - -/** - * GDataFreebaseResultClass: - * - * All the fields in the #GDataFreebaseResultClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ - -typedef struct { - /*< private >*/ - GDataEntryClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataFreebaseResultClass; - -GType gdata_freebase_result_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseResult *gdata_freebase_result_new (void) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; -GVariant *gdata_freebase_result_dup_variant (GDataFreebaseResult *self) G_GNUC_WARN_UNUSED_RESULT G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_RESULT_H */ diff --git a/gdata/services/freebase/gdata-freebase-search-query.c b/gdata/services/freebase/gdata-freebase-search-query.c deleted file mode 100644 index 3b680e07..00000000 --- a/gdata/services/freebase/gdata-freebase-search-query.c +++ /dev/null @@ -1,624 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-search-query - * @short_description: GData Freebase query object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-query.h - * - * #GDataFreebaseQuery represents a collection of query parameters specific to the Google Freebase service. - * a #GDataFreebaseQuery is built on top of a search term, further filters can be set on the search query - * through gdata_freebase_search_query_add_filter() or gdata_freebase_search_query_add_location(). The filters - * can be nested in sublevels, created through gdata_freebase_search_query_open_filter() - * and gdata_freebase_search_query_close_filter(). - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -#include -#include -#include -#include -#include - -#include "gdata-freebase-search-query.h" -#include "gdata-query.h" -#include "gdata-parser.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -static void gdata_freebase_search_query_finalize (GObject *self); -static void gdata_freebase_search_query_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gdata_freebase_search_query_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec); -static void get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboolean *params_started); - -typedef enum { - NODE_CONTAINER, - NODE_VALUE, - NODE_LOCATION -} FilterNodeType; - -typedef union { - FilterNodeType type; - - struct { - FilterNodeType type; - GDataFreebaseSearchFilterType filter_type; - GPtrArray *child_nodes; /* Contains owned FilterNode structs */ - } container; - - struct { - FilterNodeType type; - gchar *property; - gchar *value; - } value; - - struct { - FilterNodeType type; - guint64 radius; - gdouble lat; - gdouble lon; - } location; -} FilterNode; - -struct _GDataFreebaseSearchQueryPrivate { - FilterNode *filter; - GList *filter_stack; /* Contains unowned FilterNode structs */ - - gchar *lang; - guint stemmed : 1; -}; - -enum { - PROP_LANGUAGE = 1, - PROP_STEMMED -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseSearchQuery, gdata_freebase_search_query, GDATA_TYPE_QUERY) - -static void -gdata_freebase_search_query_class_init (GDataFreebaseSearchQueryClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - - gobject_class->finalize = gdata_freebase_search_query_finalize; - gobject_class->set_property = gdata_freebase_search_query_set_property; - gobject_class->get_property = gdata_freebase_search_query_get_property; - - query_class->get_query_uri = get_query_uri; - - /** - * GDataFreebaseSearchQuery:language: - * - * Language used for search results, in ISO-639-1 format. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_LANGUAGE, - g_param_spec_string ("language", - "Language used for results", - "Language in ISO-639-1 format.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_DEPRECATED)); - /** - * GDataFreebaseSearchQuery:stemmed: - * - * Whether word stemming should happen on the search terms. If this property is enabled, - * words like eg. "natural", "naturally" or "nature" would be all reduced to the root "natur" - * for search purposes. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_STEMMED, - g_param_spec_boolean ("stemmed", - "Stem search terms", - "Whether the search terms should be stemmed", - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_DEPRECATED)); -} - -static void -gdata_freebase_search_query_init (GDataFreebaseSearchQuery *self) -{ - self->priv = gdata_freebase_search_query_get_instance_private (self); -} - -static void -_free_filter_node (FilterNode *node) -{ - switch (node->type) { - case NODE_CONTAINER: - g_ptr_array_unref (node->container.child_nodes); - break; - case NODE_VALUE: - g_free (node->value.property); - g_free (node->value.value); - break; - case NODE_LOCATION: - default: - break; - } - - g_slice_free (FilterNode, node); -} - -static void -gdata_freebase_search_query_finalize (GObject *self) -{ - GDataFreebaseSearchQueryPrivate *priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - - g_free (priv->lang); - g_list_free (priv->filter_stack); - - if (priv->filter != NULL) - _free_filter_node (priv->filter); - - /* Chain up to the parent class */ - G_OBJECT_CLASS (gdata_freebase_search_query_parent_class)->finalize (self); -} - -static void -gdata_freebase_search_query_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GDataFreebaseSearchQuery *query = GDATA_FREEBASE_SEARCH_QUERY (self); - - switch (prop_id) { - case PROP_LANGUAGE: - gdata_freebase_search_query_set_language (query, g_value_get_string (value)); - break; - case PROP_STEMMED: - gdata_freebase_search_query_set_stemmed (query, g_value_get_boolean (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -gdata_freebase_search_query_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GDataFreebaseSearchQueryPrivate *priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - - switch (prop_id) { - case PROP_LANGUAGE: - g_value_set_string (value, priv->lang); - break; - case PROP_STEMMED: - g_value_set_boolean (value, priv->stemmed); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -build_filter_string (FilterNode *node, - GString *str) -{ - switch (node->type) { - case NODE_CONTAINER: - { - /* Array matches GDataFreebaseSearchFilterType */ - const gchar *type_str[] = { "all", "any", "not" }; - guint i; - - g_assert (/* node->container.filter_type >= 0 && */ - node->container.filter_type < G_N_ELEMENTS (type_str)); - - g_string_append_printf (str, "(%s", type_str[node->container.filter_type]); - - for (i = 0; i < node->container.child_nodes->len; i++) - build_filter_string (g_ptr_array_index (node->container.child_nodes, i), str); - - g_string_append (str, ")"); - break; - } - case NODE_VALUE: - { - gchar *escaped; - - escaped = g_strescape (node->value.value, NULL); - g_string_append_printf (str, " %s:\"%s\"", node->value.property, escaped); - g_free (escaped); - break; - } - case NODE_LOCATION: - { - gchar lon_str[G_ASCII_DTOSTR_BUF_SIZE], lat_str[G_ASCII_DTOSTR_BUF_SIZE]; - - g_ascii_formatd (lon_str, G_ASCII_DTOSTR_BUF_SIZE, "%.4f", node->location.lon); - g_ascii_formatd (lat_str, G_ASCII_DTOSTR_BUF_SIZE, "%.4f", node->location.lat); - g_string_append_printf (str, "(within radius:%" G_GUINT64_FORMAT "m lon:%s lat:%s)", - node->location.radius, lon_str, lat_str); - break; - } - default: - g_assert_not_reached (); - break; - } -} - -static void -get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboolean *params_started) -{ - GDataFreebaseSearchQueryPrivate *priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - const gchar *query, *lang = NULL; - gint64 updated_max; - guint cur, limit; - -#define APPEND_SEP g_string_append_c (query_uri, (*params_started == FALSE) ? '?' : '&'); *params_started = TRUE; - - query = gdata_query_get_q (self); - - if (query != NULL) { - APPEND_SEP; - g_string_append (query_uri, "query="); - g_string_append (query_uri, query); - } - - if (priv->filter != NULL) { - GString *str = g_string_new (NULL); - - build_filter_string (priv->filter, str); - - APPEND_SEP; - g_string_append (query_uri, "filter="); - g_string_append (query_uri, str->str); - g_string_free (str, TRUE); - } - - updated_max = gdata_query_get_updated_max (self); - - if (updated_max != -1) { - gchar *date_str; - - date_str = gdata_parser_int64_to_iso8601 (updated_max); - - APPEND_SEP; - g_string_append (query_uri, "as_of_time="); - g_string_append (query_uri, date_str); - g_free (date_str); - } - - if (priv->lang != NULL) { - lang = priv->lang; - } else { - const gchar * const *user_languages; - GString *lang_str = NULL; - gint i; - - user_languages = g_get_language_names (); - - for (i = 0; user_languages[i] != NULL; i++) { - if (strlen (user_languages[i]) != 2) - continue; - - if (!lang_str) - lang_str = g_string_new (user_languages[i]); - else - g_string_append_printf (lang_str, ",%s", user_languages[i]); - } - - lang = g_string_free (lang_str, FALSE); - } - - APPEND_SEP; - g_string_append (query_uri, "lang="); - g_string_append (query_uri, lang); - - if (priv->stemmed) { - APPEND_SEP; - g_string_append (query_uri, "stemmed=true"); - } - - cur = gdata_query_get_start_index (self); - - if (cur > 0) { - APPEND_SEP; - g_string_append_printf (query_uri, "cursor=%d", cur); - } - - limit = gdata_query_get_max_results (self); - - if (limit > 0) { - APPEND_SEP; - g_string_append_printf (query_uri, "limit=%d", limit); - } - - /* We don't chain up with parent class get_query_uri because it uses - * GData protocol parameters and they aren't compatible with newest API family - */ -#undef APPEND_SEP -} - -/** - * gdata_freebase_search_query_new: - * @search_terms: string to search for - * - * Creates a new #GDataFreebaseSearchQuery prepared to search for Freebase elements that - * match the given @search_terms. Further filters on the query can be set through - * gdata_freebase_search_query_add_filter() or gdata_freebase_search_query_add_location(). - * - * Return value: (transfer full): a new #GDataFreebaseSearchQuery; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseSearchQuery * -gdata_freebase_search_query_new (const gchar *search_terms) -{ - g_return_val_if_fail (search_terms != NULL, NULL); - return g_object_new (GDATA_TYPE_FREEBASE_SEARCH_QUERY, "q", search_terms, NULL); -} - -/** - * gdata_freebase_search_query_open_filter: - * @self: a #GDataFreebaseSearchQuery - * @filter_type: filter type - * - * Opens a container of filter rules, those are applied according to the behavior specified by @filter_type. - * Every call to this function must be paired by a call to gdata_freebase_search_query_close_filter(). - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_search_query_open_filter (GDataFreebaseSearchQuery *self, GDataFreebaseSearchFilterType filter_type) -{ - GDataFreebaseSearchQueryPrivate *priv; - FilterNode *current_node, *node; - - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self)); - - priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - - node = g_slice_new0 (FilterNode); - node->type = NODE_CONTAINER; - node->container.filter_type = filter_type; - node->container.child_nodes = g_ptr_array_new_with_free_func ((GDestroyNotify) _free_filter_node); - - if (priv->filter_stack != NULL) { - current_node = priv->filter_stack->data; - g_ptr_array_add (current_node->container.child_nodes, node); - } else if (priv->filter == NULL) { - priv->filter = node; - } else { - g_assert_not_reached (); - } - - priv->filter_stack = g_list_prepend (priv->filter_stack, node); -} - -/** - * gdata_freebase_search_query_close_filter: - * @self: a #GDataFreebaseSearchQuery - * - * Closes a filter level. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_search_query_close_filter (GDataFreebaseSearchQuery *self) -{ - GDataFreebaseSearchQueryPrivate *priv; - - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self)); - - priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - - if (priv->filter_stack == NULL) - g_assert_not_reached (); - - priv->filter_stack = g_list_delete_link (priv->filter_stack, priv->filter_stack); -} - -/** - * gdata_freebase_search_query_add_filter: - * @self: a #GDataFreebaseSearchQuery - * @property: Freebase property ID - * @value: match string - * - * Adds a property filter to the query. property filters are always nested in - * containers, opened and closed through gdata_freebase_search_query_open_filter() - * and gdata_freebase_search_query_close_filter(). - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_search_query_add_filter (GDataFreebaseSearchQuery *self, const gchar *property, const gchar *value) -{ - GDataFreebaseSearchQueryPrivate *priv; - FilterNode *current_node, *node; - - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self)); - g_return_if_fail (property != NULL && value != NULL); - - priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - - if (priv->filter_stack == NULL) { - g_critical ("A filter container must be opened before through " - "gdata_freebase_search_query_open_filter()"); - g_assert_not_reached (); - } - - node = g_slice_new0 (FilterNode); - node->type = NODE_VALUE; - node->value.property = g_strdup (property); - node->value.value = g_strdup (value); - - current_node = priv->filter_stack->data; - g_ptr_array_add (current_node->container.child_nodes, node); -} - -/** - * gdata_freebase_search_query_add_location: - * @self: a #GDataFreebaseSearchQuery - * @radius: radius in meters - * @lat: latitude - * @lon: longitude - * - * Adds a geolocation filter to the query. location filters are always nested in - * containers, opened and closed through gdata_freebase_search_query_open_filter() - * and gdata_freebase_search_query_close_filter(). - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_search_query_add_location (GDataFreebaseSearchQuery *self, guint64 radius, gdouble lat, gdouble lon) -{ - GDataFreebaseSearchQueryPrivate *priv = GDATA_FREEBASE_SEARCH_QUERY (self)->priv; - FilterNode *current_node, *node; - - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self)); - - if (priv->filter_stack == NULL) { - g_critical ("A filter container must be opened before through " - "gdata_freebase_search_query_open_filter()"); - g_assert_not_reached (); - } - - node = g_slice_new0 (FilterNode); - node->type = NODE_LOCATION; - node->location.radius = radius; - node->location.lat = lat; - node->location.lon = lon; - - current_node = priv->filter_stack->data; - g_ptr_array_add (current_node->container.child_nodes, node); -} - -/** - * gdata_freebase_search_query_set_language: - * @self: a #GDataFreebaseSearchQuery - * @lang: (allow-none): Language used on the search terms and results, in ISO-639-1 format, or %NULL to unset. - * - * Sets the language used, both on the search terms and the results. If unset, - * the locale preferences will be respected. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_search_query_set_language (GDataFreebaseSearchQuery *self, - const gchar *lang) -{ - GDataFreebaseSearchQueryPrivate *priv; - - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self)); - g_return_if_fail (!lang || strlen (lang) == 2); - - priv = self->priv; - - if (g_strcmp0 (priv->lang, lang) == 0) - return; - - g_free (priv->lang); - priv->lang = g_strdup (lang); - g_object_notify (G_OBJECT (self), "language"); -} - -/** - * gdata_freebase_search_query_get_language: - * @self: a #GDataFreebaseSearchQuery - * - * Gets the language set on the search query, or %NULL if unset. - * - * Return value: (allow-none): The language used on the query. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_query_get_language (GDataFreebaseSearchQuery *self) -{ - GDataFreebaseSearchQueryPrivate *priv; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self), NULL); - - priv = self->priv; - return priv->lang; -} - -/** - * gdata_freebase_search_query_set_stemmed: - * @self: a #GDataFreebaseSearchQuery - * @stemmed: %TRUE to perform stemming on the search results - * - * Sets whether stemming is performed on the provided search terms. If @stemmed is %TRUE, - * words like eg. "natural", "naturally" or "nature" would be all reduced to the root "natur" - * for search purposes. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_search_query_set_stemmed (GDataFreebaseSearchQuery *self, - gboolean stemmed) -{ - GDataFreebaseSearchQueryPrivate *priv; - - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self)); - - priv = self->priv; - - if (priv->stemmed == stemmed) - return; - - priv->stemmed = stemmed; - g_object_notify (G_OBJECT (self), "stemmed"); -} - -/** - * gdata_freebase_search_query_get_stemmed: - * @self: a #GDataFreebaseSearchQuery - * - * Returns whether the #GDataFreebaseSearchQuery will perform stemming on the search terms. - * - * Return value: %TRUE if the #GDataFreebaseSearchQuery performs stemming - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -gboolean -gdata_freebase_search_query_get_stemmed (GDataFreebaseSearchQuery *self) -{ - GDataFreebaseSearchQueryPrivate *priv; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (self), FALSE); - - priv = self->priv; - return priv->stemmed; -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-search-query.h b/gdata/services/freebase/gdata-freebase-search-query.h deleted file mode 100644 index 7c7927b2..00000000 --- a/gdata/services/freebase/gdata-freebase-search-query.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_SEARCH_QUERY_H -#define GDATA_FREEBASE_SEARCH_QUERY_H - -#include -#include - -#include -#include - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#define GDATA_TYPE_FREEBASE_SEARCH_QUERY (gdata_freebase_search_query_get_type ()) -#define GDATA_FREEBASE_SEARCH_QUERY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_FREEBASE_SEARCH_QUERY, GDataFreebaseSearchQuery)) -#define GDATA_FREEBASE_SEARCH_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_FREEBASE_SEARCH_QUERY, GDataFreebaseSearchQueryClass)) -#define GDATA_IS_FREEBASE_SEARCH_QUERY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_SEARCH_QUERY)) -#define GDATA_IS_FREEBASE_SEARCH_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_SEARCH_QUERY)) -#define GDATA_FREEBASE_SEARCH_QUERY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_SEARCH_QUERY, GDataFreebaseSearchQueryClass)) - -typedef struct _GDataFreebaseSearchQueryPrivate GDataFreebaseSearchQueryPrivate; - -/** - * GDataFreebaseSearchFilterType: - * @GDATA_FREEBASE_SEARCH_FILTER_ALL: all enclosed elements must match, logically an AND - * @GDATA_FREEBASE_SEARCH_FILTER_ANY: any of the enclosed elements must match, logically an OR - * @GDATA_FREEBASE_SEARCH_FILTER_NOT: the match is inverted. - * - * Search filter container types. - * - * Since: 0.15.1 - */ -typedef enum { - GDATA_FREEBASE_SEARCH_FILTER_ALL, - GDATA_FREEBASE_SEARCH_FILTER_ANY, - GDATA_FREEBASE_SEARCH_FILTER_NOT -} GDataFreebaseSearchFilterType; - -/** - * GDataFreebaseSearchQuery: - * - * All the fields in the #GDataFreebaseSearchQuery structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataQuery parent; - GDataFreebaseSearchQueryPrivate *priv; -} GDataFreebaseSearchQuery; - -/** - * GDataFreebaseSearchQueryClass: - * - * All the fields in the #GDataFreebaseSearchQueryClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - /*< private >*/ - GDataQueryClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataFreebaseSearchQueryClass; - -GType gdata_freebase_search_query_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseSearchQuery *gdata_freebase_search_query_new (const gchar *search_terms) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; - -void gdata_freebase_search_query_open_filter (GDataFreebaseSearchQuery *self, GDataFreebaseSearchFilterType filter_type) G_GNUC_DEPRECATED; -void gdata_freebase_search_query_close_filter (GDataFreebaseSearchQuery *self) G_GNUC_DEPRECATED; -void gdata_freebase_search_query_add_filter (GDataFreebaseSearchQuery *self, const gchar *property, const gchar *value) G_GNUC_DEPRECATED; -void gdata_freebase_search_query_add_location (GDataFreebaseSearchQuery *self, guint64 radius, gdouble lat, gdouble lon) G_GNUC_DEPRECATED; - -void gdata_freebase_search_query_set_language (GDataFreebaseSearchQuery *self, const gchar *lang) G_GNUC_DEPRECATED; -const gchar * gdata_freebase_search_query_get_language (GDataFreebaseSearchQuery *self) G_GNUC_DEPRECATED; - -void gdata_freebase_search_query_set_stemmed (GDataFreebaseSearchQuery *self, gboolean stemmed) G_GNUC_DEPRECATED; -gboolean gdata_freebase_search_query_get_stemmed (GDataFreebaseSearchQuery *self) G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_SEARCH_QUERY_H */ diff --git a/gdata/services/freebase/gdata-freebase-search-result.c b/gdata/services/freebase/gdata-freebase-search-result.c deleted file mode 100644 index 0824c1e1..00000000 --- a/gdata/services/freebase/gdata-freebase-search-result.c +++ /dev/null @@ -1,430 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-search-result - * @short_description: GData Freebase search result object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-result.h - * - * #GDataFreebaseSearchResult is a subclass of #GDataEntry to represent the result of a Freebase search query. - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -#include -#include -#include -#include - -#include "gdata-freebase-search-result.h" -#include "gdata-private.h" -#include "gdata-types.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -#define URLBASE "https://www.googleapis.com/freebase/v1" - -struct _GDataFreebaseSearchResultItem { - gchar *mid; - gchar *id; - gchar *name; - gchar *lang; - gchar *notable_id; - gchar *notable_name; - gdouble score; -}; - -struct _GDataFreebaseSearchResultPrivate { - GPtrArray *items; /* contains owned GDataFreebaseSearchResultItem structs */ - guint total_hits; -}; - -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_WITH_PRIVATE (GDataFreebaseSearchResult, gdata_freebase_search_result, GDATA_TYPE_FREEBASE_RESULT) - -static void -gdata_freebase_search_result_class_init (GDataFreebaseSearchResultClass *klass) -{ - GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->finalize = gdata_freebase_search_result_finalize; - parsable_class->parse_json = parse_json; -} - -static GDataFreebaseSearchResultItem * -item_new (void) -{ - return g_slice_new0 (GDataFreebaseSearchResultItem); -} - -static void -item_free (GDataFreebaseSearchResultItem *item) -{ - g_free (item->mid); - g_free (item->id); - g_free (item->name); - g_free (item->lang); - g_free (item->notable_id); - g_free (item->notable_name); - 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) -{ - self->priv = gdata_freebase_search_result_get_instance_private (self); - self->priv->items = g_ptr_array_new_with_free_func ((GDestroyNotify) item_free); -} - -static void -gdata_freebase_search_result_finalize (GObject *self) -{ - GDataFreebaseSearchResultPrivate *priv = GDATA_FREEBASE_SEARCH_RESULT (self)->priv; - - g_ptr_array_unref (priv->items); - - G_OBJECT_CLASS (gdata_freebase_search_result_parent_class)->finalize (self); -} - -static gboolean -parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error) -{ - GDataFreebaseSearchResultPrivate *priv = GDATA_FREEBASE_SEARCH_RESULT (parsable)->priv; - const GError *inner_error = NULL; - const gchar *member_name; - gint count, i; - - GDATA_PARSABLE_CLASS (gdata_freebase_search_result_parent_class)->parse_json (parsable, reader, user_data, error); - -#define ITEM_SET_STRING(id,field,mandatory) \ - json_reader_read_member (reader, #id); \ - item->field = g_strdup (json_reader_get_string_value (reader)); \ - if (mandatory) { \ - inner_error = json_reader_get_error (reader); \ - if (inner_error != NULL) goto item_error; \ - } \ - json_reader_end_member (reader); - -#define ITEM_SET_DOUBLE(id,field) \ - json_reader_read_member (reader, #id); \ - item->field = json_reader_get_double_value (reader); \ - inner_error = json_reader_get_error (reader); \ - if (inner_error != NULL) goto item_error; \ - json_reader_end_member (reader); - - member_name = json_reader_get_member_name (reader); - - if (member_name == NULL) - return FALSE; - - if (strcmp (member_name, "hits") == 0) { - priv->total_hits = json_reader_get_int_value (reader); - return TRUE; - } else if (strcmp (member_name, "result") != 0) { - /* Avoid anything else besides hits/result */ - return TRUE; - } - - if (!json_reader_is_array (reader)) - return FALSE; - - count = json_reader_count_elements (reader); - - for (i = 0; i < count; i++) { - GDataFreebaseSearchResultItem *item; - - item = item_new (); - json_reader_read_element (reader, i); - - ITEM_SET_STRING (mid, mid, TRUE); - ITEM_SET_STRING (id, id, FALSE); - ITEM_SET_STRING (name, name, TRUE); - ITEM_SET_STRING (lang, lang, FALSE); - ITEM_SET_DOUBLE (score, score); - - /* Read "notable" */ - json_reader_read_member (reader, "notable"); - - if (json_reader_get_error (reader) == NULL) { - ITEM_SET_STRING (id, notable_id, TRUE); - ITEM_SET_STRING (name, notable_name, TRUE); - } - - json_reader_end_member (reader); - json_reader_end_element (reader); - - g_ptr_array_add (priv->items, item); - continue; - - item_error: - item_free (item); - gdata_parser_error_required_json_content_missing (reader, error); - return FALSE; - } - -#undef ITEM_SET_DOUBLE -#undef ITEM_SET_STRING - - return TRUE; -} - -/** - * gdata_freebase_search_result_new: - * - * Creates a new #GDataFreebaseSearchResult with the given ID and default properties. - * - * Return value: (transfer full): a new #GDataFreebaseSearchResult; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseSearchResult * -gdata_freebase_search_result_new (void) -{ - return g_object_new (GDATA_TYPE_FREEBASE_SEARCH_RESULT, NULL); -} - -/** - * gdata_freebase_search_result_get_num_items: - * @self: a #GDataFreebaseSearchResult - * - * Returns the number of items contained in this result. - * - * Returns: The number of items - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -guint -gdata_freebase_search_result_get_num_items (GDataFreebaseSearchResult *self) -{ - g_return_val_if_fail (GDATA_IS_FREEBASE_SEARCH_RESULT (self), 0); - - return self->priv->items->len; -} - -/** - * gdata_freebase_search_result_get_total_hits: - * @self: a #GDataFreebaseSearchResult - * - * Returns the total number of hits found for the search query. - * - * Returns: the total number of hits. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -guint -gdata_freebase_search_result_get_total_hits (GDataFreebaseSearchResult *self) -{ - g_return_val_if_fail (GDATA_IS_FREEBASE_SEARCH_RESULT (self), 0); - - return self->priv->total_hits; -} - -/** - * gdata_freebase_search_result_get_item: - * @self: a #GDataFreebaseSearchResult - * @i: number of item to retrieve - * - * Gets an item from the search result. - * - * Returns: (transfer none) (allow-none): a search result item, or %NULL on invalid item. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const GDataFreebaseSearchResultItem * -gdata_freebase_search_result_get_item (GDataFreebaseSearchResult *self, guint i) -{ - GDataFreebaseSearchResultPrivate *priv; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SEARCH_RESULT (self), NULL); - - priv = self->priv; - g_return_val_if_fail (i < priv->items->len, NULL); - - return g_ptr_array_index (priv->items, i); -} - -/** - * gdata_freebase_search_result_item_get_mid: - * @item: a #GDataFreebaseSearchResultItem - * - * Returns the machine-encoded ID (MID) of the search result item. Elements may - * have a single MID, as opposed to the potentially multiple Freebase IDs that - * may point to it. MIDs are usable interchangeably with Freebase IDs. - * - * Returns: (transfer none): The result item MID. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_result_item_get_mid (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - return item->mid; -} - -/** - * gdata_freebase_search_result_item_get_id: - * @item: a #GDataFreebaseSearchResultItem - * - * Returns the Freebase ID of the search result item. - * - * Returns: (transfer none): The search result item Freebase ID. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_result_item_get_id (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - - if (item->id != NULL) - return item->id; - - return item->mid; -} - -/** - * gdata_freebase_search_result_item_get_name: - * @item: a #GDataFreebaseSearchResultItem - * - * Returns the human readable name of the search result item. - * - * Returns: (transfer none): The human readable name of the item. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_result_item_get_name (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - return item->name; -} - -/** - * gdata_freebase_search_result_item_get_language: - * @item: a #GDataFreebaseSearchResultItem - * - * Gets the language of this search result item, in ISO-639-1 format. - * - * Returns: (transfer none): The language of the search result item. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_result_item_get_language (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - return item->lang; -} - -/** - * gdata_freebase_search_result_item_get_notable_id: - * @item: a #GDataFreebaseSearchResultItem - * - * If this search result item is notable in an specific topic, this function - * returns the Freebase ID of this topic. - * - * Returns: (transfer none) (allow-none): The topic the result item is most notable of, or %NULL. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_result_item_get_notable_id (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - return item->notable_id; -} - -/** - * gdata_freebase_search_result_item_get_notable_name: - * @item: a #GDataFreebaseSearchResultItem - * - * If this search result item is notable in an specific topic, this function - * returns the human readable name of this topic. - * - * Returns: (transfer none) (allow-none): The human readable topic name, or %NULL - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_search_result_item_get_notable_name (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, NULL); - return item->notable_name; -} - -/** - * gdata_freebase_search_result_item_get_score: - * @item: a #GDataFreebaseSearchResultItem - * - * Returns the score of this search result item. The higher, the more relevant this - * item seems, given the search terms. - * - * Returns: the result item score. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -gdouble -gdata_freebase_search_result_item_get_score (const GDataFreebaseSearchResultItem *item) -{ - g_return_val_if_fail (item != NULL, 0.0); - return item->score; -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-search-result.h b/gdata/services/freebase/gdata-freebase-search-result.h deleted file mode 100644 index 299bc9b1..00000000 --- a/gdata/services/freebase/gdata-freebase-search-result.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_SEARCH_RESULT_H -#define GDATA_FREEBASE_SEARCH_RESULT_H - -#include -#include - -#include -#include "gdata-freebase-result.h" - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#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)) -#define GDATA_IS_FREEBASE_SEARCH_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_SEARCH_RESULT)) -#define GDATA_IS_FREEBASE_SEARCH_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_SEARCH_RESULT)) -#define GDATA_FREEBASE_SEARCH_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_SEARCH_RESULT, GDataFreebaseSearchResultClass)) - -typedef struct _GDataFreebaseSearchResultPrivate GDataFreebaseSearchResultPrivate; - -/** - * GDataFreebaseSearchResultItem: - * - * Opaque struct holding data for a single search result item. - * - * Since: 0.15.1 - */ -typedef struct _GDataFreebaseSearchResultItem GDataFreebaseSearchResultItem; - -/** - * GDataFreebaseSearchResult: - * - * All the fields in the #GDataFreebaseSearchResult structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataFreebaseResult parent; - GDataFreebaseSearchResultPrivate *priv; -} GDataFreebaseSearchResult; - -/** - * GDataFreebaseSearchResultClass: - * - * All the fields in the #GDataFreebaseSearchResultClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ - -typedef struct { - /*< private >*/ - GDataFreebaseResultClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataFreebaseSearchResultClass; - -GType gdata_freebase_search_result_item_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; -GType gdata_freebase_search_result_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseSearchResult *gdata_freebase_search_result_new (void) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; - -guint gdata_freebase_search_result_get_num_items (GDataFreebaseSearchResult *self) G_GNUC_DEPRECATED; -guint gdata_freebase_search_result_get_total_hits (GDataFreebaseSearchResult *self) G_GNUC_DEPRECATED; - -const GDataFreebaseSearchResultItem *gdata_freebase_search_result_get_item (GDataFreebaseSearchResult *self, guint i) G_GNUC_DEPRECATED; - -const gchar *gdata_freebase_search_result_item_get_mid (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_search_result_item_get_id (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_search_result_item_get_name (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_search_result_item_get_language (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_search_result_item_get_notable_id (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_search_result_item_get_notable_name (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; -gdouble gdata_freebase_search_result_item_get_score (const GDataFreebaseSearchResultItem *item) G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_SEARCH_RESULT_H */ diff --git a/gdata/services/freebase/gdata-freebase-service.c b/gdata/services/freebase/gdata-freebase-service.c deleted file mode 100644 index 41ce5c22..00000000 --- a/gdata/services/freebase/gdata-freebase-service.c +++ /dev/null @@ -1,507 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-service - * @short_description: GData Freebase service object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-service.h - * - * #GDataFreebaseService is a subclass of #GDataService for communicating with the Google Freebase API. It supports queries - * in MQL format, that allows highly flexible queries on any topic. MQL is a JSON based query language, MQL requests consist - * of a mix of defined and empty values for types in the Freebase schema, those "placeholder" values will be filled in on the - * reply. For more information and examples, see the - * MQL overview page. - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since August 2016, [Google has retired Freebase](https://developers.google.com/freebase/), - * so all of these APIs will return an error if used; and should be considered - * deprecated. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -#include -#include -#include -#include - -#include "gdata-freebase-service.h" -#include "gdata-freebase-result.h" -#include "gdata-freebase-search-result.h" -#include "gdata-service.h" -#include "gdata-private.h" -#include "gdata-query.h" -#include "gdata-feed.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -/* Standards reference at https://developers.google.com/freebase/v1/ */ - -#define URLBASE "://www.googleapis.com/freebase/v1" -#define IMAGE_URI_PREFIX "https://usercontent.googleapis.com/freebase/v1/image" - -enum { - PROP_DEVELOPER_KEY = 1 -}; - -struct _GDataFreebaseServicePrivate { - gchar *developer_key; -}; - -static void gdata_freebase_service_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gdata_freebase_service_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec); -static void gdata_freebase_service_finalize (GObject *self); -static void append_query_headers (GDataService *self, GDataAuthorizationDomain *domain, SoupMessage *message); -static GList *get_authorization_domains (void); - -_GDATA_DEFINE_AUTHORIZATION_DOMAIN (freebase, "freebase", "https://www.googleapis.com/auth/freebase.readonly") - -G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseService, gdata_freebase_service, GDATA_TYPE_SERVICE) - -static void -gdata_freebase_service_class_init (GDataFreebaseServiceClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GDataServiceClass *service_class = GDATA_SERVICE_CLASS (klass); - - gobject_class->set_property = gdata_freebase_service_set_property; - gobject_class->get_property = gdata_freebase_service_get_property; - gobject_class->finalize = gdata_freebase_service_finalize; - - service_class->append_query_headers = append_query_headers; - service_class->get_authorization_domains = get_authorization_domains; - - /** - * GDataFreebaseService:developer-key: - * - * The developer key your application has registered with the Freebase API. For more information, see the online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_DEVELOPER_KEY, - g_param_spec_string ("developer-key", - "Developer key", "Your Freebase developer API key.", - NULL, - G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_DEPRECATED)); -} - -static void -gdata_freebase_service_init (GDataFreebaseService *self) -{ - self->priv = gdata_freebase_service_get_instance_private (self); -} - -static void -append_query_headers (GDataService *self, GDataAuthorizationDomain *domain, SoupMessage *message) -{ - GDataFreebaseServicePrivate *priv = GDATA_FREEBASE_SERVICE (self)->priv; - const gchar *query; - GString *new_query; - SoupURI *uri; - - g_assert (message != NULL); - - if (priv->developer_key) { - uri = soup_message_get_uri (message); - query = soup_uri_get_query (uri); - - /* Set the key on every request, as per - * https://developers.google.com/freebase/v1/parameters - */ - if (query) { - new_query = g_string_new (query); - - g_string_append (new_query, "&key="); - g_string_append_uri_escaped (new_query, priv->developer_key, NULL, FALSE); - - soup_uri_set_query (uri, new_query->str); - g_string_free (new_query, TRUE); - } - } - - /* Chain up to the parent class */ - GDATA_SERVICE_CLASS (gdata_freebase_service_parent_class)->append_query_headers (self, domain, message); -} - -static GList * -get_authorization_domains (void) -{ - return g_list_prepend (NULL, get_freebase_authorization_domain ()); -} - -static void -gdata_freebase_service_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GDataFreebaseServicePrivate *priv = GDATA_FREEBASE_SERVICE (self)->priv; - - switch (prop_id) { - case PROP_DEVELOPER_KEY: - priv->developer_key = g_value_dup_string (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -gdata_freebase_service_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GDataFreebaseServicePrivate *priv = GDATA_FREEBASE_SERVICE (self)->priv; - - switch (prop_id) { - case PROP_DEVELOPER_KEY: - g_value_set_string (value, priv->developer_key); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -gdata_freebase_service_finalize (GObject *self) -{ - GDataFreebaseServicePrivate *priv = GDATA_FREEBASE_SERVICE (self)->priv; - - g_free (priv->developer_key); - - G_OBJECT_CLASS (gdata_freebase_service_parent_class)->finalize (self); -} - -/** - * gdata_freebase_service_new: - * @developer_key: (allow-none): developer key to use the API, or %NULL - * @authorizer: (allow-none): a #GDataAuthorizer to authorize the service's requests, or %NULL - * - * Creates a new #GDataFreebaseService using the given #GDataAuthorizer. If @authorizer is %NULL, all requests are made as an unauthenticated user. - * Having both @developer_key and @authorizer set to %NULL is allowed, but this should be reserved for debugging situations, as there is a certain - * key-less quota for those purposes. If this service is used on any code intended to be deployed, one or both of @developer_key and @authorizer - * should be non-%NULL and valid. - * - * Return value: (transfer full): a new #GDataFreebaseService; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseService * -gdata_freebase_service_new (const gchar *developer_key, GDataAuthorizer *authorizer) -{ - g_return_val_if_fail (authorizer == NULL || GDATA_IS_AUTHORIZER (authorizer), NULL); - - return g_object_new (GDATA_TYPE_FREEBASE_SERVICE, - "developer-key", developer_key, - "authorizer", authorizer, - NULL); -} - -/** - * gdata_freebase_service_get_primary_authorization_domain: - * - * The primary #GDataAuthorizationDomain for interacting with Freebase. This will not normally need to be used, as it's used internally - * by the #GDataFreebaseService methods. However, if using the plain #GDataService methods to implement custom queries or requests which libgdata - * does not support natively, then this domain may be needed to authorize the requests. - * - * The domain never changes, and is interned so that pointer comparison can be used to differentiate it from other authorization domains. - * - * Return value: (transfer none): the service's authorization domain - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataAuthorizationDomain * -gdata_freebase_service_get_primary_authorization_domain (void) -{ - return get_freebase_authorization_domain (); -} - -/** - * gdata_freebase_service_query: - * @self: a #GDataFreebaseService - * @query: a #GDataFreebaseQuery with the MQL query - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @error: (allow-none): a #GError, or %NULL - * - * Performs a MQL query on the service, you can find out more about MQL in the online MQL documentation. - * - * Return value: (transfer full): a #GDataFreebaseResult containing the query result; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseResult * -gdata_freebase_service_query (GDataFreebaseService *self, GDataFreebaseQuery *query, - GCancellable *cancellable, GError **error) -{ - GDataEntry *entry; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SERVICE (self), NULL); - g_return_val_if_fail (GDATA_IS_FREEBASE_QUERY (query), NULL); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - entry = gdata_service_query_single_entry (GDATA_SERVICE (self), get_freebase_authorization_domain (), "mqlread", - GDATA_QUERY (query), GDATA_TYPE_FREEBASE_RESULT, cancellable, error); - if (entry == NULL) - return NULL; - - return GDATA_FREEBASE_RESULT (entry); -} - -/** - * gdata_freebase_service_query_async: - * @self: a #GDataFreebaseService - * @query: a #GDataFreebaseQuery with the MQL query - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @callback: a #GAsyncReadyCallback to call when authentication is finished - * @user_data: (closure): data to pass to the @callback function - * - * Performs a MQL query on the service. @self and @query are all reffed when this function is called, so can safely - * be unreffed after this function returns. When the query is replied, or fails, @callback will be executed, and - * the result can be obtained through gdata_service_query_single_entry_finish(). - * - * For more details, see gdata_freebase_service_query(), which is the synchronous version of - * this function. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_service_query_async (GDataFreebaseService *self, GDataFreebaseQuery *query, GCancellable *cancellable, - GAsyncReadyCallback callback, gpointer user_data) -{ - g_return_if_fail (GDATA_IS_FREEBASE_SERVICE (self)); - g_return_if_fail (GDATA_IS_FREEBASE_QUERY (query)); - g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - g_return_if_fail (callback != NULL); - - gdata_service_query_single_entry_async (GDATA_SERVICE (self), get_freebase_authorization_domain (), "mqlread", - GDATA_QUERY (query), GDATA_TYPE_FREEBASE_RESULT, cancellable, callback, user_data); -} - -/** - * gdata_freebase_service_get_topic: - * @self: a #GDataFreebaseService - * @query: a #GDataFreebaseTopicQuery containing the topic ID - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @error: (allow-none): a #GError, or %NULL - * - * Queries information about a topic, identified through a Freebase ID. You can find out more about topic queries in the - * online documentation. - * - * Return value: (transfer full): a #GDataFreebaseTopicResult containing information about the topic; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicResult * -gdata_freebase_service_get_topic (GDataFreebaseService *self, GDataFreebaseTopicQuery *query, GCancellable *cancellable, GError **error) -{ - GDataEntry *entry; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SERVICE (self), NULL); - g_return_val_if_fail (GDATA_IS_FREEBASE_TOPIC_QUERY (query), NULL); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - entry = gdata_service_query_single_entry (GDATA_SERVICE (self), get_freebase_authorization_domain (), "topic", - GDATA_QUERY (query), GDATA_TYPE_FREEBASE_TOPIC_RESULT, cancellable, error); - if (entry == NULL) - return NULL; - - return GDATA_FREEBASE_TOPIC_RESULT (entry); -} - -/** - * gdata_freebase_service_get_topic_async: - * @self: a #GDataFreebaseService - * @query: a #GDataFreebaseQuery with the MQL query - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @callback: a #GAsyncReadyCallback to call when authentication is finished - * @user_data: (closure): data to pass to the @callback function - * - * Queries information about a topic, identified through a Freebase ID. @self and @query are all reffed when this - * function is called, so can safely be unreffed after this function returns. When the query is replied, or fails, - * @callback will be executed, and the result can be obtained through gdata_service_query_single_entry_finish(). - * - * For more details, see gdata_freebase_service_get_topic(), which is the synchronous version of - * this function. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_service_get_topic_async (GDataFreebaseService *self, GDataFreebaseTopicQuery *query, - GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) -{ - g_return_if_fail (GDATA_IS_FREEBASE_SERVICE (self)); - g_return_if_fail (GDATA_IS_FREEBASE_TOPIC_QUERY (query)); - g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - g_return_if_fail (callback != NULL); - - gdata_service_query_single_entry_async (GDATA_SERVICE (self), get_freebase_authorization_domain (), "topic", - GDATA_QUERY (query), GDATA_TYPE_FREEBASE_TOPIC_RESULT, cancellable, callback, user_data); -} - -/** - * gdata_freebase_service_search: - * @self: a #GDataFreebaseService - * @query: a #GDataFreebaseSearchQuery containing the topic ID - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @error: (allow-none): a #GError, or %NULL - * - * Performs a search for any given search term, filters can be set on @query to narrow down the results. The results returned - * are ordered by relevance. You can find out more about topic queries in the - * online documentation. - * - * Return value: (transfer full): a #GDataFreebaseSearchResult containing the results for the given search query; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseSearchResult * -gdata_freebase_service_search (GDataFreebaseService *self, GDataFreebaseSearchQuery *query, GCancellable *cancellable, GError **error) -{ - GDataEntry *entry; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SERVICE (self), NULL); - g_return_val_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (query), NULL); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - entry = gdata_service_query_single_entry (GDATA_SERVICE (self), get_freebase_authorization_domain (), "search", - GDATA_QUERY (query), GDATA_TYPE_FREEBASE_SEARCH_RESULT, cancellable, error); - if (entry == NULL) - return NULL; - - return GDATA_FREEBASE_SEARCH_RESULT (entry); -} - -/** - * gdata_freebase_service_search_async: - * @self: a #GDataFreebaseService - * @query: a #GDataFreebaseQuery with the MQL query - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @callback: a #GAsyncReadyCallback to call when authentication is finished - * @user_data: (closure): data to pass to the @callback function - * - * Performs a search for any given search term. @self and @query are all reffed when this - * function is called, so can safely be unreffed after this function returns. - * - * For more details, see gdata_freebase_service_search(), which is the synchronous version of - * this function. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_service_search_async (GDataFreebaseService *self, GDataFreebaseSearchQuery *query, - GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) -{ - g_return_if_fail (GDATA_IS_FREEBASE_SERVICE (self)); - g_return_if_fail (GDATA_IS_FREEBASE_SEARCH_QUERY (query)); - g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); - g_return_if_fail (callback != NULL); - - gdata_service_query_single_entry_async (GDATA_SERVICE (self), get_freebase_authorization_domain (), "search", - GDATA_QUERY (query), GDATA_TYPE_FREEBASE_SEARCH_RESULT, cancellable, callback, user_data); -} - -static gchar * -compose_image_uri (GDataFreebaseTopicValue *value, guint max_width, guint max_height) -{ - GString *uri = g_string_new (IMAGE_URI_PREFIX); - const GDataFreebaseTopicObject *object; - gboolean first = TRUE; - - object = gdata_freebase_topic_value_get_object (value); - g_assert (object != NULL); - - g_string_append (uri, gdata_freebase_topic_object_get_id (object)); - -#define APPEND_SEP g_string_append_c (uri, first ? '?' : '&'); first = FALSE; - - if (max_width > 0) { - APPEND_SEP; - g_string_append_printf (uri, "maxwidth=%d", max_width); - } - - if (max_height > 0) { - APPEND_SEP; - g_string_append_printf (uri, "maxheight=%d", max_height); - } -#undef APPEND_SEP - - return g_string_free (uri, FALSE); -} - -/** - * gdata_freebase_service_get_image: - * @self: a #GDataFreebaseService - * @value: a #GDataFreebaseTopicValue from a topic result - * @cancellable: (allow-none): optional #GCancellable object, or %NULL - * @max_width: maximum width of the image returned, or 0 - * @max_height: maximum height of the image returned, or 0 - * @error: (allow-none): a #GError, or %NULL - * - * Creates an input stream to an image object returned in a topic query. If @max_width and @max_height - * are unspecified (i.e. set to 0), the image returned will be the smallest available. - * - * Return value: (transfer full): a #GInputStream opened to the image; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GInputStream * -gdata_freebase_service_get_image (GDataFreebaseService *self, GDataFreebaseTopicValue *value, - GCancellable *cancellable, guint max_width, guint max_height, GError **error) -{ - GInputStream *stream; - gchar *uri; - - g_return_val_if_fail (GDATA_IS_FREEBASE_SERVICE (self), NULL); - g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL); - g_return_val_if_fail (value != NULL, NULL); - g_return_val_if_fail (!error || !*error, NULL); - g_return_val_if_fail (max_width < 4096 && max_height < 4096, NULL); - - if (!gdata_freebase_topic_value_is_image (value)) { - g_set_error (error, - GDATA_SERVICE_ERROR, - GDATA_SERVICE_ERROR_BAD_QUERY_PARAMETER, - _("Property ā€˜%sā€™ does not hold an image"), - gdata_freebase_topic_value_get_property (value)); - return NULL; - } - - uri = compose_image_uri (value, max_width, max_height); - stream = gdata_download_stream_new (GDATA_SERVICE (self), get_freebase_authorization_domain (), uri, cancellable); - g_free (uri); - - return stream; -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-service.h b/gdata/services/freebase/gdata-freebase-service.h deleted file mode 100644 index 1897c151..00000000 --- a/gdata/services/freebase/gdata-freebase-service.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_SERVICE_H -#define GDATA_FREEBASE_SERVICE_H - -#include -#include -#include - -#include -#include -#include "gdata-freebase-query.h" -#include "gdata-freebase-result.h" -#include "gdata-freebase-search-query.h" -#include "gdata-freebase-search-result.h" -#include "gdata-freebase-topic-query.h" -#include "gdata-freebase-topic-result.h" - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#define GDATA_TYPE_FREEBASE_SERVICE (gdata_freebase_service_get_type ()) -#define GDATA_FREEBASE_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_FREEBASE_SERVICE, GDataFreebaseService)) -#define GDATA_FREEBASE_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_FREEBASE_SERVICE, GDataFreebaseServiceClass)) -#define GDATA_IS_FREEBASE_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_SERVICE)) -#define GDATA_IS_FREEBASE_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_SERVICE)) -#define GDATA_FREEBASE_SERVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_SERVICE, GDataFreebaseServiceClass)) - -typedef struct _GDataFreebaseServicePrivate GDataFreebaseServicePrivate; - -/** - * GDataFreebaseService: - * - * All the fields in the #GDataFreebaseService structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataService parent; - /*< private >*/ - GDataFreebaseServicePrivate *priv; -} GDataFreebaseService; - -/** - * GDataFreebaseServiceClass: - * - * All the fields in the #GDataFreebaseServiceClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - /*< private >*/ - GDataServiceClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); - void (*_g_reserved2) (void); - void (*_g_reserved3) (void); - void (*_g_reserved4) (void); - void (*_g_reserved5) (void); -} GDataFreebaseServiceClass; - -GType gdata_freebase_service_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseService *gdata_freebase_service_new (const gchar *developer_key, GDataAuthorizer *authorizer) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; - -GDataAuthorizationDomain *gdata_freebase_service_get_primary_authorization_domain (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseResult *gdata_freebase_service_query (GDataFreebaseService *self, GDataFreebaseQuery *query, - GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; -void gdata_freebase_service_query_async (GDataFreebaseService *self, GDataFreebaseQuery *query, - GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) G_GNUC_DEPRECATED; - -GDataFreebaseTopicResult *gdata_freebase_service_get_topic (GDataFreebaseService *self, GDataFreebaseTopicQuery *query, - GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; -void gdata_freebase_service_get_topic_async (GDataFreebaseService *self, GDataFreebaseTopicQuery *query, - GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) G_GNUC_DEPRECATED; - -GDataFreebaseSearchResult *gdata_freebase_service_search (GDataFreebaseService *self, GDataFreebaseSearchQuery *query, - GCancellable *cancellable, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; -void gdata_freebase_service_search_async (GDataFreebaseService *self, GDataFreebaseSearchQuery *query, - GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) G_GNUC_DEPRECATED; - -GInputStream *gdata_freebase_service_get_image (GDataFreebaseService *self, GDataFreebaseTopicValue *value, - GCancellable *cancellable, guint max_width, guint max_height, GError **error) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_SERVICE_H */ diff --git a/gdata/services/freebase/gdata-freebase-topic-query.c b/gdata/services/freebase/gdata-freebase-topic-query.c deleted file mode 100644 index 97ab36db..00000000 --- a/gdata/services/freebase/gdata-freebase-topic-query.c +++ /dev/null @@ -1,349 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-topic-query - * @short_description: GData Freebase topic query object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-topic-query.h - * - * #GDataFreebaseTopicQuery represents a Freebase topic query. The topic query happens on a single Freebase ID, - * given in gdata_freebase_topic_query_new(), the reply returns all known information in Freebase for that given ID. - * For more documentation and examples, see the - * Topic response API documentation - * - * This implementation of #GDataQuery respects the gdata_query_set_max_results() and gdata_query_set_updated_max() calls. - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -#include -#include -#include -#include -#include - -#include "gdata-freebase-topic-query.h" -#include "gdata-query.h" -#include "gdata-parser.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -static void gdata_freebase_topic_query_finalize (GObject *self); -static void gdata_freebase_topic_query_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec); -static void gdata_freebase_topic_query_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec); -static void get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboolean *params_started); - -struct _GDataFreebaseTopicQueryPrivate { - gchar *lang; - gchar **filter; -}; - -enum { - PROP_LANGUAGE = 1, - PROP_FILTER -}; - -G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseTopicQuery, gdata_freebase_topic_query, GDATA_TYPE_QUERY) - -static void -gdata_freebase_topic_query_class_init (GDataFreebaseTopicQueryClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GDataQueryClass *query_class = GDATA_QUERY_CLASS (klass); - - gobject_class->finalize = gdata_freebase_topic_query_finalize; - gobject_class->set_property = gdata_freebase_topic_query_set_property; - gobject_class->get_property = gdata_freebase_topic_query_get_property; - - query_class->get_query_uri = get_query_uri; - - /** - * GDataFreebaseTopicQuery:language: - * - * Language used for topic values in the result, in ISO-639-1 format. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_LANGUAGE, - g_param_spec_string ("language", - "Language used for results", - "Language in ISO-639-1 format.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | - G_PARAM_DEPRECATED)); - - /** - * GDataFreebaseTopicQuery:filter: - * - * Array of properties (eg. "/common/topic/description", or "/computer/software/first_released"), or property - * domains (eg. "/common/topic", or "/computer") to be used as filter. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - g_object_class_install_property (gobject_class, PROP_FILTER, - g_param_spec_boxed ("filter", - "Filter", - "Property domain to be used as filter", - G_TYPE_STRV, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); -} - -static void -gdata_freebase_topic_query_init (GDataFreebaseTopicQuery *self) -{ - self->priv = gdata_freebase_topic_query_get_instance_private (self); -} - -static void -gdata_freebase_topic_query_finalize (GObject *self) -{ - GDataFreebaseTopicQueryPrivate *priv = GDATA_FREEBASE_TOPIC_QUERY (self)->priv; - - g_free (priv->lang); - g_free (priv->filter); - - /* Chain up to the parent class */ - G_OBJECT_CLASS (gdata_freebase_topic_query_parent_class)->finalize (self); -} - -static void -gdata_freebase_topic_query_set_property (GObject *self, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - GDataFreebaseTopicQuery *query = GDATA_FREEBASE_TOPIC_QUERY (self); - - switch (prop_id) { - case PROP_LANGUAGE: - gdata_freebase_topic_query_set_language (query, g_value_get_string (value)); - break; - case PROP_FILTER: - gdata_freebase_topic_query_set_filter (query, g_value_get_boxed (value)); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -gdata_freebase_topic_query_get_property (GObject *self, guint prop_id, GValue *value, GParamSpec *pspec) -{ - GDataFreebaseTopicQueryPrivate *priv = GDATA_FREEBASE_TOPIC_QUERY (self)->priv; - - switch (prop_id) { - case PROP_LANGUAGE: - g_value_set_string (value, priv->lang); - break; - case PROP_FILTER: - g_value_set_boxed (value, priv->filter); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec); - break; - } -} - -static void -get_query_uri (GDataQuery *self, const gchar *feed_uri, GString *query_uri, gboolean *params_started) -{ - GDataFreebaseTopicQueryPrivate *priv = GDATA_FREEBASE_TOPIC_QUERY (self)->priv; - const gchar *lang = NULL; - gint64 updated_max; - guint limit; - - g_string_append (query_uri, gdata_query_get_q (self)); - -#define APPEND_SEP g_string_append_c (query_uri, (*params_started == FALSE) ? '?' : '&'); *params_started = TRUE; - - if (priv->lang != NULL) { - lang = priv->lang; - } else { - const gchar * const *user_languages; - guint i; - - user_languages = g_get_language_names (); - - /* Pick the first user language */ - for (i = 0; user_languages[i] != NULL; i++) { - if (strlen (user_languages[i]) == 2) { - lang = user_languages[i]; - break; - } - } - } - - APPEND_SEP; - g_string_append (query_uri, "lang="); - g_string_append (query_uri, lang); - - if (priv->filter) { - guint i; - - for (i = 0; priv->filter[i] != NULL; i++) { - APPEND_SEP; - g_string_append (query_uri, "filter="); - g_string_append (query_uri, priv->filter[i]); - } - } - - updated_max = gdata_query_get_updated_max (self); - - if (updated_max > -1) { - APPEND_SEP; - g_string_append_printf (query_uri, "dateline=%" G_GINT64_FORMAT, updated_max); - } - - limit = gdata_query_get_max_results (self); - - if (limit > 0) { - APPEND_SEP; - g_string_append_printf (query_uri, "limit=%d", limit); - } - - /* We don't chain up with parent class get_query_uri because it uses - * GData protocol parameters and they aren't compatible with newest API family - */ -#undef APPEND_SEP -} - -/** - * gdata_freebase_topic_query_new: - * @id: a Freebase ID or MID - * - * Creates a new #GDataFreebaseTopicQuery for the given Freebase ID. Those can be - * obtained programmatically through gdata_freebase_search_result_item_get_id() or - * embedded in the result of a gdata_freebase_service_query() call. - * - * Return value: (transfer full): a new #GDataFreebaseTopicQuery - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicQuery * -gdata_freebase_topic_query_new (const gchar *id) -{ - g_return_val_if_fail (id != NULL, NULL); - return g_object_new (GDATA_TYPE_FREEBASE_TOPIC_QUERY, "q", id, NULL); -} - -/** - * gdata_freebase_topic_query_set_language: - * @self: a #GDataFreebaseTopicQuery - * @lang: (allow-none): language used on the topic query, in ISO-639-1 format, or %NULL to unset the language - * - * Sets the language used in the topic query. If unset, - * the locale preferences will be respected. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_topic_query_set_language (GDataFreebaseTopicQuery *self, - const gchar *lang) -{ - GDataFreebaseTopicQueryPrivate *priv; - - g_return_if_fail (GDATA_IS_FREEBASE_TOPIC_QUERY (self)); - g_return_if_fail (lang == NULL || strlen (lang) == 2); - - priv = self->priv; - - if (g_strcmp0 (priv->lang, lang) == 0) - return; - - g_free (priv->lang); - priv->lang = g_strdup (lang); - g_object_notify (G_OBJECT (self), "language"); -} - -/** - * gdata_freebase_topic_query_get_language: - * @self: a #GDataFreebaseTopicQuery - * - * Gets the language set on the topic query, or %NULL if unset. - * - * Return value: (allow-none): The language used on the query. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_query_get_language (GDataFreebaseTopicQuery *self) -{ - g_return_val_if_fail (GDATA_IS_FREEBASE_TOPIC_QUERY (self), NULL); - - return self->priv->lang; -} - -/** - * gdata_freebase_topic_query_set_filter: - * @self: a #GDataFreebaseTopicQuery - * @filter: (array zero-terminated=1) (allow-none): %NULL-terminated array of filter strings, or %NULL to unset - * - * Sets a filter on the properties to be returned by the #GDataFreebaseTopicQuery, a filter string usually contains either - * a specific property (eg. "/common/topic/description", or "/computer/software/first_released"), or a property domain - * (eg. "/common/topic", or "/computer"), all properties pertaining to the domain will be returned through the - * #GDataFreebaseTopicResult in the latter case. Other special strings can be passed as filter strings, those are documented - * in the Topic API overview - * - * If multiple filter strings are set, the result will contain all information necessary to satisfy each of those individually. - * If no filter is set, the "commons" special value will be implicitly assumed, which returns a reasonably complete data set. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_topic_query_set_filter (GDataFreebaseTopicQuery *self, const gchar * const *filter) -{ - GDataFreebaseTopicQueryPrivate *priv; - - g_return_if_fail (GDATA_IS_FREEBASE_TOPIC_QUERY (self)); - priv = self->priv; - - g_strfreev (priv->filter); - priv->filter = g_strdupv ((gchar **) filter); - g_object_notify (G_OBJECT (self), "filter"); -} - -/** - * gdata_freebase_topic_query_get_filter: - * @self: a #GDataFreebaseTopicQuery - * - * Gets the filter set on the topic query, or %NULL if unset. - * - * Return value: (array zero-terminated=1) (transfer none) (allow-none): The filter used on the query. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * const * -gdata_freebase_topic_query_get_filter (GDataFreebaseTopicQuery *self) -{ - g_return_val_if_fail (GDATA_IS_FREEBASE_TOPIC_QUERY (self), NULL); - - return (const gchar * const *) self->priv->filter; -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-topic-query.h b/gdata/services/freebase/gdata-freebase-topic-query.h deleted file mode 100644 index 4d20a982..00000000 --- a/gdata/services/freebase/gdata-freebase-topic-query.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_TOPIC_QUERY_H -#define GDATA_FREEBASE_TOPIC_QUERY_H - -#include -#include - -#include -#include - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#define GDATA_TYPE_FREEBASE_TOPIC_QUERY (gdata_freebase_topic_query_get_type ()) -#define GDATA_FREEBASE_TOPIC_QUERY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_FREEBASE_TOPIC_QUERY, GDataFreebaseTopicQuery)) -#define GDATA_FREEBASE_TOPIC_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_FREEBASE_TOPIC_QUERY, GDataFreebaseTopicQueryClass)) -#define GDATA_IS_FREEBASE_TOPIC_QUERY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_TOPIC_QUERY)) -#define GDATA_IS_FREEBASE_TOPIC_QUERY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_TOPIC_QUERY)) -#define GDATA_FREEBASE_TOPIC_QUERY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_TOPIC_QUERY, GDataFreebaseTopicQueryClass)) - -typedef struct _GDataFreebaseTopicQueryPrivate GDataFreebaseTopicQueryPrivate; - -/** - * GDataFreebaseTopicQuery: - * - * All the fields in the #GDataFreebaseTopicQuery structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataQuery parent; - GDataFreebaseTopicQueryPrivate *priv; -} GDataFreebaseTopicQuery; - -/** - * GDataFreebaseTopicQueryClass: - * - * All the fields in the #GDataFreebaseTopicQueryClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - /*< private >*/ - GDataQueryClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataFreebaseTopicQueryClass; - -GType gdata_freebase_topic_query_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseTopicQuery *gdata_freebase_topic_query_new (const gchar *id) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; -void gdata_freebase_topic_query_set_language (GDataFreebaseTopicQuery *self, const gchar *lang) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_topic_query_get_language (GDataFreebaseTopicQuery *self) G_GNUC_DEPRECATED; - -void gdata_freebase_topic_query_set_filter (GDataFreebaseTopicQuery *self, const gchar * const *filter) G_GNUC_DEPRECATED; -const gchar * const *gdata_freebase_topic_query_get_filter (GDataFreebaseTopicQuery *self) G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_TOPIC_QUERY_H */ diff --git a/gdata/services/freebase/gdata-freebase-topic-result.c b/gdata/services/freebase/gdata-freebase-topic-result.c deleted file mode 100644 index ac67e55d..00000000 --- a/gdata/services/freebase/gdata-freebase-topic-result.c +++ /dev/null @@ -1,1045 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -/** - * SECTION:gdata-freebase-topic-result - * @short_description: GData Freebase topic result object - * @stability: Stable - * @include: gdata/services/freebase/gdata-freebase-topic-result.h - * - * #GDataFreebaseTopicResult is a subclass of #GDataFreebaseResult that contains all or a subset of the information - * contained in Freebase about the Freebase ID given to the #GDataFreebaseTopicQuery. - * - * For more details of Google Freebase API, see the - * online documentation. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ - -typedef struct _GDataFreebaseTopicValueArray GDataFreebaseTopicValueArray; - -#include -#include -#include -#include - -#include "gdata-freebase-topic-result.h" -#include "gdata-download-stream.h" -#include "gdata-private.h" -#include "gdata-types.h" - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -typedef enum { - TYPE_NONE, - TYPE_BOOL, - TYPE_INT, - TYPE_DOUBLE, - TYPE_STRING, - TYPE_DATETIME, - TYPE_COMPOUND, - TYPE_OBJECT, - TYPE_KEY, - TYPE_URI -} TopicValueType; - -/* Wraps a compound object, either the main object returned by the result, or a - * complex object within the result values (events are at least composed of - * location and time at least, for example). - */ -struct _GDataFreebaseTopicObject { - gchar *id; - GHashTable *values; /* Hashtable of property->GDataFreebaseTopicValueArray */ - volatile gint ref_count; -}; - -/* Wraps an array of values, single-valued properties will contain an array with a single value here */ -struct _GDataFreebaseTopicValueArray { - TopicValueType type; - GPtrArray *values; - guint64 hits; /* Total number of hits, as opposed to values->len */ -}; - -/* Wraps a single value in the topic result, may be either simple (numbers, strings, Freebase IDs...), - * or nested compound types (contained by a GDataFreebaseTopicObject, which is what the value would - * contain in that case). - */ -struct _GDataFreebaseTopicValue { - gchar *property; - gchar *text; - gchar *lang; - gchar *creator; - gint64 timestamp; - GValue value; - volatile gint ref_count; -}; - -struct _GDataFreebaseTopicResultPrivate { - GDataFreebaseTopicObject *object; -}; - -static void gdata_freebase_topic_result_finalize (GObject *self); -static gboolean parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error); -static GDataFreebaseTopicObject *object_new (const gchar *id); -static void value_free (GDataFreebaseTopicValue *object); -static gboolean reader_get_properties (JsonReader *reader, GDataFreebaseTopicObject *object, GError **error); - -G_DEFINE_BOXED_TYPE (GDataFreebaseTopicObject, gdata_freebase_topic_object, gdata_freebase_topic_object_ref, gdata_freebase_topic_object_unref) -G_DEFINE_BOXED_TYPE (GDataFreebaseTopicValue, gdata_freebase_topic_value, gdata_freebase_topic_value_ref, gdata_freebase_topic_value_unref) -G_DEFINE_TYPE_WITH_PRIVATE (GDataFreebaseTopicResult, gdata_freebase_topic_result, GDATA_TYPE_FREEBASE_RESULT) - -static void -gdata_freebase_topic_result_class_init (GDataFreebaseTopicResultClass *klass) -{ - GDataParsableClass *parsable_class = GDATA_PARSABLE_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->finalize = gdata_freebase_topic_result_finalize; - parsable_class->parse_json = parse_json; -} - -static void -gdata_freebase_topic_result_init (GDataFreebaseTopicResult *self) -{ - self->priv = gdata_freebase_topic_result_get_instance_private (self); -} - -static void -gdata_freebase_topic_result_finalize (GObject *self) -{ - GDataFreebaseTopicResultPrivate *priv = GDATA_FREEBASE_TOPIC_RESULT (self)->priv; - - gdata_freebase_topic_object_unref (priv->object); - - G_OBJECT_CLASS (gdata_freebase_topic_result_parent_class)->finalize (self); -} - -static GDataFreebaseTopicValueArray * -value_array_new (TopicValueType type, guint64 hits) -{ - GDataFreebaseTopicValueArray *array; - - array = g_slice_new0 (GDataFreebaseTopicValueArray); - array->values = g_ptr_array_new_with_free_func ((GDestroyNotify) gdata_freebase_topic_value_unref); - array->type = type; - array->hits = hits; - - return array; -} - -/* Takes ownership on @value */ -static void -value_array_add (GDataFreebaseTopicValueArray *array, GDataFreebaseTopicValue *value) -{ - g_ptr_array_add (array->values, value); -} - -static void -value_array_free (GDataFreebaseTopicValueArray *array) -{ - g_ptr_array_unref (array->values); - g_slice_free (GDataFreebaseTopicValueArray, array); -} - -static guint64 -reader_get_item_count (JsonReader *reader) -{ - gint64 count; - - json_reader_read_member (reader, "count"); - count = json_reader_get_int_value (reader); - json_reader_end_member (reader); - - return (guint64) count; -} - -static guint -reader_get_value_type (JsonReader *reader, const gchar *property, GError **error) -{ - TopicValueType type = TYPE_NONE; - const GError *reader_error; - const gchar *valuestr; - - json_reader_read_member (reader, "valuetype"); - valuestr = json_reader_get_string_value (reader); - - reader_error = json_reader_get_error (reader); - - if (reader_error != NULL) { - if (error != NULL && *error == NULL) - *error = g_error_copy (reader_error); - } else { - if (strcmp (valuestr, "key") == 0) - type = TYPE_KEY; - else if (strcmp (valuestr, "uri") == 0) - type = TYPE_URI; - else if (strcmp (valuestr, "compound") == 0) - type = TYPE_COMPOUND; - else if (strcmp (valuestr, "object") == 0) - type = TYPE_OBJECT; - else if (strcmp (valuestr, "float") == 0) - type = TYPE_DOUBLE; - else if (strcmp (valuestr, "string") == 0) - type = TYPE_STRING; - else if (strcmp (valuestr, "int") == 0) - type = TYPE_INT; - else if (strcmp (valuestr, "bool") == 0) - type = TYPE_BOOL; - else if (strcmp (valuestr, "datetime") == 0) - type = TYPE_DATETIME; - else - gdata_parser_error_required_json_content_missing (reader, error); - } - - json_reader_end_member (reader); - return type; -} - -static void -value_free (GDataFreebaseTopicValue *value) -{ - if (G_IS_VALUE (&value->value)) - g_value_unset (&value->value); - g_free (value->text); - g_free (value->lang); - g_free (value->creator); - g_free (value->property); - g_slice_free (GDataFreebaseTopicValue, value); -} - -/* Parsing functions to create GDataFreebaseTopicValues, and arrays of those */ -static gchar * -reader_dup_member_string (JsonReader *reader, const gchar *member, GError **error) -{ - const GError *reader_error; - gchar *str; - - if (error != NULL && *error != NULL) - return NULL; - - json_reader_read_member (reader, member); - str = g_strdup (json_reader_get_string_value (reader)); - reader_error = json_reader_get_error (reader); - - if (reader_error != NULL) { - g_free (str); - str = NULL; - - if (error != NULL) - *error = g_error_copy (reader_error); - } - - json_reader_end_member (reader); - - return str; -} - -static gint64 -reader_parse_timestamp (JsonReader *reader, const gchar *member, GError **error) -{ - const GError *reader_error; - const gchar *date_str; - gint64 timestamp = -1; - - if (error != NULL && *error != NULL) - return -1; - - json_reader_read_member (reader, member); - date_str = json_reader_get_string_value (reader); - reader_error = json_reader_get_error (reader); - - if (reader_error != NULL) { - if (error != NULL) - *error = g_error_copy (reader_error); - } else if (date_str) { - if (!gdata_parser_int64_from_iso8601 (date_str, ×tamp)) - timestamp = -1; - } - - json_reader_end_member (reader); - - return timestamp; -} - -static gboolean -reader_fill_simple_gvalue (JsonReader *reader, TopicValueType type, GValue *value) -{ - gboolean retval = TRUE; - gint64 datetime; - - json_reader_read_member (reader, "value"); - - if (json_reader_get_error (reader) != NULL) { - json_reader_end_member (reader); - return FALSE; - } - - switch (type) { - case TYPE_BOOL: - case TYPE_INT: - case TYPE_DOUBLE: - case TYPE_STRING: - json_node_get_value (json_reader_get_value (reader), value); - break; - case TYPE_DATETIME: - if (gdata_parser_int64_from_iso8601 (json_reader_get_string_value (reader), &datetime) || - gdata_parser_int64_from_date (json_reader_get_string_value (reader), &datetime)) { - g_value_init (value, G_TYPE_INT64); - g_value_set_int64 (value, datetime); - } else { - retval = FALSE; - } - - break; - case TYPE_NONE: - case TYPE_COMPOUND: - case TYPE_OBJECT: - case TYPE_KEY: - case TYPE_URI: - default: - retval = FALSE; - } - - json_reader_end_member (reader); - return retval; -} - -static GDataFreebaseTopicObject * -reader_create_object (JsonReader *reader, TopicValueType type) -{ - GDataFreebaseTopicObject *object; - - if (type != TYPE_OBJECT && type != TYPE_COMPOUND) - return NULL; - - json_reader_read_member (reader, "id"); - - if (json_reader_get_error (reader) != NULL) { - json_reader_end_member (reader); - return NULL; - } - - object = object_new (json_reader_get_string_value (reader)); - json_reader_end_member (reader); - - return object; -} - -static gboolean -reader_fill_object_gvalue (JsonReader *reader, TopicValueType type, GValue *value) -{ - GDataFreebaseTopicObject *object; - - if (type != TYPE_OBJECT) - return FALSE; - - object = reader_create_object (reader, type); - - if (object != NULL) { - g_value_init (value, GDATA_TYPE_FREEBASE_TOPIC_OBJECT); - g_value_take_boxed (value, object); - } - - return (object != NULL); -} - -static gboolean -reader_fill_compound_gvalue (JsonReader *reader, TopicValueType type, GValue *value, GError **error) -{ - GDataFreebaseTopicObject *object; - - if (type != TYPE_COMPOUND) - return FALSE; - - object = reader_create_object (reader, type); - - if (object == NULL) - return FALSE; - - json_reader_read_member (reader, "property"); - - if (json_reader_get_error (reader) != NULL) { - json_reader_end_member (reader); - gdata_freebase_topic_object_unref (object); - return FALSE; - } - - reader_get_properties (reader, object, error); - json_reader_end_member (reader); - - g_value_init (value, GDATA_TYPE_FREEBASE_TOPIC_OBJECT); - g_value_take_boxed (value, object); - return TRUE; -} - -static GDataFreebaseTopicValue * -reader_create_value (JsonReader *reader, const gchar *property, TopicValueType type, GError **error) -{ - GDataFreebaseTopicValue *value; - - value = g_slice_new0 (GDataFreebaseTopicValue); - - value->ref_count = 1; - value->property = g_strdup (property); - value->text = reader_dup_member_string (reader, "text", error); - value->lang = reader_dup_member_string (reader, "lang", error); - - /* Not all parsed nodes are meant to contain creator/timestamp tags, - * do not pass error to those, so parsing continues. - */ - value->creator = reader_dup_member_string (reader, "creator", NULL); - value->timestamp = reader_parse_timestamp (reader, "timestamp", NULL); - - if (reader_fill_simple_gvalue (reader, type, &value->value) || - reader_fill_object_gvalue (reader, type, &value->value) || - reader_fill_compound_gvalue (reader, type, &value->value, error)) - return value; - - value_free (value); - return NULL; -} - -static GDataFreebaseTopicValueArray * -reader_create_value_array (JsonReader *reader, const gchar *property, GError **error) -{ - GDataFreebaseTopicValueArray *array; - GDataFreebaseTopicValue *value; - TopicValueType type; - guint64 count, i; - - count = reader_get_item_count (reader); - - if (count <= 0) - return NULL; - - type = reader_get_value_type (reader, property, error); - - if (type == TYPE_NONE || type == TYPE_URI || type == TYPE_KEY) - return NULL; - - array = value_array_new (type, count); - - json_reader_read_member (reader, "values"); - count = json_reader_count_elements (reader); - - for (i = 0; i < count; i++) { - json_reader_read_element (reader, i); - value = reader_create_value (reader, property, type, error); - json_reader_end_element (reader); - - if (value != NULL) - value_array_add (array, value); - } - - json_reader_end_member (reader); - - return array; -} - -static GDataFreebaseTopicObject * -object_new (const gchar *id) -{ - GDataFreebaseTopicObject *object; - - object = g_slice_new0 (GDataFreebaseTopicObject); - object->id = g_strdup (id); - object->ref_count = 1; - object->values = g_hash_table_new_full (g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) value_array_free); - return object; -} - -/* Takes ownership on @array */ -static void -object_add_value (GDataFreebaseTopicObject *object, const gchar *property, GDataFreebaseTopicValueArray *array) -{ - g_return_if_fail (object != NULL); - g_return_if_fail (property != NULL); - g_return_if_fail (array != NULL); - g_hash_table_replace (object->values, g_strdup (property), array); -} - -static gboolean -reader_get_properties (JsonReader *reader, GDataFreebaseTopicObject *object, GError **error) -{ - GDataFreebaseTopicValueArray *array; - gboolean retval = TRUE; - gint count, i; - - count = json_reader_count_members (reader); - - for (i = 0; i < count; i++) { - GError *inner_error = NULL; - const gchar *name; - gchar *property; - - json_reader_read_element (reader, i); - property = g_strdup (json_reader_get_member_name (reader)); - name = property; - - /* Reverse properties start with !, display those as - * regular properties, and skip that char - */ - if (name[0] == '!') - name++; - - /* All Freebase properties and IDs start with '/' */ - if (name[0] != '/') - continue; - - /* Parse the value for this property, possibly with nested contents */ - array = reader_create_value_array (reader, name, &inner_error); - json_reader_end_element (reader); - - if (inner_error != NULL) { - g_propagate_error (error, inner_error); - retval = FALSE; - break; - } else if (array != NULL) { - /* Takes ownership of array */ - object_add_value (object, name, array); - } - - g_free (property); - } - - return retval; -} - -static gboolean -parse_json (GDataParsable *parsable, JsonReader *reader, gpointer user_data, GError **error) -{ - GDataFreebaseTopicResultPrivate *priv = GDATA_FREEBASE_TOPIC_RESULT (parsable)->priv; - const gchar *member_name; - - GDATA_PARSABLE_CLASS (gdata_freebase_topic_result_parent_class)->parse_json (parsable, reader, user_data, error); - - member_name = json_reader_get_member_name (reader); - - if (member_name == NULL) - return FALSE; - - if (strcmp (member_name, "id") == 0) { - /* We only expect one member containing information */ - g_assert (priv->object == NULL); - priv->object = object_new (json_reader_get_string_value (reader)); - } else if (strcmp (member_name, "property") == 0) { - reader_get_properties (reader, priv->object, error); - } else { - return FALSE; - } - - return TRUE; -} - -/** - * gdata_freebase_topic_result_new: - * - * Creates a new #GDataFreebaseTopicResult with the given ID and default properties. - * - * Return value: (transfer full): a new #GDataFreebaseTopicResult; unref with g_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicResult * -gdata_freebase_topic_result_new (void) -{ - return g_object_new (GDATA_TYPE_FREEBASE_TOPIC_RESULT, NULL); -} - -/** - * gdata_freebase_topic_result_dup_object: - * @self: a #GDataFreebaseTopicResult - * - * Returns a reference to the root #GDataFreebaseTopicObject containing the - * topic query results. - * - * Returns: (transfer full): A new reference on the result object, unref with - * gdata_freebase_topic_object_unref() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicObject * -gdata_freebase_topic_result_dup_object (GDataFreebaseTopicResult *self) -{ - g_return_val_if_fail (GDATA_IS_FREEBASE_TOPIC_RESULT (self), NULL); - - return gdata_freebase_topic_object_ref (self->priv->object); -} - -/** - * gdata_freebase_topic_object_ref: - * @object: a #GDataFreebaseTopicObject - * - * Creates and returns a new reference on @object. - * - * Returns: (transfer full): @object, with an extra reference. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicObject * -gdata_freebase_topic_object_ref (GDataFreebaseTopicObject *object) -{ - g_return_val_if_fail (object != NULL, NULL); - - g_atomic_int_inc (&object->ref_count); - return object; -} - -/** - * gdata_freebase_topic_object_unref: - * @object: (transfer full): a #GDataFreebaseTopicResult - * - * Removes a reference from @object. If the reference count drops to 0, - * the object is freed. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_topic_object_unref (GDataFreebaseTopicObject *object) -{ - g_return_if_fail (object != NULL); - - if (g_atomic_int_dec_and_test (&object->ref_count)) { - g_hash_table_unref (object->values); - g_free (object->id); - g_slice_free (GDataFreebaseTopicObject, object); - } -} - -/** - * gdata_freebase_topic_object_list_properties: - * @object: a #GDataFreebaseTopicObject - * - * Returns the list of Freebase properties described by @object. - * - * Returns: (transfer container) (element-type gchar*): An array of property names, free with g_ptr_array_unref(). - * - * Since: 0.15.1 -Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GPtrArray * -gdata_freebase_topic_object_list_properties (const GDataFreebaseTopicObject *object) -{ - GPtrArray *properties; - GHashTableIter iter; - gchar *property; - - g_return_val_if_fail (object != NULL, NULL); - - properties = g_ptr_array_new (); - g_hash_table_iter_init (&iter, object->values); - - while (g_hash_table_iter_next (&iter, (gpointer *) &property, NULL)) - g_ptr_array_add (properties, property); - - return properties; -} - -/** - * gdata_freebase_topic_object_get_property_count: - * @object: a #GDataFreebaseTopicObject - * @property: a property name contained in @object - * - * Returns the number of values that @object holds for the given @property. If @object - * contains no information about @property, 0 is returned. - * - * Returns: The number of values contained for @property - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -guint64 -gdata_freebase_topic_object_get_property_count (const GDataFreebaseTopicObject *object, const gchar *property) -{ - GDataFreebaseTopicValueArray *array; - - g_return_val_if_fail (object != NULL, 0); - g_return_val_if_fail (property != NULL, 0); - array = g_hash_table_lookup (object->values, property); - - if (array == NULL) - return 0; - - return array->values->len; -} - -/** - * gdata_freebase_topic_object_get_property_hits: - * @object: a #GDataFreebaseTopicObject - * @property: a property name contained in @object - * - * Returns the total number of hits that the Freebase database stores - * for this object, this number either equals or is greater than - * gdata_freebase_topic_object_get_property_count(), the query limit - * can be controlled through gdata_query_set_max_results() on the topic - * query. - * - * If @object contains no information about @property, 0 is returned. - * - * Returns: the total number of hits for this property - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -guint64 -gdata_freebase_topic_object_get_property_hits (const GDataFreebaseTopicObject *object, const gchar *property) -{ - GDataFreebaseTopicValueArray *array; - - g_return_val_if_fail (object != NULL, 0); - g_return_val_if_fail (property != NULL, 0); - array = g_hash_table_lookup (object->values, property); - - if (array == NULL) - return 0; - - return array->hits; -} - -/** - * gdata_freebase_topic_object_get_property_value: - * @object: a #GDataFreebaseTopicObject - * @property: a property name contained in @object - * @item: item number to retrieve from @property - * - * Gets the value that @object stores for this @property/@item pair, as a generic - * #GDataFreebaseTopicValue. If @object contains no information about @property, - * or @item is outside the [0..gdata_freebase_topic_object_get_property_count() - 1] - * range, %NULL is returned. - * - * Returns: (allow-none) (transfer none): the value for this property/item - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicValue * -gdata_freebase_topic_object_get_property_value (const GDataFreebaseTopicObject *object, const gchar *property, gint64 item) -{ - GDataFreebaseTopicValueArray *array; - - g_return_val_if_fail (object != NULL, NULL); - g_return_val_if_fail (property != NULL, NULL); - array = g_hash_table_lookup (object->values, property); - - if (array == NULL) - return NULL; - - if (item < 0 || item >= array->values->len) - return NULL; - - return g_ptr_array_index (array->values, item); -} - -/** - * gdata_freebase_topic_object_get_id: - * @object: a #GDataFreebaseTopicObject - * - * Gets the Freebase ID for this specific object. - * - * Returns: (transfer none): the Freebase ID of this object - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_object_get_id (const GDataFreebaseTopicObject *object) -{ - g_return_val_if_fail (object != NULL, NULL); - return object->id; -} - -/** - * gdata_freebase_topic_value_ref: - * @value: a #GDataFreebaseTopicValue - * - * Creates and returns a new reference on @value. - * - * Returns: (transfer full): @value, with an extra reference. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GDataFreebaseTopicValue * -gdata_freebase_topic_value_ref (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - - g_atomic_int_inc (&value->ref_count); - return value; -} - -/** - * gdata_freebase_topic_value_unref: - * @value: (transfer full): a #GDataFreebaseTopicValue - * - * Removes a reference from @value. If the reference count drops to 0, - * the object is freed. - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_topic_value_unref (GDataFreebaseTopicValue *value) -{ - g_return_if_fail (value != NULL); - - if (g_atomic_int_dec_and_test (&value->ref_count)) - value_free (value); -} - -/** - * gdata_freebase_topic_value_get_property: - * @value: a #GDataFreebaseTopicValue - * - * Returns the property name that this value describes - * - * Returns: the property name of @value - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_value_get_property (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - return value->property; -} - -/** - * gdata_freebase_topic_value_get_text: - * @value: a #GDataFreebaseTopicValue - * - * Returns a textual representation of this value, this is either - * the value contained transformed to a string, or a concatenation - * of subvalues for compound types. - * - * Returns: a textual representation of @value - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_value_get_text (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - return value->text; -} - -/** - * gdata_freebase_topic_value_get_language: - * @value: a #GDataFreebaseTopicValue - * - * Returns the language used in the content of @value - * - * Returns: the language @value is written in - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_value_get_language (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - return value->lang; -} - -/** - * gdata_freebase_topic_value_get_creator: - * @value: a #GDataFreebaseTopicValue - * - * Returns the Freebase ID of the user that created this value. - * - * Returns: the creator of this value, as a Freebase ID - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_value_get_creator (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - return value->creator; -} - -/** - * gdata_freebase_topic_value_get_timestamp: - * @value: #GDataFreebaseTopicValue - * - * Returns the time at which this value was created in the Freebase database. - * It's a UNIX timestamp in seconds since the epoch. If @value has no timestamp, - * -1 will be returned. - * - * Returns: The creation time of @value, or -1 - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -gint64 -gdata_freebase_topic_value_get_timestamp (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, 0); - return value->timestamp; -} - -/** - * gdata_freebase_topic_value_get_value_type: - * @value: a #GDataFreebaseTopicValue - * - * Returns the #GType of the real value held in @value. - * - * Returns: the #GType of the contained value - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -GType -gdata_freebase_topic_value_get_value_type (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, G_TYPE_INVALID); - return G_VALUE_TYPE (&value->value); -} - -/** - * gdata_freebase_topic_value_copy_value: - * @value: a #GDataFreebaseTopicValue - * @gvalue: (out caller-allocates) (transfer full): an empty #GValue - * - * Copies in @gvalue the value held in @value. the #GValue must be later freed through g_value_unset() - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -void -gdata_freebase_topic_value_copy_value (GDataFreebaseTopicValue *value, GValue *gvalue) -{ - g_return_if_fail (value != NULL); - - g_value_copy (&value->value, gvalue); -} - -/** - * gdata_freebase_topic_value_get_int: - * @value: a #GDataFreebaseTopicValue - * - * Returns a #gint64 value held in @value. It is only valid to call this if the #GType is a %G_TYPE_INT64 - * - * Returns: the #gint64 value - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -gint64 -gdata_freebase_topic_value_get_int (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, 0); - g_return_val_if_fail (G_VALUE_HOLDS_INT64 (&value->value), 0); - - return g_value_get_int64 (&value->value); -} - -/** - * gdata_freebase_topic_value_get_double: - * @value: a #GDataFreebaseTopicValue - * - * Returns a #gdouble value held in @value. It is only valid to call this if the #GType is a %G_TYPE_DOUBLE - * - * Returns: the #gdouble value - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -gdouble -gdata_freebase_topic_value_get_double (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, 0); - g_return_val_if_fail (G_VALUE_HOLDS_DOUBLE (&value->value), 0); - - return g_value_get_double (&value->value); -} - -/** - * gdata_freebase_topic_value_get_string: - * @value: a #GDataFreebaseTopicValue - * - * Returns a string value held in @value. It is only valid to call this if the #GType is a %G_TYPE_STRING - * - * Returns: the string value - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const gchar * -gdata_freebase_topic_value_get_string (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - g_return_val_if_fail (G_VALUE_HOLDS_STRING (&value->value), NULL); - - return g_value_get_string (&value->value); -} - -/** - * gdata_freebase_topic_value_get_object: - * @value: a #GDataFreebaseTopicValue - * - * Returns a compound/complex object held in @value. It is only valid to call this if the #GType is a - * %GDATA_TYPE_FREEBASE_TOPIC_OBJECT. - * - * Returns: (transfer none): the compound value as a #GDataFreebaseTopicObject - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -const GDataFreebaseTopicObject * -gdata_freebase_topic_value_get_object (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, NULL); - g_return_val_if_fail (G_VALUE_HOLDS (&value->value, GDATA_TYPE_FREEBASE_TOPIC_OBJECT), NULL); - - return g_value_get_boxed (&value->value); -} - -/** - * gdata_freebase_topic_value_is_image: - * @value: a #GDataFreebaseTopicValue - * - * Returns true if @value holds a freebase image object, on such values it - * will be valid to call gdata_freebase_service_get_image() to get a stream - * to the image itself. - * - * Returns: Whether @value holds a Freebase image object - * - * Since: 0.15.1 - * Deprecated: 0.17.7: Google Freebase has been permanently shut down. - */ -gboolean -gdata_freebase_topic_value_is_image (GDataFreebaseTopicValue *value) -{ - g_return_val_if_fail (value != NULL, FALSE); - - return (strcmp (value->property, "/common/topic/image") == 0); -} - -G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/gdata/services/freebase/gdata-freebase-topic-result.h b/gdata/services/freebase/gdata-freebase-topic-result.h deleted file mode 100644 index 34b73e28..00000000 --- a/gdata/services/freebase/gdata-freebase-topic-result.h +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* - * GData Client - * Copyright (C) 2014 Carlos Garnacho - * - * GData Client is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * GData Client is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with GData Client. If not, see . - */ - -#ifndef GDATA_FREEBASE_TOPIC_RESULT_H -#define GDATA_FREEBASE_TOPIC_RESULT_H - -#include -#include - -#include -#include "gdata-freebase-result.h" - -G_BEGIN_DECLS - -#ifndef LIBGDATA_DISABLE_DEPRECATED - -#define GDATA_TYPE_FREEBASE_TOPIC_OBJECT (gdata_freebase_topic_object_get_type ()) -#define GDATA_TYPE_FREEBASE_TOPIC_VALUE (gdata_freebase_topic_value_get_type ()) -#define GDATA_TYPE_FREEBASE_TOPIC_RESULT (gdata_freebase_topic_result_get_type ()) -#define GDATA_FREEBASE_TOPIC_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDATA_TYPE_FREEBASE_TOPIC_RESULT, GDataFreebaseTopicResult)) -#define GDATA_FREEBASE_TOPIC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDATA_TYPE_FREEBASE_TOPIC_RESULT, GDataFreebaseTopicResultClass)) -#define GDATA_IS_FREEBASE_TOPIC_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDATA_TYPE_FREEBASE_TOPIC_RESULT)) -#define GDATA_IS_FREEBASE_TOPIC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDATA_TYPE_FREEBASE_TOPIC_RESULT)) -#define GDATA_FREEBASE_TOPIC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDATA_TYPE_FREEBASE_TOPIC_RESULT, GDataFreebaseTopicResultClass)) - -typedef struct _GDataFreebaseTopicResultPrivate GDataFreebaseTopicResultPrivate; - -/** - * GDataFreebaseTopicObject: - * - * Opaque struct containing a Freebase topic object. This object may contain one or more - * #GDataFreebaseTopicValue structs, which may in turn contain nested #GDataFreebaseTopicObject - * structs to express complex data. - * - * Since: 0.15.1 - */ -typedef struct _GDataFreebaseTopicObject GDataFreebaseTopicObject; - -/** - * GDataFreebaseTopicValue: - * - * Opaque struct containing a value of a Freebase topic object. This struct may contain a simple - * value (integers, doubles, strings...) or complex values, expressed through a #GDataFreebaseTopicObject. - * - * Since: 0.15.1 - */ -typedef struct _GDataFreebaseTopicValue GDataFreebaseTopicValue; - -/** - * GDataFreebaseTopicResult: - * - * All the fields in the #GDataFreebaseTopicResult structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - GDataFreebaseResult parent; - GDataFreebaseTopicResultPrivate *priv; -} GDataFreebaseTopicResult; - -/** - * GDataFreebaseTopicResultClass: - * - * All the fields in the #GDataFreebaseTopicResultClass structure are private and should never be accessed directly. - * - * Since: 0.15.1 - */ -typedef struct { - /*< private >*/ - GDataFreebaseResultClass parent; - - /*< private >*/ - /* Padding for future expansion */ - void (*_g_reserved0) (void); - void (*_g_reserved1) (void); -} GDataFreebaseTopicResultClass; - -GType gdata_freebase_topic_object_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; -GType gdata_freebase_topic_value_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; -GType gdata_freebase_topic_result_get_type (void) G_GNUC_CONST G_GNUC_DEPRECATED; - -GDataFreebaseTopicResult *gdata_freebase_topic_result_new (void) G_GNUC_WARN_UNUSED_RESULT G_GNUC_MALLOC G_GNUC_DEPRECATED; - -GDataFreebaseTopicObject *gdata_freebase_topic_result_dup_object (GDataFreebaseTopicResult *self) G_GNUC_DEPRECATED; - -GDataFreebaseTopicObject *gdata_freebase_topic_object_ref (GDataFreebaseTopicObject *object) G_GNUC_DEPRECATED; -void gdata_freebase_topic_object_unref (GDataFreebaseTopicObject *object) G_GNUC_DEPRECATED; - -GPtrArray *gdata_freebase_topic_object_list_properties (const GDataFreebaseTopicObject *object) G_GNUC_DEPRECATED; - -const gchar *gdata_freebase_topic_object_get_id (const GDataFreebaseTopicObject *object) G_GNUC_DEPRECATED; -guint64 gdata_freebase_topic_object_get_property_count (const GDataFreebaseTopicObject *object, const gchar *property) G_GNUC_DEPRECATED; -guint64 gdata_freebase_topic_object_get_property_hits (const GDataFreebaseTopicObject *object, const gchar *property) G_GNUC_DEPRECATED; -GDataFreebaseTopicValue *gdata_freebase_topic_object_get_property_value (const GDataFreebaseTopicObject *object, const gchar *property, gint64 item) G_GNUC_DEPRECATED; - -GDataFreebaseTopicValue *gdata_freebase_topic_value_ref (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -void gdata_freebase_topic_value_unref (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; - -const gchar *gdata_freebase_topic_value_get_property (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; - -const gchar *gdata_freebase_topic_value_get_text (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_topic_value_get_language (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_topic_value_get_creator (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -gint64 gdata_freebase_topic_value_get_timestamp (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -GType gdata_freebase_topic_value_get_value_type (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -void gdata_freebase_topic_value_copy_value (GDataFreebaseTopicValue *value, GValue *gvalue) G_GNUC_DEPRECATED; - -gint64 gdata_freebase_topic_value_get_int (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -gdouble gdata_freebase_topic_value_get_double (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -const gchar *gdata_freebase_topic_value_get_string (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; -const GDataFreebaseTopicObject *gdata_freebase_topic_value_get_object (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; - -gboolean gdata_freebase_topic_value_is_image (GDataFreebaseTopicValue *value) G_GNUC_DEPRECATED; - -#endif /* !LIBGDATA_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* !GDATA_FREEBASE_TOPIC_RESULT_H */ diff --git a/gdata/services/freebase/meson.build b/gdata/services/freebase/meson.build deleted file mode 100644 index 7ed419a4..00000000 --- a/gdata/services/freebase/meson.build +++ /dev/null @@ -1,58 +0,0 @@ -incs += include_directories('.') - -include_subdir = gdata_include_subdir / 'services/freebase' - -headers = files( - 'gdata-freebase-query.h', - 'gdata-freebase-result.h', - 'gdata-freebase-search-query.h', - 'gdata-freebase-search-result.h', - 'gdata-freebase-service.h', - 'gdata-freebase-topic-query.h', - 'gdata-freebase-topic-result.h', -) - -install_headers( - headers, - subdir: include_subdir, -) - -gir_headers += headers - -sources += files( - 'gdata-freebase-query.c', - 'gdata-freebase-result.c', - 'gdata-freebase-search-query.c', - 'gdata-freebase-search-result.c', - 'gdata-freebase-service.c', - 'gdata-freebase-topic-query.c', - 'gdata-freebase-topic-result.c', -) - -enums = 'gdata-freebase-enums' - -enums_in = gnome.mkenums_simple( - enums + '-in', - sources: headers, -) - -# FIXME: Work around the namespace being incorrectly detected -# by glib-mkenums. This needs to be fixed by changing the -# namespace in libgdata. See !6. -sources += custom_target( - enums + '.c', - input: enums_in[0], - output: enums + '.c', - command: enum_source_cmd, - capture: true, -) - -enum_headers += custom_target( - enums + '.h', - input: enums_in[1], - output: enums + '.h', - command: enum_header_cmd, - capture: true, - install: true, - install_dir: gdata_includedir / include_subdir, -) diff --git a/gdata/services/meson.build b/gdata/services/meson.build index f9879c71..7ca21622 100644 --- a/gdata/services/meson.build +++ b/gdata/services/meson.build @@ -1,7 +1,6 @@ subdir('calendar') subdir('contacts') subdir('documents') -subdir('freebase') subdir('picasaweb') subdir('tasks') subdir('youtube') diff --git a/gdata/symbol.map b/gdata/symbol.map index 9b9c8de1..005eb5de 100644 --- a/gdata/symbol.map +++ b/gdata/symbol.map @@ -458,77 +458,6 @@ global: gdata_feed_get_updated; gdata_feed_look_up_entry; gdata_feed_look_up_link; - gdata_freebase_query_get_type; - gdata_freebase_query_new; - gdata_freebase_query_new_from_variant; - gdata_freebase_result_dup_variant; - gdata_freebase_result_get_type; - gdata_freebase_result_new; - gdata_freebase_search_filter_type_get_type; - gdata_freebase_search_query_add_filter; - gdata_freebase_search_query_add_location; - gdata_freebase_search_query_close_filter; - gdata_freebase_search_query_get_language; - gdata_freebase_search_query_get_stemmed; - gdata_freebase_search_query_get_type; - gdata_freebase_search_query_new; - gdata_freebase_search_query_open_filter; - gdata_freebase_search_query_set_language; - gdata_freebase_search_query_set_stemmed; - gdata_freebase_search_result_get_item; - gdata_freebase_search_result_get_num_items; - gdata_freebase_search_result_get_total_hits; - gdata_freebase_search_result_get_type; - gdata_freebase_search_result_item_get_id; - gdata_freebase_search_result_item_get_language; - gdata_freebase_search_result_item_get_mid; - gdata_freebase_search_result_item_get_name; - gdata_freebase_search_result_item_get_notable_id; - gdata_freebase_search_result_item_get_notable_name; - gdata_freebase_search_result_item_get_score; - gdata_freebase_search_result_item_get_type; - gdata_freebase_search_result_new; - gdata_freebase_service_get_image; - gdata_freebase_service_get_topic; - gdata_freebase_service_get_topic_async; - gdata_freebase_service_get_type; - gdata_freebase_service_new; - gdata_freebase_service_query; - gdata_freebase_service_query_async; - gdata_freebase_service_search; - gdata_freebase_service_search_async; - gdata_freebase_topic_object_get_id; - gdata_freebase_topic_object_get_property_count; - gdata_freebase_topic_object_get_property_hits; - gdata_freebase_topic_object_get_property_value; - gdata_freebase_topic_object_get_type; - gdata_freebase_topic_object_list_properties; - gdata_freebase_topic_object_ref; - gdata_freebase_topic_object_unref; - gdata_freebase_topic_query_get_filter; - gdata_freebase_topic_query_get_language; - gdata_freebase_topic_query_get_type; - gdata_freebase_topic_query_new; - gdata_freebase_topic_query_set_filter; - gdata_freebase_topic_query_set_language; - gdata_freebase_topic_result_dup_object; - gdata_freebase_topic_result_get_type; - gdata_freebase_topic_result_new; - gdata_freebase_topic_value_copy_value; - gdata_freebase_topic_value_get_creator; - gdata_freebase_topic_value_get_double; - gdata_freebase_topic_value_get_int; - gdata_freebase_topic_value_get_language; - gdata_freebase_topic_value_get_object; - gdata_freebase_topic_value_get_property; - gdata_freebase_topic_value_get_string; - gdata_freebase_topic_value_get_text; - gdata_freebase_topic_value_get_timestamp; - gdata_freebase_topic_value_get_type; - gdata_freebase_topic_value_get_value_type; - gdata_freebase_topic_value_is_image; - gdata_freebase_topic_value_ref; - gdata_freebase_topic_value_unref; gdata_gcontact_calendar_get_label; gdata_gcontact_calendar_get_relation_type; gdata_gcontact_calendar_get_type; diff --git a/po/POTFILES.in b/po/POTFILES.in index 2e259b41..6561133e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -22,7 +22,6 @@ gdata/services/documents/gdata-documents-document.c gdata/services/documents/gdata-documents-entry.c gdata/services/documents/gdata-documents-feed.c gdata/services/documents/gdata-documents-service.c -gdata/services/freebase/gdata-freebase-service.c gdata/services/picasaweb/gdata-picasaweb-service.c gdata/services/tasks/gdata-tasks-service.c gdata/services/youtube/gdata-youtube-service.c -- cgit v1.2.1