evolution r36100 - branches/mail-dbus-remoting/mail



Author: psankar
Date: Wed Aug 27 06:40:52 2008
New Revision: 36100
URL: http://svn.gnome.org/viewvc/evolution?rev=36100&view=rev

Log:
get CamelStore and CamelObjectRemote from each other.

Add HashTable to get CamelObjectRemote given an object_id.


Modified:
   branches/mail-dbus-remoting/mail/camel-object-remote.c
   branches/mail-dbus-remoting/mail/camel-object-remote.h
   branches/mail-dbus-remoting/mail/camel-session-remote.c

Modified: branches/mail-dbus-remoting/mail/camel-object-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-object-remote.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-object-remote.c	Wed Aug 27 06:40:52 2008
@@ -20,6 +20,9 @@
 static int signal_inited = FALSE;
 static GHashTable *objects;
 
+
+extern GHashTable *store_rhash;
+
 static DBusHandlerResult
 dbus_listener_store_handler (DBusConnection *connection,
                                     DBusMessage    *message,
@@ -158,9 +161,19 @@
 {
 	CamelObjectRemote *obj;
 
-	obj = g_new0 (CamelObjectRemote , 1);
+	obj = (CamelObjectRemote *) g_hash_table_lookup (store_rhash, camel_service_get_url((CamelService *)store));
+	return obj;
+}
+
+
+CamelStore *
+camel_object_remote_get_camel_store (CamelObjectRemote *obj)
+{
+	CamelStore *store;
+
+	if (obj->type != CAMEL_RO_STORE)
+		return NULL;
 
-	obj->object_id = e_dbus_get_store_hash (camel_service_get_url((CamelService *)store)); 
-	obj->type = CAMEL_RO_STORE;
-	obj->hooks = NULL;
+	store = (CamelStore *) g_hash_table_lookup (store_hash, obj->object_id);
+	return store;
 }

Modified: branches/mail-dbus-remoting/mail/camel-object-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-object-remote.h	(original)
+++ branches/mail-dbus-remoting/mail/camel-object-remote.h	Wed Aug 27 06:40:52 2008
@@ -48,4 +48,5 @@
 camel_object_remote_hook_event (CamelObjectRemote *object, char *signal, CamelObjectEventHookFunc func, gpointer data);
 
 CamelObjectRemote * camel_object_remote_from_camel_store (CamelStore *store);
+CamelStore * camel_object_remote_get_camel_store (CamelObjectRemote *obj);
 #endif

Modified: branches/mail-dbus-remoting/mail/camel-session-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.c	Wed Aug 27 06:40:52 2008
@@ -10,7 +10,8 @@
 #include "camel-object-remote.h"
 
 #define CAMEL_DBUS_NAME "org.gnome.evolution.camel"
-
+extern GHashTable *store_hash;
+GHashTable *store_rhash = NULL;
 #define d(x) x
 
 /*
@@ -49,6 +50,7 @@
 		return;
 	}
 
+	store_rhash = g_hash_table_new (g_direct_hash, g_direct_equal);
 	d(printf("Camel session constructed remotely\n"));
 
 }
@@ -173,7 +175,7 @@
 	rstore->type = CAMEL_RO_STORE;
 	rstore->hooks = NULL;
 	d(printf("Camel session get service remotely\n"));
-
+	g_hash_table_insert (store_rhash, g_hash_table_lookup(store_hash, service), rstore);
 	return rstore;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]