summaryrefslogtreecommitdiff
path: root/legacy/edbus
diff options
context:
space:
mode:
authorJosé Roberto de Souza <zehortigoza@profusion.mobi>2012-09-26 18:16:34 +0000
committerLucas De Marchi <lucas.demarchi@profusion.mobi>2012-09-26 18:16:34 +0000
commit06439a3ee81faddc6c7eb471d14376033b515531 (patch)
tree16c933f85af8921cc4dd5175013e55e474d3f72a /legacy/edbus
parent4f1ea191d6347bcae52b42f9ee874056e6c78c87 (diff)
edbus: Add edbus_signal_handler_match_extra_vset
Patch by: José Roberto de Souza <zehortigoza@profusion.mobi> SVN revision: 77095
Diffstat (limited to 'legacy/edbus')
-rw-r--r--legacy/edbus/src/lib/edbus_signal_handler.c18
-rw-r--r--legacy/edbus/src/lib/edbus_signal_handler.h17
2 files changed, 30 insertions, 5 deletions
diff --git a/legacy/edbus/src/lib/edbus_signal_handler.c b/legacy/edbus/src/lib/edbus_signal_handler.c
index e82aba0204..4ebe303fff 100644
--- a/legacy/edbus/src/lib/edbus_signal_handler.c
+++ b/legacy/edbus/src/lib/edbus_signal_handler.c
@@ -76,9 +76,8 @@ _sort_arg(const void *d1, const void *d2)
76} 76}
77 77
78EAPI Eina_Bool 78EAPI Eina_Bool
79edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...) 79edbus_signal_handler_match_extra_vset(EDBus_Signal_Handler *sh, va_list ap)
80{ 80{
81 va_list ap;
82 const char *key = NULL, *read; 81 const char *key = NULL, *read;
83 DBusError err; 82 DBusError err;
84 83
@@ -89,7 +88,6 @@ edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
89 eina_strbuf_string_get(sh->match), &err); 88 eina_strbuf_string_get(sh->match), &err);
90 EINA_SAFETY_ON_TRUE_RETURN_VAL(dbus_error_is_set(&err), EINA_FALSE); 89 EINA_SAFETY_ON_TRUE_RETURN_VAL(dbus_error_is_set(&err), EINA_FALSE);
91 90
92 va_start(ap, sh);
93 for (read = va_arg(ap, char *); read; read = va_arg(ap, char *)) 91 for (read = va_arg(ap, char *); read; read = va_arg(ap, char *))
94 { 92 {
95 Signal_Argument *arg; 93 Signal_Argument *arg;
@@ -119,7 +117,6 @@ edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
119 } 117 }
120 key = NULL; 118 key = NULL;
121 } 119 }
122 va_end(ap);
123 120
124 dbus_error_init(&err); 121 dbus_error_init(&err);
125 dbus_bus_add_match(sh->conn->dbus_conn, 122 dbus_bus_add_match(sh->conn->dbus_conn,
@@ -131,7 +128,6 @@ edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
131 return EINA_FALSE; 128 return EINA_FALSE;
132 129
133error: 130error:
134 va_end(ap);
135 dbus_error_init(&err); 131 dbus_error_init(&err);
136 dbus_bus_add_match(sh->conn->dbus_conn, 132 dbus_bus_add_match(sh->conn->dbus_conn,
137 eina_strbuf_string_get(sh->match), &err); 133 eina_strbuf_string_get(sh->match), &err);
@@ -140,6 +136,18 @@ error:
140 return EINA_FALSE; 136 return EINA_FALSE;
141} 137}
142 138
139EAPI Eina_Bool
140edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...)
141{
142 Eina_Bool ret;
143 va_list ap;
144
145 va_start(ap, sh);
146 ret = edbus_signal_handler_match_extra_vset(sh, ap);
147 va_end(ap);
148 return ret;
149}
150
143EAPI EDBus_Signal_Handler * 151EAPI EDBus_Signal_Handler *
144edbus_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) 152edbus_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)
145{ 153{
diff --git a/legacy/edbus/src/lib/edbus_signal_handler.h b/legacy/edbus/src/lib/edbus_signal_handler.h
index d2c0db28a9..8769026a34 100644
--- a/legacy/edbus/src/lib/edbus_signal_handler.h
+++ b/legacy/edbus/src/lib/edbus_signal_handler.h
@@ -51,6 +51,23 @@ EAPI void edbus_signal_handler_del(EDBus_Signal_Handler *handle
51 * http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules 51 * http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules
52 */ 52 */
53EAPI Eina_Bool edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...) EINA_ARG_NONNULL(1) EINA_SENTINEL; 53EAPI Eina_Bool edbus_signal_handler_match_extra_set(EDBus_Signal_Handler *sh, ...) EINA_ARG_NONNULL(1) EINA_SENTINEL;
54/**
55 * @brief Add extra argument in match of signal handler to obtain specifics signals.
56 *
57 * Example:
58 * edbus_signal_handler_match_extra_set(sh, "arg0", "org.bansheeproject.Banshee", "arg1", "", NULL);
59 * With this extra arguments this signal handler callback only will be called
60 * when Banshee is started.
61 *
62 * @note For now is only supported argX.
63 *
64 * @param sh signal handler
65 * @param ap va_list with the keys and values, must be ended with a NULL
66 *
67 * @note To information:
68 * http://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules
69 */
70EAPI Eina_Bool edbus_signal_handler_match_extra_vset(EDBus_Signal_Handler *sh, va_list ap);
54 71
55/** 72/**
56 * @brief Add a callback function to be called when signal handler will be freed. 73 * @brief Add a callback function to be called when signal handler will be freed.