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



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

    yahoo: 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/goaprovider.c      |    4 ---
 src/goabackend/goayahoomodule.c   |   43 +++++++++++++++++++++++++++++++++++++
 src/goabackend/goayahooprovider.c |   36 ++++++++++++-------------------
 src/goabackend/goayahooprovider.h |    5 ++-
 9 files changed, 86 insertions(+), 41 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1f9e8cc..d007752 100644
--- a/configure.ac
+++ b/configure.ac
@@ -264,6 +264,7 @@ AC_DEFINE_UNQUOTED(GOA_YAHOO_CONSUMER_SECRET, ["$with_yahoo_consumer_secret"], [
 if test "$enable_yahoo" != "no"; then
   AC_DEFINE(GOA_YAHOO_ENABLED, 1, [Enable Yahoo data provider])
 fi
+AM_CONDITIONAL(BUILD_YAHOO, [test x$enable_yahoo != xno])
 
 # Facebook
 AC_ARG_ENABLE([facebook], [AS_HELP_STRING([--enable-facebook],
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 20618af..5fc4ba4 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -166,7 +166,6 @@
     </chapter>
     <chapter>
       <title>Providers</title>
-      <xi:include href="xml/goayahooprovider.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 706563f..7c548af 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -529,16 +529,6 @@ goa_oauth_provider_get_type
 </SECTION>
 
 <SECTION>
-<FILE>goayahooprovider</FILE>
-GoaYahooProvider
-<SUBSECTION Standard>
-GOA_YAHOO_PROVIDER
-GOA_IS_YAHOO_PROVIDER
-GOA_TYPE_YAHOO_PROVIDER
-goa_yahoo_provider_get_type
-</SECTION>
-
-<SECTION>
 <FILE>goatelepathyfactory</FILE>
 GoaTelepathyFactory
 GoaTelepathyFactoryClass
diff --git a/doc/goa.types b/doc/goa.types
index 3ff824b..0fcb24d 100644
--- a/doc/goa.types
+++ b/doc/goa.types
@@ -30,4 +30,3 @@ goa_files_skeleton_get_type
 goa_provider_get_type
 goa_oauth_provider_get_type
 goa_oauth2_provider_get_type
-goa_yahoo_provider_get_type
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index cb5faa0..d0f6274 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -81,7 +81,6 @@ libgoa_backend_1_0_la_SOURCES =                                               \
        goamailclient.h                 goamailclient.c                 \
        goaoauthprovider.h              goaoauthprovider.c              \
        goaoauth2provider.h             goaoauth2provider.c             \
-       goayahooprovider.h              goayahooprovider.c              \
        goatelepathyfactory.h           goatelepathyfactory.c           \
        goatelepathyprovider.h          goatelepathyprovider.c          \
        goautils.h                      goautils.c                      \
@@ -280,6 +279,31 @@ libgoawindowslive_la_LIBADD =                                      \
 libgoawindowslive_la_LDFLAGS = $(module_flags)
 endif
 
+if BUILD_YAHOO
+goamodule_LTLIBRARIES += libgoayahoo.la
+libgoayahoo_la_SOURCES =                                       \
+       goayahoomodule.c                                        \
+       goayahooprovider.c                                      \
+       goayahooprovider.h                                      \
+       $(NULL)
+libgoayahoo_la_CFLAGS =                                        \
+       $(GLIB_CFLAGS)                                          \
+       $(GTK_CFLAGS)                                           \
+       $(JSON_GLIB_CFLAGS)                                     \
+       $(REST_CFLAGS)                                          \
+       $(WEBKIT_GTK_CFLAGS)                                    \
+       $(NULL)
+libgoayahoo_la_LIBADD =                                        \
+       $(builddir)/libgoa-backend-1.0.la                       \
+       $(GLIB_LIBS)                                            \
+       $(GTK_LIBS)                                             \
+       $(JSON_GLIB_LIBS)                                       \
+       $(REST_LIBS)                                            \
+       $(WEBKIT_GTK_LIBS)                                      \
+       $(NULL)
+libgoayahoo_la_LDFLAGS = $(module_flags)
+endif
+
 libgoa_backend_1_0_la_CFLAGS =                                 \
        $(WEBKIT_GTK_CFLAGS)                                    \
        $(JSON_GLIB_CFLAGS)                                     \
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 6402348..25e5a4f 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -23,7 +23,6 @@
 #include "goaprovider.h"
 #include "goaprovider-priv.h"
 #include "goaproviderfactory.h"
-#include "goayahooprovider.h"
 #include "goatelepathyfactory.h"
 
 #ifdef GOA_KERBEROS_ENABLED
@@ -763,9 +762,6 @@ ensure_builtins_loaded (void)
 #ifdef GOA_KERBEROS_ENABLED
       type = GOA_TYPE_KERBEROS_PROVIDER;
 #endif
-#ifdef GOA_YAHOO_ENABLED
-      type = GOA_TYPE_YAHOO_PROVIDER;
-#endif
 #ifdef GOA_TELEPATHY_ENABLED
       type = GOA_TYPE_TELEPATHY_FACTORY;
 #endif
diff --git a/src/goabackend/goayahoomodule.c b/src/goabackend/goayahoomodule.c
new file mode 100644
index 0000000..f9349d2
--- /dev/null
+++ b/src/goabackend/goayahoomodule.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 "goaprovider.h"
+#include "goaprovider-priv.h"
+#include "goayahooprovider.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+  goa_yahoo_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/goayahooprovider.c b/src/goabackend/goayahooprovider.c
index 54fa24f..c4cf42b 100644
--- a/src/goabackend/goayahooprovider.c
+++ b/src/goabackend/goayahooprovider.c
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2011, 2012, 2013 Red Hat, Inc.
+ * Copyright (C) 2011, 2012, 2013, 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
@@ -27,15 +27,8 @@
 #include "goaoauthprovider.h"
 #include "goayahooprovider.h"
 
-/**
- * GoaYahooProvider:
- *
- * The #GoaYahooProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
 struct _GoaYahooProvider
 {
-  /*< private >*/
   GoaOAuthProvider parent_instance;
 };
 
@@ -46,20 +39,7 @@ struct _GoaYahooProviderClass
   GoaOAuthProviderClass parent_class;
 };
 
-/**
- * SECTION:goayahooprovider
- * @title: GoaYahooProvider
- * @short_description: A provider for Yahoo
- *
- * #GoaYahooProvider is used for handling Yahoo accounts.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaYahooProvider, goa_yahoo_provider, GOA_TYPE_OAUTH_PROVIDER,
-                         goa_provider_ensure_extension_points_registered ();
-                         g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME,
-                                                        g_define_type_id,
-                                                        "yahoo",
-                                                        0));
+G_DEFINE_DYNAMIC_TYPE (GoaYahooProvider, goa_yahoo_provider, GOA_TYPE_OAUTH_PROVIDER);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -411,6 +391,11 @@ goa_yahoo_provider_init (GoaYahooProvider *client)
 }
 
 static void
+goa_yahoo_provider_class_finalize (GoaYahooProviderClass *klass)
+{
+}
+
+static void
 goa_yahoo_provider_class_init (GoaYahooProviderClass *klass)
 {
   GoaProviderClass *provider_class;
@@ -438,3 +423,10 @@ goa_yahoo_provider_class_init (GoaYahooProviderClass *klass)
   oauth_class->get_use_external_browser = get_use_external_browser;
   oauth_class->parse_request_token_error = parse_request_token_error;
 }
+
+void
+goa_yahoo_provider_register (GIOModule *module)
+{
+  goa_yahoo_provider_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, GOA_TYPE_YAHOO_PROVIDER, "yahoo", 0);
+}
diff --git a/src/goabackend/goayahooprovider.h b/src/goabackend/goayahooprovider.h
index db1a7d2..44c3490 100644
--- a/src/goabackend/goayahooprovider.h
+++ b/src/goabackend/goayahooprovider.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_YAHOO_PROVIDER_H__
 #define __GOA_YAHOO_PROVIDER_H__
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
 typedef struct _GoaYahooProvider GoaYahooProvider;
 
 GType goa_yahoo_provider_get_type (void) G_GNUC_CONST;
+void  goa_yahoo_provider_register (GIOModule *module);
 
 G_END_DECLS
 


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