evolution r36192 - branches/mail-dbus-remoting/mail
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36192 - branches/mail-dbus-remoting/mail
- Date: Fri, 29 Aug 2008 07:58:33 +0000 (UTC)
Author: sragavan
Date: Fri Aug 29 07:58:33 2008
New Revision: 36192
URL: http://svn.gnome.org/viewvc/evolution?rev=36192&view=rev
Log:
Implement unhook event.
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 07:58:33 2008
@@ -74,7 +74,26 @@
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")) {
+ } else if (strcmp(method, "camel_object_unhook_event") == 0) {
+ char *signal, *data, *object_hash;
+ unsigned int ret_id;
+ int ptr;
+
+ dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &object_hash,
+ DBUS_TYPE_STRING, &signal,
+ DBUS_TYPE_INT32, &ptr,
+ DBUS_TYPE_INVALID);
+ data = g_strdup_printf ("%s:%s:%d", object_hash, signal, ptr);
+ 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;
+
+ camel_object_unhook_event (object, signal, (CamelObjectEventHookFunc)object_signal_cb, data);
+ } else if(strcmp (method, "camel_object_meta_set") == 0) {
char *name, *value, *object_hash;
gboolean ret;
@@ -93,7 +112,7 @@
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")) {
+ } else if(strcmp (method, "camel_object_state_write") == 0) {
char *object_hash;
int ret;
@@ -111,7 +130,7 @@
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")) {
+ } else if(strcmp (method, "camel_object_meta_get") == 0) {
char *name, *value, *object_hash;
gboolean ret;
@@ -127,6 +146,8 @@
object = session;
value = camel_object_meta_get (object, name);
+ if (!value)
+ value = "";
dbus_message_append_args (return_val, DBUS_TYPE_STRING, &value, DBUS_TYPE_INVALID);
added = TRUE;
} else /* FIXME: Free memory and return */
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 07:58:33 2008
@@ -110,6 +110,55 @@
return hook->remote_id;
}
+void
+camel_object_remote_unhook_event (CamelObjectRemote *object, char *signal, CamelObjectEventHookFunc func, gpointer data)
+{
+ CamelHookRemote *hook;
+ gboolean ret;
+ DBusError error;
+ char *hash;
+ GList *tmp, *prev;
+
+ if (object == NULL) {
+ object = rsession;
+ }
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ obj_path[object->type],
+ obj_if[object->type],
+ "camel_object_unhook_event",
+ &error,
+ "ssi", object->object_id, signal, data); /* Just string of base dir */
+
+ if (!ret) {
+ g_warning ("Error: Unhooking : %s\n", error.message);
+ return;
+ }
+
+ /* We purposefully append */
+ tmp = object->hooks;
+ prev = NULL;
+ while (tmp) {
+ CamelHookRemote *hook = tmp->data;
+ if (hook->func == func && data == hook->data && strcmp(hook->signal, signal) == 0) {
+ /* Delete it */
+ if (prev)
+ prev = tmp->next;
+ else
+ object->hooks = tmp->next;
+ g_free (hook);
+ break;
+ }
+ prev = tmp;
+ tmp = tmp->next;
+ }
+
+ return;
+}
+
gboolean
camel_object_remote_meta_set (CamelObjectRemote *object, char *name, char *value)
{
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 07:58:33 2008
@@ -48,6 +48,7 @@
unsigned int
camel_object_remote_hook_event (CamelObjectRemote *object, char *signal, CamelObjectEventHookFunc func, gpointer data);
+void camel_object_remote_unhook_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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]