summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gdbus/gdbus.h6
-rw-r--r--gdbus/object.c43
2 files changed, 49 insertions, 0 deletions
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index dc337954..6f3ddb79 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -179,6 +179,12 @@ DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...);
DBusMessage *g_dbus_create_reply_valist(DBusMessage *message,
int type, va_list args);
+gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message);
+gboolean g_dbus_send_reply(DBusConnection *connection,
+ DBusMessage *message, int type, ...);
+gboolean g_dbus_send_reply_valist(DBusConnection *connection,
+ DBusMessage *message, int type, va_list args);
+
typedef void (*name_cb_t)(const char *name, void *user_data);
guint name_listener_add(DBusConnection *connection, const char *name,
diff --git a/gdbus/object.c b/gdbus/object.c
index 56ff4433..dd3d8609 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -910,3 +910,46 @@ DBusMessage *g_dbus_create_reply(DBusMessage *message, int type, ...)
return reply;
}
+
+gboolean g_dbus_send_message(DBusConnection *connection, DBusMessage *message)
+{
+ dbus_bool_t result;
+
+ result = dbus_connection_send(connection, message, NULL);
+
+ dbus_message_unref(message);
+
+ return result;
+}
+
+gboolean g_dbus_send_reply_valist(DBusConnection *connection,
+ DBusMessage *message, int type, va_list args)
+{
+ DBusMessage *reply;
+
+ reply = dbus_message_new_method_return(message);
+ if (reply == NULL)
+ return FALSE;
+
+ if (dbus_message_append_args_valist(reply, type, args) == FALSE) {
+ dbus_message_unref(reply);
+ return FALSE;
+ }
+
+ return g_dbus_send_message(connection, reply);
+}
+
+gboolean g_dbus_send_reply(DBusConnection *connection,
+ DBusMessage *message, int type, ...)
+{
+ va_list args;
+ gboolean result;
+
+ va_start(args, type);
+
+ result = g_dbus_send_reply_valist(connection, message, type, args);
+
+ va_end(args);
+
+ return result;
+}