evolution r36080 - branches/mail-dbus-remoting/mail



Author: abharath
Date: Tue Aug 26 11:25:55 2008
New Revision: 36080
URL: http://svn.gnome.org/viewvc/evolution?rev=36080&view=rev

Log:
First taste of success seen :) Fixes for Session


Modified:
   branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
   branches/mail-dbus-remoting/mail/camel-session-remote.c
   branches/mail-dbus-remoting/mail/camel-session-remote.h
   branches/mail-dbus-remoting/mail/camel-store-remote-impl.c
   branches/mail-dbus-remoting/mail/em-folder-selector.c
   branches/mail-dbus-remoting/mail/em-folder-tree-model.c
   branches/mail-dbus-remoting/mail/em-folder-tree.c
   branches/mail-dbus-remoting/mail/em-folder-utils.c
   branches/mail-dbus-remoting/mail/em-migrate.c
   branches/mail-dbus-remoting/mail/em-subscribe-editor.c
   branches/mail-dbus-remoting/mail/mail-component.c
   branches/mail-dbus-remoting/mail/mail-dbus.c
   branches/mail-dbus-remoting/mail/mail-session.h

Modified: branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote-impl.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote-impl.c	Tue Aug 26 11:25:55 2008
@@ -15,7 +15,8 @@
 
 static gboolean session_setup = FALSE;
 
-extern GHashTable *store_hash;
+GHashTable *store_hash = NULL;
+extern CamelSession *session;
 
 static DBusHandlerResult
 dbus_listener_message_handler (DBusConnection *connection,
@@ -32,8 +33,6 @@
 {
 	const char *method = dbus_message_get_member (message);
 	DBusMessage *return_val;
-
-	CamelSession *session = NULL;
 	CamelStore *store;
 	char *store_not_found = _("Store not found");
 
@@ -160,7 +159,8 @@
 		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_get_service") == 0) {
-		char *session_str, *url_string, *err;
+		char *session_str, *url_string, *err, *store_url;
+		char *store_hash_key;
 		CamelProviderType type;
 		CamelService *service;
 		gboolean ret;
@@ -169,15 +169,21 @@
 		ex = camel_exception_new ();
 
 		ret = dbus_message_get_args(message, NULL,
-				DBUS_TYPE_STRING, &session_str,
 				DBUS_TYPE_STRING, &url_string,
 				DBUS_TYPE_INT32, &type,
 				DBUS_TYPE_INVALID);
 		
 		camel_exception_init (ex);
-		
+
+#warning "A big warning :P The store hash needs to be handled properly"		
 		service = camel_session_get_service (session, url_string, type, ex);
 
+		store_url = camel_service_get_url (service);
+
+		store_hash_key = e_dbus_get_store_hash (store_url);
+
+		g_hash_table_insert (store_hash, store_hash_key, service);
+
 		if (ex)
 			err = g_strdup (camel_exception_get_description (ex));
 		else
@@ -185,8 +191,7 @@
 
 		camel_exception_free (ex);
 			
-/*verify and fix this*/	
-		dbus_message_append_args (return_val, DBUS_TYPE_STRING, "", DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &store_hash_key, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
 		g_free (err);
 	} else if (strcmp (method, "camel_session_alert_user") == 0) {
 		char *session_str, *prompt, *err = NULL;
@@ -309,5 +314,6 @@
 camel_session_remote_impl_init ()
 {
 	session_setup = TRUE;
+	store_hash = g_hash_table_new (g_str_hash, g_str_equal);
 	e_dbus_register_handler (CAMEL_SESSION_OBJECT_PATH, dbus_listener_message_handler, NULL);
 }

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	Tue Aug 26 11:25:55 2008
@@ -8,7 +8,7 @@
 #include <evo-dbus.h>
 #include "camel-session-remote.h"
 
-#define CAMEL_SESSION_INTERFACE	"org.gnome.evolution.camel.session.mail"
+#define CAMEL_SESSION_INTERFACE	"org.gnome.evolution.camel.session"
 #define CAMEL_SESSION_OBJECT_PATH "/org/gnome/evolution/camel/session"
 #define CAMEL_DBUS_NAME "org.gnome.evolution.camel"
 
@@ -145,11 +145,11 @@
 
 CamelStoreRemote *
 camel_session_remote_get_service (CamelSessionRemote *session, const char *url_string,
-			   CamelProviderType type)
+			   CamelProviderType type, CamelException *ex)
 {
 	gboolean ret;
 	DBusError error;
-	char *service, *ex;
+	char *service;
 	CamelStoreRemote *rstore;
 
 	dbus_error_init (&error);
@@ -160,7 +160,7 @@
 			CAMEL_SESSION_INTERFACE,
 			"camel_session_get_service",
 			&error, 
-			"ssi=>ss", session->object_id, url_string, type, &service, &ex);
+			"si=>ss", url_string, type, &service, &ex);
 
 	if (!ret) {
 		g_warning ("Error: Camel session get service: %s\n", error.message);

Modified: branches/mail-dbus-remoting/mail/camel-session-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.h	(original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.h	Tue Aug 26 11:25:55 2008
@@ -3,12 +3,24 @@
  *
  * */
 
+#ifndef CAMEL_SESSION_REMOTE_H
+#define CAMEL_SESSION_REMOTE_H
+
 #include "camel-store-remote.h"
 
 typedef struct {
 	char *object_id;
 } CamelSessionRemote;
 
+/*
+#define camel_session_construct camel_session_remote_construct
+#define camel_session_get_password camel_session_remote_get_password
+#define camel_session_get_storage_path camel_session_remote_get_storage_path
+#define camel_session_forget_password camel_session_remote_forget_password
+#define camel_session_get_service camel_session_remote_get_service
+#define camel_session_alert_user camel_session_remote_alert_user
+#define camel_session_build_password_prompt camel_session_remote_build_password_prompt
+*/
 void camel_session_remote_construct (CamelSessionRemote *session,
 					const char *storage_path);
 
@@ -30,7 +42,8 @@
 
 CamelStoreRemote *camel_session_remote_get_service (CamelSessionRemote *session, 
 						const char *url_string,
-			   			CamelProviderType type);
+			   			CamelProviderType type,
+						CamelException *ex);
 
 gboolean camel_session_remote_alert_user (CamelSessionRemote *session, 
 					CamelSessionAlertType type,
@@ -57,4 +70,4 @@
 void camel_session_remote_set_network_state  (CamelSessionRemote *session,
 				     	gboolean network_state);
 
-
+#endif

Modified: branches/mail-dbus-remoting/mail/camel-store-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-store-remote-impl.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-store-remote-impl.c	Tue Aug 26 11:25:55 2008
@@ -13,7 +13,7 @@
 
 static gboolean store_setup = FALSE;
 
-GHashTable *store_hash = NULL;
+extern GHashTable *store_hash;
 GHashTable *folder_hash = NULL;
 static DBusHandlerResult
 dbus_listener_message_handler(DBusConnection * connection,

Modified: branches/mail-dbus-remoting/mail/em-folder-selector.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-selector.c	(original)
+++ branches/mail-dbus-remoting/mail/em-folder-selector.c	Tue Aug 26 11:25:55 2008
@@ -40,6 +40,8 @@
 #include "em-folder-selector.h"
 #include "em-folder-utils.h"
 
+#include "camel-session-remote.h"
+
 #define d(x)
 
 

Modified: branches/mail-dbus-remoting/mail/em-folder-tree-model.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-tree-model.c	(original)
+++ branches/mail-dbus-remoting/mail/em-folder-tree-model.c	Tue Aug 26 11:25:55 2008
@@ -37,6 +37,8 @@
 #include <libedataserver/e-xml-utils.h>
 #include <libedataserver/e-data-server-util.h>
 
+#include "camel-session-remote.h"
+
 #include <e-util/e-mktemp.h>
 
 #include <glib/gi18n.h>
@@ -412,7 +414,7 @@
 	if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE))
 		return;
 
-	if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
+	if (!(store = (CamelStore *) camel_session_remote_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
 		camel_exception_clear (&ex);
 		return;
 	}
@@ -1076,7 +1078,7 @@
 	if (!uri)
 		return NULL;
 
-	store = (CamelStore *)camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex);
+	store = (CamelStore *)camel_session_remote_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex);
 	camel_exception_clear(&ex);
 
 	url = camel_url_new (uri, NULL);

Modified: branches/mail-dbus-remoting/mail/em-folder-tree.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-tree.c	(original)
+++ branches/mail-dbus-remoting/mail/em-folder-tree.c	Tue Aug 26 11:25:55 2008
@@ -74,6 +74,8 @@
 #include "em-folder-properties.h"
 #include "em-event.h"
 
+#include "camel-session-remote.h"
+
 #define d(x)
 
 struct _selected_uri {

Modified: branches/mail-dbus-remoting/mail/em-folder-utils.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-utils.c	(original)
+++ branches/mail-dbus-remoting/mail/em-folder-utils.c	Tue Aug 26 11:25:55 2008
@@ -73,6 +73,8 @@
 #include "em-folder-selection.h"
 #include "em-folder-properties.h"
 
+#include "camel-session-remote.h"
+
 #define d(x)
 
 extern CamelSession *session;

Modified: branches/mail-dbus-remoting/mail/em-migrate.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-migrate.c	(original)
+++ branches/mail-dbus-remoting/mail/em-migrate.c	Tue Aug 26 11:25:55 2008
@@ -73,6 +73,8 @@
 #include "em-utils.h"
 #include "em-migrate.h"
 
+#include "camel-session-remote.h"
+
 #define d(x) x
 
 #ifndef G_OS_WIN32

Modified: branches/mail-dbus-remoting/mail/em-subscribe-editor.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-subscribe-editor.c	(original)
+++ branches/mail-dbus-remoting/mail/em-subscribe-editor.c	Tue Aug 26 11:25:55 2008
@@ -47,6 +47,8 @@
 #include <glade/glade.h>
 #include <glib/gi18n.h>
 
+#include "camel-session-remote.h"
+
 #define d(x)
 
 typedef struct _EMSubscribeEditor EMSubscribeEditor;

Modified: branches/mail-dbus-remoting/mail/mail-component.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-component.c	(original)
+++ branches/mail-dbus-remoting/mail/mail-component.c	Tue Aug 26 11:25:55 2008
@@ -35,6 +35,8 @@
 #include <fcntl.h>
 #include <errno.h>
 
+#include "camel-session-remote.h"
+
 #include <libedataserver/e-data-server-util.h>
 #include "em-utils.h"
 #include "em-composer-utils.h"
@@ -297,7 +299,7 @@
 	camel_url_set_path(url, tmp);
 	g_free(tmp);
 	tmp = camel_url_to_string(url, 0);
-	p->local_store = (CamelStore *)camel_session_get_service(session, tmp, CAMEL_PROVIDER_STORE, &ex);
+	p->local_store = (CamelStore *)camel_session_remote_get_service(session, tmp, CAMEL_PROVIDER_STORE, &ex);
 	g_free(tmp);
 	if (p->local_store == NULL)
 		goto fail;

Modified: branches/mail-dbus-remoting/mail/mail-dbus.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-dbus.c	(original)
+++ branches/mail-dbus-remoting/mail/mail-dbus.c	Tue Aug 26 11:25:55 2008
@@ -193,6 +193,7 @@
 
 	/* Initialize Mail Session */
 	mail_session_remote_impl_init ();
+	camel_session_remote_impl_init ();
 	camel_object_remote_impl_init ();
 	return FALSE;
 }

Modified: branches/mail-dbus-remoting/mail/mail-session.h
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-session.h	(original)
+++ branches/mail-dbus-remoting/mail/mail-session.h	Tue Aug 26 11:25:55 2008
@@ -29,6 +29,8 @@
 
 #include "mail-session-remote.h"
 
+#include "camel-session-remote.h"
+
 #ifdef __cplusplus
 extern "C" {
 #pragma }



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