X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbind%2Fdbind.c;h=e186e9878a8025358c5c293f78a24bc2bd678d79;hb=576a27a3fabbd3a8c1421d4322cafd47f02c1ada;hp=f34bcc47234f928d6fea67c79d3b677c7a29a627;hpb=b37f0b74994912dea13f33d63d3f1395554944b2;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/dbind/dbind.c b/dbind/dbind.c index f34bcc4..e186e98 100644 --- a/dbind/dbind.c +++ b/dbind/dbind.c @@ -40,41 +40,21 @@ send_and_allow_reentry (DBusConnection *bus, DBusMessage *message, DBusError *er return reply; } -/** - * dbind_method_call_reentrant: - * - * @cnx: A D-Bus Connection used to make the method call. - * @bus_name: The D-Bus bus name of the program where the method call should - * be made. - * @path: The D-Bus object path that should handle the method. - * @interface: The D-Bus interface used to scope the method name. - * @method: Method to be invoked. - * @opt_error: D-Bus error. - * @arg_types: Variable length arguments interleaving D-Bus argument types - * and pointers to argument data. - * - * Makes a D-Bus method call using the supplied location data, method name and - * argument data.This function is re-entrant. It continuously reads from the D-Bus - * bus and dispatches messages until a reply has been recieved. - **/ dbus_bool_t -dbind_method_call_reentrant (DBusConnection *cnx, - const char *bus_name, - const char *path, - const char *interface, - const char *method, - DBusError *opt_error, - const char *arg_types, - ...) +dbind_method_call_reentrant_va (DBusConnection *cnx, + const char *bus_name, + const char *path, + const char *interface, + const char *method, + DBusError *opt_error, + const char *arg_types, + va_list args) { dbus_bool_t success = FALSE; DBusMessage *msg = NULL, *reply = NULL; DBusMessageIter iter; DBusError *err, real_err; - char *p; - va_list args; - - va_start (args, arg_types); + const char *p; if (opt_error) err = opt_error; @@ -87,7 +67,8 @@ dbind_method_call_reentrant (DBusConnection *cnx, if (!msg) goto out; - dbus_message_iter_init (msg, &iter); + p = arg_types; + dbus_message_iter_init_append (msg, &iter); dbind_any_marshal_va (&iter, &p, args); reply = send_and_allow_reentry (cnx, msg, err); @@ -111,8 +92,6 @@ dbind_method_call_reentrant (DBusConnection *cnx, success = TRUE; out: - va_end (args); - if (msg) dbus_message_unref (msg); @@ -125,38 +104,66 @@ out: return success; } -/*---------------------------------------------------------------------------*/ - /** - * dbind_emit_signal: + * dbind_method_call_reentrant: * * @cnx: A D-Bus Connection used to make the method call. - * @path: The D-Bus object path that this signal is emitted from. + * @bus_name: The D-Bus bus name of the program where the method call should + * be made. + * @path: The D-Bus object path that should handle the method. * @interface: The D-Bus interface used to scope the method name. - * @signal: Name of signal to emit. + * @method: Method to be invoked. * @opt_error: D-Bus error. * @arg_types: Variable length arguments interleaving D-Bus argument types * and pointers to argument data. * - * Emits a D-Bus signal using the supplied signal name and argument data. + * Makes a D-Bus method call using the supplied location data, method name and + * argument data.This function is re-entrant. It continuously reads from the D-Bus + * bus and dispatches messages until a reply has been recieved. **/ dbus_bool_t -dbind_emit_signal (DBusConnection *cnx, - const char *path, - const char *interface, - const char *signal, - DBusError *opt_error, - const char *arg_types, - ...) +dbind_method_call_reentrant (DBusConnection *cnx, + const char *bus_name, + const char *path, + const char *interface, + const char *method, + DBusError *opt_error, + const char *arg_types, + ...) { dbus_bool_t success = FALSE; - DBusMessage *msg = NULL; - DBusMessageIter iter; - DBusError *err, real_err; - char *p; va_list args; va_start (args, arg_types); + success = dbind_method_call_reentrant_va (cnx, + bus_name, + path, + interface, + method, + opt_error, + arg_types, + args); + va_end (args); + + return success; +} + +/*---------------------------------------------------------------------------*/ + +dbus_bool_t +dbind_emit_signal_va (DBusConnection *cnx, + const char *path, + const char *interface, + const char *signal, + DBusError *opt_error, + const char *arg_types, + va_list args) +{ + dbus_bool_t success = FALSE; + DBusMessage *msg = NULL; + DBusMessageIter iter; + DBusError *err, real_err; + const char *p; if (opt_error) err = opt_error; @@ -169,7 +176,8 @@ dbind_emit_signal (DBusConnection *cnx, if (!msg) goto out; - dbus_message_iter_init (msg, &iter); + p = arg_types; + dbus_message_iter_init_append (msg, &iter); dbind_any_marshal_va (&iter, &p, args); if (!dbus_connection_send (cnx, msg, NULL)) @@ -177,7 +185,6 @@ dbind_emit_signal (DBusConnection *cnx, success = TRUE; out: - va_end (args); if (msg) dbus_message_unref (msg); @@ -188,4 +195,36 @@ out: return success; } +/** + * dbind_emit_signal: + * + * @cnx: A D-Bus Connection used to make the method call. + * @path: The D-Bus object path that this signal is emitted from. + * @interface: The D-Bus interface used to scope the method name. + * @signal: Name of signal to emit. + * @opt_error: D-Bus error. + * @arg_types: Variable length arguments interleaving D-Bus argument types + * and pointers to argument data. + * + * Emits a D-Bus signal using the supplied signal name and argument data. + **/ +dbus_bool_t +dbind_emit_signal (DBusConnection *cnx, + const char *path, + const char *interface, + const char *signal, + DBusError *opt_error, + const char *arg_types, + ...) +{ + dbus_bool_t success = FALSE; + va_list args; + + va_start (args, arg_types); + success = dbind_emit_signal_va (cnx, path, interface, signal, opt_error, arg_types, args); + va_end (args); + + return success; +} + /*END------------------------------------------------------------------------*/