evolution r36172 - branches/mail-dbus-remoting/mail



Author: abharath
Date: Thu Aug 28 17:42:31 2008
New Revision: 36172
URL: http://svn.gnome.org/viewvc/evolution?rev=36172&view=rev

Log:
Get parent store from the folder. Gotta move the children now to use these


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

Modified: branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c	Thu Aug 28 17:42:31 2008
@@ -93,6 +93,22 @@
 
 		message_count = camel_folder_get_deleted_message_count (folder);
 		dbus_message_append_args (return_val, DBUS_TYPE_INT32, &message_count, DBUS_TYPE_INVALID);
+	} else if (strcmp(method, "camel_folder_get_parent_store") == 0) {
+		gboolean ret;
+		char *store_url, *store_hash_key;
+
+		ret = dbus_message_get_args (message, NULL,
+				DBUS_TYPE_STRING, &folder_hash_key,
+				DBUS_TYPE_INVALID);
+		folder = g_hash_table_lookup (folder_hash, folder_hash_key);
+		
+		store = camel_folder_get_parent_store (folder);		
+		store_url = camel_service_get_url ((CamelService *)store);
+
+		store_hash_key = e_dbus_get_store_hash (store_url);
+
+		dbus_message_append_args (return_val, DBUS_TYPE_STRING, &store_hash_key, DBUS_TYPE_INVALID);
+		printf("%s: Success. store_hash_key:%s\n", method, store_hash_key);
 	} else if (strncmp (method, "camel_object", 12) == 0) {
 		return camel_object_signal_handler (connection, message, user_data, CAMEL_ROT_FOLDER);
 	} else

Modified: branches/mail-dbus-remoting/mail/camel-folder-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote.c	(original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote.c	Thu Aug 28 17:42:31 2008
@@ -138,4 +138,31 @@
 	return message_count;
 }
 
+CamelObjectRemote *
+camel_folder_remote_get_parent_store (CamelFolderRemote *folder)
+{
+	gboolean ret;
+	DBusError error;
+	char *store_hash_key;
+	CamelObjectRemote *rstore;
 
+	dbus_error_init (&error);
+	/* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+	ret = dbind_context_method_call (evolution_dbus_peek_context(), 
+			CAMEL_DBUS_NAME,
+			CAMEL_FOLDER_OBJECT_PATH,
+			CAMEL_FOLDER_INTERFACE,
+			"camel_folder_get_parent_store",
+			&error, 
+			"s=>s", folder->object_id, &store_hash_key); 
+
+	if (!ret) {
+		g_warning ("Error: Get parent store from camel folder remote: %s\n", error.message);
+		return;
+	}
+
+	rstore = (CamelObjectRemote *) g_hash_table_lookup (store_rhash, store_hash_key);
+	
+	d(printf("Got parent store from camel folder remotely\n"));
+	return rstore;
+}

Modified: branches/mail-dbus-remoting/mail/camel-folder-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote.h	(original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote.h	Thu Aug 28 17:42:31 2008
@@ -17,6 +17,8 @@
 
 int camel_folder_remote_get_deleted_message_count (CamelFolderRemote *folder);
 
-const char *camel_folder_remote_get_name (CamelFolder *folder);
+CamelObjectRemote *camel_folder_remote_get_parent_store (CamelFolderRemote *folder);
+
+const char *camel_folder_remote_get_name (CamelFolderRemote *folder);
 
 #endif

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	Thu Aug 28 17:42:31 2008
@@ -167,8 +167,11 @@
 camel_object_remote_from_camel_store (CamelStore *store)
 {
 	CamelObjectRemote *obj;
+	char *store_hash_key;
 
-	obj = (CamelObjectRemote *) g_hash_table_lookup (store_rhash, camel_service_get_url((CamelService *)store));
+	store_hash_key = e_dbus_get_store_hash (camel_service_get_url((CamelService *)store));
+
+	obj = (CamelObjectRemote *) g_hash_table_lookup (store_rhash, store_hash_key);
 	return obj;
 }
 



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