diff options
author | Ali Abdallah <aliovx@gmail.com> | 2017-05-11 11:06:12 +0200 |
---|---|---|
committer | Ali Abdallah <aliovx@gmail.com> | 2017-05-11 11:06:12 +0200 |
commit | d02adb17983155bfbe278228be3685d7f62ba1d0 (patch) | |
tree | ad9a9cd8a4f96a1ace793e3a0c90d307c1ba9ea4 /tumblerd/tumbler-utils.h | |
parent | 87b985eb6ac8960173e25a82adb626584d70bae4 (diff) | |
parent | 87ec6303a672bc66c538ff9df51f596fd9106d3e (diff) | |
download | tumbler-d02adb17983155bfbe278228be3685d7f62ba1d0.tar.gz |
Merge branch 'gdbus-port'tumbler-0.1.90
Diffstat (limited to 'tumblerd/tumbler-utils.h')
-rw-r--r-- | tumblerd/tumbler-utils.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/tumblerd/tumbler-utils.h b/tumblerd/tumbler-utils.h index 6d02d9d..584e845 100644 --- a/tumblerd/tumbler-utils.h +++ b/tumblerd/tumbler-utils.h @@ -21,26 +21,40 @@ #ifndef __TUMBLER_UTILS_H__ #define __TUMBLER_UTILS_H__ -#include <dbus/dbus.h> -#include <dbus/dbus-glib.h> +#include <gio/gio.h> G_BEGIN_DECLS -#define dbus_async_return_if_fail(expr, context) \ +#define g_dbus_async_return_if_fail(expr, invocation) \ G_STMT_START{ \ if (G_UNLIKELY (!(expr))) \ { \ GError *dbus_async_return_if_fail_error = NULL; \ \ - g_set_error (&dbus_async_return_if_fail_error, DBUS_GERROR, DBUS_GERROR_FAILED, \ + g_set_error (&dbus_async_return_if_fail_error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, \ "Assertion \"%s\" failed", #expr); \ - dbus_g_method_return_error (context, dbus_async_return_if_fail_error); \ + g_dbus_method_invocation_return_gerror (invocation, dbus_async_return_if_fail_error);\ g_clear_error (&dbus_async_return_if_fail_error); \ \ return; \ } \ }G_STMT_END +#define g_dbus_async_return_val_if_fail(expr, invocation,val) \ + G_STMT_START{ \ + if (G_UNLIKELY (!(expr))) \ + { \ + GError *dbus_async_return_if_fail_error = NULL; \ + \ + g_set_error (&dbus_async_return_if_fail_error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, \ + "Assertion \"%s\" failed", #expr); \ + g_dbus_method_invocation_return_gerror (invocation, dbus_async_return_if_fail_error);\ + g_clear_error (&dbus_async_return_if_fail_error); \ + \ + return (val); \ + } \ + }G_STMT_END + #if GLIB_CHECK_VERSION (2, 32, 0) #define TUMBLER_MUTEX(mtx) GMutex mtx #define tumbler_mutex_free(mtx) g_mutex_clear (&(mtx)) |