evolution r36186 - branches/mail-dbus-remoting/mail
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36186 - branches/mail-dbus-remoting/mail
- Date: Fri, 29 Aug 2008 06:36:22 +0000 (UTC)
Author: sragavan
Date: Fri Aug 29 06:36:22 2008
New Revision: 36186
URL: http://svn.gnome.org/viewvc/evolution?rev=36186&view=rev
Log:
Implement camel object meta stuff.
Modified:
branches/mail-dbus-remoting/mail/camel-object-remote-impl.c
branches/mail-dbus-remoting/mail/camel-object-remote.c
branches/mail-dbus-remoting/mail/camel-object-remote.h
Modified: branches/mail-dbus-remoting/mail/camel-object-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-object-remote-impl.c (original)
+++ branches/mail-dbus-remoting/mail/camel-object-remote-impl.c Fri Aug 29 06:36:22 2008
@@ -74,6 +74,61 @@
ret_id = camel_object_hook_event (object, signal, (CamelObjectEventHookFunc)object_signal_cb, data);
dbus_message_append_args (return_val, DBUS_TYPE_UINT32, &ret_id, DBUS_TYPE_INVALID);
added = TRUE;
+ } else if(strcmp (method, "camel_object_meta_set")) {
+ char *name, *value, *object_hash;
+ gboolean ret;
+
+ dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &object_hash,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_STRING, &value,
+ DBUS_TYPE_INVALID);
+ if (type == CAMEL_ROT_STORE)
+ object = g_hash_table_lookup (store_hash, object_hash);
+ else if (type == CAMEL_ROT_FOLDER)
+ object = g_hash_table_lookup (folder_hash, object_hash);
+ else
+ object = session;
+
+ ret = camel_object_meta_set (object, name, value);
+ dbus_message_append_args (return_val, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+ added = TRUE;
+ } else if(strcmp (method, "camel_object_state_write")) {
+ char *object_hash;
+ int ret;
+
+ dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &object_hash,
+ DBUS_TYPE_INVALID);
+
+ if (type == CAMEL_ROT_STORE)
+ object = g_hash_table_lookup (store_hash, object_hash);
+ else if (type == CAMEL_ROT_FOLDER)
+ object = g_hash_table_lookup (folder_hash, object_hash);
+ else
+ object = session;
+
+ ret = camel_object_state_write (object);
+ dbus_message_append_args (return_val, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID);
+ added = TRUE;
+ } else if(strcmp (method, "camel_object_meta_get")) {
+ char *name, *value, *object_hash;
+ gboolean ret;
+
+ dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &object_hash,
+ DBUS_TYPE_STRING, &name,
+ DBUS_TYPE_INVALID);
+ if (type == CAMEL_ROT_STORE)
+ object = g_hash_table_lookup (store_hash, object_hash);
+ else if (type == CAMEL_ROT_FOLDER)
+ object = g_hash_table_lookup (folder_hash, object_hash);
+ else
+ object = session;
+
+ value = camel_object_meta_get (object, name);
+ dbus_message_append_args (return_val, DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID);
+ added = TRUE;
} else /* FIXME: Free memory and return */
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
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 Fri Aug 29 06:36:22 2008
@@ -110,6 +110,83 @@
return hook->remote_id;
}
+gboolean
+camel_object_remote_meta_set (CamelObjectRemote *object, char *name, char *value)
+{
+ gboolean ret, ret_val;
+ DBusError error;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to the camel object */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ obj_path[object->type],
+ obj_if[object->type],
+ "camel_object_meta_set",
+ &error,
+ "sss=>i", object->object_id, name, value, &ret_val);
+
+ if (!ret) {
+ g_warning ("Error: camel_object_remote_meta_set : %s\n", error.message);
+ return FALSE;
+ }
+
+
+ return ret_val;
+}
+
+int
+camel_object_remote_state_write (CamelObjectRemote *object)
+{
+ gboolean ret;
+ int ret_val;
+ DBusError error;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to the camel object */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ obj_path[object->type],
+ obj_if[object->type],
+ "camel_object_state_write",
+ &error,
+ "s=>i", object->object_id, &ret_val);
+
+ if (!ret) {
+ g_warning ("Error: camel_object_remote_state_write : %s\n", error.message);
+ return -1;
+ }
+
+
+ return ret_val;
+}
+
+char *
+camel_object_remote_meta_get (CamelObjectRemote *object, char *name)
+{
+ gboolean ret;
+ DBusError error;
+ char *value;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to the camel object */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ obj_path[object->type],
+ obj_if[object->type],
+ "camel_object_meta_get",
+ &error,
+ "ss=>s", object->object_id, name, &value);
+
+ if (!ret) {
+ g_warning ("Error: camel_object_remote_meta_get : %s\n", error.message);
+ return NULL;
+ }
+
+
+ return value;
+}
+
static DBusHandlerResult
dbus_listener_object_handler (DBusConnection *connection,
DBusMessage *message,
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 Fri Aug 29 06:36:22 2008
@@ -51,5 +51,7 @@
CamelObjectRemote * camel_object_remote_from_camel_store (CamelStore *store);
CamelStore * camel_object_remote_get_camel_store (CamelObjectRemote *obj);
-
+gboolean camel_object_remote_meta_set (CamelObjectRemote *object, char *name, char *value);
+int camel_object_remote_state_write (CamelObjectRemote *object);
+char * camel_object_remote_meta_get (CamelObjectRemote *object, char *name);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]