[glibmm] giomm: DBusConnection: Wrap async constructors and create methods.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] giomm: DBusConnection: Wrap async constructors and create methods.
- Date: Mon, 13 Sep 2010 18:56:02 +0000 (UTC)
commit 4703e495b0c2e03cdf2a7192ca8a2531a36ba260
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Mon Sep 13 14:55:34 2010 -0400
giomm: DBusConnection: Wrap async constructors and create methods.
* gio/src/dbusconnection.{ccg,hg}: Wrapped create(), create_finish().
Renamed the create() method accepting an address instead of an
IOStream to create_for_address(). Wrapped
create_for_address_finish(). Wrapped pertinent constructors. Wrapped
start_message_processing().
* gio/src/dbusproxy.{ccg,hg}: Renamed create() accepting a BusType
parameter to create_for_bus(). Wrapped create_for_bus_finish().
ChangeLog | 12 ++++++++
gio/src/dbusconnection.ccg | 66 ++++++++++++++++++++++++++++++++++++++++++-
gio/src/dbusconnection.hg | 47 ++++++++++++++++++++++++++++++-
gio/src/dbusproxy.ccg | 4 +-
gio/src/dbusproxy.hg | 13 ++++----
5 files changed, 130 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5fb92b4..8968e0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2010-09-13 José Alburquerque <jaalburqu svn gnome org>
+ giomm: DBusConnection: Wrap async constructors and create methods.
+
+ * gio/src/dbusconnection.{ccg,hg}: Wrapped create(), create_finish().
+ Renamed the create() method accepting an address instead of an
+ IOStream to create_for_address(). Wrapped
+ create_for_address_finish(). Wrapped pertinent constructors. Wrapped
+ start_message_processing().
+ * gio/src/dbusproxy.{ccg,hg}: Renamed create() accepting a BusType
+ parameter to create_for_bus(). Wrapped create_for_bus_finish().
+
+2010-09-13 José Alburquerque <jaalburqu svn gnome org>
+
giomm: DBusServer: Corrected parameter order of constructor.
* gio/src/dbusserver.{ccg,hg}: Reordered the parameters of the
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index d50676e..b5b7eb7 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -27,6 +27,32 @@ namespace Gio
DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream,
const Glib::ustring& guid, DBusConnectionFlags flags,
const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable)
+:
+ _CONSTRUCT("stream", Glib::unwrap(stream),
+ "guid", (guid.empty() ? 0 : guid.c_str()),
+ "flags", static_cast<GDBusConnectionFlags>(flags),
+ "authentication-observer", Glib::unwrap(observer))
+{
+ init_async(slot, cancellable);
+}
+
+DBusConnection::DBusConnection(const Glib::ustring& address,
+ DBusConnectionFlags flags, const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable)
+:
+ _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()),
+ "flags", static_cast<GDBusConnectionFlags>(flags),
+ "observer", Glib::unwrap(observer))
+{
+ init_async(slot, cancellable);
+}
+
+DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream,
+ const Glib::ustring& guid, DBusConnectionFlags flags,
+ const Glib::RefPtr<DBusAuthObserver>& observer,
const Glib::RefPtr<Cancellable>& cancellable)
:
_CONSTRUCT("stream", Glib::unwrap(stream),
@@ -48,6 +74,33 @@ DBusConnection::DBusConnection(const Glib::ustring& address,
init(cancellable);
}
+void DBusConnection::create(const Glib::RefPtr<IOStream>& stream,
+ const Glib::ustring& guid, DBusConnectionFlags flags,
+ const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable)
+{
+ // Create the connection, taking an extra reference without returning it.
+ // The extra reference is taken so the connection is not destroyed when it
+ // goes out of scope. The finished connection will be returned in the slot
+ // by calling create_finish().
+ Glib::RefPtr<DBusConnection>(new DBusConnection(stream, guid, flags,
+ observer, cancellable))->reference();
+}
+
+void DBusConnection::create_for_address(const Glib::ustring& address,
+ DBusConnectionFlags flags, const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable)
+{
+ // Create the connection, taking an extra reference without returning it.
+ // The extra reference is taken so the connection is not destroyed when it
+ // goes out of scope. The finished connection will be returned in the slot
+ // by calling create_finish().
+ Glib::RefPtr<DBusConnection>(new DBusConnection(address, flags,
+ observer, cancellable))->reference();
+}
+
Glib::RefPtr<DBusConnection> DBusConnection::create(
const Glib::RefPtr<IOStream>& stream,
const Glib::ustring& guid, DBusConnectionFlags flags,
@@ -58,7 +111,7 @@ Glib::RefPtr<DBusConnection> DBusConnection::create(
observer, cancellable));
}
-Glib::RefPtr<DBusConnection> DBusConnection::create(
+Glib::RefPtr<DBusConnection> DBusConnection::create_for_address(
const Glib::ustring& address,
DBusConnectionFlags flags, const Glib::RefPtr<DBusAuthObserver>& observer,
const Glib::RefPtr<Cancellable>& cancellable)
@@ -67,6 +120,15 @@ Glib::RefPtr<DBusConnection> DBusConnection::create(
observer, cancellable));
}
+void DBusConnection::get(BusType bus_type, const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable)
+{
+ SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+ g_bus_get(static_cast<GBusType>(bus_type), Glib::unwrap(cancellable),
+ &SignalProxy_async_callback, slot_copy);
+}
+
void DBusConnection::close()
{
@@ -134,7 +196,7 @@ void DBusConnection::flush_sync()
::Glib::Error::throw_exception(gerror);
}
-void DBusConnection::send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, int timeout_msec,const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot)
+void DBusConnection::send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, int timeout_msec,const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
{
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
volatile guint32 out_serial;
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index a3cb794..a5edd76 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -59,6 +59,18 @@ protected:
_IMPLEMENTS_INTERFACE(Initable)
protected:
+
+ DBusConnection(const Glib::RefPtr<IOStream>& stream,
+ const Glib::ustring& guid, DBusConnectionFlags flags,
+ const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable);
+
+ DBusConnection(const Glib::ustring& address, DBusConnectionFlags flags,
+ const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable);
+
DBusConnection(const Glib::RefPtr<IOStream>& stream,
const Glib::ustring& guid, DBusConnectionFlags flags,
const Glib::RefPtr<DBusAuthObserver>& observer,
@@ -70,6 +82,34 @@ protected:
public:
+ /** TODO
+ */
+ void get(BusType bus_type, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
+ _IGNORE(g_bus_get)
+
+ /** @throw Glib::Error.
+ */
+ _WRAP_METHOD(static Glib::RefPtr<DBusConnection> get_finish(const Glib::RefPtr<AsyncResult>& res), g_bus_get_finish, errthrow)
+
+ _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new)
+ void create(const Glib::RefPtr<IOStream>& stream,
+ const Glib::ustring& guid, DBusConnectionFlags flags,
+ const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
+
+ /// @throw Glib::Error.
+ _WRAP_METHOD(static Glib::RefPtr<DBusConnection> create_finish(const Glib::RefPtr<AsyncResult>& res), g_dbus_connection_new_finish, errthrow)
+
+ _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address)
+ void create_for_address(const Glib::ustring& address,
+ DBusConnectionFlags flags, const Glib::RefPtr<DBusAuthObserver>& observer,
+ const SlotAsyncReady& slot,
+ const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
+
+ /// @throw Glib::Error.
+ _WRAP_METHOD(static Glib::RefPtr<DBusConnection> create_for_address_finish(const Glib::RefPtr<AsyncResult>& res), g_dbus_connection_new_for_address_finish, errthrow)
+
_WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_sync)
/** @throw Glib::Error.
*/
@@ -81,10 +121,12 @@ public:
_WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_sync)
/** @throw Glib::Error.
*/
- Glib::RefPtr<DBusConnection> create(const Glib::ustring& address,
+ Glib::RefPtr<DBusConnection> create_for_address(const Glib::ustring& address,
DBusConnectionFlags flags, const Glib::RefPtr<DBusAuthObserver>& observer,
const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
+ _WRAP_METHOD(void start_message_processing(), g_dbus_connection_start_message_processing)
+
//TODO: Documentation.
void close();
@@ -130,8 +172,9 @@ public:
//TODO: Documentation.
_IGNORE(g_dbus_connection_send_message_with_reply)
- void send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, int timeout_msec, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+ void send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, int timeout_msec, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
+ /// @throw Glib::Error.
_WRAP_METHOD(Glib::RefPtr<DBusMessage> send_message_with_reply_finish(const Glib::RefPtr<AsyncResult>& result), g_dbus_connection_send_message_with_reply_finish, errthrow)
_WRAP_METHOD(void start_message_processing(), g_dbus_connection_start_message_processing)
diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg
index 1090ca3..2ae72ca 100644
--- a/gio/src/dbusproxy.ccg
+++ b/gio/src/dbusproxy.ccg
@@ -112,7 +112,7 @@ DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
object_path, interface_name, cancellable));
}
-void DBusProxy::create(BusType bus_type, DBusProxyFlags flags,
+void DBusProxy::create_for_bus(BusType bus_type, DBusProxyFlags flags,
const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
const Glib::ustring& object_path, const Glib::ustring& interface_name,
const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
@@ -125,7 +125,7 @@ void DBusProxy::create(BusType bus_type, DBusProxyFlags flags,
object_path, interface_name, slot, cancellable))->reference();
}
-Glib::RefPtr<DBusProxy> DBusProxy::create(BusType bus_type,
+Glib::RefPtr<DBusProxy> DBusProxy::create_for_bus(BusType bus_type,
DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& info,
const Glib::ustring& name, const Glib::ustring& object_path,
const Glib::ustring& interface_name,
diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg
index 5833074..87d2901 100644
--- a/gio/src/dbusproxy.hg
+++ b/gio/src/dbusproxy.hg
@@ -102,6 +102,10 @@ public:
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
+ /** @throw Glib::Error.
+ */
+ _WRAP_METHOD(static Glib::RefPtr<DBusProxy> create_finish(const Glib::RefPtr<AsyncResult>& result), g_dbus_proxy_new_finish, errthrow)
+
_WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_sync)
static Glib::RefPtr<DBusProxy>
create(const Glib::RefPtr<DBusConnection>& connection, DBusProxyFlags flags,
@@ -110,22 +114,19 @@ public:
const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
_WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_for_bus)
- static void create(BusType bus_type, DBusProxyFlags flags,
+ static void create_for_bus(BusType bus_type, DBusProxyFlags flags,
const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
const Glib::ustring& object_path, const Glib::ustring& interface_name,
const SlotAsyncReady& slot,
const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
- // g_dbus_proxy_new_for_bus_finish() just calls g_dbus_proxy_new_finish() so
- // it is safe to use one create_finish() method for both asynchronous
- // creates.
/** @throw Glib::Error.
*/
- _WRAP_METHOD(static Glib::RefPtr<DBusProxy> create_finish(const Glib::RefPtr<AsyncResult>& result), g_dbus_proxy_new_finish, errthrow)
+ _WRAP_METHOD(static Glib::RefPtr<DBusProxy> create_for_bus_finish(const Glib::RefPtr<AsyncResult>& result), g_dbus_proxy_new_for_bus_finish, errthrow)
_WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new__for_bus_sync)
static Glib::RefPtr<DBusProxy>
- create(BusType bus_type, DBusProxyFlags flags,
+ create_for_bus(BusType bus_type, DBusProxyFlags flags,
const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
const Glib::ustring& object_path, const Glib::ustring& interface_name,
const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]