[grilo-plugins] flickr: remove GOA support
- From: Victor Toso <victortoso src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] flickr: remove GOA support
- Date: Sat, 3 Sep 2022 08:22:13 +0000 (UTC)
commit d1c0835da8f1e3968b1047e262ed4ae51e4e118d
Author: Victor Toso <victortoso gnome org>
Date: Sat Aug 27 09:33:43 2022 +0200
flickr: remove GOA support
GNOME Online accounts removed flicker backend so we need to remove it
here too.
https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/merge_requests/86
This basically reverts 2b973109 "flickr: use GOA to get user's
accounts"
meson.build | 2 +-
src/flickr/grl-flickr.c | 202 ------------------------------------------------
2 files changed, 1 insertion(+), 203 deletions(-)
---
diff --git a/meson.build b/meson.build
index 62c8f837..dce2069a 100644
--- a/meson.build
+++ b/meson.build
@@ -128,7 +128,7 @@ plugins = [ # NAME, REQ_DEPS, OPT_DEPS
['dleyna', [gio_dep, gio_unix_dep], []],
['dmap', [libdmapsharing_dep, libxml_dep], []],
['filesystem', [grilo_pls_dep], []],
- ['flickr', [grilo_net_dep, libxml_dep, oauth_dep], [goa_dep]],
+ ['flickr', [grilo_net_dep, libxml_dep, oauth_dep], []],
['freebox', [grilo_pls_dep, avahi_client_dep, avahi_glib_dep, avahi_gobject_dep], []],
['gravatar', [], []],
['local-metadata', [gio_dep, libmediaart_dep], []],
diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c
index a0b86994..d49026e7 100644
--- a/src/flickr/grl-flickr.c
+++ b/src/flickr/grl-flickr.c
@@ -35,11 +35,6 @@
#include <errno.h>
#include <math.h>
-#ifdef GOA_ENABLED
-#define GOA_API_IS_SUBJECT_TO_CHANGE
-#include <goa/goa.h>
-#endif
-
#include "grl-flickr.h"
#include "gflickr.h"
@@ -81,17 +76,6 @@ struct _GrlFlickrSourcePrivate {
gchar *user_id;
};
-#ifdef GOA_ENABLED
-/*
- * data passed when creating personal source
- * when is GOA enabled, we need even goa_account_id, not only plugin
- */
-struct token_cb_data {
- GrlPlugin *plugin;
- gchar *goa_account_id;
-};
-#endif /* GOA_ENABLED */
-
static void token_info_cb (GFlickr *f,
GHashTable *info,
@@ -100,20 +84,11 @@ static void token_info_cb (GFlickr *f,
static GrlFlickrSource *grl_flickr_source_public_new (const gchar *flickr_api_key,
const gchar *flickr_secret);
-#ifdef GOA_ENABLED
-static void grl_flickr_source_personal_new (GrlPlugin *plugin,
- const gchar *flickr_api_key,
- const gchar *flickr_secret,
- const gchar *flickr_token,
- const gchar *token_secret,
- gchar *goa_account_id);
-#else
static void grl_flickr_source_personal_new (GrlPlugin *plugin,
const gchar *flickr_api_key,
const gchar *flickr_secret,
const gchar *flickr_token,
const gchar *token_secret);
-#endif /* GOA_ENABLED */
static void grl_flickr_source_finalize (GObject *object);
@@ -133,10 +108,6 @@ static void grl_flickr_source_resolve (GrlSource *source,
static void grl_flickr_source_search (GrlSource *source,
GrlSourceSearchSpec *ss);
-#ifdef GOA_ENABLED
-static GList *grl_flickr_get_goa_multiple_config (GrlPlugin *plugin, gboolean public);
-#endif
-
/* =================== Flickr Plugin =============== */
gboolean
@@ -155,12 +126,6 @@ grl_flickr_plugin_init (GrlRegistry *registry,
GRL_LOG_DOMAIN_INIT (flickr_log_domain, "flickr");
-#ifdef GOA_ENABLED
- GRL_DEBUG ("GOA enabled");
- gboolean create_public_from_goa = FALSE;
- gchar *goa_account_id = NULL;
-#endif
-
GRL_DEBUG ("flickr_plugin_init");
/* Initialize i18n */
@@ -168,30 +133,10 @@ grl_flickr_plugin_init (GrlRegistry *registry,
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
if (configs == NULL) {
-#ifdef GOA_ENABLED
- GRL_DEBUG ("No user config passed.");
- create_public_from_goa = TRUE;
-#else
GRL_INFO ("Configuration not provided! Plugin not loaded");
return FALSE;
-#endif /* GOA_ENABLED */
}
-#ifdef GOA_ENABLED
- /* When is GOA enabled, add all configs from GOA too */
- GList *goa_config = grl_flickr_get_goa_multiple_config (plugin,
- create_public_from_goa);
-
- if (goa_config == NULL)
- {
- GRL_INFO ("Cannot get flickr sources from GOA.");
- }
- else
- {
- configs = g_list_concat (configs, goa_config);
- }
-#endif /* GOA_ENABLED */
-
while (configs) {
config = GRL_CONFIG (configs->data);
@@ -204,22 +149,11 @@ grl_flickr_plugin_init (GrlRegistry *registry,
GRL_INFO ("Required API key or secret configuration not provdied. "
" Plugin not loaded");
} else if (flickr_token && flickr_token_secret) {
-#ifdef GOA_ENABLED
- goa_account_id = grl_config_get_string (config, "goa-account-id");
-
- grl_flickr_source_personal_new (plugin,
- flickr_key,
- flickr_secret,
- flickr_token,
- flickr_token_secret,
- goa_account_id);
-#else
grl_flickr_source_personal_new (plugin,
flickr_key,
flickr_secret,
flickr_token,
flickr_token_secret);
-#endif /* GOA_ENABLED */
} else if (public_source_created) {
GRL_WARNING ("Only one public source can be created");
} else {
@@ -285,22 +219,12 @@ grl_flickr_source_public_new (const gchar *flickr_api_key,
return source;
}
-#ifdef GOA_ENABLED
-static void
-grl_flickr_source_personal_new (GrlPlugin *plugin,
- const gchar *flickr_api_key,
- const gchar *flickr_secret,
- const gchar *flickr_token,
- const gchar *flickr_token_secret,
- gchar *goa_account_id)
-#else
static void
grl_flickr_source_personal_new (GrlPlugin *plugin,
const gchar *flickr_api_key,
const gchar *flickr_secret,
const gchar *flickr_token,
const gchar *flickr_token_secret)
-#endif /* GOA_ENABLED */
{
GFlickr *f;
@@ -309,19 +233,8 @@ grl_flickr_source_personal_new (GrlPlugin *plugin,
f = g_flickr_new (flickr_api_key, flickr_secret,
flickr_token, flickr_token_secret);
-#ifdef GOA_ENABLED
- struct token_cb_data *data;
-
- data = g_slice_new (struct token_cb_data);
- data->plugin = plugin;
- data->goa_account_id = goa_account_id;
-
- g_flickr_auth_checkToken (f, flickr_token, token_info_cb,
- (gpointer) data);
-#else
g_flickr_auth_checkToken (f, flickr_token, token_info_cb,
(gpointer) plugin);
-#endif /* GOA_ENABLED */
}
static void
@@ -375,13 +288,7 @@ token_info_cb (GFlickr *f,
gchar *source_name;
gchar *username;
-#ifdef GOA_ENABLED
- struct token_cb_data *data = (struct token_cb_data *) user_data;
- GrlPlugin *plugin = data->plugin;
-#else
GrlPlugin *plugin = (GrlPlugin *) user_data;
-#endif
-
if (!info) {
GRL_WARNING ("Wrong token!");
@@ -395,21 +302,7 @@ token_info_cb (GFlickr *f,
fullname = g_hash_table_lookup (info, "user_fullname");
/* Set source id */
-#ifdef GOA_ENABLED
- if (data->goa_account_id != NULL)
- {
- source_id = g_strdup_printf (PERSONAL_SOURCE_ID, data->goa_account_id);
-
- g_free (data->goa_account_id);
- g_slice_free (struct token_cb_data, data);
- }
- else
- {
- source_id = g_strdup_printf (PERSONAL_SOURCE_ID, username);
- }
-#else
source_id = g_strdup_printf (PERSONAL_SOURCE_ID, username);
-#endif /* GOA_ENABLED */
source_name = g_strdup_printf (PERSONAL_SOURCE_NAME, fullname);
source_desc = g_strdup_printf (PERSONAL_SOURCE_DESC, fullname);
@@ -844,101 +737,6 @@ gettags_cb (GFlickr *f, GList *taglist, gpointer user_data)
}
}
-#ifdef GOA_ENABLED
-static GList *
-grl_flickr_get_goa_multiple_config (GrlPlugin *plugin, gboolean public)
-{
- GList *tmp;
- GList *list = NULL;
- GError *error = NULL;
- GrlConfig *conf = NULL;
- GList *configs = NULL;
-
- gchar *access_token;
- gchar *token_secret;
-
- gboolean public_created = FALSE;
-
- GoaAccount *acc = NULL;
- GoaOAuthBased *oauth = NULL;
- GoaClient *cl = goa_client_new_sync (NULL, &error);
-
- if (error != NULL)
- {
- GRL_ERROR ("%s\n", error->message);
- return NULL;
- }
-
- list = goa_client_get_accounts (cl);
- tmp = g_list_first (list);
-
- /* find flickr one's and get tokens */
- while (tmp != NULL)
- {
- acc = goa_object_peek_account (tmp->data);
-
- if (strcmp (goa_account_get_provider_type (acc), "flickr") == 0)
- {
- oauth = goa_object_peek_oauth_based (tmp->data);
-
- if (oauth != NULL)
- {
- conf = grl_config_new (grl_plugin_get_id (plugin),
- NULL);
-
- /* Consumer data */
- grl_config_set_api_key (conf,
- goa_oauth_based_get_consumer_key (oauth));
- grl_config_set_api_secret (conf,
- goa_oauth_based_get_consumer_secret (oauth));
-
- /* enable recognize that this config is from goa */
- grl_config_set_string (conf, "goa-account-id",
- goa_account_get_id (acc));
-
- /* if public == TRUE, create one public source */
- if (public == TRUE && public_created == FALSE)
- {
- configs = g_list_append (configs, conf);
- public_created = TRUE;
-
- continue; /* Use this personal source again, but this time with tokens */
- }
-
- /* Get Access Token */
- if (! goa_oauth_based_call_get_access_token_sync (oauth,
- &access_token,
- &token_secret,
- NULL, NULL,
- &error))
- {
-
- /* No access token doesn't mean error */
- GRL_INFO ("Access token: %s\n", error->message);
- g_error_free (error);
- }
- else
- {
- grl_config_set_api_token (conf, access_token);
- grl_config_set_api_token_secret (conf, token_secret);
-
- g_clear_pointer (&access_token, g_free);
- g_clear_pointer (&token_secret, g_free);
- }
-
- configs = g_list_append (configs, conf);
- }
- }
- tmp = g_list_next (tmp);
- }
-
- g_object_unref (cl);
- g_list_free_full (list, g_object_unref);
-
- return configs;
-}
-#endif /* FLICKR_GOA_ENABLED */
-
/* ================== API Implementation ================ */
static const GList *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]