[gnome-online-accounts/wip/modules: 10/12] owncloud: Split it into a loadable module
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/modules: 10/12] owncloud: Split it into a loadable module
- Date: Wed, 7 May 2014 11:53:57 +0000 (UTC)
commit 98e15ffce539e79073692fe0070120ef49209a28
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Apr 29 15:59:56 2014 +0200
owncloud: Split it into a loadable module
The markup comments for documentation have been removed because they
were unused and useless.
Fixes: https://bugzilla.gnome.org/729173
configure.ac | 1 +
src/goabackend/Makefile.am | 22 ++++++++++++++++-
src/goabackend/goaowncloudmodule.c | 43 ++++++++++++++++++++++++++++++++++
src/goabackend/goaowncloudprovider.c | 38 ++++++++++++-----------------
src/goabackend/goaowncloudprovider.h | 5 ++-
src/goabackend/goaprovider.c | 4 ---
6 files changed, 84 insertions(+), 29 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 337acfd..5176176 100644
--- a/configure.ac
+++ b/configure.ac
@@ -238,6 +238,7 @@ AC_ARG_ENABLE([owncloud],
if test "$enable_owncloud" != "no"; then
AC_DEFINE(GOA_OWNCLOUD_ENABLED, 1, [Enable ownCloud data provider])
fi
+AM_CONDITIONAL(BUILD_OWNCLOUD, [test x$enable_owncloud != xno])
# Yahoo
AC_ARG_ENABLE([yahoo], [AS_HELP_STRING([--enable-yahoo], [Enable Yahoo provider])], [], [enable_yahoo=no])
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 1dd8f12..9fa13b6 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -82,7 +82,6 @@ libgoa_backend_1_0_la_SOURCES = \
goaoauthprovider.h goaoauthprovider.c \
goaoauth2provider.h goaoauth2provider.c \
goaimapsmtpprovider.h goaimapsmtpprovider.c \
- goaowncloudprovider.h goaowncloudprovider.c \
goayahooprovider.h goayahooprovider.c \
goatelepathyfactory.h goatelepathyfactory.c \
goatelepathyprovider.h goatelepathyprovider.c \
@@ -192,6 +191,27 @@ libgoa_backend_1_0_la_SOURCES += \
goakerberosprovider.h goakerberosprovider.c
endif
+if BUILD_OWNCLOUD
+goamodule_LTLIBRARIES += libgoaowncloud.la
+libgoaowncloud_la_SOURCES = \
+ goaowncloudmodule.c \
+ goaowncloudprovider.c \
+ goaowncloudprovider.h \
+ $(NULL)
+libgoaowncloud_la_CFLAGS = \
+ $(GLIB_CFLAGS) \
+ $(GTK_CFLAGS) \
+ $(LIBSOUP_CFLAGS) \
+ $(NULL)
+libgoaowncloud_la_LIBADD = \
+ $(builddir)/libgoa-backend-1.0.la \
+ $(GLIB_LIBS) \
+ $(GTK_LIBS) \
+ $(LIBSOUP_LIBS) \
+ $(NULL)
+libgoaowncloud_la_LDFLAGS = $(module_flags)
+endif
+
if BUILD_POCKET
goamodule_LTLIBRARIES += libgoapocket.la
libgoapocket_la_SOURCES = \
diff --git a/src/goabackend/goaowncloudmodule.c b/src/goabackend/goaowncloudmodule.c
new file mode 100644
index 0000000..cfaf577
--- /dev/null
+++ b/src/goabackend/goaowncloudmodule.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 "goaowncloudprovider.h"
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+
+void
+g_io_module_load (GIOModule *module)
+{
+ goa_owncloud_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/goaowncloudprovider.c b/src/goabackend/goaowncloudprovider.c
index fdc9c61..e99d9f9 100644
--- a/src/goabackend/goaowncloudprovider.c
+++ b/src/goabackend/goaowncloudprovider.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
@@ -30,15 +30,8 @@
#include "goaowncloudprovider.h"
#include "goautils.h"
-/**
- * GoaOwncloudProvider:
- *
- * The #GoaOwncloudProvider structure contains only private data and should
- * only be accessed using the provided API.
- */
struct _GoaOwncloudProvider
{
- /*< private >*/
GoaProvider parent_instance;
};
@@ -49,20 +42,7 @@ struct _GoaOwncloudProviderClass
GoaProviderClass parent_class;
};
-/**
- * SECTION:goaowncloudprovider
- * @title: GoaOwncloudProvider
- * @short_description: A provider for ownCloud servers
- *
- * #GoaOwncloudProvider is used to access ownCloud servers.
- */
-
-G_DEFINE_TYPE_WITH_CODE (GoaOwncloudProvider, goa_owncloud_provider, GOA_TYPE_PROVIDER,
- goa_provider_ensure_extension_points_registered ();
- g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME,
- g_define_type_id,
- "owncloud",
- 0));
+G_DEFINE_DYNAMIC_TYPE (GoaOwncloudProvider, goa_owncloud_provider, GOA_TYPE_PROVIDER);
/* ---------------------------------------------------------------------------------------------------- */
@@ -1124,6 +1104,11 @@ goa_owncloud_provider_init (GoaOwncloudProvider *provider)
}
static void
+goa_owncloud_provider_class_finalize (GoaOwncloudProviderClass *klass)
+{
+}
+
+static void
goa_owncloud_provider_class_init (GoaOwncloudProviderClass *klass)
{
GoaProviderClass *provider_class;
@@ -1196,3 +1181,12 @@ on_handle_get_password (GoaPasswordBased *interface,
g_object_unref (provider);
return TRUE; /* invocation was handled */
}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+void
+goa_owncloud_provider_register (GIOModule *module)
+{
+ goa_owncloud_provider_register_type (G_TYPE_MODULE (module));
+ g_io_extension_point_implement (GOA_PROVIDER_EXTENSION_POINT_NAME, GOA_TYPE_OWNCLOUD_PROVIDER, "owncloud",
0);
+}
diff --git a/src/goabackend/goaowncloudprovider.h b/src/goabackend/goaowncloudprovider.h
index 7f7e169..97a0dfc 100644
--- a/src/goabackend/goaowncloudprovider.h
+++ b/src/goabackend/goaowncloudprovider.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_OWNCLOUD_PROVIDER_H__
#define __GOA_OWNCLOUD_PROVIDER_H__
-#include <glib-object.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
typedef struct _GoaOwncloudProvider GoaOwncloudProvider;
GType goa_owncloud_provider_get_type (void) G_GNUC_CONST;
+void goa_owncloud_provider_register (GIOModule *module);
G_END_DECLS
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 5f8b04e..1b643fb 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -24,7 +24,6 @@
#include "goaprovider-priv.h"
#include "goaproviderfactory.h"
#include "goaimapsmtpprovider.h"
-#include "goaowncloudprovider.h"
#include "goayahooprovider.h"
#include "goatelepathyfactory.h"
@@ -762,9 +761,6 @@ ensure_builtins_loaded (void)
* important because it affects the order in which they are
* returned by goa_provider_get_all.
*/
-#ifdef GOA_OWNCLOUD_ENABLED
- type = GOA_TYPE_OWNCLOUD_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]