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



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

    flickr: 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/goaflickrmodule.c   |   43 ++++++++++++++++++++++++++++++++++++
 src/goabackend/goaflickrprovider.c |   36 +++++++++++------------------
 src/goabackend/goaflickrprovider.h |    4 ++-
 src/goabackend/goaprovider.c       |    4 ---
 9 files changed, 86 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2864889..455bea1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,6 +187,7 @@ AC_DEFINE_UNQUOTED(GOA_FLICKR_CONSUMER_SECRET, ["$with_flickr_consumer_secret"],
 if test "$enable_flickr" != "no"; then
   AC_DEFINE(GOA_FLICKR_ENABLED, 1, [Enable Flickr data provider])
 fi
+AM_CONDITIONAL(BUILD_FLICKR, [test x$enable_flickr != xno])
 
 # Google
 AC_ARG_ENABLE([google], [AS_HELP_STRING([--enable-google], [Enable Google provider])], [], 
[enable_google=yes])
diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
index 56dc0a0..fab3806 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/goayahooprovider.xml"/>
-      <xi:include href="xml/goaflickrprovider.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 695b6c2..be2ea62 100644
--- a/doc/goa-sections.txt
+++ b/doc/goa-sections.txt
@@ -549,16 +549,6 @@ goa_yahoo_provider_get_type
 </SECTION>
 
 <SECTION>
-<FILE>goaflickrprovider</FILE>
-GoaFlickrProvider
-<SUBSECTION Standard>
-GOA_FLICKR_PROVIDER
-GOA_IS_FLICKR_PROVIDER
-GOA_TYPE_FLICKR_PROVIDER
-goa_flickr_provider_get_type
-</SECTION>
-
-<SECTION>
 <FILE>goatelepathyfactory</FILE>
 GoaTelepathyFactory
 GoaTelepathyFactoryClass
diff --git a/doc/goa.types b/doc/goa.types
index aa34088..3ff824b 100644
--- a/doc/goa.types
+++ b/doc/goa.types
@@ -31,4 +31,3 @@ goa_provider_get_type
 goa_oauth_provider_get_type
 goa_oauth2_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 3440b53..2485a0e 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -85,7 +85,6 @@ libgoa_backend_1_0_la_SOURCES =                                               \
        goaimapsmtpprovider.h           goaimapsmtpprovider.c           \
        goaowncloudprovider.h           goaowncloudprovider.c           \
        goayahooprovider.h              goayahooprovider.c              \
-       goaflickrprovider.h             goaflickrprovider.c             \
        goatelepathyfactory.h           goatelepathyfactory.c           \
        goatelepathyprovider.h          goatelepathyprovider.c          \
        goapocketprovider.h             goapocketprovider.c             \
@@ -121,6 +120,31 @@ libgoafacebook_la_LIBADD =                                 \
 libgoafacebook_la_LDFLAGS = $(module_flags)
 endif
 
+if BUILD_FLICKR
+goamodule_LTLIBRARIES += libgoaflickr.la
+libgoaflickr_la_SOURCES =                                      \
+       goaflickrmodule.c                                       \
+       goaflickrprovider.c                                     \
+       goaflickrprovider.h                                     \
+       $(NULL)
+libgoaflickr_la_CFLAGS =                                       \
+       $(GLIB_CFLAGS)                                          \
+       $(GTK_CFLAGS)                                           \
+       $(JSON_GLIB_CFLAGS)                                     \
+       $(REST_CFLAGS)                                          \
+       $(WEBKIT_GTK_CFLAGS)                                    \
+       $(NULL)
+libgoaflickr_la_LIBADD =                                       \
+       $(builddir)/libgoa-backend-1.0.la                       \
+       $(GLIB_LIBS)                                            \
+       $(GTK_LIBS)                                             \
+       $(JSON_GLIB_LIBS)                                       \
+       $(REST_LIBS)                                            \
+       $(WEBKIT_GTK_LIBS)                                      \
+       $(NULL)
+libgoaflickr_la_LDFLAGS = $(module_flags)
+endif
+
 if BUILD_GOOGLE
 goamodule_LTLIBRARIES += libgoagoogle.la
 libgoagoogle_la_SOURCES =                                      \
diff --git a/src/goabackend/goaflickrmodule.c b/src/goabackend/goaflickrmodule.c
new file mode 100644
index 0000000..dc0145e
--- /dev/null
+++ b/src/goabackend/goaflickrmodule.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 "goaflickrprovider.h"
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+  goa_flickr_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/goaflickrprovider.c b/src/goabackend/goaflickrprovider.c
index 3b2009a..2195e1c 100644
--- a/src/goabackend/goaflickrprovider.c
+++ b/src/goabackend/goaflickrprovider.c
@@ -1,7 +1,7 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
  * Copyright (C) 2011 Willem van Engen <gnome willem engen nl>
- * 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
@@ -28,15 +28,8 @@
 #include "goaoauthprovider.h"
 #include "goaflickrprovider.h"
 
-/**
- * GoaFlickrProvider:
- *
- * The #GoaFlickrProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
 struct _GoaFlickrProvider
 {
-  /*< private >*/
   GoaOAuthProvider parent_instance;
 };
 
@@ -47,20 +40,7 @@ struct _GoaFlickrProviderClass
   GoaOAuthProviderClass parent_class;
 };
 
-/**
- * SECTION:goaflickrprovider
- * @title: GoaFlickrProvider
- * @short_description: A provider for Flickr
- *
- * #GoaFlickrProvider is used for handling Flickr accounts.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaFlickrProvider, goa_flickr_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,
-                                                        "flickr",
-                                                        0));
+G_DEFINE_DYNAMIC_TYPE (GoaFlickrProvider, goa_flickr_provider, GOA_TYPE_OAUTH_PROVIDER);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -440,6 +420,11 @@ goa_flickr_provider_init (GoaFlickrProvider *client)
 }
 
 static void
+goa_flickr_provider_class_finalize (GoaFlickrProviderClass *klass)
+{
+}
+
+static void
 goa_flickr_provider_class_init (GoaFlickrProviderClass *klass)
 {
   GoaProviderClass *provider_class;
@@ -468,3 +453,10 @@ goa_flickr_provider_class_init (GoaFlickrProviderClass *klass)
   oauth_class->parse_request_token_error = parse_request_token_error;
   oauth_class->add_account_key_values    = add_account_key_values;
 }
+
+void
+goa_flickr_provider_register (GIOModule *module)
+{
+  goa_flickr_provider_register_type (G_TYPE_MODULE (module));
+  g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, GOA_TYPE_FLICKR_PROVIDER, "flickr", 0);
+}
diff --git a/src/goabackend/goaflickrprovider.h b/src/goabackend/goaflickrprovider.h
index c069427..fdb6abc 100644
--- a/src/goabackend/goaflickrprovider.h
+++ b/src/goabackend/goaflickrprovider.h
@@ -1,6 +1,7 @@
 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /*
  * Copyright (C) 2012 Willem van Engen <gnome willem engen nl>
+ * 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
@@ -23,7 +24,7 @@
 #ifndef __GOA_FLICKR_PROVIDER_H__
 #define __GOA_FLICKR_PROVIDER_H__
 
-#include <glib-object.h>
+#include <gio/gio.h>
 
 G_BEGIN_DECLS
 
@@ -34,6 +35,7 @@ G_BEGIN_DECLS
 typedef struct _GoaFlickrProvider GoaFlickrProvider;
 
 GType goa_flickr_provider_get_type (void) G_GNUC_CONST;
+void  goa_flickr_provider_register (GIOModule *module);
 
 G_END_DECLS
 
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 4a5b344..82ed571 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -27,7 +27,6 @@
 #include "goaimapsmtpprovider.h"
 #include "goaowncloudprovider.h"
 #include "goayahooprovider.h"
-#include "goaflickrprovider.h"
 #include "goatelepathyfactory.h"
 #include "goapocketprovider.h"
 
@@ -768,9 +767,6 @@ ensure_builtins_loaded (void)
 #ifdef GOA_OWNCLOUD_ENABLED
       type = GOA_TYPE_OWNCLOUD_PROVIDER;
 #endif
-#ifdef GOA_FLICKR_ENABLED
-      type = GOA_TYPE_FLICKR_PROVIDER;
-#endif
 #ifdef GOA_POCKET_ENABLED
       type = GOA_TYPE_POCKET_PROVIDER;
 #endif


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