[evolution-groupwise] Provide a callback for the tranport to fetch the connection
- From: Chenthill Palanisamy <pchen src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-groupwise] Provide a callback for the tranport to fetch the connection
- Date: Mon, 14 May 2012 13:36:35 +0000 (UTC)
commit d22d4d81b49b52e800cb2c1bf276bf128528abaa
Author: Chenthill Palanisamy <pchenthill novell com>
Date: Thu May 10 17:42:01 2012 +0530
Provide a callback for the tranport to fetch the connection
src/camel/camel-groupwise-store.c | 15 ++++++++++++---
src/camel/camel-groupwise-transport.c | 24 ++++++++++++++----------
src/camel/camel-groupwise-transport.h | 13 ++++++++++---
3 files changed, 36 insertions(+), 16 deletions(-)
---
diff --git a/src/camel/camel-groupwise-store.c b/src/camel/camel-groupwise-store.c
index c418fcf..2b597bb 100644
--- a/src/camel/camel-groupwise-store.c
+++ b/src/camel/camel-groupwise-store.c
@@ -1505,6 +1505,14 @@ groupwise_store_authenticate_sync (CamelService *service,
return result;
}
+static EGwConnection *
+get_connection (CamelService *transport, CamelStore *store, GCancellable *cancellable, GError **error)
+{
+ CamelGroupwiseStore *gw_store = (CamelGroupwiseStore *) store;
+
+ return gw_store->priv->cnc;
+}
+
static gboolean
groupwise_store_initable_init (GInitable *initable,
GCancellable *cancellable,
@@ -1567,9 +1575,10 @@ groupwise_store_initable_init (GInitable *initable,
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
- camel_groupwise_transport_set_store (
- CAMEL_GROUPWISE_TRANSPORT (transport),
- groupwise_store);
+ camel_groupwise_transport_set_connection_callback (
+ CAMEL_SERVICE (transport),
+ get_connection,
+ (CamelStore *) groupwise_store);
}
return (transport != NULL);
diff --git a/src/camel/camel-groupwise-transport.c b/src/camel/camel-groupwise-transport.c
index 10e9585..c4eb824 100644
--- a/src/camel/camel-groupwise-transport.c
+++ b/src/camel/camel-groupwise-transport.c
@@ -31,7 +31,6 @@
#include <glib/gi18n-lib.h>
#include "camel-groupwise-settings.h"
-#include "camel-groupwise-store.h"
#include "camel-groupwise-transport.h"
#include "camel-groupwise-utils.h"
@@ -44,7 +43,8 @@
G_DEFINE_TYPE (CamelGroupwiseTransport, camel_groupwise_transport, CAMEL_TYPE_TRANSPORT)
struct _CamelGroupwiseTransportPrivate {
- CamelGroupwiseStore *store;
+ GetConnectionCb cb;
+ CamelStore *store;
};
static void
@@ -54,7 +54,7 @@ groupwise_transport_dispose (GObject *object)
priv = CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE (object);
- if (priv->store != NULL) {
+ if (priv->store) {
g_object_unref (priv->store);
priv->store = NULL;
}
@@ -108,8 +108,10 @@ groupwise_send_to_sync (CamelTransport *transport,
GSList *sent_item_list = NULL;
gchar *reply_request = NULL;
EGwItemLinkInfo *info = NULL;
+
+ priv = CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE (transport);
- if (!transport) {
+ if (!transport || !priv->cb) {
g_set_error (
error, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_CANT_AUTHENTICATE,
@@ -117,12 +119,11 @@ groupwise_send_to_sync (CamelTransport *transport,
return FALSE;
}
- priv = CAMEL_GROUPWISE_TRANSPORT_GET_PRIVATE (transport);
camel_operation_push_message (cancellable, _("Sending Message") );
- /*camel groupwise store and cnc*/
- cnc = cnc_lookup (priv->store->priv);
+ /* callback for retreiving the connection */
+ cnc = priv->cb (CAMEL_SERVICE (transport), priv->store, cancellable, error);
if (!cnc) {
g_warning ("||| Eh!!! Failure |||\n");
camel_operation_pop_message (cancellable);
@@ -215,11 +216,14 @@ camel_groupwise_transport_init (CamelGroupwiseTransport *transport)
}
void
-camel_groupwise_transport_set_store (CamelGroupwiseTransport *transport,
- CamelGroupwiseStore *store)
+camel_groupwise_transport_set_connection_callback (CamelService *service,
+ GetConnectionCb cb,
+ CamelStore *store)
{
+ CamelGroupwiseTransport *transport = CAMEL_GROUPWISE_TRANSPORT (service);
+
g_return_if_fail (CAMEL_IS_GROUPWISE_TRANSPORT (transport));
- g_return_if_fail (CAMEL_IS_GROUPWISE_STORE (store));
+ transport->priv->cb = cb;
transport->priv->store = g_object_ref (store);
}
diff --git a/src/camel/camel-groupwise-transport.h b/src/camel/camel-groupwise-transport.h
index ee9d21c..acb3fee 100644
--- a/src/camel/camel-groupwise-transport.h
+++ b/src/camel/camel-groupwise-transport.h
@@ -60,10 +60,17 @@ struct _CamelGroupwiseTransportClass {
CamelTransportClass parent_class;
};
+typedef EGwConnection * (*GetConnectionCb)
+ (CamelService *transport,
+ CamelStore *store,
+ GCancellable *cancellable,
+ GError **error);
+
GType camel_groupwise_transport_get_type (void);
-void camel_groupwise_transport_set_store
- (CamelGroupwiseTransport *transport,
- CamelGroupwiseStore *store);
+void camel_groupwise_transport_set_connection_callback
+ (CamelService *transport,
+ GetConnectionCb cb,
+ CamelStore *store);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]