[gnome-online-accounts] Add Foursquare
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] Add Foursquare
- Date: Thu, 18 Dec 2014 09:24:19 +0000 (UTC)
commit ac96507c2ec8097e83eaaf57c39b69c777a469d2
Author: Damián Nohales <damiannohales gmail com>
Date: Thu May 8 16:43:11 2014 -0300
Add Foursquare
https://bugzilla.gnome.org/show_bug.cgi?id=729837
README | 6 +
configure.ac | 23 ++
data/icons/16x16/Makefile.am | 1 +
data/icons/16x16/goa-account-foursquare.png | Bin 0 -> 1624 bytes
data/icons/22x22/Makefile.am | 1 +
data/icons/22x22/goa-account-foursquare.png | Bin 0 -> 974 bytes
data/icons/24x24/Makefile.am | 1 +
data/icons/24x24/goa-account-foursquare.png | Bin 0 -> 1058 bytes
data/icons/32x32/Makefile.am | 1 +
data/icons/32x32/goa-account-foursquare.png | Bin 0 -> 1642 bytes
data/icons/48x48/Makefile.am | 1 +
data/icons/48x48/goa-account-foursquare.png | Bin 0 -> 2555 bytes
doc/goa-docs.xml | 1 +
doc/goa-sections.txt | 10 +
doc/goa.types | 1 +
gnome-online-accounts.doap | 3 +-
po/POTFILES.in | 1 +
src/goabackend/Makefile.am | 1 +
src/goabackend/goafoursquareprovider.c | 459 +++++++++++++++++++++++++++
src/goabackend/goafoursquareprovider.h | 40 +++
src/goabackend/goaprovider.c | 4 +
21 files changed, 553 insertions(+), 1 deletions(-)
---
diff --git a/README b/README
index 829046d..df7d884 100644
--- a/README
+++ b/README
@@ -26,6 +26,12 @@ Flickr
OAuth 1.0: http://www.flickr.com/services/api/auth.oauth.html
+Foursquare
+----------
+
+OAuth 2.0: https://developer.foursquare.com/overview/auth
+
+
Google
------
diff --git a/configure.ac b/configure.ac
index 1dcfbe8..f85d6f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -185,6 +185,28 @@ if test "$enable_flickr" != "no"; then
AC_DEFINE(GOA_FLICKR_ENABLED, 1, [Enable Flickr data provider])
fi
+# Foursquare
+AC_DEFINE(GOA_FOURSQUARE_NAME, ["foursquare"], [ProviderType and extension point name])
+AC_ARG_ENABLE([foursquare],
+ [AS_HELP_STRING([--enable-foursquare],
+ [Enable Foursquare provider])],
+ [],
+ [enable_foursquare=no])
+AC_ARG_WITH(foursquare-client-id,
+ [AS_HELP_STRING([--with-foursquare-client-id],
+ [Foursquare OAuth 2.0 client id])],
+ [],
+ [])
+if test "$with_foursquare_client_id" = ""; then
+ with_foursquare_client_id="MBNU2NES5HASNDQJ25YPFGG2UGRZHPI3IYTNJGE0KIWT2HCF"
+fi
+AC_DEFINE_UNQUOTED(GOA_FOURSQUARE_CLIENT_ID,
+ ["$with_foursquare_client_id"],
+ [Foursquare OAuth 2.0 client id])
+if test "$enable_foursquare" != "no"; then
+ AC_DEFINE(GOA_FOURSQUARE_ENABLED, 1, [Enable Foursquare data provider])
+fi
+
# Google
AC_DEFINE(GOA_GOOGLE_NAME, ["google"], [ProviderType and extension point name])
AC_ARG_ENABLE([google], [AS_HELP_STRING([--enable-google], [Enable Google provider])], [],
[enable_google=yes])
@@ -530,6 +552,7 @@ echo "
introspection: ${found_introspection}
Flickr provider: ${enable_flickr} (OAuth 1.0, key:${with_flickr_consumer_key}
secret:${with_flickr_consumer_secret})
+ Foursquare provider: ${enable_foursquare} (id:${with_foursquare_client_id})
Google provider: ${enable_google} (OAuth 2.0, id:${with_google_client_id}
secret:${with_google_client_secret})
IMAP/SMTP provider: ${enable_imap_smtp}
Media Server provider: ${enable_media_server}
diff --git a/data/icons/16x16/Makefile.am b/data/icons/16x16/Makefile.am
index 712e92c..889664f 100644
--- a/data/icons/16x16/Makefile.am
+++ b/data/icons/16x16/Makefile.am
@@ -8,6 +8,7 @@ icon_DATA = \
goa-account-google.png \
goa-account-owncloud.png \
goa-account-pocket.png \
+ goa-account-foursquare.png \
goa-account-yahoo.png \
$(NULL)
diff --git a/data/icons/16x16/goa-account-foursquare.png b/data/icons/16x16/goa-account-foursquare.png
new file mode 100644
index 0000000..1d782c5
Binary files /dev/null and b/data/icons/16x16/goa-account-foursquare.png differ
diff --git a/data/icons/22x22/Makefile.am b/data/icons/22x22/Makefile.am
index 7936883..710f3cc 100644
--- a/data/icons/22x22/Makefile.am
+++ b/data/icons/22x22/Makefile.am
@@ -8,6 +8,7 @@ icon_DATA = \
goa-account-google.png \
goa-account-owncloud.png \
goa-account-pocket.png \
+ goa-account-foursquare.png \
goa-account-yahoo.png \
$(NULL)
diff --git a/data/icons/22x22/goa-account-foursquare.png b/data/icons/22x22/goa-account-foursquare.png
new file mode 100644
index 0000000..8c4d382
Binary files /dev/null and b/data/icons/22x22/goa-account-foursquare.png differ
diff --git a/data/icons/24x24/Makefile.am b/data/icons/24x24/Makefile.am
index 71bda53..9863d8c 100644
--- a/data/icons/24x24/Makefile.am
+++ b/data/icons/24x24/Makefile.am
@@ -7,6 +7,7 @@ icon_DATA = \
goa-account-google.png \
goa-account-owncloud.png \
goa-account-pocket.png \
+ goa-account-foursquare.png \
goa-account-flickr.png \
goa-account-yahoo.png \
$(NULL)
diff --git a/data/icons/24x24/goa-account-foursquare.png b/data/icons/24x24/goa-account-foursquare.png
new file mode 100644
index 0000000..2ac0f6a
Binary files /dev/null and b/data/icons/24x24/goa-account-foursquare.png differ
diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am
index e6c7c40..9bf6ce9 100644
--- a/data/icons/32x32/Makefile.am
+++ b/data/icons/32x32/Makefile.am
@@ -8,6 +8,7 @@ icon_DATA = \
goa-account-google.png \
goa-account-owncloud.png \
goa-account-pocket.png \
+ goa-account-foursquare.png \
goa-account-yahoo.png \
$(NULL)
diff --git a/data/icons/32x32/goa-account-foursquare.png b/data/icons/32x32/goa-account-foursquare.png
new file mode 100644
index 0000000..3579174
Binary files /dev/null and b/data/icons/32x32/goa-account-foursquare.png differ
diff --git a/data/icons/48x48/Makefile.am b/data/icons/48x48/Makefile.am
index ce58d39..1f794a4 100644
--- a/data/icons/48x48/Makefile.am
+++ b/data/icons/48x48/Makefile.am
@@ -8,6 +8,7 @@ icon_DATA = \
goa-account-owncloud.png \
goa-account-pocket.png \
goa-account-flickr.png \
+ goa-account-foursquare.png \
goa-account-yahoo.png \
$(NULL)
diff --git a/data/icons/48x48/goa-account-foursquare.png b/data/icons/48x48/goa-account-foursquare.png
new file mode 100644
index 0000000..942bda4
Binary files /dev/null and b/data/icons/48x48/goa-account-foursquare.png differ
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 1cbb3bf..b33281a 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -179,6 +179,7 @@
<xi:include href="xml/goafacebookprovider.xml"/>
<xi:include href="xml/goayahooprovider.xml"/>
<xi:include href="xml/goaflickrprovider.xml"/>
+ <xi:include href="xml/goafoursquareprovider.xml"/>
<xi:include href="xml/goatelepathyfactory.xml"/>
<xi:include href="xml/goatelepathyprovider.xml"/>
</chapter>
diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
index 56ee75f..d08e1a3 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -606,6 +606,16 @@ goa_flickr_provider_get_type
</SECTION>
<SECTION>
+<FILE>goafoursquareprovider</FILE>
+GoaFoursquareProvider
+<SUBSECTION Standard>
+GOA_FOURSQUARE_PROVIDER
+GOA_IS_FOURSQUARE_PROVIDER
+GOA_TYPE_FOURSQUARE_PROVIDER
+goa_foursquare_provider_get_type
+</SECTION>
+
+<SECTION>
<FILE>goatelepathyfactory</FILE>
GoaTelepathyFactory
GoaTelepathyFactoryClass
diff --git a/doc/goa.types b/doc/goa.types
index d4d4e06..9eadc95 100644
--- a/doc/goa.types
+++ b/doc/goa.types
@@ -59,4 +59,5 @@ goa_facebook_provider_get_type
goa_media_server_provider_get_type
goa_yahoo_provider_get_type
goa_flickr_provider_get_type
+goa_foursquare_provider_get_type
goa_windows_live_provider_get_type
diff --git a/gnome-online-accounts.doap b/gnome-online-accounts.doap
index 1ebdbf2..bd47309 100644
--- a/gnome-online-accounts.doap
+++ b/gnome-online-accounts.doap
@@ -15,7 +15,8 @@
GNOME Online Accounts provides interfaces so that applications and
libraries in GNOME can access the user's online accounts. It has
providers for Google, ownCloud, Facebook, Flickr, Windows Live,
- Pocket, Microsoft Exchange, IMAP/SMTP, Jabber, SIP and Kerberos.
+ Pocket, Foursquare, Microsoft Exchange, IMAP/SMTP, Jabber, SIP and
+ Kerberos.
</description>
<homepage rdf:resource="https://wiki.gnome.org/Projects/GnomeOnlineAccounts" />
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 32b4688..a7d2546 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,6 +7,7 @@ src/goabackend/goaewsclient.c
src/goabackend/goaexchangeprovider.c
src/goabackend/goafacebookprovider.c
src/goabackend/goaflickrprovider.c
+src/goabackend/goafoursquareprovider.c
src/goabackend/goagoogleprovider.c
src/goabackend/goahttpclient.c
src/goabackend/goaimapauthlogin.c
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index f3b87f1..759f52d 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -88,6 +88,7 @@ libgoa_backend_1_0_la_SOURCES = \
goaowncloudprovider.h goaowncloudprovider.c \
goayahooprovider.h goayahooprovider.c \
goaflickrprovider.h goaflickrprovider.c \
+ goafoursquareprovider.h goafoursquareprovider.c \
goawindowsliveprovider.h goawindowsliveprovider.c \
goatelepathyfactory.h goatelepathyfactory.c \
goatelepathyprovider.h goatelepathyprovider.c \
diff --git a/src/goabackend/goafoursquareprovider.c b/src/goabackend/goafoursquareprovider.c
new file mode 100644
index 0000000..0a82b10
--- /dev/null
+++ b/src/goabackend/goafoursquareprovider.c
@@ -0,0 +1,459 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2014 Damián Nohales
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+#include <rest/rest-proxy.h>
+#include <json-glib/json-glib.h>
+
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+#include "goaoauth2provider.h"
+#include "goafoursquareprovider.h"
+
+/**
+ * GoaFoursquareProvider:
+ *
+ * The #GoaFoursquareProvider structure contains only private data and should
+ * only be accessed using the provided API.
+ */
+struct _GoaFoursquareProvider
+{
+ /*< private >*/
+ GoaOAuth2Provider parent_instance;
+};
+
+typedef struct _GoaFoursquareProviderClass GoaFoursquareProviderClass;
+
+struct _GoaFoursquareProviderClass
+{
+ GoaOAuth2ProviderClass parent_class;
+};
+
+/**
+ * SECTION:goafoursquareprovider
+ * @title: GoaFoursquareProvider
+ * @short_description: A provider for Foursquare
+ *
+ * #GoaFoursquareProvider is used for handling Foursquare accounts.
+ */
+
+G_DEFINE_TYPE_WITH_CODE (GoaFoursquareProvider, goa_foursquare_provider, GOA_TYPE_OAUTH2_PROVIDER,
+ goa_provider_ensure_extension_points_registered ();
+ g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME,
+ g_define_type_id,
+ GOA_FOURSQUARE_NAME,
+ 0));
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static const gchar *
+get_provider_type (GoaProvider *_provider)
+{
+ return GOA_FOURSQUARE_NAME;
+}
+
+static gchar *
+get_provider_name (GoaProvider *_provider,
+ GoaObject *object)
+{
+ return g_strdup (_("Foursquare"));
+}
+
+static GoaProviderGroup
+get_provider_group (GoaProvider *_provider)
+{
+ return GOA_PROVIDER_GROUP_BRANDED;
+}
+
+static GoaProviderFeatures
+get_provider_features (GoaProvider *_provider)
+{
+ return GOA_PROVIDER_FEATURE_BRANDED |
+ GOA_PROVIDER_FEATURE_MAPS;
+}
+
+static gchar *
+build_authorization_uri (GoaOAuth2Provider *provider,
+ const gchar *authorization_uri,
+ const gchar *escaped_redirect_uri,
+ const gchar *escaped_client_id,
+ const gchar *escaped_scope)
+{
+ gchar *uri;
+
+ uri = g_strdup_printf ("%s"
+ "?response_type=token"
+ "&redirect_uri=%s"
+ "&client_id=%s",
+ authorization_uri,
+ escaped_redirect_uri,
+ escaped_client_id);
+ return uri;
+}
+
+static const gchar *
+get_authorization_uri (GoaOAuth2Provider *provider)
+{
+ return "https://foursquare.com/oauth2/authenticate";
+}
+
+static const gchar *
+get_redirect_uri (GoaOAuth2Provider *provider)
+{
+ return "https://localhost/";
+}
+
+static const gchar *
+get_client_id (GoaOAuth2Provider *provider)
+{
+ return GOA_FOURSQUARE_CLIENT_ID;
+}
+
+static const gchar *
+get_client_secret (GoaOAuth2Provider *provider)
+{
+ /* The client secret is not used in the Foursquare Token Flow
+ * that is the recommended flow for serverless apps.
+ */
+ return NULL;
+}
+
+static const gchar *
+get_authentication_cookie (GoaOAuth2Provider *provider)
+{
+ return "bbhive";
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gchar *
+get_identity_sync (GoaOAuth2Provider *provider,
+ const gchar *access_token,
+ gchar **out_presentation_identity,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GError *identity_error;
+ RestProxy *proxy;
+ RestProxyCall *call;
+ JsonParser *parser;
+ JsonObject *json_object;
+ gchar *ret;
+ gchar *id;
+ gchar *presentation_identity;
+
+ ret = NULL;
+
+ identity_error = NULL;
+ proxy = NULL;
+ call = NULL;
+ parser = NULL;
+ id = NULL;
+ presentation_identity = NULL;
+
+ /* TODO: cancellable */
+
+ proxy = rest_proxy_new ("https://api.foursquare.com/v2/users/self", FALSE);
+ call = rest_proxy_new_call (proxy);
+ rest_proxy_call_set_method (call, "GET");
+ rest_proxy_call_add_param (call, "oauth_token", access_token);
+
+ /* See https://developer.foursquare.com/overview/versioning */
+ rest_proxy_call_add_param (call, "v", "20140226");
+
+ if (!rest_proxy_call_sync (call, error))
+ goto out;
+ if (rest_proxy_call_get_status_code (call) != 200)
+ {
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Expected status 200 when requesting your identity, instead got status %d (%s)"),
+ rest_proxy_call_get_status_code (call),
+ rest_proxy_call_get_status_message (call));
+ goto out;
+ }
+
+ parser = json_parser_new ();
+ if (!json_parser_load_from_data (parser,
+ rest_proxy_call_get_payload (call),
+ rest_proxy_call_get_payload_length (call),
+ &identity_error))
+ {
+ g_warning ("json_parser_load_from_data() failed: %s (%s, %d)",
+ identity_error->message,
+ g_quark_to_string (identity_error->domain),
+ identity_error->code);
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ json_object = json_node_get_object (json_parser_get_root (parser));
+ json_object = json_object_get_object_member (json_object, "response");
+ if (json_object == NULL)
+ {
+ g_warning ("Did not find response object in JSON data");
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ json_object = json_object_get_object_member (json_object, "user");
+ if (json_object == NULL)
+ {
+ g_warning ("Did not find user object in JSON data");
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ id = g_strdup (json_object_get_string_member (json_object, "id"));
+ if (id == NULL)
+ {
+ g_warning ("Did not find id in JSON data");
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ json_object = json_object_get_object_member (json_object, "contact");
+ if (json_object == NULL)
+ {
+ g_warning ("Did not find contact object in JSON data");
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ presentation_identity = g_strdup (json_object_get_string_member (json_object, "email"));
+ if (presentation_identity == NULL)
+ {
+ g_warning ("Did not find email in JSON data");
+ g_set_error (error,
+ GOA_ERROR,
+ GOA_ERROR_FAILED,
+ _("Could not parse response"));
+ goto out;
+ }
+
+ ret = id;
+ id = NULL;
+ if (out_presentation_identity != NULL)
+ {
+ *out_presentation_identity = presentation_identity;
+ presentation_identity = NULL;
+ }
+
+ out:
+ g_clear_error (&identity_error);
+ g_clear_object (&call);
+ g_clear_object (&parser);
+ g_clear_object (&proxy);
+ g_free (id);
+ g_free (presentation_identity);
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+is_deny_node (GoaOAuth2Provider *provider, WebKitDOMNode *node)
+{
+ return FALSE;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+is_identity_node (GoaOAuth2Provider *provider, WebKitDOMHTMLInputElement *element)
+{
+ gboolean ret;
+ gchar *element_type;
+ gchar *name;
+
+ element_type = NULL;
+ name = NULL;
+
+ ret = FALSE;
+
+ g_object_get (element, "type", &element_type, NULL);
+ if (g_strcmp0 (element_type, "email") != 0)
+ goto out;
+
+ name = webkit_dom_html_input_element_get_name (element);
+ if (g_strcmp0 (name, "emailOrPhone") != 0)
+ goto out;
+
+ ret = TRUE;
+
+ out:
+ g_free (element_type);
+ g_free (name);
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+build_object (GoaProvider *provider,
+ GoaObjectSkeleton *object,
+ GKeyFile *key_file,
+ const gchar *group,
+ GDBusConnection *connection,
+ gboolean just_added,
+ GError **error)
+{
+ GoaAccount *account = NULL;
+ GoaMaps *maps = NULL;
+ gboolean maps_enabled;
+ gboolean ret = FALSE;
+
+ /* Chain up */
+ if (!GOA_PROVIDER_CLASS (goa_foursquare_provider_parent_class)->build_object (provider,
+ object,
+ key_file,
+ group,
+ connection,
+ just_added,
+ error))
+ goto out;
+
+ account = goa_object_get_account (GOA_OBJECT (object));
+
+ /* Maps */
+ maps = goa_object_get_maps (GOA_OBJECT (object));
+ maps_enabled = g_key_file_get_boolean (key_file, group, "MapsEnabled", NULL);
+ if (maps_enabled)
+ {
+ if (maps == NULL)
+ {
+ maps = goa_maps_skeleton_new ();
+ goa_object_skeleton_set_maps (object, maps);
+ }
+ }
+ else
+ {
+ if (maps != NULL)
+ goa_object_skeleton_set_maps (object, NULL);
+ }
+
+ if (just_added)
+ {
+ goa_account_set_maps_disabled (account, !maps_enabled);
+ g_signal_connect (account,
+ "notify::maps-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ "MapsEnabled");
+ }
+
+ ret = TRUE;
+
+ out:
+ g_clear_object (&account);
+ g_clear_object (&maps);
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+get_use_mobile_browser (GoaOAuth2Provider *provider)
+{
+ return TRUE;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+show_account (GoaProvider *provider,
+ GoaClient *client,
+ GoaObject *object,
+ GtkBox *vbox,
+ GtkGrid *grid,
+ G_GNUC_UNUSED GtkGrid *dummy)
+{
+ gint row;
+
+ row = 0;
+
+ goa_util_add_account_info (grid, row++, object);
+
+ goa_util_add_row_switch_from_keyfile_with_blurb (grid, row++, object,
+ /* Translators: This is a label for a series of
+ * options switches. For example: “Use for Mail”. */
+ _("Use for"),
+ "maps-disabled",
+ _("_Maps"));
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+add_account_key_values (GoaOAuth2Provider *provider,
+ GVariantBuilder *builder)
+{
+ g_variant_builder_add (builder, "{ss}", "MapsEnabled", "true");
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+goa_foursquare_provider_init (GoaFoursquareProvider *client)
+{
+}
+
+static void
+goa_foursquare_provider_class_init (GoaFoursquareProviderClass *klass)
+{
+ GoaProviderClass *provider_class;
+ GoaOAuth2ProviderClass *oauth2_class;
+
+ provider_class = GOA_PROVIDER_CLASS (klass);
+ provider_class->get_provider_type = get_provider_type;
+ provider_class->get_provider_name = get_provider_name;
+ provider_class->get_provider_group = get_provider_group;
+ provider_class->get_provider_features = get_provider_features;
+ provider_class->build_object = build_object;
+ provider_class->show_account = show_account;
+
+ oauth2_class = GOA_OAUTH2_PROVIDER_CLASS (klass);
+ oauth2_class->get_authorization_uri = get_authorization_uri;
+ oauth2_class->build_authorization_uri = build_authorization_uri;
+ oauth2_class->get_redirect_uri = get_redirect_uri;
+ oauth2_class->get_client_id = get_client_id;
+ oauth2_class->get_client_secret = get_client_secret;
+ oauth2_class->get_use_mobile_browser = get_use_mobile_browser;
+ oauth2_class->get_authentication_cookie = get_authentication_cookie;
+ oauth2_class->get_identity_sync = get_identity_sync;
+ oauth2_class->is_deny_node = is_deny_node;
+ oauth2_class->is_identity_node = is_identity_node;
+ oauth2_class->add_account_key_values = add_account_key_values;
+}
diff --git a/src/goabackend/goafoursquareprovider.h b/src/goabackend/goafoursquareprovider.h
new file mode 100644
index 0000000..d9b50f3
--- /dev/null
+++ b/src/goabackend/goafoursquareprovider.h
@@ -0,0 +1,40 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2014 Damián Nohales
+ *
+ * This library 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 of the License, or (at your option) any later version.
+ *
+ * This library 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 this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
+#error "Only <goabackend/goabackend.h> can be included directly."
+#endif
+
+#ifndef __GOA_FOURSQUARE_PROVIDER_H__
+#define __GOA_FOURSQUARE_PROVIDER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GOA_TYPE_FOURSQUARE_PROVIDER (goa_foursquare_provider_get_type ())
+#define GOA_FOURSQUARE_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOA_TYPE_FOURSQUARE_PROVIDER,
GoaFoursquareProvider))
+#define GOA_IS_FOURSQUARE_PROVIDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOA_TYPE_FOURSQUARE_PROVIDER))
+
+typedef struct _GoaFoursquareProvider GoaFoursquareProvider;
+
+GType goa_foursquare_provider_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GOA_FOURSQUARE_PROVIDER_H__ */
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 95c0195..e92d8a0 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -30,6 +30,7 @@
#include "goaowncloudprovider.h"
#include "goayahooprovider.h"
#include "goaflickrprovider.h"
+#include "goafoursquareprovider.h"
#include "goawindowsliveprovider.h"
#include "goatelepathyfactory.h"
#include "goapocketprovider.h"
@@ -781,6 +782,9 @@ static struct
#ifdef GOA_POCKET_ENABLED
{ GOA_POCKET_NAME, goa_pocket_provider_get_type },
#endif
+#ifdef GOA_FOURSQUARE_ENABLED
+ { GOA_FOURSQUARE_NAME, goa_foursquare_provider_get_type },
+#endif
#ifdef GOA_EXCHANGE_ENABLED
{ GOA_EXCHANGE_NAME, goa_exchange_provider_get_type },
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]