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



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

    exchange: 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 --------
 src/goabackend/Makefile.am           |   20 +++++++++++++++-
 src/goabackend/goaexchangemodule.c   |   43 ++++++++++++++++++++++++++++++++++
 src/goabackend/goaexchangeprovider.c |   38 ++++++++++++-----------------
 src/goabackend/goaexchangeprovider.h |    5 ++-
 src/goabackend/goaprovider.c         |    4 ---
 8 files changed, 82 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2d26ff1..337acfd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,7 @@ AC_ARG_ENABLE([exchange],
 if test "$enable_exchange" != "no"; then
   AC_DEFINE(GOA_EXCHANGE_ENABLED, 1, [Enable Microsoft Exchange data provider])
 fi
+AM_CONDITIONAL(BUILD_EXCHANGE, [test x$enable_exchange != xno])
 
 # Flickr
 AC_ARG_ENABLE([flickr], [AS_HELP_STRING([--enable-flickr], [Enable Flickr provider])], [], 
[enable_flickr=yes])
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index fab3806..20618af 100644
--- a/doc/goa-docs.xml
+++ b/doc/goa-docs.xml
@@ -166,7 +166,6 @@
     </chapter>
     <chapter>
       <title>Providers</title>
-      <xi:include href="xml/goaexchangeprovider.xml"/>
       <xi:include href="xml/goayahooprovider.xml"/>
       <xi:include href="xml/goatelepathyfactory.xml"/>
       <xi:include href="xml/goatelepathyprovider.xml"/>
diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
index be2ea62..706563f 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -529,16 +529,6 @@ goa_oauth_provider_get_type
 </SECTION>
 
 <SECTION>
-<FILE>goaexchangeprovider</FILE>
-GoaExchangeProvider
-<SUBSECTION Standard>
-GOA_EXCHANGE_PROVIDER
-GOA_IS_EXCHANGE_PROVIDER
-GOA_TYPE_EXCHANGE_PROVIDER
-goa_exchange_provider_get_type
-</SECTION>
-
-<SECTION>
 <FILE>goayahooprovider</FILE>
 GoaYahooProvider
 <SUBSECTION Standard>
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index c1601aa..1dd8f12 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -79,7 +79,6 @@ libgoa_backend_1_0_la_SOURCES =                                               \
        goaimapauthlogin.h              goaimapauthlogin.c              \
        goasmtpauth.h                   goasmtpauth.c                   \
        goamailclient.h                 goamailclient.c                 \
-       goaexchangeprovider.h           goaexchangeprovider.c           \
        goaoauthprovider.h              goaoauthprovider.c              \
        goaoauth2provider.h             goaoauth2provider.c             \
        goaimapsmtpprovider.h           goaimapsmtpprovider.c           \
@@ -94,6 +93,25 @@ libgoa_backend_1_0_la_SOURCES =                                              \
        $(top_builddir)/src/goaidentity/org.freedesktop.realmd.c        \
        $(NULL)
 
+if BUILD_EXCHANGE
+goamodule_LTLIBRARIES += libgoaexchange.la
+libgoaexchange_la_SOURCES =                                    \
+       goaexchangemodule.c                                     \
+       goaexchangeprovider.c                                   \
+       goaexchangeprovider.h                                   \
+       $(NULL)
+libgoaexchange_la_CFLAGS =                                     \
+       $(GLIB_CFLAGS)                                          \
+       $(GTK_CFLAGS)                                           \
+       $(NULL)
+libgoaexchange_la_LIBADD =                                     \
+       $(builddir)/libgoa-backend-1.0.la                       \
+       $(GLIB_LIBS)                                            \
+       $(GTK_LIBS)                                             \
+       $(NULL)
+libgoaexchange_la_LDFLAGS = $(module_flags)
+endif
+
 if BUILD_FACEBOOK
 goamodule_LTLIBRARIES += libgoafacebook.la
 libgoafacebook_la_SOURCES =                                    \
diff --git a/src/goabackend/goaexchangemodule.c b/src/goabackend/goaexchangemodule.c
new file mode 100644
index 0000000..ef49160
--- /dev/null
+++ b/src/goabackend/goaexchangemodule.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 "goaexchangeprovider.h"
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+  goa_exchange_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/goaexchangeprovider.c b/src/goabackend/goaexchangeprovider.c
index 32ba8bd..dc319c2 100644
--- a/src/goabackend/goaexchangeprovider.c
+++ b/src/goabackend/goaexchangeprovider.c
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2012, 2013 Red Hat, Inc.
+ * Copyright (C) 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
@@ -25,15 +25,8 @@
 #include "goaexchangeprovider.h"
 #include "goautils.h"
 
-/**
- * GoaExchangeProvider:
- *
- * The #GoaExchangeProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
 struct _GoaExchangeProvider
 {
-  /*< private >*/
   GoaProvider parent_instance;
 };
 
@@ -44,20 +37,7 @@ struct _GoaExchangeProviderClass
   GoaProviderClass parent_class;
 };
 
-/**
- * SECTION:goaexchangeprovider
- * @title: GoaExchangeProvider
- * @short_description: A provider for Microsoft Exchange servers
- *
- * #GoaExchangeProvider is used to access Microsoft Exchange servers.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaExchangeProvider, goa_exchange_provider, GOA_TYPE_PROVIDER,
-                         goa_provider_ensure_extension_points_registered ();
-                         g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME,
-                                                        g_define_type_id,
-                                                        "exchange",
-                                                        0));
+G_DEFINE_DYNAMIC_TYPE (GoaExchangeProvider, goa_exchange_provider, GOA_TYPE_PROVIDER);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -961,6 +941,11 @@ goa_exchange_provider_init (GoaExchangeProvider *provider)
 }
 
 static void
+goa_exchange_provider_class_finalize (GoaExchangeProviderClass *klass)
+{
+}
+
+static void
 goa_exchange_provider_class_init (GoaExchangeProviderClass *klass)
 {
   GoaProviderClass *provider_class;
@@ -1033,3 +1018,12 @@ on_handle_get_password (GoaPasswordBased      *interface,
   g_object_unref (provider);
   return TRUE; /* invocation was handled */
 }
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+void
+goa_exchange_provider_register (GIOModule *module)
+{
+  goa_exchange_provider_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, GOA_TYPE_EXCHANGE_PROVIDER, "exchange", 
0);
+}
diff --git a/src/goabackend/goaexchangeprovider.h b/src/goabackend/goaexchangeprovider.h
index 3eb21ee..7039b21 100644
--- a/src/goabackend/goaexchangeprovider.h
+++ b/src/goabackend/goaexchangeprovider.h
@@ -1,6 +1,6 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
- * Copyright (C) 2012 Red Hat, Inc.
+ * Copyright (C) 2012, 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_EXCHANGE_PROVIDER_H__
 #define __GOA_EXCHANGE_PROVIDER_H__
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
 typedef struct _GoaExchangeProvider GoaExchangeProvider;
 
 GType goa_exchange_provider_get_type (void) G_GNUC_CONST;
+void  goa_exchange_provider_register (GIOModule *module);
 
 G_END_DECLS
 
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 0f74c8a..5f8b04e 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 "goaexchangeprovider.h"
 #include "goaimapsmtpprovider.h"
 #include "goaowncloudprovider.h"
 #include "goayahooprovider.h"
@@ -766,9 +765,6 @@ ensure_builtins_loaded (void)
 #ifdef GOA_OWNCLOUD_ENABLED
       type = GOA_TYPE_OWNCLOUD_PROVIDER;
 #endif
-#ifdef GOA_EXCHANGE_ENABLED
-      type = GOA_TYPE_EXCHANGE_PROVIDER;
-#endif
 #ifdef GOA_IMAP_SMTP_ENABLED
       type = GOA_TYPE_IMAP_SMTP_PROVIDER;
 #endif


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