[glibmm] DBusConnection: Callbacks: Return DBusError exceptions to caller.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] DBusConnection: Callbacks: Return DBusError exceptions to caller.
- Date: Fri, 7 Jan 2011 17:47:32 +0000 (UTC)
commit 5b4a561aab473adf47c6b267ac4a69b310de777e
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Fri Jan 7 12:43:17 2011 -0500
DBusConnection: Callbacks: Return DBusError exceptions to caller.
* gio/src/dbusconnection.ccg: Modify the callbacks that deal with
getting/setting properties for a DBus interface to set the GError*
parameter if it is a DBus related GError. This should allow receiving
DBus exceptions if the slot throws one with respect to not being able
to successfully get/set a property.
ChangeLog | 10 ++++++++++
gio/src/dbusconnection.ccg | 13 +++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9e2050d..183ac04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-01-07 José Alburquerque <jaalburqu svn gnome org>
+ DBusConnection: Callbacks: Return DBusError exceptions to caller.
+
+ * gio/src/dbusconnection.ccg: Modify the callbacks that deal with
+ getting/setting properties for a DBus interface to set the GError*
+ parameter if it is a DBus related GError. This should allow receiving
+ DBus exceptions if the slot throws one with respect to not being able
+ to successfully get/set a property.
+
+2011-01-07 José Alburquerque <jaalburqu svn gnome org>
+
DBusConnection: Use gobj() instead of reinterpret_cast<> for *VTable.
* gio/src/dbusconnection.ccg: Use the gobj() of the
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index 20933dc..c0305b5 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -21,6 +21,7 @@
#include <giomm/dbusauthobserver.h>
#include <giomm/dbusintrospection.h>
#include <giomm/dbusmethodinvocation.h>
+#include <giomm/error.h>
#include "slot_async.h"
namespace
@@ -107,7 +108,7 @@ static void DBusInterfaceVTable_MethodCall_giomm_callback(
static GVariant* DBusInterfaceVTable_GetProperty_giomm_callback(
GDBusConnection* connection, const char* sender, const char* object_path,
- const char* interface_name, const char* property_name, GError**,
+ const char* interface_name, const char* property_name, GError** error,
void* user_data)
{
Gio::DBusInterfaceVTable* vtable =
@@ -125,6 +126,10 @@ static GVariant* DBusInterfaceVTable_GetProperty_giomm_callback(
Glib::ustring(interface_name), Glib::ustring(property_name));
return result.gobj_copy();
}
+ catch(const Gio::DBusError& ex)
+ {
+ *error = const_cast<GError*>(ex.gobj());
+ }
catch(...)
{
Glib::exception_handlers_invoke();
@@ -136,7 +141,7 @@ static GVariant* DBusInterfaceVTable_GetProperty_giomm_callback(
static gboolean DBusInterfaceVTable_SetProperty_giomm_callback(
GDBusConnection* connection, const char* sender, const char* object_path,
const char* interface_name, const char* property_name, GVariant* value,
- GError**, void* user_data)
+ GError** error, void* user_data)
{
Gio::DBusInterfaceVTable* vtable =
static_cast<Gio::DBusInterfaceVTable*>(user_data);
@@ -151,6 +156,10 @@ static gboolean DBusInterfaceVTable_SetProperty_giomm_callback(
Glib::ustring(interface_name), Glib::ustring(property_name),
Glib::VariantBase(value, true)));
}
+ catch(const Gio::DBusError& ex)
+ {
+ *error = const_cast<GError*>(ex.gobj());
+ }
catch(...)
{
Glib::exception_handlers_invoke();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]