diff options
Diffstat (limited to 'gdbus')
-rw-r--r-- | gdbus/gdbus.h | 3 | ||||
-rw-r--r-- | gdbus/object.c | 31 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h index 66baa852..dc337954 100644 --- a/gdbus/gdbus.h +++ b/gdbus/gdbus.h @@ -175,6 +175,9 @@ DBusMessage *g_dbus_create_error_valist(DBusMessage *message, const char *name, const char *format, va_list args); DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name, const char *format, ...); +DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...); +DBusMessage *g_dbus_create_reply_valist(DBusMessage *message, + int type, va_list args); typedef void (*name_cb_t)(const char *name, void *user_data); diff --git a/gdbus/object.c b/gdbus/object.c index 869482a4..56ff4433 100644 --- a/gdbus/object.c +++ b/gdbus/object.c @@ -879,3 +879,34 @@ DBusMessage *g_dbus_create_error(DBusMessage *message, const char *name, return reply; } + +DBusMessage *g_dbus_create_reply_valist(DBusMessage *message, + int type, va_list args) +{ + DBusMessage *reply; + + reply = dbus_message_new_method_return(message); + if (reply == NULL) + return NULL; + + if (dbus_message_append_args_valist(reply, type, args) == FALSE) { + dbus_message_unref(reply); + return NULL; + } + + return reply; +} + +DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...) +{ + va_list args; + DBusMessage *reply; + + va_start(args, type); + + reply = g_dbus_create_reply_valist(message, type, args); + + va_end(args); + + return reply; +} |