[evolution-data-server] Rename owncloud-backend module to webdav-backend
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Rename owncloud-backend module to webdav-backend
- Date: Wed, 2 Aug 2017 06:30:06 +0000 (UTC)
commit a65018da76525190318f77f262c0709c4b5efedc
Author: Milan Crha <mcrha redhat com>
Date: Wed Aug 2 08:26:43 2017 +0200
Rename owncloud-backend module to webdav-backend
There had been nothing specific about ownCloud in the module,
thus make it a generic WebDAV module, which can be reused when needed.
A migration code for the change had been added as well.
src/modules/CMakeLists.txt | 2 +-
.../module-gnome-online-accounts.c | 2 +-
.../CMakeLists.txt | 4 +-
.../module-webdav-backend.c} | 68 ++++++++++----------
.../evolution-source-registry/CMakeLists.txt | 3 +-
.../evolution-source-registry-autoconfig.c | 7 +--
.../evolution-source-registry-methods.h | 47 ++++++++++++++
.../evolution-source-registry-migrate-basedir.c | 5 +-
.../evolution-source-registry-migrate-proxies.c | 3 +-
.../evolution-source-registry-migrate-sources.c | 10 +--
... => evolution-source-registry-migrate-tweaks.c} | 50 ++++++++++++--
.../evolution-source-registry.c | 20 +-----
12 files changed, 143 insertions(+), 78 deletions(-)
---
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index adf29bd..9bd3a16 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -65,7 +65,7 @@ endmacro(add_credentials_module)
add_subdirectory(cache-reaper)
add_subdirectory(google-backend)
add_subdirectory(outlook-backend)
-add_subdirectory(owncloud-backend)
+add_subdirectory(webdav-backend)
add_subdirectory(yahoo-backend)
if(HAVE_GTK)
diff --git a/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
b/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
index fafc33b..72cef78 100644
--- a/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
+++ b/src/modules/gnome-online-accounts/module-gnome-online-accounts.c
@@ -103,7 +103,7 @@ gnome_online_accounts_get_backend_name (const gchar *goa_provider_type)
eds_backend_name = "none";
if (g_str_equal (goa_provider_type, "owncloud"))
- eds_backend_name = "owncloud";
+ eds_backend_name = "webdav";
if (g_str_equal (goa_provider_type, "windows_live"))
eds_backend_name = "outlook";
diff --git a/src/modules/owncloud-backend/CMakeLists.txt b/src/modules/webdav-backend/CMakeLists.txt
similarity index 70%
rename from src/modules/owncloud-backend/CMakeLists.txt
rename to src/modules/webdav-backend/CMakeLists.txt
index 91bad5a..ab7e97c 100644
--- a/src/modules/owncloud-backend/CMakeLists.txt
+++ b/src/modules/webdav-backend/CMakeLists.txt
@@ -1,13 +1,13 @@
set(extra_deps)
set(sources
- module-owncloud-backend.c
+ module-webdav-backend.c
)
set(extra_defines)
set(extra_cflags)
set(extra_incdirs)
set(extra_ldflags)
-add_source_registry_module(module-owncloud-backend
+add_source_registry_module(module-webdav-backend
sources
extra_deps
extra_defines
diff --git a/src/modules/owncloud-backend/module-owncloud-backend.c
b/src/modules/webdav-backend/module-webdav-backend.c
similarity index 61%
rename from src/modules/owncloud-backend/module-owncloud-backend.c
rename to src/modules/webdav-backend/module-webdav-backend.c
index 0768959..6a34961 100644
--- a/src/modules/owncloud-backend/module-owncloud-backend.c
+++ b/src/modules/webdav-backend/module-webdav-backend.c
@@ -1,5 +1,5 @@
/*
- * module-owncloud-backend.c
+ * module-webdav-backend.c
*
* 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
@@ -21,34 +21,34 @@
#include <libedataserver/libedataserver.h>
/* Standard GObject macros */
-#define E_TYPE_OWNCLOUD_BACKEND \
- (e_owncloud_backend_get_type ())
-#define E_OWNCLOUD_BACKEND(obj) \
+#define E_TYPE_WEBDAV_BACKEND \
+ (e_webdav_backend_get_type ())
+#define E_WEBDAV_BACKEND(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), E_TYPE_OWNCLOUD_BACKEND, EOwncloudBackend))
-#define E_IS_OWNCLOUD_BACKEND(obj) \
+ ((obj), E_TYPE_WEBDAV_BACKEND, EWebDAVBackend))
+#define E_IS_WEBDAV_BACKEND(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), E_TYPE_OWNCLOUD_BACKEND))
+ ((obj), E_TYPE_WEBDAV_BACKEND))
-typedef struct _EOwncloudBackend EOwncloudBackend;
-typedef struct _EOwncloudBackendClass EOwncloudBackendClass;
+typedef struct _EWebDAVBackend EWebDAVBackend;
+typedef struct _EWebDAVBackendClass EWebDAVBackendClass;
-typedef struct _EOwncloudBackendFactory EOwncloudBackendFactory;
-typedef struct _EOwncloudBackendFactoryClass EOwncloudBackendFactoryClass;
+typedef struct _EWebDAVBackendFactory EWebDAVBackendFactory;
+typedef struct _EWebDAVBackendFactoryClass EWebDAVBackendFactoryClass;
-struct _EOwncloudBackend {
+struct _EWebDAVBackend {
EWebDAVCollectionBackend parent;
};
-struct _EOwncloudBackendClass {
+struct _EWebDAVBackendClass {
EWebDAVCollectionBackendClass parent_class;
};
-struct _EOwncloudBackendFactory {
+struct _EWebDAVBackendFactory {
ECollectionBackendFactory parent;
};
-struct _EOwncloudBackendFactoryClass {
+struct _EWebDAVBackendFactoryClass {
ECollectionBackendFactoryClass parent_class;
};
@@ -57,21 +57,21 @@ void e_module_load (GTypeModule *type_module);
void e_module_unload (GTypeModule *type_module);
/* Forward Declarations */
-GType e_owncloud_backend_get_type (void);
-GType e_owncloud_backend_factory_get_type (void);
+GType e_webdav_backend_get_type (void);
+GType e_webdav_backend_factory_get_type (void);
G_DEFINE_DYNAMIC_TYPE (
- EOwncloudBackend,
- e_owncloud_backend,
+ EWebDAVBackend,
+ e_webdav_backend,
E_TYPE_WEBDAV_COLLECTION_BACKEND)
G_DEFINE_DYNAMIC_TYPE (
- EOwncloudBackendFactory,
- e_owncloud_backend_factory,
+ EWebDAVBackendFactory,
+ e_webdav_backend_factory,
E_TYPE_COLLECTION_BACKEND_FACTORY)
static ESourceAuthenticationResult
-owncloud_backend_authenticate_sync (EBackend *backend,
+webdav_backend_authenticate_sync (EBackend *backend,
const ENamedParameters *credentials,
gchar **out_certificate_pem,
GTlsCertificateFlags *out_certificate_errors,
@@ -85,7 +85,7 @@ owncloud_backend_authenticate_sync (EBackend *backend,
source = e_backend_get_source (backend);
- /* Ignore the request for non-GOA ownCloud sources by pretending success */
+ /* Ignore the request for non-GOA WebDAV sources by pretending success */
if (!e_source_has_extension (source, E_SOURCE_EXTENSION_GOA))
return E_SOURCE_AUTHENTICATION_ACCEPTED;
@@ -98,49 +98,49 @@ owncloud_backend_authenticate_sync (EBackend *backend,
}
static void
-e_owncloud_backend_class_init (EOwncloudBackendClass *class)
+e_webdav_backend_class_init (EWebDAVBackendClass *class)
{
EBackendClass *backend_class;
backend_class = E_BACKEND_CLASS (class);
- backend_class->authenticate_sync = owncloud_backend_authenticate_sync;
+ backend_class->authenticate_sync = webdav_backend_authenticate_sync;
}
static void
-e_owncloud_backend_class_finalize (EOwncloudBackendClass *class)
+e_webdav_backend_class_finalize (EWebDAVBackendClass *class)
{
}
static void
-e_owncloud_backend_init (EOwncloudBackend *backend)
+e_webdav_backend_init (EWebDAVBackend *backend)
{
}
static void
-e_owncloud_backend_factory_class_init (EOwncloudBackendFactoryClass *class)
+e_webdav_backend_factory_class_init (EWebDAVBackendFactoryClass *class)
{
ECollectionBackendFactoryClass *factory_class;
factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class);
- factory_class->factory_name = "owncloud";
- factory_class->backend_type = E_TYPE_OWNCLOUD_BACKEND;
+ factory_class->factory_name = "webdav";
+ factory_class->backend_type = E_TYPE_WEBDAV_BACKEND;
}
static void
-e_owncloud_backend_factory_class_finalize (EOwncloudBackendFactoryClass *class)
+e_webdav_backend_factory_class_finalize (EWebDAVBackendFactoryClass *class)
{
}
static void
-e_owncloud_backend_factory_init (EOwncloudBackendFactory *factory)
+e_webdav_backend_factory_init (EWebDAVBackendFactory *factory)
{
}
G_MODULE_EXPORT void
e_module_load (GTypeModule *type_module)
{
- e_owncloud_backend_register_type (type_module);
- e_owncloud_backend_factory_register_type (type_module);
+ e_webdav_backend_register_type (type_module);
+ e_webdav_backend_factory_register_type (type_module);
}
G_MODULE_EXPORT void
diff --git a/src/services/evolution-source-registry/CMakeLists.txt
b/src/services/evolution-source-registry/CMakeLists.txt
index 0a4ef55..3ade922 100644
--- a/src/services/evolution-source-registry/CMakeLists.txt
+++ b/src/services/evolution-source-registry/CMakeLists.txt
@@ -62,10 +62,11 @@ set(DEPENDENCIES
set(SOURCES
evolution-source-registry.c
evolution-source-registry-autoconfig.c
+ evolution-source-registry-methods.h
evolution-source-registry-migrate-basedir.c
evolution-source-registry-migrate-proxies.c
evolution-source-registry-migrate-sources.c
- evolution-source-registry-migrate-imap-to-imapx.c
+ evolution-source-registry-migrate-tweaks.c
${CMAKE_CURRENT_BINARY_DIR}/evolution-source-registry-resource.c
${CMAKE_CURRENT_BINARY_DIR}/evolution-source-registry-resource.h
)
diff --git a/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
b/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
index 66b2cc1..f3f9810 100644
--- a/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
+++ b/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
@@ -24,6 +24,8 @@
#include <libebackend/libebackend.h>
#include <camel/camel.h>
+#include "evolution-source-registry-methods.h"
+
typedef struct _MergeSourceData {
gchar *source_filename;
gchar *path;
@@ -35,11 +37,6 @@ typedef void (*MergeSourcePopulateHashtableFunc)(GHashTable *source,
const gchar *basename,
const gchar *filename);
-/* Forward Declarations */
-gboolean evolution_source_registry_merge_autoconfig_sources
- (ESourceRegistryServer *server,
- GError **error);
-
static void
e_autoconfig_free_merge_source_data (gpointer mem)
{
diff --git a/src/services/evolution-source-registry/evolution-source-registry-methods.h
b/src/services/evolution-source-registry/evolution-source-registry-methods.h
new file mode 100644
index 0000000..a3b8dc2
--- /dev/null
+++ b/src/services/evolution-source-registry/evolution-source-registry-methods.h
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ *
+ * 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/>.
+ *
+ */
+
+#ifndef EVOLUTION_SOURCE_REGISTRY_METHODS_H
+#define EVOLUTION_SOURCE_REGISTRY_METHODS_H
+
+#include <libebackend/libebackend.h>
+
+G_BEGIN_DECLS
+
+gboolean evolution_source_registry_merge_autoconfig_sources
+ (ESourceRegistryServer *server,
+ GError **error);
+
+void evolution_source_registry_migrate_basedir
+ (void);
+
+void evolution_source_registry_migrate_proxies
+ (ESourceRegistryServer *server);
+
+void evolution_source_registry_migrate_sources
+ (void);
+
+gboolean evolution_source_registry_migrate_gconf_tree_xml
+ (const gchar *filename,
+ GError **error);
+
+gboolean evolution_source_registry_migrate_tweak_key_file
+ (ESourceRegistryServer *server,
+ GKeyFile *key_file,
+ const gchar *uid);
+
+G_END_DECLS
+
+#endif /* EVOLUTION_SOURCE_REGISTRY_METHODS_H */
diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-basedir.c
b/src/services/evolution-source-registry/evolution-source-registry-migrate-basedir.c
index 72774ce..4ea193d 100644
--- a/src/services/evolution-source-registry/evolution-source-registry-migrate-basedir.c
+++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-basedir.c
@@ -15,12 +15,13 @@
*
*/
+#include "evolution-data-server-config.h"
+
#include <errno.h>
#include <glib/gstdio.h>
#include <libedataserver/libedataserver.h>
-/* Forward Declarations */
-void evolution_source_registry_migrate_basedir (void);
+#include "evolution-source-registry-methods.h"
static gboolean
migrate_rename (const gchar *old_filename,
diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
b/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
index 1a1caa1..d531cb9 100644
--- a/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
+++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
@@ -23,8 +23,7 @@
#define NETWORK_CONFIG_SCHEMA_ID "org.gnome.evolution.shell.network-config"
-/* Forward Declarations */
-void evolution_source_registry_migrate_proxies (ESourceRegistryServer *server);
+#include "evolution-source-registry-methods.h"
void
evolution_source_registry_migrate_proxies (ESourceRegistryServer *server)
diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
b/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
index 4c4cf0c..90a5bec 100644
--- a/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
+++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-sources.c
@@ -15,6 +15,8 @@
*
*/
+#include "evolution-data-server-config.h"
+
#include <errno.h>
#include <string.h>
#include <glib/gstdio.h>
@@ -28,6 +30,8 @@
#include <libebackend/libebackend.h>
+#include "evolution-source-registry-methods.h"
+
/* These constants are collected from various e-source-*.h files
* throughout evolution-data-server and known extension packages. */
#define E_SOURCE_GROUP_NAME "Data Source"
@@ -163,12 +167,6 @@ static const SecretSchema e_passwords_schema = {
}
};
-/* Forward Declarations */
-void evolution_source_registry_migrate_sources (void);
-gboolean evolution_source_registry_migrate_gconf_tree_xml
- (const gchar *filename,
- GError **error);
-
static ParseData *
parse_data_new (ParseType parse_type)
{
diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-imap-to-imapx.c
b/src/services/evolution-source-registry/evolution-source-registry-migrate-tweaks.c
similarity index 75%
rename from src/services/evolution-source-registry/evolution-source-registry-migrate-imap-to-imapx.c
rename to src/services/evolution-source-registry/evolution-source-registry-migrate-tweaks.c
index 21cd66f..07d896d 100644
--- a/src/services/evolution-source-registry/evolution-source-registry-migrate-imap-to-imapx.c
+++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-tweaks.c
@@ -1,6 +1,4 @@
/*
- * evolution-source-registry-migrate-imap-to-imapx.c
- *
* 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.
@@ -15,18 +13,16 @@
*
*/
+#include "evolution-data-server-config.h"
+
#include <errno.h>
#include <glib/gstdio.h>
#include <libebackend/libebackend.h>
-/* Forward Declarations */
-gboolean evolution_source_registry_migrate_imap_to_imapx
- (ESourceRegistryServer *server,
- GKeyFile *key_file,
- const gchar *uid);
+#include "evolution-source-registry-methods.h"
-gboolean
+static gboolean
evolution_source_registry_migrate_imap_to_imapx (ESourceRegistryServer *server,
GKeyFile *key_file,
const gchar *uid)
@@ -147,3 +143,41 @@ evolution_source_registry_migrate_imap_to_imapx (ESourceRegistryServer *server,
return TRUE;
}
+static gboolean
+evolution_source_registry_migrate_owncloud_to_webdav (ESourceRegistryServer *server,
+ GKeyFile *key_file,
+ const gchar *uid)
+{
+ gboolean modified = FALSE;
+
+ g_return_val_if_fail (key_file != NULL, FALSE);
+
+ if (g_key_file_has_group (key_file, E_SOURCE_EXTENSION_COLLECTION) &&
+ g_key_file_has_key (key_file, E_SOURCE_EXTENSION_COLLECTION, "BackendName", NULL)) {
+ gchar *backend_name;
+
+ backend_name = g_key_file_get_string (key_file, E_SOURCE_EXTENSION_COLLECTION, "BackendName",
NULL);
+ if (g_strcmp0 (backend_name, "owncloud") == 0) {
+ g_key_file_set_string (key_file, E_SOURCE_EXTENSION_COLLECTION, "BackendName",
"webdav");
+ modified = TRUE;
+ }
+
+ g_free (backend_name);
+ }
+
+ return modified;
+}
+
+gboolean
+evolution_source_registry_migrate_tweak_key_file (ESourceRegistryServer *server,
+ GKeyFile *key_file,
+ const gchar *uid)
+{
+ gboolean modified;
+
+ modified = evolution_source_registry_migrate_imap_to_imapx (server, key_file, uid);
+
+ modified = evolution_source_registry_migrate_owncloud_to_webdav (server, key_file, uid) || modified;
+
+ return modified;
+}
diff --git a/src/services/evolution-source-registry/evolution-source-registry.c
b/src/services/evolution-source-registry/evolution-source-registry.c
index dbdb234..151e309 100644
--- a/src/services/evolution-source-registry/evolution-source-registry.c
+++ b/src/services/evolution-source-registry/evolution-source-registry.c
@@ -29,6 +29,7 @@
#include <libebackend/libebackend.h>
#include "evolution-source-registry-resource.h"
+#include "evolution-source-registry-methods.h"
#define RESOURCE_PATH_RO_SOURCES "/org/gnome/evolution-data-server/ro-sources"
#define RESOURCE_PATH_RW_SOURCES "/org/gnome/evolution-data-server/rw-sources"
@@ -41,20 +42,6 @@ static GOptionEntry entries[] = {
{ NULL }
};
-/* Forward Declarations */
-void evolution_source_registry_migrate_basedir (void);
-void evolution_source_registry_migrate_sources (void);
-
-gboolean evolution_source_registry_migrate_imap_to_imapx
- (ESourceRegistryServer *server,
- GKeyFile *key_file,
- const gchar *uid);
-void evolution_source_registry_migrate_proxies
- (ESourceRegistryServer *server);
-gboolean evolution_source_registry_merge_autoconfig_sources
- (ESourceRegistryServer *server,
- GError **error);
-
static void
evolution_source_registry_load_error (ESourceRegistryServer *server,
GFile *file,
@@ -225,11 +212,12 @@ reload:
G_CALLBACK (evolution_source_registry_load_sources), NULL);
/* Convert "imap" mail accounts to "imapx". */
- if (!opt_disable_migration)
+ if (!opt_disable_migration) {
g_signal_connect (
server, "tweak-key-file", G_CALLBACK (
- evolution_source_registry_migrate_imap_to_imapx),
+ evolution_source_registry_migrate_tweak_key_file),
NULL);
+ }
g_debug ("Server is up and running...");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]