[gnome-online-accounts/wip/modules: 3/5] google: Split it into a loadable module



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

    google: 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/goagooglemodule.c   |   43 ++++++++++++++++++++++++++++++++++++
 src/goabackend/goagoogleprovider.c |   34 +++++++++++-----------------
 src/goabackend/goagoogleprovider.h |    5 ++-
 src/goabackend/goaprovider.c       |    4 ---
 9 files changed, 85 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f37d08a..c46f9e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,6 +214,7 @@ AC_DEFINE_UNQUOTED(GOA_GOOGLE_CLIENT_SECRET,
 if test "$enable_google" != "no"; then
   AC_DEFINE(GOA_GOOGLE_ENABLED, 1, [Enable Google data provider])
 fi
+AM_CONDITIONAL(BUILD_GOOGLE, [test x$enable_google != xno])
 
 # IMAP/SMTP
 AC_ARG_ENABLE([imap-smtp],
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 6567b0e..d30929a 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -167,7 +167,6 @@
     <chapter>
       <title>Providers</title>
       <xi:include href="xml/goaexchangeprovider.xml"/>
-      <xi:include href="xml/goagoogleprovider.xml"/>
       <xi:include href="xml/goawindowsliveprovider.xml"/>
       <xi:include href="xml/goafacebookprovider.xml"/>
       <xi:include href="xml/goayahooprovider.xml"/>
diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
index 7f46754..59da10e 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -539,16 +539,6 @@ goa_exchange_provider_get_type
 </SECTION>
 
 <SECTION>
-<FILE>goagoogleprovider</FILE>
-GoaGoogleProvider
-<SUBSECTION Standard>
-GOA_GOOGLE_PROVIDER
-GOA_IS_GOOGLE_PROVIDER
-GOA_TYPE_GOOGLE_PROVIDER
-goa_google_provider_get_type
-</SECTION>
-
-<SECTION>
 <FILE>goawindowsliveprovider</FILE>
 GoaWindowsLiveProvider
 <SUBSECTION Standard>
diff --git a/doc/goa.types b/doc/goa.types
index c88c0af..8e01cc2 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_google_provider_get_type
 goa_facebook_provider_get_type
 goa_yahoo_provider_get_type
 goa_flickr_provider_get_type
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index e91bb48..cf79a1e 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             \
-       goagoogleprovider.h             goagoogleprovider.c             \
        goafacebookprovider.h           goafacebookprovider.c           \
        goaimapsmtpprovider.h           goaimapsmtpprovider.c           \
        goaowncloudprovider.h           goaowncloudprovider.c           \
@@ -99,6 +98,31 @@ libgoa_backend_1_0_la_SOURCES =                                              \
        $(top_builddir)/src/goaidentity/org.freedesktop.realmd.c        \
        $(NULL)
 
+if BUILD_GOOGLE
+goamodule_LTLIBRARIES += libgoagoogleprovider.la
+libgoagoogleprovider_la_SOURCES =                              \
+       goagooglemodule.c                                       \
+       goagoogleprovider.c                                     \
+       goagoogleprovider.h                                     \
+       $(NULL)
+libgoagoogleprovider_la_CFLAGS =                               \
+       $(GLIB_CFLAGS)                                          \
+       $(GTK_CFLAGS)                                           \
+       $(JSON_GLIB_CFLAGS)                                     \
+       $(REST_CFLAGS)                                          \
+       $(WEBKIT_GTK_CFLAGS)                                    \
+       $(NULL)
+libgoagoogleprovider_la_LIBADD =                               \
+       $(builddir)/libgoa-backend-1.0.la                       \
+       $(GLIB_LIBS)                                            \
+       $(GTK_LIBS)                                             \
+       $(JSON_GLIB_LIBS)                                       \
+       $(REST_LIBS)                                            \
+       $(WEBKIT_GTK_LIBS)                                      \
+       $(NULL)
+libgoagoogleprovider_la_LDFLAGS = $(module_flags)
+endif
+
 if BUILD_KERBEROS
 libgoa_backend_1_0_la_SOURCES +=                                       \
        goakerberosprovider.h           goakerberosprovider.c
diff --git a/src/goabackend/goagooglemodule.c b/src/goabackend/goagooglemodule.c
new file mode 100644
index 0000000..2f380f3
--- /dev/null
+++ b/src/goabackend/goagooglemodule.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 "goagoogleprovider.h"
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+  goa_google_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/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
index d096edd..1c93caf 100644
--- a/src/goabackend/goagoogleprovider.c
+++ b/src/goabackend/goagoogleprovider.c
@@ -27,15 +27,8 @@
 #include "goaoauth2provider.h"
 #include "goagoogleprovider.h"
 
-/**
- * GoaGoogleProvider:
- *
- * The #GoaGoogleProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
 struct _GoaGoogleProvider
 {
-  /*< private >*/
   GoaOAuth2Provider parent_instance;
 };
 
@@ -46,20 +39,7 @@ struct _GoaGoogleProviderClass
   GoaOAuth2ProviderClass parent_class;
 };
 
-/**
- * SECTION:goagoogleprovider
- * @title: GoaGoogleProvider
- * @short_description: A provider for Google
- *
- * #GoaGoogleProvider is used for handling Google accounts.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaGoogleProvider, goa_google_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,
-                                                        "google",
-                                                        0));
+G_DEFINE_DYNAMIC_TYPE (GoaGoogleProvider, goa_google_provider, GOA_TYPE_OAUTH2_PROVIDER);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -609,6 +589,11 @@ goa_google_provider_init (GoaGoogleProvider *client)
 }
 
 static void
+goa_google_provider_class_finalize (GoaGoogleProviderClass *klass)
+{
+}
+
+static void
 goa_google_provider_class_init (GoaGoogleProviderClass *klass)
 {
   GoaProviderClass *provider_class;
@@ -637,3 +622,10 @@ goa_google_provider_class_init (GoaGoogleProviderClass *klass)
   oauth2_class->get_use_mobile_browser    = get_use_mobile_browser;
   oauth2_class->add_account_key_values    = add_account_key_values;
 }
+
+void
+goa_google_provider_register (GIOModule *module)
+{
+  goa_google_provider_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, GOA_TYPE_GOOGLE_PROVIDER, "google", 0);
+}
diff --git a/src/goabackend/goagoogleprovider.h b/src/goabackend/goagoogleprovider.h
index f7ff62d..c3ead7f 100644
--- a/src/goabackend/goagoogleprovider.h
+++ b/src/goabackend/goagoogleprovider.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_GOOGLE_PROVIDER_H__
 #define __GOA_GOOGLE_PROVIDER_H__
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
 typedef struct _GoaGoogleProvider GoaGoogleProvider;
 
 GType goa_google_provider_get_type (void) G_GNUC_CONST;
+void  goa_google_provider_register (GIOModule *module);
 
 G_END_DECLS
 
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index f78a65b..470b143 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 "goagoogleprovider.h"
 #include "goafacebookprovider.h"
 #include "goaimapsmtpprovider.h"
 #include "goaowncloudprovider.h"
@@ -768,9 +767,6 @@ ensure_builtins_loaded (void)
        * important because it affects the order in which they are
        * returned by goa_provider_get_all.
        */
-#ifdef GOA_GOOGLE_ENABLED
-      type = GOA_TYPE_GOOGLE_PROVIDER;
-#endif
 #ifdef GOA_OWNCLOUD_ENABLED
       type = GOA_TYPE_OWNCLOUD_PROVIDER;
 #endif


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