[gnome-online-accounts/wip/modules: 6/10] live: Split it into a loadable module



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

    live: 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/goawindowslivemodule.c   |   43 +++++++++++++++++++++++++++++++
 src/goabackend/goawindowsliveprovider.c |   37 +++++++++++---------------
 src/goabackend/goawindowsliveprovider.h |    5 ++-
 9 files changed, 88 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5377d45..2864889 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,6 +302,7 @@ AC_DEFINE_UNQUOTED(GOA_WINDOWS_LIVE_CLIENT_ID,
 if test "$enable_windows_live" != "no"; then
   AC_DEFINE(GOA_WINDOWS_LIVE_ENABLED, 1, [Enable Windows Live data provider])
 fi
+AM_CONDITIONAL(BUILD_WINDOWS_LIVE, [test x$enable_windows_live != xno])
 
 # Telepathy
 AC_ARG_ENABLE([telepathy],
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 3c5797d..56dc0a0 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/goawindowsliveprovider.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 5e2389c..695b6c2 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -539,16 +539,6 @@ goa_exchange_provider_get_type
 </SECTION>
 
 <SECTION>
-<FILE>goawindowsliveprovider</FILE>
-GoaWindowsLiveProvider
-<SUBSECTION Standard>
-GOA_WINDOWS_LIVE_PROVIDER
-GOA_IS_WINDOWS_LIVE_PROVIDER
-GOA_TYPE_WINDOWS_LIVE_PROVIDER
-goa_windows_live_provider_get_type
-</SECTION>
-
-<SECTION>
 <FILE>goayahooprovider</FILE>
 GoaYahooProvider
 <SUBSECTION Standard>
diff --git a/doc/goa.types b/doc/goa.types
index 33cefd3..aa34088 100644
--- a/doc/goa.types
+++ b/doc/goa.types
@@ -32,4 +32,3 @@ goa_oauth_provider_get_type
 goa_oauth2_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 6b3a575..3440b53 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -86,7 +86,6 @@ libgoa_backend_1_0_la_SOURCES =                                               \
        goaowncloudprovider.h           goaowncloudprovider.c           \
        goayahooprovider.h              goayahooprovider.c              \
        goaflickrprovider.h             goaflickrprovider.c             \
-       goawindowsliveprovider.h        goawindowsliveprovider.c        \
        goatelepathyfactory.h           goatelepathyfactory.c           \
        goatelepathyprovider.h          goatelepathyprovider.c          \
        goapocketprovider.h             goapocketprovider.c             \
@@ -152,6 +151,31 @@ libgoa_backend_1_0_la_SOURCES +=                                   \
        goakerberosprovider.h           goakerberosprovider.c
 endif
 
+if BUILD_WINDOWS_LIVE
+goamodule_LTLIBRARIES += libgoawindowslive.la
+libgoawindowslive_la_SOURCES =                                 \
+       goawindowslivemodule.c                                  \
+       goawindowsliveprovider.c                                \
+       goawindowsliveprovider.h                                \
+       $(NULL)
+libgoawindowslive_la_CFLAGS =                                  \
+       $(GLIB_CFLAGS)                                          \
+       $(GTK_CFLAGS)                                           \
+       $(JSON_GLIB_CFLAGS)                                     \
+       $(REST_CFLAGS)                                          \
+       $(WEBKIT_GTK_CFLAGS)                                    \
+       $(NULL)
+libgoawindowslive_la_LIBADD =                                  \
+       $(builddir)/libgoa-backend-1.0.la                       \
+       $(GLIB_LIBS)                                            \
+       $(GTK_LIBS)                                             \
+       $(JSON_GLIB_LIBS)                                       \
+       $(REST_LIBS)                                            \
+       $(WEBKIT_GTK_LIBS)                                      \
+       $(NULL)
+libgoawindowslive_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 730801d..4a5b344 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -28,7 +28,6 @@
 #include "goaowncloudprovider.h"
 #include "goayahooprovider.h"
 #include "goaflickrprovider.h"
-#include "goawindowsliveprovider.h"
 #include "goatelepathyfactory.h"
 #include "goapocketprovider.h"
 
@@ -772,9 +771,6 @@ ensure_builtins_loaded (void)
 #ifdef GOA_FLICKR_ENABLED
       type = GOA_TYPE_FLICKR_PROVIDER;
 #endif
-#ifdef GOA_WINDOWS_LIVE_ENABLED
-      type = GOA_TYPE_WINDOWS_LIVE_PROVIDER;
-#endif
 #ifdef GOA_POCKET_ENABLED
       type = GOA_TYPE_POCKET_PROVIDER;
 #endif
diff --git a/src/goabackend/goawindowslivemodule.c b/src/goabackend/goawindowslivemodule.c
new file mode 100644
index 0000000..e28d6e5
--- /dev/null
+++ b/src/goabackend/goawindowslivemodule.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 "goawindowsliveprovider.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+  goa_windows_live_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/goawindowsliveprovider.c b/src/goabackend/goawindowsliveprovider.c
index d3d8ff2..784beab 100644
--- a/src/goabackend/goawindowsliveprovider.c
+++ b/src/goabackend/goawindowsliveprovider.c
@@ -29,15 +29,8 @@
 #include "goaoauth2provider.h"
 #include "goawindowsliveprovider.h"
 
-/**
- * GoaWindowsLiveProvider:
- *
- * The #GoaWindowsLiveProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
 struct _GoaWindowsLiveProvider
 {
-  /*< private >*/
   GoaOAuth2Provider parent_instance;
 };
 
@@ -48,20 +41,7 @@ struct _GoaWindowsLiveProviderClass
   GoaOAuth2ProviderClass parent_class;
 };
 
-/**
- * SECTION:goawindowsliveprovider
- * @title: GoaWindowsLiveProvider
- * @short_description: A provider for Windows Live accounts
- *
- * #GoaWindowsLiveProvider is used for handling Windows Live accounts.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaWindowsLiveProvider, goa_windows_live_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,
-                                                        "windows_live",
-                                                        0));
+G_DEFINE_DYNAMIC_TYPE (GoaWindowsLiveProvider, goa_windows_live_provider, GOA_TYPE_OAUTH2_PROVIDER);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -449,6 +429,11 @@ goa_windows_live_provider_init (GoaWindowsLiveProvider *client)
 }
 
 static void
+goa_windows_live_provider_class_finalize (GoaWindowsLiveProviderClass *klass)
+{
+}
+
+static void
 goa_windows_live_provider_class_init (GoaWindowsLiveProviderClass *klass)
 {
   GoaProviderClass *provider_class;
@@ -476,3 +461,13 @@ goa_windows_live_provider_class_init (GoaWindowsLiveProviderClass *klass)
   oauth2_class->is_identity_node         = is_identity_node;
   oauth2_class->add_account_key_values   = add_account_key_values;
 }
+
+void
+goa_windows_live_provider_register (GIOModule *module)
+{
+  goa_windows_live_provider_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME,
+                                  GOA_TYPE_WINDOWS_LIVE_PROVIDER,
+                                  "windows_live",
+                                  0);
+}
diff --git a/src/goabackend/goawindowsliveprovider.h b/src/goabackend/goawindowsliveprovider.h
index 763ac73..f524efa 100644
--- a/src/goabackend/goawindowsliveprovider.h
+++ b/src/goabackend/goawindowsliveprovider.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.
  * Copyright (C) 2011 Collabora Ltd.
  *
  * This library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
 #ifndef __GOA_WINDOWS_LIVE_PROVIDER_H__
 #define __GOA_WINDOWS_LIVE_PROVIDER_H__
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -35,6 +35,7 @@ G_BEGIN_DECLS
 typedef struct _GoaWindowsLiveProvider GoaWindowsLiveProvider;
 
 GType goa_windows_live_provider_get_type (void) G_GNUC_CONST;
+void  goa_windows_live_provider_register (GIOModule *module);
 
 G_END_DECLS
 


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