[gnome-online-accounts/wip/modules: 4/13] facebook: Split it into a loadable module



commit e9a2f5f8eb6bf6eaa82ede4392bee69b27fcd4c1
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Apr 29 15:59:56 2014 +0200

    facebook: Split it into a loadable module
    
    As a side effect, the documentation has been removed. There is no point
    in scanning yet another shared library when there are no symbols that
    need documenting.
    
    Fixes: https://bugzilla.gnome.org/729173

 configure.ac                         |    1 +
 doc/goa-docs.xml                     |    1 -
 doc/goa-sections.txt                 |   10 --------
 doc/goa.types                        |    1 -
 src/goabackend/Makefile.am           |   26 +++++++++++++++++++-
 src/goabackend/goafacebookmodule.c   |   43 ++++++++++++++++++++++++++++++++++
 src/goabackend/goafacebookprovider.c |   34 ++++++++++----------------
 src/goabackend/goafacebookprovider.h |    5 ++-
 src/goabackend/goaprovider.c         |    4 ---
 9 files changed, 85 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 05928df..5377d45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,6 +281,7 @@ AC_DEFINE_UNQUOTED(GOA_FACEBOOK_CLIENT_ID,
 if test "$enable_facebook" != "no"; then
   AC_DEFINE(GOA_FACEBOOK_ENABLED, 1, [Enable Facebook data provider])
 fi
+AM_CONDITIONAL(BUILD_FACEBOOK, [test x$enable_facebook != xno])
 
 # Windows Live
 AC_ARG_ENABLE([windows-live], [AS_HELP_STRING([--enable-windows-live],
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index d30929a..3c5797d 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -168,7 +168,6 @@
       <title>Providers</title>
       <xi:include href="xml/goaexchangeprovider.xml"/>
       <xi:include href="xml/goawindowsliveprovider.xml"/>
-      <xi:include href="xml/goafacebookprovider.xml"/>
       <xi:include href="xml/goayahooprovider.xml"/>
       <xi:include href="xml/goaflickrprovider.xml"/>
       <xi:include href="xml/goatelepathyfactory.xml"/>
diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
index 59da10e..5e2389c 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -549,16 +549,6 @@ goa_windows_live_provider_get_type
 </SECTION>
 
 <SECTION>
-<FILE>goafacebookprovider</FILE>
-GoaFacebookProvider
-<SUBSECTION Standard>
-GOA_FACEBOOK_PROVIDER
-GOA_IS_FACEBOOK_PROVIDER
-GOA_TYPE_FACEBOOK_PROVIDER
-goa_facebook_provider_get_type
-</SECTION>
-
-<SECTION>
 <FILE>goayahooprovider</FILE>
 GoaYahooProvider
 <SUBSECTION Standard>
diff --git a/doc/goa.types b/doc/goa.types
index 8e01cc2..33cefd3 100644
--- a/doc/goa.types
+++ b/doc/goa.types
@@ -30,7 +30,6 @@ goa_files_skeleton_get_type
 goa_provider_get_type
 goa_oauth_provider_get_type
 goa_oauth2_provider_get_type
-goa_facebook_provider_get_type
 goa_yahoo_provider_get_type
 goa_flickr_provider_get_type
 goa_windows_live_provider_get_type
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 781480b..6b3a575 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -82,7 +82,6 @@ libgoa_backend_1_0_la_SOURCES =                                               \
        goaexchangeprovider.h           goaexchangeprovider.c           \
        goaoauthprovider.h              goaoauthprovider.c              \
        goaoauth2provider.h             goaoauth2provider.c             \
-       goafacebookprovider.h           goafacebookprovider.c           \
        goaimapsmtpprovider.h           goaimapsmtpprovider.c           \
        goaowncloudprovider.h           goaowncloudprovider.c           \
        goayahooprovider.h              goayahooprovider.c              \
@@ -98,6 +97,31 @@ libgoa_backend_1_0_la_SOURCES =                                              \
        $(top_builddir)/src/goaidentity/org.freedesktop.realmd.c        \
        $(NULL)
 
+if BUILD_FACEBOOK
+goamodule_LTLIBRARIES += libgoafacebook.la
+libgoafacebook_la_SOURCES =                                    \
+       goafacebookmodule.c                                     \
+       goafacebookprovider.c                                   \
+       goafacebookprovider.h                                   \
+       $(NULL)
+libgoafacebook_la_CFLAGS =                                     \
+       $(GLIB_CFLAGS)                                          \
+       $(GTK_CFLAGS)                                           \
+       $(JSON_GLIB_CFLAGS)                                     \
+       $(REST_CFLAGS)                                          \
+       $(WEBKIT_GTK_CFLAGS)                                    \
+       $(NULL)
+libgoafacebook_la_LIBADD =                                     \
+       $(builddir)/libgoa-backend-1.0.la                       \
+       $(GLIB_LIBS)                                            \
+       $(GTK_LIBS)                                             \
+       $(JSON_GLIB_LIBS)                                       \
+       $(REST_LIBS)                                            \
+       $(WEBKIT_GTK_LIBS)                                      \
+       $(NULL)
+libgoafacebook_la_LDFLAGS = $(module_flags)
+endif
+
 if BUILD_GOOGLE
 goamodule_LTLIBRARIES += libgoagoogle.la
 libgoagoogle_la_SOURCES =                                      \
diff --git a/src/goabackend/goafacebookmodule.c b/src/goabackend/goafacebookmodule.c
new file mode 100644
index 0000000..7e7c849
--- /dev/null
+++ b/src/goabackend/goafacebookmodule.c
@@ -0,0 +1,43 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.h>
+
+#include "goafacebookprovider.h"
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+  goa_facebook_provider_register (module);
+}
+
+void
+g_io_module_unload (GIOModule *module)
+{
+}
+
+gchar **
+g_io_module_query (void)
+{
+  gchar *extension_points[] = {GOA_PROVIDER_EXTENSION_POINT_NAME, NULL};
+  return g_strdupv (extension_points);
+}
diff --git a/src/goabackend/goafacebookprovider.c b/src/goabackend/goafacebookprovider.c
index 85f3a08..bbcc91e 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -27,15 +27,8 @@
 #include "goaoauth2provider.h"
 #include "goafacebookprovider.h"
 
-/**
- * GoaFacebookProvider:
- *
- * The #GoaFacebookProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
 struct _GoaFacebookProvider
 {
-  /*< private >*/
   GoaOAuth2Provider parent_instance;
 };
 
@@ -46,20 +39,7 @@ struct _GoaFacebookProviderClass
   GoaOAuth2ProviderClass parent_class;
 };
 
-/**
- * SECTION:goafacebookprovider
- * @title: GoaFacebookProvider
- * @short_description: A provider for Facebook
- *
- * #GoaFacebookProvider is used for handling Facebook accounts.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaFacebookProvider, goa_facebook_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,
-                                                        "facebook",
-                                                        0));
+G_DEFINE_DYNAMIC_TYPE (GoaFacebookProvider, goa_facebook_provider, GOA_TYPE_OAUTH2_PROVIDER);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -456,6 +436,11 @@ goa_facebook_provider_init (GoaFacebookProvider *client)
 }
 
 static void
+goa_facebook_provider_class_finalize (GoaFacebookProviderClass *klass)
+{
+}
+
+static void
 goa_facebook_provider_class_init (GoaFacebookProviderClass *klass)
 {
   GoaProviderClass *provider_class;
@@ -483,3 +468,10 @@ goa_facebook_provider_class_init (GoaFacebookProviderClass *klass)
   oauth2_class->is_identity_node         = is_identity_node;
   oauth2_class->add_account_key_values   = add_account_key_values;
 }
+
+void
+goa_facebook_provider_register (GIOModule *module)
+{
+  goa_facebook_provider_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, GOA_TYPE_FACEBOOK_PROVIDER, "facebook", 
0);
+}
diff --git a/src/goabackend/goafacebookprovider.h b/src/goabackend/goafacebookprovider.h
index 9635a53..264926a 100644
--- a/src/goabackend/goafacebookprovider.h
+++ b/src/goabackend/goafacebookprovider.h
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011, 2014 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,7 @@
 #ifndef __GOA_FACEBOOK_PROVIDER_H__
 #define __GOA_FACEBOOK_PROVIDER_H__
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
 typedef struct _GoaFacebookProvider GoaFacebookProvider;
 
 GType goa_facebook_provider_get_type (void) G_GNUC_CONST;
+void  goa_facebook_provider_register (GIOModule *module);
 
 G_END_DECLS
 
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 470b143..730801d 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -24,7 +24,6 @@
 #include "goaprovider-priv.h"
 #include "goaproviderfactory.h"
 #include "goaexchangeprovider.h"
-#include "goafacebookprovider.h"
 #include "goaimapsmtpprovider.h"
 #include "goaowncloudprovider.h"
 #include "goayahooprovider.h"
@@ -770,9 +769,6 @@ ensure_builtins_loaded (void)
 #ifdef GOA_OWNCLOUD_ENABLED
       type = GOA_TYPE_OWNCLOUD_PROVIDER;
 #endif
-#ifdef GOA_FACEBOOK_ENABLED
-      type = GOA_TYPE_FACEBOOK_PROVIDER;
-#endif
 #ifdef GOA_FLICKR_ENABLED
       type = GOA_TYPE_FLICKR_PROVIDER;
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]