[evolution-kolab/account-mgmt: 5/12] Replace KOLAB_SYNC_STRATEGY_PROP with a CamelSettings property.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-kolab/account-mgmt: 5/12] Replace KOLAB_SYNC_STRATEGY_PROP with a CamelSettings property.
- Date: Fri, 29 Jun 2012 13:31:30 +0000 (UTC)
commit f3cee58158e8ddbb79544b48526ef47f032498b8
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jun 26 14:23:34 2012 -0400
Replace KOLAB_SYNC_STRATEGY_PROP with a CamelSettings property.
src/addressbook/e-book-backend-kolab.c | 4 +-
src/calendar/e-cal-backend-kolab.c | 4 +-
src/libekolab/kolab-types.h | 2 -
src/libekolabutil/camel-kolab-imapx-settings.c | 81 +++++++++++++++++++++++-
src/libekolabutil/camel-kolab-imapx-settings.h | 7 ++
5 files changed, 89 insertions(+), 9 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-kolab.c b/src/addressbook/e-book-backend-kolab.c
index 48b8134..0fa47d4 100644
--- a/src/addressbook/e-book-backend-kolab.c
+++ b/src/addressbook/e-book-backend-kolab.c
@@ -243,7 +243,6 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
gchar *username = NULL;
gchar *user_at_server = NULL;
gchar *tmp_key = NULL;
- const gchar *prop_str = NULL;
gboolean online = FALSE;
gboolean auth_required = FALSE;
gboolean ok = FALSE;
@@ -285,8 +284,7 @@ e_book_backend_kolab_open (EBookBackendSync *backend,
g_debug ("%s()[%u] username = %s", __func__, __LINE__, username);
/* Prepare data from sync strategy property */
- prop_str = e_source_get_property (esource, KOLAB_SYNC_STRATEGY_PROP);
- sync_value = kolab_util_misc_sync_value_from_property (prop_str);
+ sync_value = camel_kolab_imapx_settings_get_sync_strategy (kolab_settings);
sourcename = kolab_util_backend_get_relative_path_from_uri (priv->book_uri);
/* Check whether we have a KolabMailAccess (KoMA) instance already */
diff --git a/src/calendar/e-cal-backend-kolab.c b/src/calendar/e-cal-backend-kolab.c
index 26690fd..8bc5206 100644
--- a/src/calendar/e-cal-backend-kolab.c
+++ b/src/calendar/e-cal-backend-kolab.c
@@ -268,7 +268,6 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
gchar *username = NULL;
gchar *user_at_server = NULL;
gchar *tmp_key = NULL;
- const gchar *prop_str = NULL;
gboolean online = FALSE;
gboolean auth_required = FALSE;
gboolean ok = FALSE;
@@ -338,8 +337,7 @@ e_cal_backend_kolab_open (ECalBackendSync *backend,
g_debug (" + Cal cache cleaning %s.", ok ? "was successful" : "FAILED");
/* Prepare data from sync strategy property */
- prop_str = e_source_get_property (esource, KOLAB_SYNC_STRATEGY_PROP);
- sync_value = kolab_util_misc_sync_value_from_property (prop_str);
+ sync_value = camel_kolab_imapx_settings_get_sync_strategy (kolab_settings);
sourcename = kolab_util_backend_get_relative_path_from_uri (priv->cal_uri);
/* Check whether we have a KolabMailAccess (KoMA) instance already */
diff --git a/src/libekolab/kolab-types.h b/src/libekolab/kolab-types.h
index df49201..e6ec251 100644
--- a/src/libekolab/kolab-types.h
+++ b/src/libekolab/kolab-types.h
@@ -65,8 +65,6 @@ typedef enum {
#define KOLAB_STRATEGY_DESC_CLIENT "Take Local (client-side)"
#define KOLAB_STRATEGY_DESC_DUPE "Take Both (resulting in two different, parallel entries)"
-#define KOLAB_SYNC_STRATEGY_PROP "kolab-sync-strategy"
-
typedef enum {
KOLAB_PKCS11_INFRASTRUCTURE_DISABLE,
KOLAB_PKCS11_INFRASTRUCTURE_ENABLE,
diff --git a/src/libekolabutil/camel-kolab-imapx-settings.c b/src/libekolabutil/camel-kolab-imapx-settings.c
index e45113d..d3f0d5b 100644
--- a/src/libekolabutil/camel-kolab-imapx-settings.c
+++ b/src/libekolabutil/camel-kolab-imapx-settings.c
@@ -31,10 +31,17 @@
#include "camel-kolab-imapx-settings.h"
+#include <libekolab/kolab-enumtypes.h>
+
/*----------------------------------------------------------------------------*/
struct _CamelKolabIMAPXSettingsPrivate {
- gint foo; /* FIXME */
+ KolabSyncStrategyID sync_strategy;
+};
+
+enum {
+ PROP_0,
+ PROP_SYNC_STRATEGY
};
#define CAMEL_KOLAB_IMAPX_SETTINGS_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CAMEL_TYPE_KOLAB_IMAPX_SETTINGS, CamelKolabIMAPXSettingsPrivate))
@@ -53,15 +60,87 @@ camel_kolab_imapx_settings_init (CamelKolabIMAPXSettings *self)
}
static void
+camel_kolab_imapx_settings_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SYNC_STRATEGY:
+ camel_kolab_imapx_settings_set_sync_strategy (
+ CAMEL_KOLAB_IMAPX_SETTINGS (object),
+ g_value_get_enum (value));
+ return;
+ default:
+ break;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+camel_kolab_imapx_settings_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SYNC_STRATEGY:
+ g_value_set_enum (
+ value,
+ camel_kolab_imapx_settings_get_sync_strategy (
+ CAMEL_KOLAB_IMAPX_SETTINGS (object)));
+ return;
+ default:
+ break;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
camel_kolab_imapx_settings_class_init (CamelKolabIMAPXSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (CamelKolabIMAPXSettingsPrivate));
+
+ object_class->set_property = camel_kolab_imapx_settings_set_property;
+ object_class->get_property = camel_kolab_imapx_settings_get_property;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SYNC_STRATEGY,
+ g_param_spec_enum (
+ "sync-strategy",
+ "Sync Strategy",
+ "Conflict resolution strategy",
+ KOLAB_TYPE_SYNC_STRATEGY_ID,
+ KOLAB_SYNC_STRATEGY_DEFAULT,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
/*----------------------------------------------------------------------------*/
/* API functions */
+KolabSyncStrategyID
+camel_kolab_imapx_settings_get_sync_strategy (CamelKolabIMAPXSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_KOLAB_IMAPX_SETTINGS (settings), KOLAB_SYNC_STRATEGY_DEFAULT);
+
+ return settings->priv->sync_strategy;
+}
+
+void
+camel_kolab_imapx_settings_set_sync_strategy (CamelKolabIMAPXSettings *settings,
+ KolabSyncStrategyID sync_strategy)
+{
+ g_return_if_fail (CAMEL_IS_KOLAB_IMAPX_SETTINGS (settings));
+
+ settings->priv->sync_strategy = sync_strategy;
+
+ g_object_notify (G_OBJECT (settings), "sync-strategy");
+}
/*----------------------------------------------------------------------------*/
diff --git a/src/libekolabutil/camel-kolab-imapx-settings.h b/src/libekolabutil/camel-kolab-imapx-settings.h
index 3f90b4d..0d0d1c6 100644
--- a/src/libekolabutil/camel-kolab-imapx-settings.h
+++ b/src/libekolabutil/camel-kolab-imapx-settings.h
@@ -33,6 +33,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <libekolab/kolab-types.h>
#include <libekolabutil/camel-system-headers.h>
/*----------------------------------------------------------------------------*/
@@ -74,6 +75,12 @@ struct _CamelKolabIMAPXSettingsClass {
GType
camel_kolab_imapx_settings_get_type (void);
+KolabSyncStrategyID
+camel_kolab_imapx_settings_get_sync_strategy (CamelKolabIMAPXSettings *settings);
+void
+camel_kolab_imapx_settings_set_sync_strategy (CamelKolabIMAPXSettings *settings,
+ KolabSyncStrategyID sync_strategy);
+
G_END_DECLS
/*----------------------------------------------------------------------------*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]