forked from enlightenment/efl
add data pointer to method callbacks
clean up some warnings SVN revision: 26202
This commit is contained in:
parent
f32284778e
commit
eae096cce5
|
@ -46,7 +46,7 @@ extern "C" {
|
||||||
typedef struct _Ecore_DBus_Message_Field Ecore_DBus_Message_Field;
|
typedef struct _Ecore_DBus_Message_Field Ecore_DBus_Message_Field;
|
||||||
typedef struct _Ecore_DBus_Address Ecore_DBus_Address;
|
typedef struct _Ecore_DBus_Address Ecore_DBus_Address;
|
||||||
|
|
||||||
typedef void (*Ecore_DBus_Method_Call_Cb) (Ecore_DBus_Event_Method_Call *event);
|
typedef void (*Ecore_DBus_Method_Call_Cb) (void *data, Ecore_DBus_Event_Method_Call *event);
|
||||||
|
|
||||||
typedef struct _Ecore_DBus_Object Ecore_DBus_Object;
|
typedef struct _Ecore_DBus_Object Ecore_DBus_Object;
|
||||||
typedef struct _Ecore_DBus_Object_Method Ecore_DBus_Object_Method;
|
typedef struct _Ecore_DBus_Object_Method Ecore_DBus_Object_Method;
|
||||||
|
@ -66,6 +66,7 @@ extern "C" {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
Ecore_DBus_Method_Call_Cb func;
|
Ecore_DBus_Method_Call_Cb func;
|
||||||
|
void *data;
|
||||||
};
|
};
|
||||||
struct _Ecore_DBus_Object_Registry
|
struct _Ecore_DBus_Object_Registry
|
||||||
{
|
{
|
||||||
|
@ -219,6 +220,7 @@ extern "C" {
|
||||||
EAPI void ecore_dbus_message_print(Ecore_DBus_Message *msg);
|
EAPI void ecore_dbus_message_print(Ecore_DBus_Message *msg);
|
||||||
EAPI void *ecore_dbus_message_header_field_get(Ecore_DBus_Message *msg, Ecore_DBus_Message_Header_Field field);
|
EAPI void *ecore_dbus_message_header_field_get(Ecore_DBus_Message *msg, Ecore_DBus_Message_Header_Field field);
|
||||||
EAPI void *ecore_dbus_message_body_field_get(Ecore_DBus_Message *msg, unsigned int pos);
|
EAPI void *ecore_dbus_message_body_field_get(Ecore_DBus_Message *msg, unsigned int pos);
|
||||||
|
EAPI int ecore_dbus_message_serial_get(Ecore_DBus_Message *m);
|
||||||
|
|
||||||
/* methods */
|
/* methods */
|
||||||
EAPI int ecore_dbus_method_hello(Ecore_DBus_Server *svr, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data);
|
EAPI int ecore_dbus_method_hello(Ecore_DBus_Server *svr, Ecore_DBus_Method_Return_Cb method_cb, Ecore_DBus_Error_Cb, void *data);
|
||||||
|
@ -248,7 +250,7 @@ extern "C" {
|
||||||
EAPI Ecore_DBus_Object *ecore_dbus_object_add(Ecore_DBus_Server *svr, const char *path);
|
EAPI Ecore_DBus_Object *ecore_dbus_object_add(Ecore_DBus_Server *svr, const char *path);
|
||||||
EAPI void ecore_dbus_object_free(Ecore_DBus_Object *obj);
|
EAPI void ecore_dbus_object_free(Ecore_DBus_Object *obj);
|
||||||
|
|
||||||
EAPI Ecore_DBus_Object_Method *ecore_dbus_object_method_add(Ecore_DBus_Object *obj, const char *interface, const char *method_name, Ecore_DBus_Method_Call_Cb func);
|
EAPI Ecore_DBus_Object_Method *ecore_dbus_object_method_add(Ecore_DBus_Object *obj, const char *interface, const char *method_name, Ecore_DBus_Method_Call_Cb func, void *data);
|
||||||
EAPI void ecore_dbus_object_method_remove(Ecore_DBus_Object *obj, Ecore_DBus_Object_Method *method);
|
EAPI void ecore_dbus_object_method_remove(Ecore_DBus_Object *obj, Ecore_DBus_Object_Method *method);
|
||||||
EAPI void ecore_dbus_object_method_free(Ecore_DBus_Object_Method *method);
|
EAPI void ecore_dbus_object_method_free(Ecore_DBus_Object_Method *method);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ _ecore_dbus_message_marshal_variant(Ecore_DBus_Message *msg, Ecore_DBus_Data_Typ
|
||||||
_ecore_dbus_message_append_byte(msg, type);
|
_ecore_dbus_message_append_byte(msg, type);
|
||||||
_ecore_dbus_message_append_byte(msg, '\0');
|
_ecore_dbus_message_append_byte(msg, '\0');
|
||||||
|
|
||||||
f->value = _ecore_dbus_message_marshal(msg, &type, data);
|
f->value = _ecore_dbus_message_marshal(msg, (char *)&type, data);
|
||||||
ecore_list_remove_first(msg->recurse);
|
ecore_list_remove_first(msg->recurse);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,7 @@ _ecore_dbus_event_method_call_cb(void *udata, int evtype, void *ev)
|
||||||
keys = ecore_hash_keys(event->server->objects);
|
keys = ecore_hash_keys(event->server->objects);
|
||||||
printf("Keys\n----\n");
|
printf("Keys\n----\n");
|
||||||
while ((key = ecore_list_next(keys)))
|
while ((key = ecore_list_next(keys)))
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
printf(" %s => %d\n", key, (int)ecore_hash_get(event->server->objects, key));
|
printf(" %s => %d\n", key, (int)ecore_hash_get(event->server->objects, key));
|
||||||
}
|
|
||||||
|
|
||||||
ecore_list_destroy(keys);
|
ecore_list_destroy(keys);
|
||||||
|
|
||||||
|
@ -88,7 +85,7 @@ _ecore_dbus_event_method_call_cb(void *udata, int evtype, void *ev)
|
||||||
if (method)
|
if (method)
|
||||||
{
|
{
|
||||||
printf("[ecore_dbus] method found %s\n", event->header.member);
|
printf("[ecore_dbus] method found %s\n", event->header.member);
|
||||||
method->func(event);
|
method->func(method->data, event);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +138,7 @@ _ecore_dbus_object_free(Ecore_DBus_Object *obj)
|
||||||
/* object methods */
|
/* object methods */
|
||||||
|
|
||||||
EAPI Ecore_DBus_Object_Method *
|
EAPI Ecore_DBus_Object_Method *
|
||||||
ecore_dbus_object_method_add(Ecore_DBus_Object *obj, const char *interface, const char *method_name, Ecore_DBus_Method_Call_Cb func)
|
ecore_dbus_object_method_add(Ecore_DBus_Object *obj, const char *interface, const char *method_name, Ecore_DBus_Method_Call_Cb func, void *data)
|
||||||
{
|
{
|
||||||
Ecore_DBus_Object_Method *m;
|
Ecore_DBus_Object_Method *m;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
@ -154,6 +151,7 @@ ecore_dbus_object_method_add(Ecore_DBus_Object *obj, const char *interface, cons
|
||||||
m->name = strdup(method_name);
|
m->name = strdup(method_name);
|
||||||
|
|
||||||
m->func = func;
|
m->func = func;
|
||||||
|
m->data = data;
|
||||||
|
|
||||||
ecore_list_append(obj->methods, m);
|
ecore_list_append(obj->methods, m);
|
||||||
|
|
||||||
|
|
|
@ -263,4 +263,5 @@ _ecore_dbus_complete_type_length_get(const char *signature)
|
||||||
}
|
}
|
||||||
signature++;
|
signature++;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue