[evolution-activesync] Make it compile against evolution 3.4.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-activesync] Make it compile against evolution 3.4.
- Date: Tue, 24 Apr 2012 08:45:21 +0000 (UTC)
commit 7ef7293c1a381243088f667d27884e13e0a1f69e
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Tue Apr 24 14:14:31 2012 +0530
Make it compile against evolution 3.4.
camel/Makefile.am | 6 +-
camel/camel-eas-settings.c | 254 +++++++++++++++++++++++++++++++++++++++++++
camel/camel-eas-settings.h | 71 ++++++++++++
camel/camel-eas-store.c | 38 +++++++
camel/camel-eas-transport.c | 17 ++-
camel/camel-eas-utils.c | 6 +-
6 files changed, 385 insertions(+), 7 deletions(-)
---
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 23b7c4e..bbd13b3 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -26,7 +26,8 @@ libcameleas_la_SOURCES = \
camel-eas-provider.c \
camel-eas-utils.c \
camel-eas-transport.c \
- camel-eas-compat.c
+ camel-eas-compat.c \
+ camel-eas-settings.c
noinst_HEADERS = \
camel-eas-folder.h \
@@ -36,7 +37,8 @@ noinst_HEADERS = \
camel-eas-summary.h \
camel-eas-utils.h \
camel-eas-transport.h \
- camel-eas-compat.h
+ camel-eas-compat.h \
+ camel-eas-settings.h
libcameleas_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
diff --git a/camel/camel-eas-settings.c b/camel/camel-eas-settings.c
new file mode 100644
index 0000000..3d6d911
--- /dev/null
+++ b/camel/camel-eas-settings.c
@@ -0,0 +1,254 @@
+/*
+ * camel-eas-settings.c
+ *
+ * This program 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) version 3.
+ *
+ * This program 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include "camel-eas-settings.h"
+
+#define CAMEL_EAS_SETTINGS_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), CAMEL_TYPE_EAS_SETTINGS, CamelEasSettingsPrivate))
+
+struct _CamelEasSettingsPrivate {
+ gboolean check_all;
+ gchar *owaurl;
+ gchar *account_uid;
+};
+
+enum {
+ PROP_0,
+ PROP_CHECK_ALL,
+ PROP_OWAURL,
+ PROP_ACCOUNT_UID,
+};
+
+G_DEFINE_TYPE_WITH_CODE (
+ CamelEasSettings,
+ camel_eas_settings,
+ CAMEL_TYPE_OFFLINE_SETTINGS,
+ G_IMPLEMENT_INTERFACE (
+ CAMEL_TYPE_NETWORK_SETTINGS, NULL))
+
+static void
+eas_settings_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CHECK_ALL:
+ camel_eas_settings_set_check_all (
+ CAMEL_EAS_SETTINGS (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_OWAURL:
+ camel_eas_settings_set_owaurl (
+ CAMEL_EAS_SETTINGS (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_ACCOUNT_UID:
+ camel_eas_settings_set_account_uid (
+ CAMEL_EAS_SETTINGS (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+eas_settings_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CHECK_ALL:
+ g_value_set_boolean (
+ value,
+ camel_eas_settings_get_check_all (
+ CAMEL_EAS_SETTINGS (object)));
+ return;
+
+ case PROP_OWAURL:
+ g_value_set_string (
+ value,
+ camel_eas_settings_get_owaurl (
+ CAMEL_EAS_SETTINGS (object)));
+ return;
+
+ case PROP_ACCOUNT_UID:
+ g_value_set_string (
+ value,
+ camel_eas_settings_get_account_uid (
+ CAMEL_EAS_SETTINGS (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+eas_settings_finalize (GObject *object)
+{
+ CamelEasSettingsPrivate *priv;
+
+ priv = CAMEL_EAS_SETTINGS_GET_PRIVATE (object);
+
+ g_free (priv->owaurl);
+ g_free (priv->account_uid);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (camel_eas_settings_parent_class)->finalize (object);
+}
+
+static void
+camel_eas_settings_class_init (CamelEasSettingsClass *class)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (class, sizeof (CamelEasSettingsPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = eas_settings_set_property;
+ object_class->get_property = eas_settings_get_property;
+ object_class->finalize = eas_settings_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_OWAURL,
+ g_param_spec_string (
+ "owaurl",
+ "OWA URL",
+ "OWA URL",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CHECK_ALL,
+ g_param_spec_boolean (
+ "check-all",
+ "Check All",
+ "Check all folders for new messages",
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ACCOUNT_UID,
+ g_param_spec_string (
+ "account-uid",
+ "Account UID",
+ "Account UID",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ G_PARAM_STATIC_STRINGS));
+
+}
+
+static void
+camel_eas_settings_init (CamelEasSettings *settings)
+{
+ settings->priv = CAMEL_EAS_SETTINGS_GET_PRIVATE (settings);
+}
+
+
+const gchar *
+camel_eas_settings_get_oaburl (CamelEasSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EAS_SETTINGS (settings), NULL);
+
+ return settings->priv->owaurl;
+}
+
+void
+camel_eas_settings_set_owaurl (CamelEasSettings *settings,
+ const gchar *url)
+{
+ g_return_if_fail (CAMEL_IS_EAS_SETTINGS (settings));
+
+ g_free (settings->priv->owaurl);
+ settings->priv->owaurl = g_strdup (url);
+
+ g_object_notify (G_OBJECT (settings), "owaurl");
+}
+
+const gchar *
+camel_eas_settings_get_account_uid (CamelEasSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EAS_SETTINGS (settings), NULL);
+
+ return settings->priv->account_uid;
+}
+
+void
+camel_eas_settings_set_account_uid (CamelEasSettings *settings,
+ const gchar *account_uid)
+{
+ g_return_if_fail (CAMEL_IS_EAS_SETTINGS (settings));
+
+ g_free (settings->priv->account_uid);
+ settings->priv->account_uid= g_strdup (account_uid);
+
+ g_object_notify (G_OBJECT (settings), "account-uid");
+}
+
+/**
+ * camel_eas_settings_get_check_all:
+ * @settings: a #CamelEasSettings
+ *
+ * Returns whether to check all folders for new messages.
+ *
+ * Returns: whether to check all folders for new messages
+ *
+ * Since: 3.4
+ **/
+gboolean
+camel_eas_settings_get_check_all (CamelEasSettings *settings)
+{
+ g_return_val_if_fail (CAMEL_IS_EAS_SETTINGS (settings), FALSE);
+
+ return settings->priv->check_all;
+}
+
+/**
+ * camel_eas_settings_set_check_all:
+ * @settings: a #CamelEasSettings
+ * @check_all: whether to check all folders for new messages
+ *
+ * Sets whether to check all folders for new messages.
+ *
+ * Since: 3.4
+ **/
+void
+camel_eas_settings_set_check_all (CamelEasSettings *settings,
+ gboolean check_all)
+{
+ g_return_if_fail (CAMEL_IS_EAS_SETTINGS (settings));
+
+ settings->priv->check_all = check_all;
+
+ g_object_notify (G_OBJECT (settings), "check-all");
+}
diff --git a/camel/camel-eas-settings.h b/camel/camel-eas-settings.h
new file mode 100644
index 0000000..eb2ecf6
--- /dev/null
+++ b/camel/camel-eas-settings.h
@@ -0,0 +1,71 @@
+/*
+ * camel-eas-settings.h
+ *
+ * This program 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) version 3.
+ *
+ * This program 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifndef CAMEL_EAS_SETTINGS_H
+#define CAMEL_EAS_SETTINGS_H
+
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define CAMEL_TYPE_EAS_SETTINGS \
+ (camel_eas_settings_get_type ())
+#define CAMEL_EAS_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), CAMEL_TYPE_EAS_SETTINGS, CamelEasSettings))
+#define CAMEL_EAS_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), CAMEL_TYPE_EAS_SETTINGS, CamelEasSettingsClass))
+#define CAMEL_IS_EAS_SETTINGS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), CAMEL_TYPE_EAS_SETTINGS))
+#define CAMEL_IS_EAS_SETTINGS_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), CAMEL_TYPE_EAS_SETTINGS))
+#define CAMEL_EAS_SETTINGS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), CAMEL_TYPE_EAS_SETTINGS))
+
+G_BEGIN_DECLS
+
+typedef struct _CamelEasSettings CamelEasSettings;
+typedef struct _CamelEasSettingsClass CamelEasSettingsClass;
+typedef struct _CamelEasSettingsPrivate CamelEasSettingsPrivate;
+
+struct _CamelEasSettings {
+ CamelOfflineSettings parent;
+ CamelEasSettingsPrivate *priv;
+};
+
+struct _CamelEasSettingsClass {
+ CamelOfflineSettingsClass parent_class;
+};
+
+GType camel_eas_settings_get_type (void) G_GNUC_CONST;
+gboolean camel_eas_settings_get_check_all (CamelEasSettings *settings);
+void camel_eas_settings_set_check_all (CamelEasSettings *settings,
+ gboolean check_all);
+const gchar * camel_eas_settings_get_owaurl (CamelEasSettings *settings);
+void camel_eas_settings_set_owaurl (CamelEasSettings *settings,
+ const gchar *url);
+const gchar * camel_eas_settings_get_account_uid (CamelEasSettings *settings);
+void camel_eas_settings_set_account_uid (CamelEasSettings *settings,
+ const gchar *uid);
+
+G_END_DECLS
+
+#endif /* CAMEL_EAS_SETTINGS_H */
diff --git a/camel/camel-eas-store.c b/camel/camel-eas-store.c
index 548f25c..6118e18 100644
--- a/camel/camel-eas-store.c
+++ b/camel/camel-eas-store.c
@@ -52,6 +52,10 @@
#include <ws2tcpip.h>
#endif
+#if EDS_CHECK_VERSION(3,3,90)
+#include "camel-eas-settings.h"
+#endif
+
#define d(x) x
#define CURSOR_ITEM_LIMIT 100
@@ -157,6 +161,9 @@ eas_store_construct (CamelService *service, CamelSession *session,
CamelEasStore *eas_store;
CamelEasStorePrivate *priv;
gchar *summary_file, *session_storage_path;
+#if EDS_CHECK_VERSION(3,3,90)
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings (service));
+#endif
#if ! EDS_CHECK_VERSION(3,1,0)
CamelServiceClass *service_class;
@@ -184,7 +191,11 @@ eas_store_construct (CamelService *service, CamelSession *session,
}
eas_store->storage_path = session_storage_path;
+#if EDS_CHECK_VERSION(3,3,90)
+ priv->account_uid = g_strdup(camel_eas_settings_get_account_uid ((CamelEasSettings *) settings));
+#else
priv->account_uid = g_strdup (camel_url_get_param (url, "account_uid"));
+#endif
if (!priv->account_uid) {
g_set_error (
error, CAMEL_STORE_ERROR,
@@ -478,6 +489,7 @@ eas_rename_folder_sync (CamelStore *store,
gchar *
eas_get_name (CamelService *service, gboolean brief)
{
+#if !EDS_CHECK_VERSION (3,3,90)
CamelURL *url = camel_service_get_camel_url (service);
if (brief)
@@ -486,6 +498,25 @@ eas_get_name (CamelService *service, gboolean brief)
else
return g_strdup_printf(_("Exchange ActiveSync service for %s on %s"),
url->user, url->host);
+#else
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings (service));
+ const char *account_uid = camel_eas_settings_get_account_uid ((CamelEasSettings *) settings);
+ /* Account UID is nothing but the email or user host */
+ char **strings;
+ char *ret;
+
+ strings = g_strsplit (account_uid, "@", 0);
+ if (brief)
+ ret = g_strdup_printf(_("Exchange ActiveSync server %s"),
+ strings[1]);
+ else
+ ret = g_strdup_printf(_("Exchange ActiveSync service for %s on %s"),
+ strings[0], strings[1]);
+
+ g_strfreev (strings);
+
+ return ret;
+#endif
}
EasEmailHandler *
@@ -505,13 +536,20 @@ eas_get_trash_folder_sync (CamelStore *store, EVO3(GCancellable *cancellable,) G
static gboolean
eas_can_refresh_folder (CamelStore *store, CamelFolderInfo *info, GError **error)
{
+#if EDS_CHECK_VERSION (3,3,90)
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings (CAMEL_SERVICE(store)));
+#endif
/* Skip unselectable folders from automatic refresh */
if (info && (info->flags & CAMEL_FOLDER_NOSELECT) != 0) return FALSE;
+#if !EDS_CHECK_VERSION (3,3,90)
/* Delegate decision to parent class */
return CAMEL_STORE_CLASS(camel_eas_store_parent_class)->can_refresh_folder (store, info, error) ||
(camel_url_get_param (camel_service_get_camel_url(CAMEL_SERVICE(store)),
"check_all") != NULL);
+#else
+ return CAMEL_STORE_CLASS(camel_eas_store_parent_class)->can_refresh_folder (store, info, error) || camel_eas_settings_get_check_all ((CamelEasSettings *)settings);
+#endif
}
gboolean
diff --git a/camel/camel-eas-transport.c b/camel/camel-eas-transport.c
index f03e95f..0c13e19 100644
--- a/camel/camel-eas-transport.c
+++ b/camel/camel-eas-transport.c
@@ -36,6 +36,10 @@
#include "camel-eas-store.h"
#include "camel-eas-transport.h"
+#if EDS_CHECK_VERSION(3,3,90)
+#include "camel-eas-settings.h"
+#endif
+
G_DEFINE_TYPE (CamelEasTransport, camel_eas_transport, CAMEL_TYPE_TRANSPORT)
static gboolean
@@ -80,7 +84,7 @@ eas_send_to_sync (CamelTransport *transport,
GError **error)
{
gpointer progress_data;
- CamelService *service;
+ CamelService *service = CAMEL_SERVICE (transport);
EasEmailHandler *handler;
CamelStream *mimefile, *filtered;
CamelMimeFilter *filter;
@@ -89,14 +93,19 @@ eas_send_to_sync (CamelTransport *transport,
const gchar *msgid;
int fd;
gboolean res;
-
+#if EDS_CHECK_VERSION(3,3,90)
+ CamelStoreSettings *settings = CAMEL_STORE_SETTINGS (camel_service_get_settings (service));
+#endif
+
EVO3(progress_data = cancellable);
EVO2(progress_data = camel_operation_registered());
- service = CAMEL_SERVICE (transport);
+#if EDS_CHECK_VERSION(3,3,90)
+ account_uid = g_strdup(camel_eas_settings_get_account_uid ((CamelEasSettings *) settings));
+#else
account_uid = camel_url_get_param (camel_service_get_camel_url(service),
"account_uid");
-
+#endif
handler = eas_mail_handler_new (account_uid, error);
if (!handler)
return FALSE;
diff --git a/camel/camel-eas-utils.c b/camel/camel-eas-utils.c
index bf37c28..feca7a7 100644
--- a/camel/camel-eas-utils.c
+++ b/camel/camel-eas-utils.c
@@ -44,6 +44,8 @@ camel_eas_utils_build_folder_info (CamelEasStore *store, const gchar *fid)
{
CamelEasStoreSummary *eas_summary = store->summary;
CamelFolderInfo *fi;
+
+#if !EDS_CHECK_VERSION(3,1,0)
gchar *url;
url = camel_url_to_string (camel_service_get_camel_url(CAMEL_SERVICE (store)),
@@ -58,6 +60,7 @@ camel_eas_utils_build_folder_info (CamelEasStore *store, const gchar *fid)
g_free ((gchar *)url);
url = temp_url;
}
+#endif
fi = camel_folder_info_new ();
fi->full_name = camel_eas_store_summary_get_folder_full_name (eas_summary,
@@ -87,8 +90,9 @@ camel_eas_utils_build_folder_info (CamelEasStore *store, const gchar *fid)
default:
;
}
-
+#if !EDS_CHECK_VERSION(3,1,0)
g_free (url);
+#endif
return fi;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]