diff options
author | José Alburquerque <jaalburqu@svn.gnome.org> | 2010-12-09 00:13:37 -0500 |
---|---|---|
committer | José Alburquerque <jaalburqu@svn.gnome.org> | 2010-12-09 00:20:51 -0500 |
commit | d848e3c85561e3183d91934e4afc334817b0c74c (patch) | |
tree | 2917a71419be508c39a7710043c6a439499174d3 /gio/src/dbusproxy.ccg | |
parent | 7ff513acf2c45e6029a961c46c81217ffe6787e1 (diff) | |
download | glibmm-d848e3c85561e3183d91934e4afc334817b0c74c.tar.gz |
DBusProxy: Add a non-cancellable call_sync() method.
* gio/src/dbusproxy.{ccg,hg}: Add a non-cancellable call_sync()
method. Reorder the paramters so that the "timeout_msec" parameter in
methods that have it can have a default of '-1' which means a default
timeout.
Diffstat (limited to 'gio/src/dbusproxy.ccg')
-rw-r--r-- | gio/src/dbusproxy.ccg | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg index c90140f9..e597e0c2 100644 --- a/gio/src/dbusproxy.ccg +++ b/gio/src/dbusproxy.ccg @@ -295,11 +295,12 @@ void DBusProxy::get_cached_property(Glib::VariantBase& property, } void DBusProxy::call(const Glib::ustring& method_name, - int timeout_msec, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantBase& parameters, - DBusCallFlags flags) + int timeout_msec, + DBusCallFlags flags +) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -313,10 +314,11 @@ void DBusProxy::call(const Glib::ustring& method_name, } void DBusProxy::call(const Glib::ustring& method_name, - int timeout_msec, const SlotAsyncReady& slot, const Glib::VariantBase& parameters, - DBusCallFlags flags) + int timeout_msec, + DBusCallFlags flags +) { // Create a copy of the slot. // A pointer to it will be passed through the callback's data parameter @@ -343,9 +345,12 @@ void DBusProxy::call_finish(Glib::VariantBase& ret, const Glib::RefPtr<AsyncResu } void DBusProxy::call_sync(Glib::VariantBase& result, - const Glib::ustring& method_name, int timeout_msec, DBusCallFlags flags, + const Glib::ustring& method_name, + const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantBase& parameters, - const Glib::RefPtr<Cancellable>& cancellable) + int timeout_msec, + DBusCallFlags flags +) { GError *g_error = 0; @@ -361,4 +366,24 @@ void DBusProxy::call_sync(Glib::VariantBase& result, result.init(g_variant, false /* don't take extra reference */); } +void DBusProxy::call_sync(Glib::VariantBase& result, + const Glib::ustring& method_name, + const Glib::VariantBase& parameters, + int timeout_msec, + DBusCallFlags flags +) +{ + GError *g_error = 0; + + GVariant* const g_variant = + g_dbus_proxy_call_sync(gobj(), method_name.c_str(), + const_cast<GVariant*>(parameters.gobj()), + static_cast<GDBusCallFlags>(flags), timeout_msec, 0, &g_error); + + if(g_error) + ::Glib::Error::throw_exception(g_error); + + result.init(g_variant, false /* don't take extra reference */); +} + } // namespace Gio |