evolution r36181 - branches/mail-dbus-remoting/mail
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36181 - branches/mail-dbus-remoting/mail
- Date: Fri, 29 Aug 2008 03:46:49 +0000 (UTC)
Author: sragavan
Date: Fri Aug 29 03:46:49 2008
New Revision: 36181
URL: http://svn.gnome.org/viewvc/evolution?rev=36181&view=rev
Log:
Clean up and start using CamelObjectRemote for folder.
Modified:
branches/mail-dbus-remoting/mail/camel-store-remote.c
branches/mail-dbus-remoting/mail/camel-store-remote.h
Modified: branches/mail-dbus-remoting/mail/camel-store-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-store-remote.c (original)
+++ branches/mail-dbus-remoting/mail/camel-store-remote.c Fri Aug 29 03:46:49 2008
@@ -10,15 +10,19 @@
#include "camel-store-remote.h"
#include "camel-object-remote.h"
extern GHashTable *folder_hash;
+GHashTable *folder_rhash = NULL;
-CamelFolder *camel_store_get_folder_remote(CamelStoreRemote * store,
+CamelObjectRemote *camel_store_get_folder_remote(CamelStoreRemote * store,
const char *folder_name,
guint32 flags,
CamelException *ex)
{
DBusError error;
char *err = NULL, *shash = NULL;
- CamelFolder *folder = NULL;
+ CamelObjectRemote *object = NULL;
+
+ if (!folder_rhash)
+ folder_rhash = g_hash_table_new (g_str_hash, g_str_equal);
dbus_error_init(&error);
/* Invoke the appropriate dbind call to CamelStoreGetFolder */
@@ -30,18 +34,24 @@
&error,
"ssu=>ss", store->object_id, folder_name,
flags, &shash, &err))
- folder = g_hash_table_lookup (folder_hash, shash);
+ object = g_hash_table_lookup (folder_rhash, shash);
+ if (!object) {
+ object = g_new0(CamelObjectRemote, 1);
+ object->object_id = shash;
+ object->type = CAMEL_RO_FOLDER;
+ g_hash_table_insert (folder_rhash, shash, object);
+ }
else {
g_warning ("camel_store_get_folder error: %s\n", error.message);
dbus_error_free (&error);
}
- printf("Back folder %p: %s: %p\n", folder_hash, shash, folder);
+ printf("Back folder %p: %s: %p\n", folder_hash, shash, object);
- return folder;
+ return object;
}
-static CamelFolder *camel_store_get_specific_folder_remote(CamelStoreRemote *
+static CamelObjectRemote *camel_store_get_specific_folder_remote(CamelStoreRemote *
store,
const char *method)
{
@@ -50,6 +60,9 @@
char *err;
char *fhash;
+ if (!folder_rhash)
+ folder_rhash = g_hash_table_new (g_str_hash, g_str_equal);
+
dbus_error_init(&error);
/* Invoke the appropriate dbind call to CamelStoreGetFolder */
ret = dbind_context_method_call(evolution_dbus_peek_context(),
@@ -64,24 +77,30 @@
if (ret != DBUS_HANDLER_RESULT_HANDLED) {
return NULL;
} else {
- CamelFolder *folder = g_hash_table_lookup(folder_hash, fhash);
- return folder;
+ CamelObjectRemote *object = g_hash_table_lookup (folder_rhash, fhash);
+ if (!object) {
+ object = g_new0(CamelObjectRemote, 1);
+ object->object_id = fhash;
+ object->type = CAMEL_RO_FOLDER;
+ g_hash_table_insert (folder_rhash, fhash, object);
+ }
+ return object;
}
}
-CamelFolder *camel_store_get_inbox_remote(CamelStoreRemote * store, CamelException *ex)
+CamelObjectRemote *camel_store_get_inbox_remote(CamelStoreRemote * store, CamelException *ex)
{
return (camel_store_get_specific_folder_remote
(store, "camel_store_get_inbox"));
}
-CamelFolder *camel_store_get_trash_remote(CamelStoreRemote * store, CamelException *ex)
+CamelObjectRemote *camel_store_get_trash_remote(CamelStoreRemote * store, CamelException *ex)
{
return (camel_store_get_specific_folder_remote
(store, "camel_store_get_trash"));
}
-CamelFolder *camel_store_get_junk_remote(CamelStoreRemote * store, CamelException *ex)
+CamelObjectRemote *camel_store_get_junk_remote(CamelStoreRemote * store, CamelException *ex)
{
return (camel_store_get_specific_folder_remote
(store, "camel_store_get_junk"));
@@ -439,7 +458,7 @@
&error, "ssu=>is", store->object_id, top ? top : "", flags, &ptr, &err);
info = (gpointer)ptr;
-
+
return info;
}
Modified: branches/mail-dbus-remoting/mail/camel-store-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-store-remote.h (original)
+++ branches/mail-dbus-remoting/mail/camel-store-remote.h Fri Aug 29 03:46:49 2008
@@ -7,7 +7,7 @@
#define CAMEL_STORE_REMOTE_H
#include <camel/camel.h>
-
+#include "camel-object-remote.h"
typedef struct {
char *object_id;
} CamelFolderRemote;
@@ -16,13 +16,13 @@
char *object_id;
} CamelStoreRemote;
-CamelFolder *camel_store_get_folder_remote(CamelStoreRemote * store,
+CamelObjectRemote *camel_store_get_folder_remote(CamelStoreRemote * store,
const char *folder_name,
guint32 flags,
CamelException *ex);
-CamelFolder *camel_store_get_inbox_remote(CamelStoreRemote * store, CamelException *ex);
-CamelFolder *camel_store_get_trash_remote(CamelStoreRemote * store, CamelException *ex);
-CamelFolder *camel_store_get_junk_remote(CamelStoreRemote * store, CamelException *ex);
+CamelObjectRemote *camel_store_get_inbox_remote(CamelStoreRemote * store, CamelException *ex);
+CamelObjectRemote *camel_store_get_trash_remote(CamelStoreRemote * store, CamelException *ex);
+CamelObjectRemote *camel_store_get_junk_remote(CamelStoreRemote * store, CamelException *ex);
void camel_store_delete_folder_remote(CamelStoreRemote * store,
const char *folder_name, CamelException *ex);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]