edbus: Add edbus_signal_handler_match_extra_vset
Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 77095
This commit is contained in:
parent
4f1ea191d6
commit
06439a3ee8
|
@ -76,9 +76,8 @@ _sort_arg(const void *d1, const void *d2)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
|
edbus_signal_handler_match_extra_vset(EDBus_Signal_Handler *sh, va_list ap)
|
||||||
{
|
{
|
||||||
va_list ap;
|
|
||||||
const char *key = NULL, *read;
|
const char *key = NULL, *read;
|
||||||
DBusError err;
|
DBusError err;
|
||||||
|
|
||||||
|
@ -89,7 +88,6 @@ edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
|
||||||
eina_strbuf_string_get(sh->match), &err);
|
eina_strbuf_string_get(sh->match), &err);
|
||||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(dbus_error_is_set(&err), EINA_FALSE);
|
EINA_SAFETY_ON_TRUE_RETURN_VAL(dbus_error_is_set(&err), EINA_FALSE);
|
||||||
|
|
||||||
va_start(ap, sh);
|
|
||||||
for (read = va_arg(ap, char *); read; read = va_arg(ap, char *))
|
for (read = va_arg(ap, char *); read; read = va_arg(ap, char *))
|
||||||
{
|
{
|
||||||
Signal_Argument *arg;
|
Signal_Argument *arg;
|
||||||
|
@ -119,7 +117,6 @@ edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
|
||||||
}
|
}
|
||||||
key = NULL;
|
key = NULL;
|
||||||
}
|
}
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
dbus_error_init(&err);
|
dbus_error_init(&err);
|
||||||
dbus_bus_add_match(sh->conn->dbus_conn,
|
dbus_bus_add_match(sh->conn->dbus_conn,
|
||||||
|
@ -131,7 +128,6 @@ edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
va_end(ap);
|
|
||||||
dbus_error_init(&err);
|
dbus_error_init(&err);
|
||||||
dbus_bus_add_match(sh->conn->dbus_conn,
|
dbus_bus_add_match(sh->conn->dbus_conn,
|
||||||
eina_strbuf_string_get(sh->match), &err);
|
eina_strbuf_string_get(sh->match), &err);
|
||||||
|
@ -140,6 +136,18 @@ error:
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI Eina_Bool
|
||||||
|
edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
|
||||||
|
{
|
||||||
|
Eina_Bool ret;
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, sh);
|
||||||
|
ret = edbus_signal_handler_match_extra_vset(sh, ap);
|
||||||
|
va_end(ap);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
EAPI EDBus_Signal_Handler *
|
EAPI EDBus_Signal_Handler *
|
||||||
edbus_signal_handler_add(EDBus_Connection *conn, const char *sender, const char *path, const char *interface, const char *member, EDBus_Signal_Cb cb, const void *cb_data)
|
edbus_signal_handler_add(EDBus_Connection *conn, const char *sender, const char *path, const char *interface, const char *member, EDBus_Signal_Cb cb, const void *cb_data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,23 @@ EAPI void edbus_signal_handler_del(EDBus_Signal_Handler *handle
|
||||||
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules
|
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules
|
||||||
*/
|
*/
|
||||||
EAPI Eina_Bool edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...) EINA_ARG_NONNULL(1) EINA_SENTINEL;
|
EAPI Eina_Bool edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...) EINA_ARG_NONNULL(1) EINA_SENTINEL;
|
||||||
|
/**
|
||||||
|
* @brief Add extra argument in match of signal handler to obtain specifics signals.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* edbus_signal_handler_match_extra_set(sh, "arg0", "org.bansheeproject.Banshee", "arg1", "", NULL);
|
||||||
|
* With this extra arguments this signal handler callback only will be called
|
||||||
|
* when Banshee is started.
|
||||||
|
*
|
||||||
|
* @note For now is only supported argX.
|
||||||
|
*
|
||||||
|
* @param sh signal handler
|
||||||
|
* @param ap va_list with the keys and values, must be ended with a NULL
|
||||||
|
*
|
||||||
|
* @note To information:
|
||||||
|
* http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules
|
||||||
|
*/
|
||||||
|
EAPI Eina_Bool edbus_signal_handler_match_extra_vset(EDBus_Signal_Handler *sh, va_list ap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add a callback function to be called when signal handler will be freed.
|
* @brief Add a callback function to be called when signal handler will be freed.
|
||||||
|
|
Loading…
Reference in New Issue