diff options
author | Murray Cumming <murrayc@murrayc.com> | 2011-02-16 11:29:19 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2011-02-16 11:29:19 +0100 |
commit | 4e118b927f83290bae27bcae707be8e1c83f47d5 (patch) | |
tree | ec7ec4fa6c8424e19a97dc935d6f4e61ece8d882 | |
parent | ce84ddbd917364c61d50c3921c1f32fdde9f6698 (diff) | |
download | glibmm-4e118b927f83290bae27bcae707be8e1c83f47d5.tar.gz |
Move the DBus classes into a Gio::DBus namespace.
* gio/giomm.h:
* gio/src/dbus*.[hg|ccg]
* gio/src/error.hg: Rename all DBus* classes to remove the prefix, putting
them in a Gio::DBus namespace.
This required the use of the new _GMMPROC_EXTRA_NAMESPACE macro, to avoid
generating a confused wrap_init.cc.
Along the way, I removed unnecessary class predeclarations, instead including
the relevant header, because that is more convenient for users of the API.
* gio/src/dbuserror.[hg|ccg]: Renamed to dbuserrorutils.[hg|ccg] and
renamed the Error namespace to ErrorUtils, to avoid a clash with the
Gio::DBus::Error exception.
* gio/src/filelist.am:
* tools/m4/convert_gio.m4: Changed some conversions.
* examples/dbus/busserver.cc:
* examples/dbus/peer.cc:
* examples/dbus/userbus.cc: Adapted.
This is generally more organized. A prefix, instead of a namespace, looked
generally wrong to C++ coders.
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | examples/dbus/busserver.cc | 22 | ||||
-rw-r--r-- | examples/dbus/peer.cc | 32 | ||||
-rw-r--r-- | examples/dbus/userbus.cc | 8 | ||||
-rw-r--r-- | gio/giomm.h | 2 | ||||
-rw-r--r-- | gio/src/credentials.hg | 2 | ||||
-rw-r--r-- | gio/src/dbusauthobserver.ccg | 5 | ||||
-rw-r--r-- | gio/src/dbusauthobserver.hg | 13 | ||||
-rw-r--r-- | gio/src/dbusconnection.ccg | 365 | ||||
-rw-r--r-- | gio/src/dbusconnection.hg | 355 | ||||
-rw-r--r-- | gio/src/dbuserrorutils.ccg | 4 | ||||
-rw-r--r-- | gio/src/dbuserrorutils.hg | 6 | ||||
-rw-r--r-- | gio/src/dbusintrospection.hg | 67 | ||||
-rw-r--r-- | gio/src/dbusmessage.ccg | 14 | ||||
-rw-r--r-- | gio/src/dbusmessage.hg | 48 | ||||
-rw-r--r-- | gio/src/dbusmethodinvocation.ccg | 7 | ||||
-rw-r--r-- | gio/src/dbusmethodinvocation.hg | 31 | ||||
-rw-r--r-- | gio/src/dbusownname.hg | 16 | ||||
-rw-r--r-- | gio/src/dbusproxy.ccg | 141 | ||||
-rw-r--r-- | gio/src/dbusproxy.hg | 157 | ||||
-rw-r--r-- | gio/src/dbusserver.ccg | 60 | ||||
-rw-r--r-- | gio/src/dbusserver.hg | 68 | ||||
-rw-r--r-- | gio/src/dbusutils.hg | 2 | ||||
-rw-r--r-- | gio/src/dbuswatchname.ccg | 2 | ||||
-rw-r--r-- | gio/src/dbuswatchname.hg | 18 | ||||
-rw-r--r-- | gio/src/error.hg | 5 | ||||
-rw-r--r-- | gio/src/filelist.am | 4 | ||||
-rw-r--r-- | tools/m4/convert_gio.m4 | 42 |
28 files changed, 808 insertions, 712 deletions
@@ -1,5 +1,29 @@ 2011-02-16 Murray Cumming <murrayc@murrayc.com> + Move the DBus classes into a Gio::DBus namespace. + + * gio/giomm.h: + * gio/src/dbus*.[hg|ccg] + * gio/src/error.hg: Rename all DBus* classes to remove the prefix, putting + them in a Gio::DBus namespace. + This required the use of the new _GMMPROC_EXTRA_NAMESPACE macro, to avoid + generating a confused wrap_init.cc. + Along the way, I removed unnecessary class predeclarations, instead including + the relevant header, because that is more convenient for users of the API. + * gio/src/dbuserror.[hg|ccg]: Renamed to dbuserrorutils.[hg|ccg] and + renamed the Error namespace to ErrorUtils, to avoid a clash with the + Gio::DBus::Error exception. + * gio/src/filelist.am: + * tools/m4/convert_gio.m4: Changed some conversions. + * examples/dbus/busserver.cc: + * examples/dbus/peer.cc: + * examples/dbus/userbus.cc: Adapted. + + This is generally more organized. A prefix, instead of a namespace, looked + generally wrong to C++ coders. + +2011-02-16 Murray Cumming <murrayc@murrayc.com> + gmmproc: Allow some classes to be in a sub-namespace. * tools/m4/class_shared.m4: diff --git a/examples/dbus/busserver.cc b/examples/dbus/busserver.cc index cac377c7..3beeca2d 100644 --- a/examples/dbus/busserver.cc +++ b/examples/dbus/busserver.cc @@ -23,7 +23,7 @@ * allow per-client alarms, but that is left as an exercise. * * Along with the above it provides a method to get its stdout's file - * descriptor to test the Gio::DBusMessage API. + * descriptor to test the Gio::DBus::Message API. */ #include <giomm.h> @@ -33,7 +33,7 @@ namespace { -static Glib::RefPtr<Gio::DBusNodeInfo> introspection_data; +static Glib::RefPtr<Gio::DBus::NodeInfo> introspection_data; static Glib::ustring introspection_xml = "<node>" @@ -57,11 +57,11 @@ static Glib::TimeVal curr_alarm; } // anonymous namespace /* TODO: This code does not seem to be used. murrayc. -static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>& connection, +static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& sender, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, const Glib::VariantBase& parameters, - const Glib::RefPtr<Gio::DBusMethodInvocation>& invocation) + const Glib::RefPtr<Gio::DBus::MethodInvocation>& invocation) { if(method_name == "GetTime") { @@ -100,7 +100,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>& connection, if(!curr_alarm.assign_from_iso8601(time_str)) { // If setting alarm was not successful, return an error. - Gio::DBusError error(Gio::DBusError::INVALID_ARGS, + Gio::DBus::Error error(Gio::DBus::Error::INVALID_ARGS, "Alarm string is not in ISO8601 format."); invocation->return_gerror(error); } @@ -116,8 +116,8 @@ static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>& connection, { list->append(STDOUT_FILENO); - Glib::RefPtr<Gio::DBusMessage> reply = - Gio::DBusMessage::create_method_reply(invocation->get_message()); + Glib::RefPtr<Gio::DBus::Message> reply = + Gio::DBus::Message::create_method_reply(invocation->get_message()); reply->set_unix_fd_list(list); @@ -144,7 +144,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>& connection, else { // Non-existent method on the interface. - Gio::DBusError error(Gio::DBusError::UNKNOWN_METHOD, + Gio::DBus::Error error(Gio::DBus::Error::UNKNOWN_METHOD, "Method does not exist."); invocation->return_gerror(error); } @@ -152,7 +152,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>& connection, */ void on_get_property(Glib::VariantBase& property, - const Glib::RefPtr<Gio::DBusConnection>& /* connection */, + const Glib::RefPtr<Gio::DBus::Connection>& /* connection */, const Glib::ustring& /* sender */, const Glib::ustring& /* object_path */, const Glib::ustring& /* interface_name */, const Glib::ustring& property_name) { @@ -174,12 +174,12 @@ void on_get_property(Glib::VariantBase& property, } else { - throw Gio::DBusError(Gio::DBusError::FAILED, "Unknown property name."); + throw Gio::DBus::Error(Gio::DBus::Error::FAILED, "Unknown property name."); } } /** TODO: This code does not seem to be used. murrayc. -bool on_set_property(const Glib::RefPtr<Gio::DBusConnection>& connection, +bool on_set_property(const Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& sender, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& property_name, const Glib::VariantBase& value) diff --git a/examples/dbus/peer.cc b/examples/dbus/peer.cc index 1a7a1ca9..be32da3a 100644 --- a/examples/dbus/peer.cc +++ b/examples/dbus/peer.cc @@ -89,7 +89,7 @@ TCP transport on two different hosts without authentication: #include <glibmm.h> #include <iostream> -static Glib::RefPtr<Gio::DBusNodeInfo> introspection_data; +static Glib::RefPtr<Gio::DBus::NodeInfo> introspection_data; static Glib::ustring introspection_xml = "<node>" @@ -103,14 +103,14 @@ static Glib::ustring introspection_xml = // This variable is used to keep an incoming connection active until it is // closed. -static Glib::RefPtr<Gio::DBusConnection> curr_connection; +static Glib::RefPtr<Gio::DBus::Connection> curr_connection; -static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>&, +static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>&, const Glib::ustring& /* sender */, const Glib::ustring& /* object_path */, const Glib::ustring& /* interface_name */, const Glib::ustring& method_name, // Since the parameters are generally tuples, get them from the invocation. const Glib::VariantBase& /* parameters */, - const Glib::RefPtr<Gio::DBusMethodInvocation>& invocation) + const Glib::RefPtr<Gio::DBus::MethodInvocation>& invocation) { if(method_name == "HelloWorld") { @@ -140,10 +140,10 @@ static void on_method_call(const Glib::RefPtr<Gio::DBusConnection>&, } // Create the interface VTable. -static const Gio::DBusInterfaceVTable +static const Gio::DBus::InterfaceVTable interface_vtable(sigc::ptr_fun(&on_method_call)); -bool on_new_connection(const Glib::RefPtr<Gio::DBusConnection>& connection) +bool on_new_connection(const Glib::RefPtr<Gio::DBus::Connection>& connection) { Glib::RefPtr<Gio::Credentials> credentials = connection->get_peer_credentials(); @@ -158,7 +158,7 @@ bool on_new_connection(const Glib::RefPtr<Gio::DBusConnection>& connection) std::cout << "Client connected." << std::endl << "Peer credentials: " << credentials_str << std::endl << - "Negotiated capabilities: unix-fd-passing=" << (connection->get_capabilities() & Gio::DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING) << std::endl; + "Negotiated capabilities: unix-fd-passing=" << (connection->get_capabilities() & Gio::DBus::CAPABILITY_FLAGS_UNIX_FD_PASSING) << std::endl; // If there is already an active connection, do not accept this new one. // There may be a better way to decide how to keep current incoming @@ -192,16 +192,16 @@ bool on_new_connection(const Glib::RefPtr<Gio::DBusConnection>& connection) void run_as_server(Glib::ustring address, bool allow_anonymous) { Glib::ustring guid = Gio::DBus::generate_guid(); - Gio::DBusServerFlags flags = Gio::DBUS_SERVER_FLAGS_NONE; + Gio::DBus::ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE; if(allow_anonymous) - flags |= Gio::DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; + flags |= Gio::DBus::SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS; - Glib::RefPtr<Gio::DBusServer> server; + Glib::RefPtr<Gio::DBus::Server> server; try { - server = Gio::DBusServer::create_sync(address, guid, flags); + server = Gio::DBus::Server::create_sync(address, guid, flags); } catch(const Glib::Error& ex) { @@ -223,12 +223,12 @@ void run_as_server(Glib::ustring address, bool allow_anonymous) void run_as_client(Glib::ustring address) { - Glib::RefPtr<Gio::DBusConnection> connection; + Glib::RefPtr<Gio::DBus::Connection> connection; try { - connection = Gio::DBusConnection::create_for_address_sync(address, - Gio::DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT); + connection = Gio::DBus::Connection::create_for_address_sync(address, + Gio::DBus::CONNECTION_FLAGS_AUTHENTICATION_CLIENT); } catch(const Glib::Error& ex) { @@ -239,7 +239,7 @@ void run_as_client(Glib::ustring address) std::cout << "Connected. " << std::endl << "Negotiated capabilities: unix-fd-passing=" << - static_cast<bool>(connection->get_capabilities() & Gio::DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING) << "." << std::endl; + static_cast<bool>(connection->get_capabilities() & Gio::DBus::CAPABILITY_FLAGS_UNIX_FD_PASSING) << "." << std::endl; // Get the current time to send as a greeting when calling a server's method. Glib::TimeVal time; @@ -330,7 +330,7 @@ int main(int argc, char** argv) try { - introspection_data = Gio::DBusNodeInfo::create_for_xml(introspection_xml); + introspection_data = Gio::DBus::NodeInfo::create_for_xml(introspection_xml); } catch(const Glib::Error& ex) { diff --git a/examples/dbus/userbus.cc b/examples/dbus/userbus.cc index 63698540..bd6996d1 100644 --- a/examples/dbus/userbus.cc +++ b/examples/dbus/userbus.cc @@ -34,7 +34,7 @@ bool main_loop_idle() // method. void dbus_proxy_available(Glib::RefPtr<Gio::AsyncResult>& result) { - Glib::RefPtr<Gio::DBusProxy> proxy = Gio::DBusProxy::create_finish(result); + Glib::RefPtr<Gio::DBus::Proxy> proxy = Gio::DBus::Proxy::create_finish(result); if(!proxy) { @@ -82,8 +82,8 @@ int main(int, char**) loop = Glib::MainLoop::create(); // Get the user session bus connection. - Glib::RefPtr<Gio::DBusConnection> connection = - Gio::DBusConnection::get_sync(Gio::BUS_TYPE_SESSION); + Glib::RefPtr<Gio::DBus::Connection> connection = + Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SESSION); // Check for an unavailable connection. if(!connection) @@ -93,7 +93,7 @@ int main(int, char**) } // Create the proxy to the bus asynchronously. - Gio::DBusProxy::create(connection, "org.freedesktop.DBus", + Gio::DBus::Proxy::create(connection, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", sigc::ptr_fun(&dbus_proxy_available)); diff --git a/gio/giomm.h b/gio/giomm.h index bb49bf4d..12f71c3d 100644 --- a/gio/giomm.h +++ b/gio/giomm.h @@ -34,7 +34,7 @@ #include <giomm/dbusaddress.h> #include <giomm/dbusauthobserver.h> #include <giomm/dbusconnection.h> -#include <giomm/dbuserror.h> +#include <giomm/dbuserrorutils.h> #include <giomm/dbusintrospection.h> #include <giomm/dbusmessage.h> #include <giomm/dbusmethodinvocation.h> diff --git a/gio/src/credentials.hg b/gio/src/credentials.hg index 71fd962c..ee0ca975 100644 --- a/gio/src/credentials.hg +++ b/gio/src/credentials.hg @@ -27,7 +27,7 @@ namespace Gio _WRAP_ENUM(CredentialsType, GCredentialsType, NO_GTYPE) -/** Credentials - An object containing credentials. +/** An object containing credentials. * The Credentials type is a reference-counted wrapper for native credentials. * This information is typically used for identifying, authenticating and * authorizing other processes. diff --git a/gio/src/dbusauthobserver.ccg b/gio/src/dbusauthobserver.ccg index 555a34bc..7e96b87d 100644 --- a/gio/src/dbusauthobserver.ccg +++ b/gio/src/dbusauthobserver.ccg @@ -18,6 +18,11 @@ */ #include <gio/gio.h> +#include <giomm/credentials.h> + +//To help the generated code: +typedef Gio::Credentials Credentials; +typedef Gio::IOStream IOStream; namespace Gio { diff --git a/gio/src/dbusauthobserver.hg b/gio/src/dbusauthobserver.hg index 52dba4c4..7723e4de 100644 --- a/gio/src/dbusauthobserver.hg +++ b/gio/src/dbusauthobserver.hg @@ -27,19 +27,24 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { +namespace DBus +{ + +_GMMPROC_EXTRA_NAMESPACE(DBus) + //TODO: Add example from the C API docs in class docs. /** DBusAuthObserver - Object used for authenticating connections. * The DBusAuthObserver type provides a mechanism for participating in how a - * DBusServer (or a DBusConnection) authenticates remote peers. Simply + * DBusServer (or a DBus::Connection) authenticates remote peers. Simply * instantiate a DBusAuthObserver and connect to the signals you are * interested in. Note that new signals may be added in the future. * * @newin{2,28} * @ingroup DBus */ -class DBusAuthObserver : public Glib::Object +class AuthObserver : public Glib::Object { - _CLASS_GOBJECT(DBusAuthObserver, GDBusAuthObserver, G_DBUS_AUTH_OBSERVER, Glib::Object, GObject) + _CLASS_GOBJECT(AuthObserver, GDBusAuthObserver, G_DBUS_AUTH_OBSERVER, Glib::Object, GObject) protected: _CTOR_DEFAULT @@ -55,4 +60,6 @@ public: _WRAP_SIGNAL(bool authorize_authenticated_peer(const Glib::RefPtr<const IOStream>& stream, const Glib::RefPtr<const Credentials>& credentials), "authorize-authenticated-peer", no_default_handler) }; +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg index 17eb4a80..eae69e0a 100644 --- a/gio/src/dbusconnection.ccg +++ b/gio/src/dbusconnection.ccg @@ -35,8 +35,8 @@ static void DBusConnection_Signal_giomm_callback(GDBusConnection* connection, const char* interface_name, const char* signal_name, GVariant* parameters, void* user_data) { - Gio::DBusConnection::SlotSignal* the_slot = - static_cast<Gio::DBusConnection::SlotSignal*>(user_data); + Gio::DBus::Connection::SlotSignal* the_slot = + static_cast<Gio::DBus::Connection::SlotSignal*>(user_data); try { @@ -52,19 +52,19 @@ static void DBusConnection_Signal_giomm_callback(GDBusConnection* connection, static void DBusConnection_Signal_giomm_callback_destroy(void* data) { - delete static_cast<Gio::DBusConnection::SlotSignal*>(data); + delete static_cast<Gio::DBus::Connection::SlotSignal*>(data); } static GDBusMessage* DBusConnection_Message_Filter_giomm_callback( GDBusConnection* connection, GDBusMessage* message, gboolean incoming, void* user_data) { - Gio::DBusConnection::SlotMessageFilter* the_slot = - static_cast<Gio::DBusConnection::SlotMessageFilter*>(user_data); + Gio::DBus::Connection::SlotMessageFilter* the_slot = + static_cast<Gio::DBus::Connection::SlotMessageFilter*>(user_data); try { - Glib::RefPtr<Gio::DBusMessage> result = (*the_slot)( + Glib::RefPtr<Gio::DBus::Message> result = (*the_slot)( Glib::wrap(connection, true), Glib::wrap(message, true), static_cast<bool>(incoming)); return (result) ? result->gobj_copy() : 0; @@ -79,7 +79,7 @@ static GDBusMessage* DBusConnection_Message_Filter_giomm_callback( static void DBusConnection_Message_Filter_giomm_callback_destroy(void* data) { - delete static_cast<Gio::DBusConnection::SlotMessageFilter*>(data); + delete static_cast<Gio::DBus::Connection::SlotMessageFilter*>(data); } static void DBusInterfaceVTable_MethodCall_giomm_callback( @@ -87,10 +87,10 @@ static void DBusInterfaceVTable_MethodCall_giomm_callback( const char* interface_name, const char* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, void* user_data) { - Gio::DBusInterfaceVTable* vtable = - static_cast<Gio::DBusInterfaceVTable*>(user_data); + Gio::DBus::InterfaceVTable* vtable = + static_cast<Gio::DBus::InterfaceVTable*>(user_data); - Gio::DBusInterfaceVTable::SlotInterfaceMethodCall* the_slot = + Gio::DBus::InterfaceVTable::SlotInterfaceMethodCall* the_slot = vtable->get_slot_method_call(); try @@ -110,10 +110,10 @@ static GVariant* DBusInterfaceVTable_GetProperty_giomm_callback( const char* interface_name, const char* property_name, GError** error, void* user_data) { - Gio::DBusInterfaceVTable* vtable = - static_cast<Gio::DBusInterfaceVTable*>(user_data); + Gio::DBus::InterfaceVTable* vtable = + static_cast<Gio::DBus::InterfaceVTable*>(user_data); - Gio::DBusInterfaceVTable::SlotInterfaceGetProperty* the_slot = + Gio::DBus::InterfaceVTable::SlotInterfaceGetProperty* the_slot = vtable->get_slot_get_property(); try @@ -142,10 +142,10 @@ static gboolean DBusInterfaceVTable_SetProperty_giomm_callback( const char* interface_name, const char* property_name, GVariant* value, GError** error, void* user_data) { - Gio::DBusInterfaceVTable* vtable = - static_cast<Gio::DBusInterfaceVTable*>(user_data); + Gio::DBus::InterfaceVTable* vtable = + static_cast<Gio::DBus::InterfaceVTable*>(user_data); - Gio::DBusInterfaceVTable::SlotInterfaceSetProperty* the_slot = + Gio::DBus::InterfaceVTable::SlotInterfaceSetProperty* the_slot = vtable->get_slot_set_property(); try @@ -171,10 +171,10 @@ static char** DBusSubtreeVTable_Enumerate_giomm_callback( GDBusConnection* connection, const char* sender, const char* object_path, void* user_data) { - Gio::DBusSubtreeVTable* vtable = - static_cast<Gio::DBusSubtreeVTable*>(user_data); + Gio::DBus::SubtreeVTable* vtable = + static_cast<Gio::DBus::SubtreeVTable*>(user_data); - Gio::DBusSubtreeVTable::SlotSubtreeEnumerate* the_slot = + Gio::DBus::SubtreeVTable::SlotSubtreeEnumerate* the_slot = vtable->get_slot_enumerate(); try @@ -204,21 +204,21 @@ static GDBusInterfaceInfo** DBusSubtreeVTable_Introspect_giomm_callback( GDBusConnection* connection, const char* sender, const char* object_path, const char* node, void* user_data) { - Gio::DBusSubtreeVTable* vtable = - static_cast<Gio::DBusSubtreeVTable*>(user_data); + Gio::DBus::SubtreeVTable* vtable = + static_cast<Gio::DBus::SubtreeVTable*>(user_data); - Gio::DBusSubtreeVTable::SlotSubtreeIntrospect* the_slot = + Gio::DBus::SubtreeVTable::SlotSubtreeIntrospect* the_slot = vtable->get_slot_introspect(); try { - std::vector< Glib::RefPtr<Gio::DBusInterfaceInfo> > result = + std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> > result = (*the_slot)(Glib::wrap(connection, true), sender, object_path, node); // This will be freed by the caller, along with unreferencing its members. GDBusInterfaceInfo** info = g_new(GDBusInterfaceInfo*, result.size()); - for(std::vector< Glib::RefPtr<Gio::DBusInterfaceInfo> >::size_type i = 0; + for(std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> >::size_type i = 0; i < result.size(); i++) { info[i] = static_cast<GDBusInterfaceInfo*>( @@ -240,19 +240,19 @@ static const GDBusInterfaceVTable* DBusSubtreeVTable_Dispatch_giomm_callback( const char* interface_name, const char* node, void** out_user_data, void* user_data) { - Gio::DBusSubtreeVTable* vtable = - static_cast<Gio::DBusSubtreeVTable*>(user_data); + Gio::DBus::SubtreeVTable* vtable = + static_cast<Gio::DBus::SubtreeVTable*>(user_data); - Gio::DBusSubtreeVTable::SlotSubtreeDispatch* the_slot = + Gio::DBus::SubtreeVTable::SlotSubtreeDispatch* the_slot = vtable->get_slot_dispatch(); try { - const Gio::DBusInterfaceVTable* vtable = + const Gio::DBus::InterfaceVTable* vtable = (*the_slot)(Glib::wrap(connection, true), sender, object_path, interface_name, (node ? node : "")); - *out_user_data = const_cast<Gio::DBusInterfaceVTable*>(vtable); + *out_user_data = const_cast<Gio::DBus::InterfaceVTable*>(vtable); return vtable->gobj(); } @@ -271,12 +271,15 @@ static const GDBusInterfaceVTable* DBusSubtreeVTable_Dispatch_giomm_callback( namespace Gio { -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +namespace DBus +{ + +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -286,11 +289,11 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init_async(slot, cancellable); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -300,11 +303,11 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init_async(slot, cancellable); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -314,10 +317,10 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init_async(slot); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -327,11 +330,11 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init_async(slot); } -DBusConnection::DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, +Connection::Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -340,10 +343,10 @@ DBusConnection::DBusConnection(const std::string& address, init_async(slot, cancellable); } -DBusConnection::DBusConnection(const std::string& address, +Connection::Connection(const std::string& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -352,10 +355,10 @@ DBusConnection::DBusConnection(const std::string& address, init_async(slot, cancellable); } -DBusConnection::DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, +Connection::Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -364,9 +367,9 @@ DBusConnection::DBusConnection(const std::string& address, init_async(slot); } -DBusConnection::DBusConnection(const std::string& address, +Connection::Connection(const std::string& address, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -375,11 +378,11 @@ DBusConnection::DBusConnection(const std::string& address, init_async(slot); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -389,10 +392,10 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init(cancellable); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -402,10 +405,10 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init(cancellable); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags) + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -415,9 +418,9 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init(); } -DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, +Connection::Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("stream", Glib::unwrap(stream), "guid", (guid.empty() ? 0 : guid.c_str()), @@ -427,10 +430,10 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream, init(); } -DBusConnection::DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, +Connection::Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -439,9 +442,9 @@ DBusConnection::DBusConnection(const std::string& address, init(cancellable); } -DBusConnection::DBusConnection(const std::string& address, +Connection::Connection(const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -450,9 +453,9 @@ DBusConnection::DBusConnection(const std::string& address, init(cancellable); } -DBusConnection::DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags) +Connection::Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -461,8 +464,8 @@ DBusConnection::DBusConnection(const std::string& address, init(); } -DBusConnection::DBusConnection(const std::string& address, - DBusConnectionFlags flags) +Connection::Connection(const std::string& address, + ConnectionFlags flags) : _CONSTRUCT("address", (address.empty() ? 0 : address.c_str()), "flags", static_cast<GDBusConnectionFlags>(flags), @@ -472,184 +475,184 @@ DBusConnection::DBusConnection(const std::string& address, } //static -void DBusConnection::create(const Glib::RefPtr<IOStream>& stream, +void Connection::create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(stream, guid, observer, slot, cancellable, flags); + Connection(stream, guid, observer, slot, cancellable, flags); } //static -void DBusConnection::create(const Glib::RefPtr<IOStream>& stream, +void Connection::create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(stream, guid, slot, cancellable, flags); + Connection(stream, guid, slot, cancellable, flags); } //static -void DBusConnection::create(const Glib::RefPtr<IOStream>& stream, +void Connection::create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(stream, guid, observer, slot, flags); + Connection(stream, guid, observer, slot, flags); } //static -void DBusConnection::create(const Glib::RefPtr<IOStream>& stream, +void Connection::create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(stream, guid, slot, flags); + Connection(stream, guid, slot, flags); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_sync( +Glib::RefPtr<Connection> Connection::create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(stream, guid, + return Glib::RefPtr<Connection>(new Connection(stream, guid, observer, cancellable, flags)); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_sync( +Glib::RefPtr<Connection> Connection::create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(stream, guid, + return Glib::RefPtr<Connection>(new Connection(stream, guid, cancellable, flags)); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_sync( +Glib::RefPtr<Connection> Connection::create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags) + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(stream, guid, + return Glib::RefPtr<Connection>(new Connection(stream, guid, observer, flags)); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_sync( +Glib::RefPtr<Connection> Connection::create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, - DBusConnectionFlags flags) + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(stream, guid, + return Glib::RefPtr<Connection>(new Connection(stream, guid, flags)); } //static -void DBusConnection::create_for_address(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, +void Connection::create_for_address(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(address, observer, slot, cancellable, flags); + Connection(address, observer, slot, cancellable, flags); } //static -void DBusConnection::create_for_address(const std::string& address, +void Connection::create_for_address(const std::string& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(address, slot, cancellable, flags); + Connection(address, slot, cancellable, flags); } //static -void DBusConnection::create_for_address(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, +void Connection::create_for_address(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(address, observer, slot, flags); + Connection(address, observer, slot, flags); } //static -void DBusConnection::create_for_address(const std::string& address, +void Connection::create_for_address(const std::string& address, const SlotAsyncReady& slot, - DBusConnectionFlags flags) + ConnectionFlags flags) { // Note that this does not return anything, because it is async - see // create_finish(). - DBusConnection(address, slot, flags); + Connection(address, slot, flags); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_for_address_sync( +Glib::RefPtr<Connection> Connection::create_for_address_sync( const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(address, observer, + return Glib::RefPtr<Connection>(new Connection(address, observer, cancellable, flags)); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_for_address_sync( +Glib::RefPtr<Connection> Connection::create_for_address_sync( const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags) + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(address, cancellable, + return Glib::RefPtr<Connection>(new Connection(address, cancellable, flags)); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_for_address_sync( +Glib::RefPtr<Connection> Connection::create_for_address_sync( const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags) + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(address, observer, + return Glib::RefPtr<Connection>(new Connection(address, observer, flags)); } //static -Glib::RefPtr<DBusConnection> DBusConnection::create_for_address_sync( +Glib::RefPtr<Connection> Connection::create_for_address_sync( const std::string& address, - DBusConnectionFlags flags) + ConnectionFlags flags) { - return Glib::RefPtr<DBusConnection>(new DBusConnection(address, flags)); + return Glib::RefPtr<Connection>(new Connection(address, flags)); } //static -void DBusConnection::get(BusType bus_type, const SlotAsyncReady& slot, +void Connection::get(BusType bus_type, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); @@ -659,7 +662,7 @@ void DBusConnection::get(BusType bus_type, const SlotAsyncReady& slot, } //static -void DBusConnection::get(BusType bus_type, const SlotAsyncReady& slot) +void Connection::get(BusType bus_type, const SlotAsyncReady& slot) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); @@ -668,7 +671,7 @@ void DBusConnection::get(BusType bus_type, const SlotAsyncReady& slot) } //static -Glib::RefPtr<DBusConnection> DBusConnection::get_sync(BusType bus_type) +Glib::RefPtr<Connection> Connection::get_sync(BusType bus_type) { GError* gerror = 0; @@ -681,12 +684,12 @@ Glib::RefPtr<DBusConnection> DBusConnection::get_sync(BusType bus_type) return Glib::wrap(result); } -void DBusConnection::close() +void Connection::close() { g_dbus_connection_close(gobj(), 0, 0, 0); } -void DBusConnection::close(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) +void Connection::close(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); @@ -696,7 +699,7 @@ void DBusConnection::close(const SlotAsyncReady& slot, const Glib::RefPtr<Cancel slot_copy); } -void DBusConnection::close(const SlotAsyncReady& slot) +void Connection::close(const SlotAsyncReady& slot) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); @@ -706,7 +709,7 @@ void DBusConnection::close(const SlotAsyncReady& slot) slot_copy); } -void DBusConnection::close_sync() +void Connection::close_sync() { GError* gerror = 0; g_dbus_connection_close_sync(gobj(), 0, &(gerror)); @@ -714,12 +717,12 @@ void DBusConnection::close_sync() ::Glib::Error::throw_exception(gerror); } -void DBusConnection::flush() +void Connection::flush() { g_dbus_connection_flush(gobj(), 0, 0, 0); } -void DBusConnection::flush(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) +void Connection::flush(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); @@ -729,7 +732,7 @@ void DBusConnection::flush(const SlotAsyncReady& slot, const Glib::RefPtr<Cancel slot_copy); } -void DBusConnection::flush(const SlotAsyncReady& slot) +void Connection::flush(const SlotAsyncReady& slot) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); @@ -739,7 +742,7 @@ void DBusConnection::flush(const SlotAsyncReady& slot) slot_copy); } -void DBusConnection::flush_sync() +void Connection::flush_sync() { GError* gerror = 0; g_dbus_connection_flush_sync(gobj(), 0, &(gerror)); @@ -747,8 +750,8 @@ void DBusConnection::flush_sync() ::Glib::Error::throw_exception(gerror); } -bool DBusConnection::send_message(const Glib::RefPtr<DBusMessage>& message, - DBusSendMessageFlags flags) +bool Connection::send_message(const Glib::RefPtr<Message>& message, + SendMessageFlags flags) { GError* gerror = 0; @@ -762,7 +765,7 @@ bool DBusConnection::send_message(const Glib::RefPtr<DBusMessage>& message, return result; } -void DBusConnection::send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, int timeout_msec,const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) +void Connection::send_message_with_reply(const Glib::RefPtr<Message>& message, int timeout_msec,const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); volatile guint32 out_serial = 0; @@ -774,7 +777,7 @@ void DBusConnection::send_message_with_reply(const Glib::RefPtr<DBusMessage>& me message->set_serial(out_serial); } -void DBusConnection::send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, int timeout_msec,const SlotAsyncReady& slot) +void Connection::send_message_with_reply(const Glib::RefPtr<Message>& message, int timeout_msec,const SlotAsyncReady& slot) { SlotAsyncReady* slot_copy = new SlotAsyncReady(slot); volatile guint32 out_serial = 0; @@ -786,8 +789,8 @@ void DBusConnection::send_message_with_reply(const Glib::RefPtr<DBusMessage>& me message->set_serial(out_serial); } -Glib::RefPtr<DBusMessage> DBusConnection::send_message_with_reply_sync( - const Glib::RefPtr<DBusMessage>& message, +Glib::RefPtr<Message> Connection::send_message_with_reply_sync( + const Glib::RefPtr<Message>& message, const Glib::RefPtr<Cancellable>& cancellable, gint timeout_msec ) @@ -807,8 +810,8 @@ Glib::RefPtr<DBusMessage> DBusConnection::send_message_with_reply_sync( return Glib::wrap(result); } -Glib::RefPtr<DBusMessage> DBusConnection::send_message_with_reply_sync( - const Glib::RefPtr<DBusMessage>& message, +Glib::RefPtr<Message> Connection::send_message_with_reply_sync( + const Glib::RefPtr<Message>& message, gint timeout_msec ) { @@ -827,7 +830,7 @@ Glib::RefPtr<DBusMessage> DBusConnection::send_message_with_reply_sync( return Glib::wrap(result); } -void DBusConnection::call( +void Connection::call( const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, @@ -836,7 +839,7 @@ void DBusConnection::call( const Glib::RefPtr<Cancellable>& cancellable, const Glib::ustring& bus_name, int timeout_msec, - DBusCallFlags flags, + CallFlags flags, const Glib::VariantType& reply_type ) { @@ -853,7 +856,7 @@ void DBusConnection::call( } // Non-cancellable version. -void DBusConnection::call( +void Connection::call( const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& method_name, @@ -861,7 +864,7 @@ void DBusConnection::call( const SlotAsyncReady& slot, const Glib::ustring& bus_name, int timeout_msec, - DBusCallFlags flags, + CallFlags flags, const Glib::VariantType& reply_type ) { @@ -877,7 +880,7 @@ void DBusConnection::call( &SignalProxy_async_callback, slot_copy); } -void DBusConnection::call_finish( +void Connection::call_finish( Glib::VariantBase& output, const Glib::RefPtr<AsyncResult>& res ) @@ -890,7 +893,7 @@ void DBusConnection::call_finish( output.init(gvariant); // No need for extra ref. } -void DBusConnection::call_sync( +void Connection::call_sync( Glib::VariantBase& output, const Glib::ustring& object_path, const Glib::ustring& interface_name, @@ -899,7 +902,7 @@ void DBusConnection::call_sync( const Glib::RefPtr<Cancellable>& cancellable, const Glib::ustring& bus_name, int timeout_msec, - DBusCallFlags flags, + CallFlags flags, const Glib::VariantType& reply_type ) { @@ -919,7 +922,7 @@ void DBusConnection::call_sync( } // Non-cancellable version. -void DBusConnection::call_sync( +void Connection::call_sync( Glib::VariantBase& output, const Glib::ustring& object_path, const Glib::ustring& interface_name, @@ -927,7 +930,7 @@ void DBusConnection::call_sync( const Glib::VariantBase& parameters, const Glib::ustring& bus_name, int timeout_msec, - DBusCallFlags flags, + CallFlags flags, const Glib::VariantType& reply_type ) { @@ -945,7 +948,7 @@ void DBusConnection::call_sync( output.init(gvariant); // No need to take extra reference. } -void DBusConnection::emit_signal( +void Connection::emit_signal( const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::ustring& signal_name, @@ -963,14 +966,14 @@ void DBusConnection::emit_signal( ::Glib::Error::throw_exception(gerror); } -guint DBusConnection::signal_subscribe( +guint Connection::signal_subscribe( const SlotSignal& slot, const Glib::ustring& sender, const Glib::ustring& interface_name, const Glib::ustring& member, const Glib::ustring& object_path, const Glib::ustring& arg0, - DBusSignalFlags flags + SignalFlags flags ) { SlotSignal* slot_copy = new SlotSignal(slot); @@ -982,7 +985,7 @@ guint DBusConnection::signal_subscribe( &DBusConnection_Signal_giomm_callback_destroy); } -guint DBusConnection::add_filter(const SlotMessageFilter& slot) +guint Connection::add_filter(const SlotMessageFilter& slot) { SlotMessageFilter* slot_copy = new SlotMessageFilter(slot); @@ -991,15 +994,15 @@ guint DBusConnection::add_filter(const SlotMessageFilter& slot) DBusConnection_Message_Filter_giomm_callback_destroy); } -guint DBusConnection::register_object(const Glib::ustring& object_path, - const Glib::RefPtr<DBusInterfaceInfo>& interface_info, - const DBusInterfaceVTable* vtable) +guint Connection::register_object(const Glib::ustring& object_path, + const Glib::RefPtr<InterfaceInfo>& interface_info, + const InterfaceVTable* vtable) { GError* gerror = 0; const guint result = g_dbus_connection_register_object(gobj(), object_path.c_str(), Glib::unwrap(interface_info), - vtable->gobj(), const_cast<DBusInterfaceVTable*>(vtable), 0, &gerror); + vtable->gobj(), const_cast<InterfaceVTable*>(vtable), 0, &gerror); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1007,15 +1010,15 @@ guint DBusConnection::register_object(const Glib::ustring& object_path, return result; } -guint DBusConnection::register_subtree(const Glib::ustring& object_path, - const DBusSubtreeVTable* vtable, DBusSubtreeFlags flags) +guint Connection::register_subtree(const Glib::ustring& object_path, + const SubtreeVTable* vtable, SubtreeFlags flags) { GError* gerror = 0; const guint result = g_dbus_connection_register_subtree(gobj(), object_path.c_str(), vtable->gobj(), static_cast<GDBusSubtreeFlags>(flags), - const_cast<DBusSubtreeVTable*>(vtable), 0, &gerror); + const_cast<SubtreeVTable*>(vtable), 0, &gerror); if(gerror) ::Glib::Error::throw_exception(gerror); @@ -1023,7 +1026,7 @@ guint DBusConnection::register_subtree(const Glib::ustring& object_path, return result; } -DBusInterfaceVTable::DBusInterfaceVTable( +InterfaceVTable::InterfaceVTable( const SlotInterfaceMethodCall& slot_method_call, const SlotInterfaceGetProperty& slot_get_property, const SlotInterfaceSetProperty& slot_set_property @@ -1037,32 +1040,32 @@ DBusInterfaceVTable::DBusInterfaceVTable( gobject_.set_property = &DBusInterfaceVTable_SetProperty_giomm_callback; } -DBusInterfaceVTable::~DBusInterfaceVTable() +InterfaceVTable::~InterfaceVTable() { delete slot_method_call_; delete slot_get_property_; delete slot_set_property_; } -DBusInterfaceVTable::SlotInterfaceMethodCall* - DBusInterfaceVTable::get_slot_method_call() const +InterfaceVTable::SlotInterfaceMethodCall* + InterfaceVTable::get_slot_method_call() const { return slot_method_call_; } -DBusInterfaceVTable::SlotInterfaceGetProperty* - DBusInterfaceVTable::get_slot_get_property() const +InterfaceVTable::SlotInterfaceGetProperty* + InterfaceVTable::get_slot_get_property() const { return slot_get_property_; } -DBusInterfaceVTable::SlotInterfaceSetProperty* - DBusInterfaceVTable::get_slot_set_property() const +InterfaceVTable::SlotInterfaceSetProperty* + InterfaceVTable::get_slot_set_property() const { return slot_set_property_; } -DBusSubtreeVTable::DBusSubtreeVTable( +SubtreeVTable::SubtreeVTable( const SlotSubtreeEnumerate& slot_enumerate, const SlotSubtreeIntrospect& slot_introspect, const SlotSubtreeDispatch& slot_dispatch @@ -1076,29 +1079,31 @@ DBusSubtreeVTable::DBusSubtreeVTable( gobject_.dispatch = &DBusSubtreeVTable_Dispatch_giomm_callback; } -DBusSubtreeVTable::~DBusSubtreeVTable() +SubtreeVTable::~SubtreeVTable() { delete slot_enumerate_; delete slot_introspect_; delete slot_dispatch_; } -DBusSubtreeVTable::SlotSubtreeEnumerate* - DBusSubtreeVTable::get_slot_enumerate() const +SubtreeVTable::SlotSubtreeEnumerate* + SubtreeVTable::get_slot_enumerate() const { return slot_enumerate_; } -DBusSubtreeVTable::SlotSubtreeIntrospect* - DBusSubtreeVTable::get_slot_introspect() const +SubtreeVTable::SlotSubtreeIntrospect* + SubtreeVTable::get_slot_introspect() const { return slot_introspect_; } -DBusSubtreeVTable::SlotSubtreeDispatch* - DBusSubtreeVTable::get_slot_dispatch() const +SubtreeVTable::SlotSubtreeDispatch* + SubtreeVTable::get_slot_dispatch() const { return slot_dispatch_; } +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg index e6d4f72a..9a84d32b 100644 --- a/gio/src/dbusconnection.hg +++ b/gio/src/dbusconnection.hg @@ -20,6 +20,9 @@ #include <glibmm/object.h> #include <giomm/initable.h> #include <giomm/asyncinitable.h> +#include <giomm/dbusauthobserver.h> +#include <giomm/dbusmethodinvocation.h> +#include <giomm/dbusintrospection.h> #include <giomm/iostream.h> #include <giomm/asyncresult.h> #include <giomm/credentials.h> @@ -33,145 +36,147 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { +namespace DBus +{ + _WRAP_ENUM(BusType, GBusType) -_WRAP_ENUM(DBusCallFlags, GDBusCallFlags, NO_GTYPE) -_WRAP_ENUM(DBusConnectionFlags, GDBusConnectionFlags, NO_GTYPE) -_WRAP_ENUM(DBusSendMessageFlags, GDBusSendMessageFlags, NO_GTYPE) -_WRAP_ENUM(DBusSignalFlags, GDBusSignalFlags, NO_GTYPE) -_WRAP_ENUM(DBusSubtreeFlags, GDBusSubtreeFlags, NO_GTYPE) - -class DBusAuthObserver; -class DBusInterfaceInfo; -class DBusInterfaceVTable; -class DBusMethodInvocation; -class DBusSubtreeVTable; +_WRAP_ENUM(CallFlags, GDBusCallFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(ConnectionFlags, GDBusConnectionFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(SendMessageFlags, GDBusSendMessageFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(SignalFlags, GDBusSignalFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(SubtreeFlags, GDBusSubtreeFlags, s#^DBUS_##, NO_GTYPE) + +class InterfaceVTable; +class SubtreeVTable; + +_GMMPROC_EXTRA_NAMESPACE(DBus) /// @defgroup DBus D-Bus API //TODO: Add example from C API in class docs. -/** DBusConnection - D-Bus Connections. - * The DBusConnection type is used for D-Bus connections to remote peers such +/** A D-Bus Connection. + * The Connection type is used for D-Bus connections to remote peers such * as a message buses. It is a low-level API that offers a lot of flexibility. * For instance, it lets you establish a connection over any transport that * can by represented as an IOStream. * * This class is rarely used directly in D-Bus clients. If you are writing an * D-Bus client, it is often easier to use the Gio::DBus::own_name(), - * Gio::DBus::watch_name() or DBusProxy::create_for_bus() APIs. + * Gio::DBus::watch_name() or Gio::DBus::Proxy::create_for_bus() APIs. * * @newin{2,28} * @ingroup DBus */ -class DBusConnection +class Connection : public Glib::Object, public Initable, public AsyncInitable { protected: - _CLASS_GOBJECT(DBusConnection, GDBusConnection, G_DBUS_CONNECTION, Glib::Object, GObject) + _CLASS_GOBJECT(Connection, GDBusConnection, G_DBUS_CONNECTION, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Initable) _IMPLEMENTS_INTERFACE(AsyncInitable) protected: - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags); + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags); - DBusConnection(const Glib::RefPtr<IOStream>& stream, + Connection(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, + Connection(const std::string& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, + Connection(const std::string& address, const SlotAsyncReady& slot, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, + Connection(const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags); + ConnectionFlags flags); - DBusConnection(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags); + Connection(const std::string& address, + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags); - DBusConnection(const std::string& address, - DBusConnectionFlags flags); + Connection(const std::string& address, + ConnectionFlags flags); public: /** Signature for slot used in signal_subscribe(). * For example, * @code - * void on_signal(const Glib::RefPtr<DBusConnection>& connection, const + * void on_signal(const Glib::RefPtr<Connection>& connection, const * Glib::ustring& sender_name, const Glib::ustring& object_path, const * Glib::ustring& object_path, const Glib::ustring& interface_name, const * Glib::ustring& signal_name, const Glib::VariantBase& parameters);. * @endcode */ - typedef sigc::slot<void, const Glib::RefPtr<DBusConnection>&, + typedef sigc::slot<void, const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::VariantBase&> SlotSignal; /** Signature for slot used in add_filter(). * For example, * @code - * Glib::RefPtr<DBusMessage> on_message_filter(const - * Glib::RefPtr<DBusConnection> connection, const Glib::RefPtr<DBusMessage>& + * Glib::RefPtr<Message> on_message_filter(const + * Glib::RefPtr<Connection> connection, const Glib::RefPtr<Message>& * message, bool incoming);. * @endcode * @@ -181,9 +186,9 @@ public: * drop a message can simply return <tt>0</tt>. And filter function may * modify a message by copying it and return the copy. */ - typedef sigc::slot<Glib::RefPtr<DBusMessage>, - const Glib::RefPtr<DBusConnection>&, - const Glib::RefPtr<DBusMessage>&, bool> SlotMessageFilter; + typedef sigc::slot<Glib::RefPtr<Message>, + const Glib::RefPtr<Connection>&, + const Glib::RefPtr<Message>&, bool> SlotMessageFilter; /** Asynchronously connects to the message bus specified by @a bus_type. * @@ -209,128 +214,128 @@ public: _WRAP_METHOD_DOCS_ONLY( g_bus_get_finish, errthrow) /// @throw Glib::Error. - _WRAP_METHOD(static Glib::RefPtr<DBusConnection> get_finish(const Glib::RefPtr<AsyncResult>& res), g_bus_get_finish, errthrow) + _WRAP_METHOD(static Glib::RefPtr<Connection> get_finish(const Glib::RefPtr<AsyncResult>& res), g_bus_get_finish, errthrow) - _WRAP_METHOD(static Glib::RefPtr<DBusConnection> get_sync(BusType bus_type, const Glib::RefPtr<Cancellable>& cancellable), g_bus_get_sync, errthrow) + _WRAP_METHOD(static Glib::RefPtr<Connection> get_sync(BusType bus_type, const Glib::RefPtr<Cancellable>& cancellable), g_bus_get_sync, errthrow) /// A Non-cancellable version of get_sync(). - static Glib::RefPtr<DBusConnection> get_sync(BusType bus_type); + static Glib::RefPtr<Connection> get_sync(BusType bus_type); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new) static void create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new) static void create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create(). static void create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create(). static void create(const Glib::RefPtr<IOStream>& stream, const std::string& guid, const SlotAsyncReady& slot, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_finish) /// @throw Glib::Error. - _WRAP_METHOD(static Glib::RefPtr<DBusConnection> create_finish(const Glib::RefPtr<AsyncResult>& res), g_dbus_connection_new_finish, errthrow) + _WRAP_METHOD(static Glib::RefPtr<Connection> create_finish(const Glib::RefPtr<AsyncResult>& res), g_dbus_connection_new_finish, errthrow) _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address) static void create_for_address(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address) static void create_for_address(const std::string& address, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create_for_address(). static void create_for_address(const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const SlotAsyncReady& slot, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create_for_address(). static void create_for_address(const std::string& address, const SlotAsyncReady& slot, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_finish) /// @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(static Glib::RefPtr<Connection> 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. - static Glib::RefPtr<DBusConnection> create_sync( + static Glib::RefPtr<Connection> create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_sync) /// @throw Glib::Error. - static Glib::RefPtr<DBusConnection> create_sync( + static Glib::RefPtr<Connection> create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create_sync(). - static Glib::RefPtr<DBusConnection> create_sync( + static Glib::RefPtr<Connection> create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create_sync(). - static Glib::RefPtr<DBusConnection> create_sync( + static Glib::RefPtr<Connection> create_sync( const Glib::RefPtr<IOStream>& stream, const std::string& guid, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_sync) /// @throw Glib::Error. - static Glib::RefPtr<DBusConnection> create_for_address_sync( + static Glib::RefPtr<Connection> create_for_address_sync( const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_new_for_address_sync) /// @throw Glib::Error. - static Glib::RefPtr<DBusConnection> create_for_address_sync( + static Glib::RefPtr<Connection> create_for_address_sync( const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create_for_address_sync(). - static Glib::RefPtr<DBusConnection> create_for_address_sync( + static Glib::RefPtr<Connection> create_for_address_sync( const std::string& address, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + const Glib::RefPtr<AuthObserver>& observer, + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /// Non-cancellable version of create_for_address_sync(). - static Glib::RefPtr<DBusConnection> create_for_address_sync( + static Glib::RefPtr<Connection> create_for_address_sync( const std::string& address, - DBusConnectionFlags flags = Gio::DBUS_CONNECTION_FLAGS_NONE); + ConnectionFlags flags = Gio::DBus::CONNECTION_FLAGS_NONE); /** Closes the connection. Note that this never causes the process to exit * (this might only happen if the other end of a shared message bus @@ -498,17 +503,17 @@ public: //TODO: In the C API, out_serial is volatile, but gmmproc can't parse that. #m4 _CONVERSION(`guint32&',`volatile guint32*',`&($3)') - _WRAP_METHOD(bool send_message(const Glib::RefPtr<DBusMessage>& message, DBusSendMessageFlags flags, guint32& out_serial), g_dbus_connection_send_message, errthrow) + _WRAP_METHOD(bool send_message(const Glib::RefPtr<Message>& message, SendMessageFlags flags, guint32& out_serial), g_dbus_connection_send_message, errthrow) /// A send_message() without an "out_serial" parameter. - bool send_message(const Glib::RefPtr<DBusMessage>& message, - DBusSendMessageFlags flags = Gio::DBUS_SEND_MESSAGE_FLAGS_NONE); + bool send_message(const Glib::RefPtr<Message>& message, + SendMessageFlags flags = Gio::DBus::SEND_MESSAGE_FLAGS_NONE); /** Asynchronously sends message to the peer represented by the connection. * - * Unless flags contain the Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL + * Unless flags contain the Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL * flag, the serial number will be assigned by the connection and set on - * message via Gio::DBusMessage::set_serial(). + * message via Gio::DBus::Message::set_serial(). * * If the connection is closed then the operation will fail with * Gio::IO_ERROR_CLOSED. If @a cancellable is canceled, the operation will @@ -522,7 +527,7 @@ public: * send_message_with_reply_sync() for the synchronous version. * * Note that message must be unlocked, unless flags contain the - * Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. + * Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. * * See the C API docs for examples. * @@ -534,7 +539,7 @@ public: * * @newin{2,28} */ - void send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, + void send_message_with_reply(const Glib::RefPtr<Message>& message, int timeout_msec, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable); @@ -542,22 +547,22 @@ public: /** Non-cancellable version of send_message_with_reply(). */ - void send_message_with_reply(const Glib::RefPtr<DBusMessage>& message, + void send_message_with_reply(const Glib::RefPtr<Message>& message, int timeout_msec, const SlotAsyncReady& slot); _WRAP_METHOD_DOCS_ONLY(g_dbus_connection_send_message_with_reply_finish) /// @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(Glib::RefPtr<Message> send_message_with_reply_finish(const Glib::RefPtr<AsyncResult>& result), g_dbus_connection_send_message_with_reply_finish, errthrow) /** Synchronously sends @a message to the peer represented by the connection * and blocks the calling thread until a reply is received or the timeout is * reached. See send_message_with_reply() for the asynchronous version of * this method. * - * Unless flags contain the Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL + * Unless flags contain the Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL * flag, the serial number will be assigned by the connection and set on - * message via Gio::DBusMessage::set_serial(). + * message via Gio::DBus::Message::set_serial(). * * If the connection is closed then the operation will fail with * Gio::IO_ERROR_CLOSED. If @a cancellable is canceled, the operation will @@ -566,13 +571,13 @@ public: * * Note that a Glib::Error is thrown if a local in-process error occured. * That is to say that the returned DBusMessage object may be of type - * G_DBUS_MESSAGE_TYPE_ERROR. Use Gio::DBusMessage::to_exception() to + * G_DBUS_MESSAGE_TYPE_ERROR. Use Gio::DBus::Message::to_exception() to * transcode this to a Glib::Error. * * See the C API docs for examples. * * Note that message must be unlocked, unless flags contain the - * Gio::DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. + * Gio::DBus::SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. * * @param message A DBusMessage. * @param cancellable A Cancellable. @@ -583,16 +588,16 @@ public: * @throw Glib::Error. * @newin{2,28} */ - Glib::RefPtr<DBusMessage> send_message_with_reply_sync( - const Glib::RefPtr<DBusMessage>& message, + Glib::RefPtr<Message> send_message_with_reply_sync( + const Glib::RefPtr<Message>& message, const Glib::RefPtr<Cancellable>& cancellable, gint timeout_msec ); _IGNORE(g_dbus_connection_send_message_with_reply_sync) /// A non-cancellable version of send_message_with_reply_sync(). - Glib::RefPtr<DBusMessage> send_message_with_reply_sync( - const Glib::RefPtr<DBusMessage>& message, + Glib::RefPtr<Message> send_message_with_reply_sync( + const Glib::RefPtr<Message>& message, gint timeout_msec ); @@ -605,7 +610,7 @@ public: _WRAP_METHOD(std::string get_guid() const, g_dbus_connection_get_guid) _WRAP_METHOD(Glib::ustring get_unique_name() const, g_dbus_connection_get_unique_name) - _WRAP_METHOD(DBusCapabilityFlags get_capabilities() const, g_dbus_connection_get_capabilities) + _WRAP_METHOD(CapabilityFlags get_capabilities() const, g_dbus_connection_get_capabilities) _WRAP_METHOD(Glib::RefPtr<Credentials> get_peer_credentials(), g_dbus_connection_get_peer_credentials, refreturn) _WRAP_METHOD(Glib::RefPtr<const Credentials> get_peer_credentials() const, g_dbus_connection_get_peer_credentials, refreturn, constversion) @@ -642,7 +647,7 @@ public: * connection is not a message bus connection. * @param timeout_msec The timeout in milliseconds, -1 to use the default * timeout or G_MAXINT for no timeout. - * @param flags Flags from the Gio::DBusCallFlags enumeration. + * @param flags Flags from the Gio::DBus::CallFlags enumeration. * @param reply_type The expected type of the reply, or <tt>0</tt>. * @newin{2,28} */ @@ -655,7 +660,7 @@ public: const Glib::RefPtr<Cancellable>& cancellable, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, const Glib::VariantType& reply_type = Glib::VariantType() ); _IGNORE(g_dbus_connection_call) @@ -669,7 +674,7 @@ public: const SlotAsyncReady& slot, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, const Glib::VariantType& reply_type = Glib::VariantType() ); @@ -715,7 +720,7 @@ public: * connection is not a message bus connection. * @param timeout_msec The timeout in milliseconds, -1 to use the default * timeout or G_MAXINT for no timeout. - * @param flags Flags from the Gio::DBusCallFlags enumeration. + * @param flags Flags from the Gio::DBus::CallFlags enumeration. * @param reply_type The expected type of the reply, or <tt>0</tt>. * @throw Glib::Error. * @newin{2,28} @@ -729,7 +734,7 @@ public: const Glib::RefPtr<Cancellable>& cancellable, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, const Glib::VariantType& reply_type = Glib::VariantType() ); _IGNORE(g_dbus_connection_call_sync) @@ -743,7 +748,7 @@ public: const Glib::VariantBase& parameters, const Glib::ustring& bus_name = Glib::ustring(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE, + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE, const Glib::VariantType& reply_type = Glib::VariantType() ); @@ -809,7 +814,7 @@ public: const Glib::ustring& member = Glib::ustring(), const Glib::ustring& object_path = Glib::ustring(), const Glib::ustring& arg0 = Glib::ustring(), - DBusSignalFlags flags = Gio::DBUS_SIGNAL_FLAGS_NONE + SignalFlags flags = Gio::DBus::SIGNAL_FLAGS_NONE ); _IGNORE(g_dbus_connection_signal_subscribe) @@ -874,15 +879,15 @@ public: * * @param object_path The object path to register at. * @param interface_info Introspection data for the interface. - * @param vtable A GDBusInterfaceVTable to call into or NULL. + * @param vtable An InterfaceVTable to call into or NULL. * @return A registration id (never 0) that can be used with * unregister_object() if no Glib::Error is thrown. * @throw Glib::Error. * @newin{2,28} */ guint register_object(const Glib::ustring& object_path, - const Glib::RefPtr<DBusInterfaceInfo>& interface_info, - const DBusInterfaceVTable* vtable); + const Glib::RefPtr<InterfaceInfo>& interface_info, + const InterfaceVTable* vtable); _IGNORE(g_dbus_connection_register_object) _WRAP_METHOD(bool unregister_object(guint registration_id), g_dbus_connection_unregister_object) @@ -895,10 +900,10 @@ public: * * When handling remote calls into any node in the subtree, first the * enumerate slot is used to check if the node exists. If the node - * exists or the Gio::DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag + * exists or the Gio::DBus::SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag * is set the introspection slot is used to check if the node supports the * requested method. If so, the dispatch function is used to determine where - * to dispatch the call. The collected DBusInterfaceVTable will be used to + * to dispatch the call. The collected InterfaceVTable will be used to * call into the interface vtable for processing the request. * * All calls into user-provided code will be invoked in the thread-default @@ -915,7 +920,7 @@ public: * * * @param object_path The object path to register the subtree at. - * @param vtable A DBusSubtreeVTable to enumerate, introspect and dispatch + * @param vtable A SubtreeVTable to enumerate, introspect and dispatch * nodes in the subtree. * @param flags Flags used to fine tune the behavior of the subtree. * @return A subtree registration id (never 0) that can be used with @@ -924,18 +929,18 @@ public: * @newin{2,28} */ guint register_subtree(const Glib::ustring& object_path, - const DBusSubtreeVTable* vtable, - DBusSubtreeFlags flags = Gio::DBUS_SUBTREE_FLAGS_NONE); + const SubtreeVTable* vtable, + SubtreeFlags flags = Gio::DBus::SUBTREE_FLAGS_NONE); _IGNORE(g_dbus_connection_register_subtree) _WRAP_METHOD(bool unregister_subtree(guint registration_id), g_dbus_connection_unregister_subtree) //_WRAP_PROPERTY("address", std::string) // write-only construct-only //_WRAP_PROPERTY("authentication-observer", Glib::RefPtr<AuthObserver>) // write-only construct-only - _WRAP_PROPERTY("capabilities", DBusCapabilityFlags) + _WRAP_PROPERTY("capabilities", CapabilityFlags) _WRAP_PROPERTY("closed", bool) _WRAP_PROPERTY("exit-on-close", bool) - //_WRAP_PROPERTY("flags", DBusConnectionFlags) // write-only construct-only + //_WRAP_PROPERTY("flags", ConnectionFlags) // write-only construct-only _WRAP_PROPERTY("guid", std::string) _WRAP_PROPERTY("stream", Glib::RefPtr<IOStream>) _WRAP_PROPERTY("unique-name", Glib::ustring) @@ -944,12 +949,12 @@ public: _WRAP_SIGNAL(void closed(bool remote_peer_vanished, const Glib::Error& error), "closed", no_default_handler) }; -/** DBusInterfaceVTable - A class used to represent a virtual table for +/**This represents a virtual table for * handling properties and method calls for a D-Bus interface. * * If you want to handle getting/setting D-Bus properties asynchronously, * simply register an object with the org.freedesktop.DBus.Properties D-Bus - * interface using Gio::DBusConnection::register_object(). + * interface using Gio::DBus::Connection::register_object(). * * The only correct use of this class is to declare a global instance of it * (or an instance local to the main function) and pass pointers to the @@ -962,30 +967,30 @@ public: * @newin{2,28} * @ingroup DBus */ -class DBusInterfaceVTable +class InterfaceVTable { - _CLASS_GENERIC(DBusInterfaceVTable, GDBusInterfaceVTable) + _CLASS_GENERIC(InterfaceVTable, GDBusInterfaceVTable) public: /** The type for a slot which handles a method call for a D-Bus interface. * for example, * @code - * void on_interface_method_call(const Glib::RefPtr<Gio::DBusConnection>& + * void on_interface_method_call(const Glib::RefPtr<Gio::DBus::Connection>& * connection, const Glib::ustring& sender, const Glib::ustring& * object_path, const Glib::ustring& interface_name, const Glib::ustring& * method_name, const Glib::VariantBase& parameters, const - * Glib::RefPtr<Gio::DBusMethodInvocation>& invocation); + * Glib::RefPtr<Gio::DBus::MethodInvocation>& invocation); * @endcode */ typedef sigc::slot< void, - const Glib::RefPtr<DBusConnection>&, + const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::VariantBase&, - const Glib::RefPtr<DBusMethodInvocation>& + const Glib::RefPtr<MethodInvocation>& > SlotInterfaceMethodCall; /** The type for a slot which handles getting a property for a D-Bus @@ -993,7 +998,7 @@ public: * for example, * @code * void on_interface_get_property(Glib::VariantBase& property, const - * Glib::RefPtr<Gio::DBusConnection>& connection, const Glib::ustring& + * Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& * sender, const Glib::ustring& object_path, const Glib::ustring& * interface_name, const Glib::ustring& property_name); * @endcode @@ -1002,7 +1007,7 @@ public: typedef sigc::slot< void, Glib::VariantBase&, - const Glib::RefPtr<DBusConnection>&, + const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, @@ -1013,7 +1018,7 @@ public: * interface. * for example, * @code - * bool on_interface_set_property(const Glib::RefPtr<Gio::DBusConnection>& + * bool on_interface_set_property(const Glib::RefPtr<Gio::DBus::Connection>& * connection, const Glib::ustring& sender, const Glib::ustring& * object_path, const Glib::ustring& interface_name, const Glib::ustring& * property_name, const Glib::VariantBase& value); @@ -1022,7 +1027,7 @@ public: */ typedef sigc::slot< bool, - const Glib::RefPtr<DBusConnection>&, + const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, @@ -1030,19 +1035,19 @@ public: const Glib::VariantBase& > SlotInterfaceSetProperty; - /** Constructs a new DBusInterfaceVTable using the specified slots. + /** Constructs a new InterfaceVTable using the specified slots. * @param slot_method_call The slot for handling incoming method calls. * @param slot_get_property The slot for getting a property. * @param slot_set_property The slot for setting a property. */ - explicit DBusInterfaceVTable( + explicit InterfaceVTable( const SlotInterfaceMethodCall& slot_method_call, const SlotInterfaceGetProperty& slot_get_property = SlotInterfaceGetProperty(), const SlotInterfaceSetProperty& slot_set_property = SlotInterfaceSetProperty() ); /// Destructor. - virtual ~DBusInterfaceVTable(); + virtual ~InterfaceVTable(); /// Provides access to the underlying C object. GDBusInterfaceVTable* gobj() @@ -1055,13 +1060,13 @@ public: private: // Non-copyable. - DBusInterfaceVTable(const DBusInterfaceVTable& other); - DBusInterfaceVTable& operator=(const DBusInterfaceVTable& other); + InterfaceVTable(const InterfaceVTable& other); + InterfaceVTable& operator=(const InterfaceVTable& other); public: #ifndef DOXYGEN_SHOULD_SKIP_THIS // These are so the C callbacks and the - // Gio::DBusConnection::register_object() method can have access to the + // Gio::DBus::Connection::register_object() method can have access to the // copies of the slots used for creation when registering. SlotInterfaceMethodCall* get_slot_method_call() const; SlotInterfaceGetProperty* get_slot_get_property() const; @@ -1078,8 +1083,8 @@ protected: SlotInterfaceSetProperty* slot_set_property_; }; -/** DBusSubtreeVTable - A class used to represent a virtual table for - * subtrees registered with Gio::DBusConnection::register_subtree(). +/** This represents a virtual table for + * subtrees registered with Gio::DBus::Connection::register_subtree(). * * The only correct use of this class is to declare a global instance of it * (or an instance local to the main function) and pass pointers to the @@ -1092,16 +1097,16 @@ protected: * @newin{2,28} * @ingroup DBus */ -class DBusSubtreeVTable +class SubtreeVTable { - _CLASS_GENERIC(DBusSubtreeVTable, GDBusSubtreeVTable) + _CLASS_GENERIC(SubtreeVTable, GDBusSubtreeVTable) public: /** The type for a slot which handles enumerating child nodes. * * This slot is called when generating introspection data and also when * preparing to dispatch incoming messages in the event that the - * Gio::DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not + * Gio::DBus::SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not * specified (ie: to verify that the object path is valid). * * Hierarchies are not supported; the items that you return should not @@ -1110,13 +1115,13 @@ public: * For example, * @code * std::vector<Glib::ustring> on_subtree_enumerate(const - * Glib::RefPtr<Gio::DBusConnection>& connection, const Glib::ustring& + * Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& * sender, const Glib::ustring& object_path); * @endcode */ typedef sigc::slot< std::vector<Glib::ustring>, - const Glib::RefPtr<DBusConnection>&, + const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring& > SlotSubtreeEnumerate; @@ -1135,15 +1140,15 @@ public: * * for example, * @code - * std::vector< Glib::RefPtr<Gio::DBusInterFaceInfo> > - * on_subtree_introspect(const Glib::RefPtr<Gio::DBusConnection>& + * std::vector< Glib::RefPtr<Gio::DBus::InterFaceInfo> > + * on_subtree_introspect(const Glib::RefPtr<Gio::DBus::Connection>& * connection, const Glib::ustring& sender, const Glib::ustring& * object_path, const Glib::ustring& node); * @endcode */ typedef sigc::slot< - std::vector< Glib::RefPtr<Gio::DBusInterfaceInfo> >, - const Glib::RefPtr<DBusConnection>&, + std::vector< Glib::RefPtr<Gio::DBus::InterfaceInfo> >, + const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring& @@ -1157,34 +1162,34 @@ public: * * for example, * @code - * const Gio::DBusInterfaceVTable* on_subtree_dispatch(const - * Glib::RefPtr<Gio::DBusConnection>& connection, const Glib::ustring& + * const Gio::DBus::InterfaceVTable* on_subtree_dispatch(const + * Glib::RefPtr<Gio::DBus::Connection>& connection, const Glib::ustring& * sender, const Glib::ustring& object_path, const Glib::ustring& * interface_name, const Glib::ustring& node); * @endcode */ typedef sigc::slot< - const DBusInterfaceVTable*, - const Glib::RefPtr<DBusConnection>&, + const InterfaceVTable*, + const Glib::RefPtr<Connection>&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring&, const Glib::ustring& > SlotSubtreeDispatch; - /** Constructs a new DBusSubtreeVTable using specified slots. + /** Constructs a new SubtreeVTable using specified slots. * @param slot_enumerate The slot for handling incoming method calls. * @param slot_introspect The slot for getting a property. * @param slot_dispatch The slot for setting a property. */ - explicit DBusSubtreeVTable( + explicit SubtreeVTable( const SlotSubtreeEnumerate& slot_enumerate, const SlotSubtreeIntrospect& slot_introspect = SlotSubtreeIntrospect(), const SlotSubtreeDispatch& slot_dispatch = SlotSubtreeDispatch() ); /// Destructor. - virtual ~DBusSubtreeVTable(); + virtual ~SubtreeVTable(); /// Provides access to the underlying C object. GDBusSubtreeVTable* gobj() @@ -1197,13 +1202,13 @@ public: private: // Non-copyable. - DBusSubtreeVTable(const DBusSubtreeVTable& other); - DBusSubtreeVTable& operator=(const DBusSubtreeVTable& other); + SubtreeVTable(const SubtreeVTable& other); + SubtreeVTable& operator=(const SubtreeVTable& other); public: #ifndef DOXYGEN_SHOULD_SKIP_THIS // These are so the C callbacks and the - // Gio::DBusConnection::register_subtreee() method can have access to the + // Gio::DBus::Connection::register_subtreee() method can have access to the // copies of the slots used for creation when registering. SlotSubtreeEnumerate* get_slot_enumerate() const; SlotSubtreeIntrospect* get_slot_introspect() const; @@ -1220,4 +1225,6 @@ protected: SlotSubtreeDispatch* slot_dispatch_; }; +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbuserrorutils.ccg b/gio/src/dbuserrorutils.ccg index 796761bd..dcf0c2f1 100644 --- a/gio/src/dbuserrorutils.ccg +++ b/gio/src/dbuserrorutils.ccg @@ -25,7 +25,7 @@ namespace Gio namespace DBus { -namespace Error +namespace ErrorUtils { bool is_remote_error(const Glib::Error& error) @@ -43,7 +43,7 @@ bool strip_remote_error(Glib::Error& error) return static_cast<bool>(g_dbus_error_strip_remote_error(error.gobj())); } -} // namespace Error +} // namespace ErrorUtils } // namespace DBus diff --git a/gio/src/dbuserrorutils.hg b/gio/src/dbuserrorutils.hg index f7f8707d..7ec998c0 100644 --- a/gio/src/dbuserrorutils.hg +++ b/gio/src/dbuserrorutils.hg @@ -25,7 +25,7 @@ namespace Gio namespace DBus { -namespace Error +namespace ErrorUtils { /** Checks if @a error represents an error received via D-Bus from a remote @@ -43,7 +43,7 @@ bool is_remote_error(const Glib::Error& error); * * This function is guaranteed to return a D-Bus error name for all * Glib::Error instances returned from functions handling remote method calls - * (e.g. Gio::DBusConnection::call_finish()) unless strip_remote_error() has + * (e.g. Gio::DBus::Connection::call_finish()) unless strip_remote_error() has * been used on @a error. * * @param error A Glib::Error. @@ -68,7 +68,7 @@ Glib::ustring get_remote_error(const Glib::Error& error); */ bool strip_remote_error(Glib::Error& error); -} // namespace Error +} // namespace ErrorUtils } // namespace DBus diff --git a/gio/src/dbusintrospection.hg b/gio/src/dbusintrospection.hg index 757392dc..b125fe42 100644 --- a/gio/src/dbusintrospection.hg +++ b/gio/src/dbusintrospection.hg @@ -25,43 +25,46 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(DBusPropertyInfoFlags, GDBusPropertyInfoFlags, NO_GTYPE) +namespace DBus +{ + +_WRAP_ENUM(PropertyInfoFlags, GDBusPropertyInfoFlags, s#^DBUS_##, NO_GTYPE) -/** DBusAnnotationInfo - Stores information about an annotation. +/** Stores information about an annotation. * * @newin{2,28} * @ingroup DBus */ -class DBusAnnotationInfo +class AnnotationInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusAnnotationInfo, GDBusAnnotationInfo, NONE, g_dbus_annotation_info_ref, g_dbus_annotation_info_unref) + _CLASS_OPAQUE_REFCOUNTED(AnnotationInfo, GDBusAnnotationInfo, NONE, g_dbus_annotation_info_ref, g_dbus_annotation_info_unref) public: -#m4 _CONVERSION(`const Glib::ArrayHandle< Glib::RefPtr<DBusAnnotationInfo> >&', `GDBusAnnotationInfo**', `const_cast<GDBusAnnotationInfo**>($3.data())') - _WRAP_METHOD(static Glib::ustring info_lookup(const Glib::ArrayHandle< Glib::RefPtr<DBusAnnotationInfo> >& annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup) +#m4 _CONVERSION(`const Glib::ArrayHandle< Glib::RefPtr<AnnotationInfo> >&', `GDBusAnnotationInfo**', `const_cast<GDBusAnnotationInfo**>($3.data())') + _WRAP_METHOD(static Glib::ustring info_lookup(const Glib::ArrayHandle< Glib::RefPtr<AnnotationInfo> >& annotations, const Glib::ustring& name), g_dbus_annotation_info_lookup) }; -/** DBusArgInfo - Stores information about an argument for a method or a +/** ArgInfo - Stores information about an argument for a method or a * signal. * * @newin{2,28} * @ingroup DBus */ -class DBusArgInfo +class ArgInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusArgInfo, GDBusArgInfo, NONE, g_dbus_arg_info_ref, g_dbus_arg_info_unref) + _CLASS_OPAQUE_REFCOUNTED(ArgInfo, GDBusArgInfo, NONE, g_dbus_arg_info_ref, g_dbus_arg_info_unref) public: }; -/** DBusMethodInfo - Stores information about a method on an D-Bus interface. +/** Stores information about a method on an D-Bus interface. * * @newin{2,28} * @ingroup DBus */ -class DBusMethodInfo +class MethodInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusMethodInfo, GDBusMethodInfo, NONE, g_dbus_method_info_ref, g_dbus_method_info_unref) + _CLASS_OPAQUE_REFCOUNTED(MethodInfo, GDBusMethodInfo, NONE, g_dbus_method_info_ref, g_dbus_method_info_unref) public: }; @@ -71,9 +74,9 @@ public: * @newin{2,28} * @ingroup DBus */ -class DBusSignalInfo +class SignalInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusSignalInfo, GDBusSignalInfo, NONE, g_dbus_signal_info_ref, g_dbus_signal_info_unref) + _CLASS_OPAQUE_REFCOUNTED(SignalInfo, GDBusSignalInfo, NONE, g_dbus_signal_info_ref, g_dbus_signal_info_unref) public: }; @@ -83,54 +86,56 @@ public: * @newin{2,28} * @ingroup DBus */ -class DBusPropertyInfo +class PropertyInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusPropertyInfo, GDBusPropertyInfo, NONE, g_dbus_property_info_ref, g_dbus_property_info_unref) + _CLASS_OPAQUE_REFCOUNTED(PropertyInfo, GDBusPropertyInfo, NONE, g_dbus_property_info_ref, g_dbus_property_info_unref) public: }; -/** DBusInterfaceInfo - Stores information about a D-Bus interface. +/** Stores information about a D-Bus interface. * * @newin{2,28} * @ingroup DBus */ -class DBusInterfaceInfo +class InterfaceInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusInterfaceInfo, GDBusInterfaceInfo, NONE, g_dbus_interface_info_ref, g_dbus_interface_info_unref) + _CLASS_OPAQUE_REFCOUNTED(InterfaceInfo, GDBusInterfaceInfo, NONE, g_dbus_interface_info_ref, g_dbus_interface_info_unref) public: - _WRAP_METHOD(Glib::RefPtr<DBusMethodInfo> lookup_method(const Glib::ustring& name), g_dbus_interface_info_lookup_method, refreturn) - _WRAP_METHOD(Glib::RefPtr<const DBusMethodInfo> lookup_method(const Glib::ustring& name) const, g_dbus_interface_info_lookup_method, constversion, refreturn) + _WRAP_METHOD(Glib::RefPtr<MethodInfo> lookup_method(const Glib::ustring& name), g_dbus_interface_info_lookup_method, refreturn) + _WRAP_METHOD(Glib::RefPtr<const MethodInfo> lookup_method(const Glib::ustring& name) const, g_dbus_interface_info_lookup_method, constversion, refreturn) - _WRAP_METHOD(Glib::RefPtr<DBusSignalInfo> lookup_signal(const Glib::ustring& name), g_dbus_interface_info_lookup_signal, refreturn) - _WRAP_METHOD(Glib::RefPtr<const DBusSignalInfo> lookup_signal(const Glib::ustring& name) const, g_dbus_interface_info_lookup_signal, constversion, refreturn) + _WRAP_METHOD(Glib::RefPtr<SignalInfo> lookup_signal(const Glib::ustring& name), g_dbus_interface_info_lookup_signal, refreturn) + _WRAP_METHOD(Glib::RefPtr<const SignalInfo> lookup_signal(const Glib::ustring& name) const, g_dbus_interface_info_lookup_signal, constversion, refreturn) - _WRAP_METHOD(Glib::RefPtr<DBusPropertyInfo> lookup_property(const Glib::ustring& name), g_dbus_interface_info_lookup_property, refreturn) - _WRAP_METHOD(Glib::RefPtr<const DBusPropertyInfo> lookup_property(const Glib::ustring& name) const, g_dbus_interface_info_lookup_property, constversion, refreturn) + _WRAP_METHOD(Glib::RefPtr<PropertyInfo> lookup_property(const Glib::ustring& name), g_dbus_interface_info_lookup_property, refreturn) + _WRAP_METHOD(Glib::RefPtr<const PropertyInfo> lookup_property(const Glib::ustring& name) const, g_dbus_interface_info_lookup_property, constversion, refreturn) //TODO: _WRAP_METHOD(void generate_xml(guint indent, GString* string_builder), g_dbus_interface_info_generate_xml) }; -/** DBusNodeInfo - Stores information about nodes in a remote object +/** NodeInfo - Stores information about nodes in a remote object * hierarchy. * * @newin{2,28} * @ingroup DBus */ -class DBusNodeInfo +class NodeInfo { - _CLASS_OPAQUE_REFCOUNTED(DBusNodeInfo, GDBusNodeInfo, NONE, g_dbus_node_info_ref, g_dbus_node_info_unref) + _CLASS_OPAQUE_REFCOUNTED(NodeInfo, GDBusNodeInfo, NONE, g_dbus_node_info_ref, g_dbus_node_info_unref) public: _WRAP_METHOD_DOCS_ONLY(g_dbus_node_info_new_for_xml) /// @throw Glib::Error. - _WRAP_METHOD(static Glib::RefPtr<DBusNodeInfo> create_for_xml(const Glib::ustring& xml_data), g_dbus_node_info_new_for_xml, errthrow) + _WRAP_METHOD(static Glib::RefPtr<NodeInfo> create_for_xml(const Glib::ustring& xml_data), g_dbus_node_info_new_for_xml, errthrow) - _WRAP_METHOD(Glib::RefPtr<DBusInterfaceInfo> lookup_interface(const Glib::ustring& name), g_dbus_node_info_lookup_interface, refreturn) - _WRAP_METHOD(Glib::RefPtr<const DBusInterfaceInfo> lookup_interface(const Glib::ustring& name) const, g_dbus_node_info_lookup_interface, constversion, refreturn) + _WRAP_METHOD(Glib::RefPtr<InterfaceInfo> lookup_interface(const Glib::ustring& name), g_dbus_node_info_lookup_interface, refreturn) + _WRAP_METHOD(Glib::RefPtr<const InterfaceInfo> lookup_interface(const Glib::ustring& name) const, g_dbus_node_info_lookup_interface, constversion, refreturn) //TODO: _WRAP_METHOD(void generate_xml(guint indent, GString* string_builder), g_dbus_node_info_generate_xml) }; +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbusmessage.ccg b/gio/src/dbusmessage.ccg index b2229f44..8e43a3a2 100644 --- a/gio/src/dbusmessage.ccg +++ b/gio/src/dbusmessage.ccg @@ -25,9 +25,12 @@ namespace Gio { -typedef DBusMessage::ByteOrder ByteOrder; +namespace DBus +{ + +typedef Message::ByteOrder ByteOrder; -void DBusMessage::get_body(Glib::VariantBase& value) const +void Message::get_body(Glib::VariantBase& value) const { GVariant* const g_value = g_dbus_message_get_body(const_cast<GDBusMessage*>(gobj())); @@ -38,8 +41,8 @@ void DBusMessage::get_body(Glib::VariantBase& value) const value.init(g_value, true /* take a reference */); } -void DBusMessage::get_header(Glib::VariantBase& value, - DBusMessageHeaderField header_field) const +void Message::get_header(Glib::VariantBase& value, + MessageHeaderField header_field) const { GVariant* const g_value = g_dbus_message_get_header(const_cast<GDBusMessage*>(gobj()), @@ -52,10 +55,11 @@ void DBusMessage::get_header(Glib::VariantBase& value, } #ifdef G_OS_UNIX -void DBusMessage::unset_unix_fd_list() +void Message::unset_unix_fd_list() { g_dbus_message_set_unix_fd_list(gobj(), 0); } #endif //G_OS_UNIX +} //namespace DBus } // namespace Gio diff --git a/gio/src/dbusmessage.hg b/gio/src/dbusmessage.hg index ba114280..48b4d43b 100644 --- a/gio/src/dbusmessage.hg +++ b/gio/src/dbusmessage.hg @@ -20,6 +20,7 @@ #include <glibmm/object.h> #include <glibmm/variant.h> #include <glibmm/utility.h> +#include <giomm/unixfdlist.h> _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) @@ -27,23 +28,26 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(DBusMessageType, GDBusMessageType, NO_GTYPE) -_WRAP_ENUM(DBusMessageFlags, GDBusMessageFlags, NO_GTYPE) -_WRAP_ENUM(DBusMessageHeaderField, GDBusMessageHeaderField, NO_GTYPE) -_WRAP_ENUM(DBusCapabilityFlags, GDBusCapabilityFlags, NO_GTYPE) +namespace DBus +{ + +_WRAP_ENUM(MessageType, GDBusMessageType, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(MessageFlags, GDBusMessageFlags, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(MessageHeaderField, GDBusMessageHeaderField, s#^DBUS_##, NO_GTYPE) +_WRAP_ENUM(CapabilityFlags, GDBusCapabilityFlags, s#^DBUS_##, NO_GTYPE) -class UnixFDList; +_GMMPROC_EXTRA_NAMESPACE(DBus) /** DBusMessage - D-Bus Message. * A type for representing D-Bus messages that can be sent or received on a - * DBusConnection. + * Connection. * * @newin{2,28} * @ingroup DBus */ -class DBusMessage : public Glib::Object +class Message : public Glib::Object { - _CLASS_GOBJECT(DBusMessage, GDBusMessage, G_DBUS_MESSAGE, Glib::Object, GObject) + _CLASS_GOBJECT(Message, GDBusMessage, G_DBUS_MESSAGE, Glib::Object, GObject) protected: _CTOR_DEFAULT @@ -56,23 +60,23 @@ public: // Note that we can't use _WRAP_CTOR() and _WRAP_CREATE() because the C functions do more than just call g_object_new(): // See http://bugzilla.gnome.org/show_bug.cgi?id=624977 // TODO: Should these parameters be ustring or std::string? - _WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_signal(const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& signal), g_dbus_message_new_signal) - _WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_method_call(const Glib::ustring& name, const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& method), g_dbus_message_new_method_call) - _WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_method_reply(const Glib::RefPtr<DBusMessage>& method_call_message), g_dbus_message_new_method_reply) - _WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_method_error_literal(const Glib::RefPtr<const DBusMessage>& method_call_message, const Glib::ustring& error_name, const Glib::ustring& error_message), g_dbus_message_new_method_error_literal) + _WRAP_METHOD(static Glib::RefPtr<Message> create_signal(const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& signal), g_dbus_message_new_signal) + _WRAP_METHOD(static Glib::RefPtr<Message> create_method_call(const Glib::ustring& name, const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& method), g_dbus_message_new_method_call) + _WRAP_METHOD(static Glib::RefPtr<Message> create_method_reply(const Glib::RefPtr<Message>& method_call_message), g_dbus_message_new_method_reply) + _WRAP_METHOD(static Glib::RefPtr<Message> create_method_error_literal(const Glib::RefPtr<const Message>& method_call_message, const Glib::ustring& error_name, const Glib::ustring& error_message), g_dbus_message_new_method_error_literal) - _WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_from_blob(const guchar* blob, gsize blob_len, DBusCapabilityFlags capabilities = DBUS_CAPABILITY_FLAGS_NONE), g_dbus_message_new_from_blob, errthrow) + _WRAP_METHOD(static Glib::RefPtr<Message> create_from_blob(const guchar* blob, gsize blob_len, CapabilityFlags capabilities = CAPABILITY_FLAGS_NONE), g_dbus_message_new_from_blob, errthrow) _WRAP_METHOD(Glib::ustring print(guint indent), g_dbus_message_print) _WRAP_METHOD(bool get_locked() const, g_dbus_message_get_locked) _WRAP_METHOD(void lock() ,g_dbus_message_lock) - _WRAP_METHOD(Glib::RefPtr<DBusMessage> copy() const, g_dbus_message_copy, errthrow) + _WRAP_METHOD(Glib::RefPtr<Message> copy() const, g_dbus_message_copy, errthrow) - _WRAP_METHOD(DBusMessageType get_message_type() const, g_dbus_message_get_message_type) - _WRAP_METHOD(void set_message_type(DBusMessageType type), g_dbus_message_set_message_type) + _WRAP_METHOD(MessageType get_message_type() const, g_dbus_message_get_message_type) + _WRAP_METHOD(void set_message_type(MessageType type), g_dbus_message_set_message_type) //gmmproc can't handle the character literals, and this won't be expanded in future, //so we just wrap it by hand. @@ -91,8 +95,8 @@ public: _WRAP_METHOD(guint32 get_serial() const, g_dbus_message_get_serial) _WRAP_METHOD(void set_serial(guint32 serial), g_dbus_message_set_serial) - _WRAP_METHOD(DBusMessageFlags get_flags() const, g_dbus_message_get_flags) - _WRAP_METHOD(void set_flags(DBusMessageFlags flags), g_dbus_message_set_flags) + _WRAP_METHOD(MessageFlags get_flags() const, g_dbus_message_get_flags) + _WRAP_METHOD(void set_flags(MessageFlags flags), g_dbus_message_set_flags) /** Gets the body of a message. The body is returned in @a value. * @param value Location in which to store the header. @@ -121,10 +125,10 @@ public: * @param value Location in which to store the header. * @param header_field The header field type. */ - void get_header(Glib::VariantBase& value, DBusMessageHeaderField header_field) const; + void get_header(Glib::VariantBase& value, MessageHeaderField header_field) const; _IGNORE(g_dbus_message_get_header) - _WRAP_METHOD(void set_header(DBusMessageHeaderField header_field, const Glib::VariantBase& value), g_dbus_message_set_header) + _WRAP_METHOD(void set_header(MessageHeaderField header_field, const Glib::VariantBase& value), g_dbus_message_set_header) #m4 _CONVERSION(`guchar*',`Glib::ArrayHandle<guchar>',`Glib::ArrayHandle<guchar>($3)') _WRAP_METHOD(Glib::ArrayHandle<guchar> get_header_fields() const, g_dbus_message_get_header_fields) @@ -157,11 +161,13 @@ public: _WRAP_METHOD(static gssize bytes_needed(const guchar* blob, gsize blob_len), g_dbus_message_bytes_needed, errthrow) - _WRAP_METHOD(guchar* to_blob(gsize& out_size, DBusCapabilityFlags capabilities = DBUS_CAPABILITY_FLAGS_NONE), g_dbus_message_to_blob, errthrow) + _WRAP_METHOD(guchar* to_blob(gsize& out_size, CapabilityFlags capabilities = CAPABILITY_FLAGS_NONE), g_dbus_message_to_blob, errthrow) _WRAP_METHOD(void to_exception(), g_dbus_message_to_gerror, errthrow) _WRAP_PROPERTY("locked", bool) }; +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbusmethodinvocation.ccg b/gio/src/dbusmethodinvocation.ccg index 60123073..7d29db4e 100644 --- a/gio/src/dbusmethodinvocation.ccg +++ b/gio/src/dbusmethodinvocation.ccg @@ -25,7 +25,10 @@ namespace Gio { -void DBusMethodInvocation::get_parameters(Glib::VariantBase& value) const +namespace DBus +{ + +void MethodInvocation::get_parameters(Glib::VariantBase& value) const { GVariant* const g_value = g_dbus_method_invocation_get_parameters(const_cast<GDBusMethodInvocation*>(gobj())); @@ -35,4 +38,6 @@ void DBusMethodInvocation::get_parameters(Glib::VariantBase& value) const value.init(g_value, true /* take a reference */); } +} // namespace DBus + } // namespace Gio diff --git a/gio/src/dbusmethodinvocation.hg b/gio/src/dbusmethodinvocation.hg index f97e4942..bbe84db7 100644 --- a/gio/src/dbusmethodinvocation.hg +++ b/gio/src/dbusmethodinvocation.hg @@ -17,6 +17,9 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +//#include <giomm/dbusconnection.h> +#include <giomm/dbusmessage.h> +#include <giomm/dbusintrospection.h> #include <glibmm/object.h> #include <glibmm/variant.h> @@ -26,9 +29,12 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -class DBusConnection; -class DBusMessage; -class DBusMethodInfo; +namespace DBus +{ + +class Connection; + +_GMMPROC_EXTRA_NAMESPACE(DBus) /** DBusMethodInvocation - Object for handling remote calls. * Instances of the DBusMethodInvocation class are used when handling D-Bus @@ -37,14 +43,14 @@ class DBusMethodInfo; * * The normal way to obtain a DBusMethodInvocation object is to receive it as * an argument to the SlotMethodCall that was passed to - * Gio::DBusConnection::register_object(). + * Gio::DBus::Connection::register_object(). * * @newin{2,28} * @ingroup DBus */ -class DBusMethodInvocation : public Glib::Object +class MethodInvocation : public Glib::Object { - _CLASS_GOBJECT(DBusMethodInvocation, GDBusMethodInvocation, G_DBUS_METHOD_INVOCATION, Glib::Object, GObject) + _CLASS_GOBJECT(MethodInvocation, GDBusMethodInvocation, G_DBUS_METHOD_INVOCATION, Glib::Object, GObject) public: _WRAP_METHOD(Glib::ustring get_sender() const, g_dbus_method_invocation_get_sender) @@ -52,15 +58,15 @@ public: _WRAP_METHOD(Glib::ustring get_interface_name() const, g_dbus_method_invocation_get_interface_name) _WRAP_METHOD(Glib::ustring get_method_name() const, g_dbus_method_invocation_get_method_name) -#m4 _CONVERSION(`const GDBusMethodInfo*', `Glib::RefPtr<const DBusMethodInfo>', `Glib::wrap(const_cast<GDBusMethodInfo*>($3))') +#m4 _CONVERSION(`const GDBusMethodInfo*', `Glib::RefPtr<const MethodInfo>', `Glib::wrap(const_cast<GDBusMethodInfo*>($3))') // The C API only returns a const GDBusMethodInfo. - _WRAP_METHOD(Glib::RefPtr<const DBusMethodInfo> get_method_info() const, g_dbus_method_invocation_get_method_info, refreturn) + _WRAP_METHOD(Glib::RefPtr<const MethodInfo> get_method_info() const, g_dbus_method_invocation_get_method_info, refreturn) - _WRAP_METHOD(Glib::RefPtr<DBusConnection> get_connection(), g_dbus_method_invocation_get_connection, refreturn) - _WRAP_METHOD(Glib::RefPtr<const DBusConnection> get_connection() const, g_dbus_method_invocation_get_connection, refreturn, constversion) + _WRAP_METHOD(Glib::RefPtr<Connection> get_connection(), g_dbus_method_invocation_get_connection, refreturn) + _WRAP_METHOD(Glib::RefPtr<const Connection> get_connection() const, g_dbus_method_invocation_get_connection, refreturn, constversion) - _WRAP_METHOD(Glib::RefPtr<DBusMessage> get_message(), g_dbus_method_invocation_get_message, refreturn) - _WRAP_METHOD(Glib::RefPtr<const DBusMessage> get_message() const, g_dbus_method_invocation_get_message, refreturn, constversion) + _WRAP_METHOD(Glib::RefPtr<Message> get_message(), g_dbus_method_invocation_get_message, refreturn) + _WRAP_METHOD(Glib::RefPtr<const Message> get_message() const, g_dbus_method_invocation_get_message, refreturn, constversion) /** Gets the parameters of the method invocation. * @@ -88,4 +94,5 @@ public: }; +} //namespace DBus } // namespace Gio diff --git a/gio/src/dbusownname.hg b/gio/src/dbusownname.hg index e6db230c..39132b76 100644 --- a/gio/src/dbusownname.hg +++ b/gio/src/dbusownname.hg @@ -27,29 +27,29 @@ namespace Gio namespace DBus { -_WRAP_ENUM(BusNameOwnerFlags, GBusNameOwnerFlags) +_WRAP_ENUM(BusNameOwnerFlags, GBusNameOwnerFlags, s#^DBUS_##) /** For example, - * void on_bus_acquired(const Glib::RefPtr<Gio::DBusConnection>& connection, + * void on_bus_acquired(const Glib::RefPtr<Gio::DBus::Connection>& connection, * const Glib::ustring& name); * @newin{2,28} * @ingroup DBus */ -typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring> SlotBusAcquired; +typedef sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring> SlotBusAcquired; /** For example, - * void on_name_acquired(const Glib::RefPtr<Gio::DBusConnection>& connection, + * void on_name_acquired(const Glib::RefPtr<Gio::DBus::Connection>& connection, * const Glib::ustring& name); * @ingroup DBus */ -typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring> SlotNameAcquired; +typedef sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring> SlotNameAcquired; /** For example, - * void on_name_lost(const Glib::RefPtr<Gio::DBusConnection>& connection, + * void on_name_lost(const Glib::RefPtr<Gio::DBus::Connection>& connection, * const Glib::ustring& name); * @ingroup DBus */ -typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring> SlotNameLost; +typedef sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring> SlotNameLost; //TODO: Add example from C API in class docs. /** Starts acquiring @a name on the bus specified by @a bus_type and calls @a @@ -74,7 +74,7 @@ typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring * If the name is acquired or lost (for example another application could * acquire the name if you allow replacement or the application currently * owning the name exits), the slots are also invoked. If the - * DBusConnection that is used for attempting to own the name closes, then + * Connection that is used for attempting to own the name closes, then * @a name_lost_slot is invoked since it is no longer possible for other * processes to access the process. * diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg index 3df17549..612a77b8 100644 --- a/gio/src/dbusproxy.ccg +++ b/gio/src/dbusproxy.ccg @@ -26,14 +26,17 @@ namespace Gio { -DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection, +namespace DBus +{ + +Proxy::Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -45,13 +48,13 @@ _CONSTRUCT("g-connection", Glib::unwrap(connection), init_async(slot, cancellable); } -DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection, +Proxy::Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -63,13 +66,13 @@ _CONSTRUCT("g-connection", Glib::unwrap(connection), init_async(slot); } -DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection, +Proxy::Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -81,12 +84,12 @@ _CONSTRUCT("g-connection", Glib::unwrap(connection), init(cancellable); } -DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection, +Proxy::Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-connection", Glib::unwrap(connection), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -98,14 +101,14 @@ _CONSTRUCT("g-connection", Glib::unwrap(connection), init(); } -DBusProxy::DBusProxy(BusType bus_type, +Proxy::Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -117,13 +120,13 @@ _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), init_async(slot, cancellable); } -DBusProxy::DBusProxy(BusType bus_type, +Proxy::Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -135,13 +138,13 @@ _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), init_async(slot); } -DBusProxy::DBusProxy(BusType bus_type, +Proxy::Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -153,12 +156,12 @@ _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), init(cancellable); } -DBusProxy::DBusProxy(BusType bus_type, +Proxy::Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) : _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), "g-flags", static_cast<GDBusProxyFlags>(flags), @@ -170,103 +173,103 @@ _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type), init(); } -void DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection, +void Proxy::create(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - DBusProxy(connection, name, object_path, interface_name, slot, + Proxy(connection, name, object_path, interface_name, slot, cancellable, info, flags); } -void DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection, +void Proxy::create(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - DBusProxy(connection, name, object_path, interface_name, slot, info, flags); + Proxy(connection, name, object_path, interface_name, slot, info, flags); } -Glib::RefPtr<DBusProxy> -DBusProxy::create_sync(const Glib::RefPtr<DBusConnection>& connection, +Glib::RefPtr<Proxy> +Proxy::create_sync(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - return Glib::RefPtr<DBusProxy>(new DBusProxy(connection, name, + return Glib::RefPtr<Proxy>(new Proxy(connection, name, object_path, interface_name, cancellable, info, flags)); } -Glib::RefPtr<DBusProxy> -DBusProxy::create_sync(const Glib::RefPtr<DBusConnection>& connection, +Glib::RefPtr<Proxy> +Proxy::create_sync(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - return Glib::RefPtr<DBusProxy>(new DBusProxy(connection, name, + return Glib::RefPtr<Proxy>(new Proxy(connection, name, object_path, interface_name, info, flags)); } -void DBusProxy::create_for_bus(BusType bus_type, +void Proxy::create_for_bus(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - DBusProxy(bus_type, name, object_path, interface_name, slot, cancellable, + Proxy(bus_type, name, object_path, interface_name, slot, cancellable, info, flags); } -void DBusProxy::create_for_bus(BusType bus_type, +void Proxy::create_for_bus(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - DBusProxy(bus_type, name, object_path, interface_name, slot, info, flags); + Proxy(bus_type, name, object_path, interface_name, slot, info, flags); } -Glib::RefPtr<DBusProxy> DBusProxy::create_for_bus_sync(BusType bus_type, +Glib::RefPtr<Proxy> Proxy::create_for_bus_sync(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - return Glib::RefPtr<DBusProxy>(new DBusProxy(bus_type, name, + return Glib::RefPtr<Proxy>(new Proxy(bus_type, name, object_path, interface_name, cancellable, info, flags)); } -Glib::RefPtr<DBusProxy> DBusProxy::create_for_bus_sync(BusType bus_type, +Glib::RefPtr<Proxy> Proxy::create_for_bus_sync(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info, - DBusProxyFlags flags) + const Glib::RefPtr<InterfaceInfo>& info, + ProxyFlags flags) { - return Glib::RefPtr<DBusProxy>(new DBusProxy(bus_type, name, + return Glib::RefPtr<Proxy>(new Proxy(bus_type, name, object_path, interface_name, info, flags)); } -void DBusProxy::get_cached_property(Glib::VariantBase& property, +void Proxy::get_cached_property(Glib::VariantBase& property, const Glib::ustring& property_name) const { GVariant* const g_variant = @@ -276,12 +279,12 @@ void DBusProxy::get_cached_property(Glib::VariantBase& property, property.init(g_variant, false /* no extra reference needed */); } -void DBusProxy::call(const Glib::ustring& method_name, +void Proxy::call(const Glib::ustring& method_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantBase& parameters, int timeout_msec, - DBusCallFlags flags + CallFlags flags ) { // Create a copy of the slot. @@ -295,11 +298,11 @@ void DBusProxy::call(const Glib::ustring& method_name, Glib::unwrap(cancellable), &SignalProxy_async_callback, slot_copy); } -void DBusProxy::call(const Glib::ustring& method_name, +void Proxy::call(const Glib::ustring& method_name, const SlotAsyncReady& slot, const Glib::VariantBase& parameters, int timeout_msec, - DBusCallFlags flags + CallFlags flags ) { // Create a copy of the slot. @@ -313,7 +316,7 @@ void DBusProxy::call(const Glib::ustring& method_name, 0, &SignalProxy_async_callback, slot_copy); } -void DBusProxy::call_finish(Glib::VariantBase& ret, const Glib::RefPtr<AsyncResult>& res) +void Proxy::call_finish(Glib::VariantBase& ret, const Glib::RefPtr<AsyncResult>& res) { GError* g_error = 0; @@ -326,12 +329,12 @@ void DBusProxy::call_finish(Glib::VariantBase& ret, const Glib::RefPtr<AsyncResu ret.init(g_variant, false /* don't take extra reference */); } -void DBusProxy::call_sync(Glib::VariantBase& result, +void Proxy::call_sync(Glib::VariantBase& result, const Glib::ustring& method_name, const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantBase& parameters, int timeout_msec, - DBusCallFlags flags + CallFlags flags ) { GError* g_error = 0; @@ -348,12 +351,12 @@ void DBusProxy::call_sync(Glib::VariantBase& result, result.init(g_variant, false /* don't take extra reference */); } -void DBusProxy::call_sync( +void Proxy::call_sync( Glib::VariantBase& result, const Glib::ustring& method_name, const Glib::VariantBase& parameters, int timeout_msec, - DBusCallFlags flags + CallFlags flags ) { GError* g_error = 0; @@ -369,4 +372,6 @@ void DBusProxy::call_sync( result.init(g_variant, false /* don't take extra reference */); } +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg index 0d795bfd..673e354b 100644 --- a/gio/src/dbusproxy.hg +++ b/gio/src/dbusproxy.hg @@ -18,6 +18,8 @@ */ #include <glibmm/object.h> +#include <giomm/asyncresult.h> +#include <giomm/dbusintrospection.h> #include <giomm/initable.h> #include <giomm/asyncinitable.h> #include <giomm/dbusconnection.h> @@ -28,30 +30,29 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(DBusProxyFlags, GDBusProxyFlags, NO_GTYPE) +namespace DBus +{ -class AsyncResult; -class DBusConnection; -class DBusInterfaceInfo; +_WRAP_ENUM(ProxyFlags, GDBusProxyFlags, s#^DBUS_##, NO_GTYPE) -/** DBusProxy - Client-side proxies. - * DBusProxy is a base class used for proxies to access a D-Bus interface on - * a remote object. A DBusProxy can be constructed for both well-known and +/** A client-side proxy. + * This is a base class used for proxies to access a D-Bus interface on + * a remote object. It can be constructed for both well-known and * unique names. * - * By default, DBusProxy will cache all properties (and listen to changes) of + * By default, Proxy will cache all properties (and listen to changes) of * the remote object, and proxy all signals that gets emitted. This behaviour - * can be changed by passing suitable DBusProxyFlags when the proxy is + * can be changed by passing suitable ProxyFlags when the proxy is * created. If the proxy is for a well-known name, the property cache is * flushed when the name owner vanishes and reloaded when a name owner * appears. * - * If a DBusProxy is used for a well-known name, the owner of the name is + * If a Proxy is used for a well-known name, the owner of the name is * tracked and can be read from property_g_name_owner(). * * The generic signal_g_properties_changed() and signal_g_signal() signals are * not very convenient to work with. Therefore, the recommended way of working - * with proxies is to subclass DBusProxy, and have more natural properties and + * with proxies is to subclass Proxy, and have more natural properties and * signals in your derived class. * * This documentation was adapted from the C API documentation. The C API docs @@ -60,124 +61,124 @@ class DBusInterfaceInfo; * @newin{2,28} * @ingroup DBus */ -class DBusProxy +class Proxy : public Glib::Object, public Initable, public AsyncInitable { - _CLASS_GOBJECT(DBusProxy, GDBusProxy, G_DBUS_PROXY, Glib::Object, GObject) + _CLASS_GOBJECT(Proxy, GDBusProxy, G_DBUS_PROXY, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Initable) _IMPLEMENTS_INTERFACE(AsyncInitable) protected: - DBusProxy(const Glib::RefPtr<DBusConnection>& connection, + Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(const Glib::RefPtr<DBusConnection>& connection, + Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(const Glib::RefPtr<DBusConnection>& connection, + Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(const Glib::RefPtr<DBusConnection>& connection, + Proxy(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(BusType bus_type, + Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(BusType bus_type, + Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(BusType bus_type, + Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - DBusProxy(BusType bus_type, + Proxy(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); public: _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new) - static void create(const Glib::RefPtr<DBusConnection>& connection, + static void create(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); /// Non-cancellable version of create(). - static void create(const Glib::RefPtr<DBusConnection>& connection, + static void create(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_finish) /// @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<Proxy> 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_sync(const Glib::RefPtr<DBusConnection>& connection, + static Glib::RefPtr<Proxy> + create_sync(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); /// Non-cancellable version of create_sync(). - static Glib::RefPtr<DBusProxy> - create_sync(const Glib::RefPtr<DBusConnection>& connection, + static Glib::RefPtr<Proxy> + create_sync(const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_for_bus) static void create_for_bus(BusType bus_type, @@ -186,8 +187,8 @@ public: const Glib::ustring& interface_name, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); /// Non-cancellable version of create_for_bus(). static void create_for_bus(BusType bus_type, @@ -195,36 +196,36 @@ public: const Glib::ustring& object_path, const Glib::ustring& interface_name, const SlotAsyncReady& slot, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_for_bus_finish) /// @throw Glib::Error. - _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(static Glib::RefPtr<Proxy> 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> + static Glib::RefPtr<Proxy> create_for_bus_sync(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, const Glib::RefPtr<Cancellable>& cancellable, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); /// Non-cancellable version of create_for_bus_sync(). - static Glib::RefPtr<DBusProxy> + static Glib::RefPtr<Proxy> create_for_bus_sync(BusType bus_type, const Glib::ustring& name, const Glib::ustring& object_path, const Glib::ustring& interface_name, - const Glib::RefPtr<DBusInterfaceInfo>& info = Glib::RefPtr<DBusInterfaceInfo>(), - DBusProxyFlags flags = DBUS_PROXY_FLAGS_NONE); + const Glib::RefPtr<InterfaceInfo>& info = Glib::RefPtr<InterfaceInfo>(), + ProxyFlags flags = PROXY_FLAGS_NONE); - _WRAP_METHOD(DBusProxyFlags get_flags() const, g_dbus_proxy_get_flags) + _WRAP_METHOD(ProxyFlags get_flags() const, g_dbus_proxy_get_flags) - _WRAP_METHOD(Glib::RefPtr<DBusConnection> get_connection(), g_dbus_proxy_get_connection) - _WRAP_METHOD(Glib::RefPtr<const DBusConnection> get_connection() const, g_dbus_proxy_get_connection) + _WRAP_METHOD(Glib::RefPtr<Connection> get_connection(), g_dbus_proxy_get_connection) + _WRAP_METHOD(Glib::RefPtr<const Connection> get_connection() const, g_dbus_proxy_get_connection) _WRAP_METHOD(Glib::ustring get_name() const, g_dbus_proxy_get_name) _WRAP_METHOD(Glib::ustring get_name_owner() const, g_dbus_proxy_get_name_owner) @@ -255,9 +256,9 @@ public: #m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3)') _WRAP_METHOD(Glib::StringArrayHandle get_cached_property_names() const, g_dbus_proxy_get_cached_property_names) - _WRAP_METHOD(void set_interface_info(const Glib::RefPtr<DBusInterfaceInfo>& info), g_dbus_proxy_set_interface_info) - _WRAP_METHOD(Glib::RefPtr<DBusInterfaceInfo> get_interface_info(), g_dbus_proxy_get_interface_info) - _WRAP_METHOD(Glib::RefPtr<const DBusInterfaceInfo> get_interface_info() const, g_dbus_proxy_get_interface_info, constversion) + _WRAP_METHOD(void set_interface_info(const Glib::RefPtr<InterfaceInfo>& info), g_dbus_proxy_set_interface_info) + _WRAP_METHOD(Glib::RefPtr<InterfaceInfo> get_interface_info(), g_dbus_proxy_get_interface_info) + _WRAP_METHOD(Glib::RefPtr<const InterfaceInfo> get_interface_info() const, g_dbus_proxy_get_interface_info, constversion) _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_call) void call( @@ -266,7 +267,7 @@ public: const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantBase& parameters = Glib::VariantBase(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE ); /// A non-cancellable version of call(). @@ -275,7 +276,7 @@ public: const SlotAsyncReady& slot, const Glib::VariantBase& parameters = Glib::VariantBase(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE ); /** Finishes an operation started with call(). @@ -296,7 +297,7 @@ public: * @param method_name Name of method to invoke. * @param timeout_msec The timeout in milliseconds or -1 to use the proxy * default timeout. - * @param flags Flags from the DBusCallFlags enumeration. + * @param flags Flags from the DBus::CallFlags enumeration. * @param parameters A Glib::VariantBase tuple with parameters for the * signal. * @param cancellable A Cancellable. @@ -309,7 +310,7 @@ public: const Glib::RefPtr<Cancellable>& cancellable, const Glib::VariantBase& parameters = Glib::VariantBase(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE ); _IGNORE(g_dbus_proxy_call_sync) @@ -319,14 +320,14 @@ public: const Glib::ustring& method_name, const Glib::VariantBase& parameters = Glib::VariantBase(), int timeout_msec = -1, - DBusCallFlags flags = Gio::DBUS_CALL_FLAGS_NONE + CallFlags flags = Gio::DBus::CALL_FLAGS_NONE ); //_WRAP_PROPERTY("g-bus-type", BusType) // write-only construct-only - _WRAP_PROPERTY("g-connection", Glib::RefPtr<DBusConnection>) + _WRAP_PROPERTY("g-connection", Glib::RefPtr<Connection>) _WRAP_PROPERTY("g-default-timeout", int) - _WRAP_PROPERTY("g-flags", DBusProxyFlags) - _WRAP_PROPERTY("g-interface-info", Glib::RefPtr<DBusInterfaceInfo>) + _WRAP_PROPERTY("g-flags", ProxyFlags) + _WRAP_PROPERTY("g-interface-info", Glib::RefPtr<InterfaceInfo>) _WRAP_PROPERTY("g-interface-name", Glib::ustring) _WRAP_PROPERTY("g-name", Glib::ustring) _WRAP_PROPERTY("g-name-owner", Glib::ustring) @@ -342,4 +343,6 @@ public: _WRAP_SIGNAL(void signal(const Glib::ustring& sender_name, const Glib::ustring& signal_name, const Glib::VariantBase& parameters), "g-signal") }; +} //namespace + } // namespace Gio diff --git a/gio/src/dbusserver.ccg b/gio/src/dbusserver.ccg index f2bba79a..0aea4888 100644 --- a/gio/src/dbusserver.ccg +++ b/gio/src/dbusserver.ccg @@ -24,13 +24,16 @@ namespace Gio { +namespace DBus +{ + //TODO: Uncomment when bug #639478 is resolved. /* -DBusServer::DBusServer(const std::string& address, +Server::Server(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags) + ServerFlags flags) : _CONSTRUCT("address", (address.empty() ? static_cast<char*>(0) : address.c_str()), "flags", static_cast<GDBusServerFlags>(flags), @@ -40,10 +43,10 @@ DBusServer::DBusServer(const std::string& address, init(cancellable); } -DBusServer::DBusServer(const std::string& address, +Server::Server(const std::string& address, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags) + ServerFlags flags) : _CONSTRUCT("address", (address.empty() ? static_cast<char*>(0) : address.c_str()), "flags", static_cast<GDBusServerFlags>(flags), @@ -53,10 +56,10 @@ DBusServer::DBusServer(const std::string& address, init(cancellable); } -DBusServer::DBusServer(const std::string& address, +Server::Server(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusServerFlags flags) + const Glib::RefPtr<AuthObserver>& observer, + ServerFlags flags) : _CONSTRUCT("address", (address.empty() ? static_cast<char*>(0) : address.c_str()), "flags", static_cast<GDBusServerFlags>(flags), @@ -66,9 +69,9 @@ DBusServer::DBusServer(const std::string& address, init(); } -DBusServer::DBusServer(const std::string& address, +Server::Server(const std::string& address, const std::string& guid, - DBusServerFlags flags) + ServerFlags flags) : _CONSTRUCT("address", (address.empty() ? static_cast<char*>(0) : address.c_str()), "flags", static_cast<GDBusServerFlags>(flags), @@ -79,21 +82,21 @@ DBusServer::DBusServer(const std::string& address, } */ -Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, +Glib::RefPtr<Server> Server::create_sync(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags) + ServerFlags flags) { //TODO: Use the constructor instead of the code underneath when //g_dbus_server_new_sync() does not do more than call g_initable_new(). //https://bugzilla.gnome.org/show_bug.cgi?id=639478 - //return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, observer, + //return Glib::RefPtr<Server>(new Server(address, guid, observer, //cancellable, flags)); GError* gerror = 0; - Glib::RefPtr<DBusServer> result = + Glib::RefPtr<Server> result = Glib::wrap(g_dbus_server_new_sync(address.c_str(), static_cast<GDBusServerFlags>(flags), guid.c_str(), @@ -107,20 +110,20 @@ Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, return result; } -Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, +Glib::RefPtr<Server> Server::create_sync(const std::string& address, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags) + ServerFlags flags) { //TODO: Use the constructor instead of the code underneath when //g_dbus_server_new_sync() does not do more than call g_initable_new(). //https://bugzilla.gnome.org/show_bug.cgi?id=639478 - //return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, + //return Glib::RefPtr<Server>(new Server(address, guid, //cancellable, flags)); GError* gerror = 0; - Glib::RefPtr<DBusServer> result = + Glib::RefPtr<Server> result = Glib::wrap(g_dbus_server_new_sync(address.c_str(), static_cast<GDBusServerFlags>(flags), guid.c_str(), 0, @@ -133,20 +136,20 @@ Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, return result; } -Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, +Glib::RefPtr<Server> Server::create_sync(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusServerFlags flags) + const Glib::RefPtr<AuthObserver>& observer, + ServerFlags flags) { //TODO: Use the constructor instead of the code underneath when //g_dbus_server_new_sync() does not do more than call g_initable_new(). //https://bugzilla.gnome.org/show_bug.cgi?id=639478 - //return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, observer, + //return Glib::RefPtr<Server>(new Server(address, guid, observer, //flags)); GError* gerror = 0; - Glib::RefPtr<DBusServer> result = + Glib::RefPtr<Server> result = Glib::wrap(g_dbus_server_new_sync(address.c_str(), static_cast<GDBusServerFlags>(flags), guid.c_str(), @@ -160,18 +163,18 @@ Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, return result; } -Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, +Glib::RefPtr<Server> Server::create_sync(const std::string& address, const std::string& guid, - DBusServerFlags flags) + ServerFlags flags) { //TODO: Use the constructor instead of the code underneath when //g_dbus_server_new_sync() does not do more than call g_initable_new(). //https://bugzilla.gnome.org/show_bug.cgi?id=639478 - //return Glib::RefPtr<DBusServer>(new DBusServer(address, guid, flags)); + //return Glib::RefPtr<Server>(new Server(address, guid, flags)); GError* gerror = 0; - Glib::RefPtr<DBusServer> result = + Glib::RefPtr<Server> result = Glib::wrap(g_dbus_server_new_sync(address.c_str(), static_cast<GDBusServerFlags>(flags), guid.c_str(), 0, 0, &gerror)); @@ -182,4 +185,5 @@ Glib::RefPtr<DBusServer> DBusServer::create_sync(const std::string& address, return result; } +} // namespace DBus } // namespace Gio diff --git a/gio/src/dbusserver.hg b/gio/src/dbusserver.hg index d9e1e9c9..fcfc5ba0 100644 --- a/gio/src/dbusserver.hg +++ b/gio/src/dbusserver.hg @@ -18,6 +18,8 @@ */ #include <glibmm/object.h> +#include <giomm/dbusconnection.h> +#include <giomm/dbusauthobserver.h> #include <giomm/initable.h> _DEFS(giomm,gio) @@ -26,10 +28,12 @@ _PINCLUDE(glibmm/private/object_p.h) namespace Gio { -_WRAP_ENUM(DBusServerFlags, GDBusServerFlags, NO_GTYPE) +namespace DBus +{ + +_WRAP_ENUM(ServerFlags, GDBusServerFlags, s#^DBUS_##, NO_GTYPE) -class DBusAuthObserver; -class DBusConnection; +_GMMPROC_EXTRA_NAMESPACE(DBus) //TODO: Add example from the C API in class docs. /** DBusServer - Helper for accepting connections. @@ -40,9 +44,9 @@ class DBusConnection; * @newin{2,28} * @ingroup DBus */ -class DBusServer : public Glib::Object, public Initable +class Server : public Glib::Object, public Initable { - _CLASS_GOBJECT(DBusServer, GDBusServer, G_DBUS_SERVER, Glib::Object, GObject) + _CLASS_GOBJECT(Server, GDBusServer, G_DBUS_SERVER, Glib::Object, GObject) _IMPLEMENTS_INTERFACE(Initable) protected: @@ -51,90 +55,92 @@ protected: /* DBusServer(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags); + ServerFlags flags); DBusServer(const std::string& address, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags); + ServerFlags flags); DBusServer(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusServerFlags flags); + const Glib::RefPtr<AuthObserver>& observer, + ServerFlags flags); DBusServer(const std::string& address, const std::string& guid, - DBusServerFlags flags); + ServerFlags flags); */ public: _WRAP_METHOD_DOCS_ONLY(g_dbus_server_new_sync) /// @throw Glib::Error. - static Glib::RefPtr<DBusServer> create_sync(const std::string& address, + static Glib::RefPtr<Server> create_sync(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, + const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags = Gio::DBUS_SERVER_FLAGS_NONE); + ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); _WRAP_METHOD_DOCS_ONLY(g_dbus_server_new_sync) /// @throw Glib::Error. - static Glib::RefPtr<DBusServer> create_sync(const std::string& address, + static Glib::RefPtr<Server> create_sync(const std::string& address, const std::string& guid, const Glib::RefPtr<Cancellable>& cancellable, - DBusServerFlags flags = Gio::DBUS_SERVER_FLAGS_NONE); + ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); /// Non-cancellable version of create_sync(). - static Glib::RefPtr<DBusServer> create_sync(const std::string& address, + static Glib::RefPtr<Server> create_sync(const std::string& address, const std::string& guid, - const Glib::RefPtr<DBusAuthObserver>& observer, - DBusServerFlags flags = Gio::DBUS_SERVER_FLAGS_NONE); + const Glib::RefPtr<AuthObserver>& observer, + ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); /// Non-cancellable version of create_sync(). - static Glib::RefPtr<DBusServer> create_sync(const std::string& address, + static Glib::RefPtr<Server> create_sync(const std::string& address, const std::string& guid, - DBusServerFlags flags = Gio::DBUS_SERVER_FLAGS_NONE); + ServerFlags flags = Gio::DBus::SERVER_FLAGS_NONE); _WRAP_METHOD(void start(), g_dbus_server_start) _WRAP_METHOD(void stop(), g_dbus_server_stop) _WRAP_METHOD(bool is_active() const, g_dbus_server_is_active) _WRAP_METHOD(std::string get_guid() const, g_dbus_server_get_guid) - _WRAP_METHOD(DBusServerFlags get_flags() const, g_dbus_server_get_flags) + _WRAP_METHOD(ServerFlags get_flags() const, g_dbus_server_get_flags) _WRAP_METHOD(std::string get_client_address() const, g_dbus_server_get_client_address) _WRAP_PROPERTY("active", bool) _WRAP_PROPERTY("address", std::string) - _WRAP_PROPERTY("authentication-observer", Glib::RefPtr<DBusAuthObserver>) + _WRAP_PROPERTY("authentication-observer", Glib::RefPtr<AuthObserver>) _WRAP_PROPERTY("client-address", std::string) - _WRAP_PROPERTY("flags", DBusServerFlags) + _WRAP_PROPERTY("flags", ServerFlags) _WRAP_PROPERTY("guid", std::string) -#m4 _CONVERSION(`GDBusConnection*', `const Glib::RefPtr<DBusConnection>&', `Glib::wrap($3, true)') +#m4 _CONVERSION(`GDBusConnection*', `const Glib::RefPtr<Connection>&', `Glib::wrap($3, true)') /** Emitted when a new authenticated connection has been made. Use - * Gio::DBusConnection::get_peer_credentials() to figure out what identity + * Gio::DBus::Connection::get_peer_credentials() to figure out what identity * (if any), was authenticated. * * If you want to accept the connection, keep a global reference to the * connection (by keeping it in a global RefPtr<>) and return <tt>true</tt>. - * When you are done with the connection call Gio::DBusConnection::close(). + * When you are done with the connection call Gio::DBus::Connection::close(). * Note that the other peer may disconnect at any time - a typical thing to * do when accepting a connection is to listen to the - * Gio::DBusConnection::signal_closed() signal. + * Gio::DBus::Connection::signal_closed() signal. * - * If property_flags() contains Gio::DBUS_SERVER_FLAGS_RUN_IN_THREAD then + * If property_flags() contains Gio::DBus::SERVER_FLAGS_RUN_IN_THREAD then * the signal is emitted in a new thread dedicated to the connection. * Otherwise the signal is emitted in the thread-default main loop of the * thread that server was constructed in. * * You are guaranteed that signal handlers for this signal runs before * incoming messages on the connection are processed. This means that it's - * suitable to call Gio::DBusConnection::register_object() or similar from + * suitable to call Gio::DBus::Connection::register_object() or similar from * the signal handler. */ - _WRAP_SIGNAL(bool new_connection(const Glib::RefPtr<DBusConnection>& connection), "new-connection", no_default_handler) + _WRAP_SIGNAL(bool new_connection(const Glib::RefPtr<Connection>& connection), "new-connection", no_default_handler) }; +} //namespace DBus + } // namespace Gio diff --git a/gio/src/dbusutils.hg b/gio/src/dbusutils.hg index 885f9e0b..ac2acf9d 100644 --- a/gio/src/dbusutils.hg +++ b/gio/src/dbusutils.hg @@ -26,7 +26,7 @@ namespace DBus { /** Generate a D-Bus GUID that can be used with e.g. - * Gio::DBusConnection::create(). + * Gio::DBus::Connection::create(). * * See the D-Bus specification regarding what strings are valid D-Bus GUID * (for example, D-Bus GUIDs are not RFC-4122 compliant). diff --git a/gio/src/dbuswatchname.ccg b/gio/src/dbuswatchname.ccg index 587d9223..972b6cc8 100644 --- a/gio/src/dbuswatchname.ccg +++ b/gio/src/dbuswatchname.ccg @@ -110,7 +110,7 @@ guint watch_name( } guint watch_name( - const Glib::RefPtr<DBusConnection>& connection, + const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const SlotNameAppeared& name_appeared_slot, const SlotNameVanished& name_vanished_slot, diff --git a/gio/src/dbuswatchname.hg b/gio/src/dbuswatchname.hg index 5668cdaf..d3c2e350 100644 --- a/gio/src/dbuswatchname.hg +++ b/gio/src/dbuswatchname.hg @@ -27,21 +27,21 @@ namespace Gio namespace DBus { -_WRAP_ENUM(BusNameWatcherFlags, GBusNameWatcherFlags) +_WRAP_ENUM(BusNameWatcherFlags, GBusNameWatcherFlags, s#^DBUS_##, NO_GTYPE) /** For example, - * void on_name_appeared(const Glib::RefPtr<Gio::DBusConnection>& connection, + * void on_name_appeared(const Glib::RefPtr<Gio::DBus::Connection>& connection, * const Glib::ustring& name, const Glib::ustring& name_owner); * @ingroup DBus */ -typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring, const Glib::ustring&> SlotNameAppeared; +typedef sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring, const Glib::ustring&> SlotNameAppeared; /** For example, - * void on_name_vanished(const Glib::RefPtr<Gio::DBusConnection>& connection, + * void on_name_vanished(const Glib::RefPtr<Gio::DBus::Connection>& connection, * const Glib::ustring& name); * @ingroup DBus */ -typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring> SlotNameVanished; +typedef sigc::slot<void, const Glib::RefPtr<Gio::DBus::Connection>&, Glib::ustring> SlotNameVanished; //TODO: Add example from C API in class docs? /** Starts watching @a name on the bus specified by @a bus_type and calls @@ -55,7 +55,7 @@ typedef sigc::slot<void, const Glib::RefPtr<Gio::DBusConnection>&, Glib::ustring * unwatch_name() with the watcher id this function returns. * * If the name vanishes or appears (for example the application owning the - * name could restart), the slot are also invoked. If the DBusConnection + * name could restart), the slot are also invoked. If the Connection * that is used for watching the name disconnects, then @a * name_vanished_slot is invoked since it is no longer possible to access * the name. @@ -93,9 +93,9 @@ guint watch_name( ); _IGNORE(g_bus_watch_name) -/** A watch_name() function that takes a DBusConnection instead of a BusType. +/** A watch_name() function that takes a Connection instead of a BusType. * - * @param connection A DBusConnection. + * @param connection A Connection. * @param name The name (well-known or unique) to watch. * @param name_appeared_slot Slot to invoke when name is known to exist. * @param name_vanished_slot Slot to invoke when name is known to not @@ -108,7 +108,7 @@ _IGNORE(g_bus_watch_name) * @ingroup DBus */ guint watch_name( - const Glib::RefPtr<DBusConnection>& connection, + const Glib::RefPtr<Connection>& connection, const Glib::ustring& name, const SlotNameAppeared& name_appeared_slot = SlotNameAppeared(), const SlotNameVanished& name_vanished_slot = SlotNameVanished(), diff --git a/gio/src/error.hg b/gio/src/error.hg index 8bc9b1b9..f22b153e 100644 --- a/gio/src/error.hg +++ b/gio/src/error.hg @@ -40,10 +40,13 @@ namespace Gio /** Exception class for giomm errors. */ -_WRAP_GERROR(DBusError, GDBusError, G_DBUS_ERROR, NO_GTYPE) _WRAP_GERROR(Error, GIOErrorEnum, G_IO_ERROR, NO_GTYPE) _WRAP_GERROR(ResolverError, GResolverError, G_RESOLVER_ERROR, NO_GTYPE) +namespace DBus +{ +_WRAP_GERROR(Error, GDBusError, G_DBUS_ERROR, NO_GTYPE) +} //namespace DBus } // namespace Gio diff --git a/gio/src/filelist.am b/gio/src/filelist.am index 6f5a2814..cf5f7b1b 100644 --- a/gio/src/filelist.am +++ b/gio/src/filelist.am @@ -25,10 +25,10 @@ giomm_files_any_hg = \ credentials.hg \ datainputstream.hg \ dataoutputstream.hg \ - dbusaddress.hg \ + dbusaddress.hg \ dbusauthobserver.hg \ dbusconnection.hg \ - dbuserror.hg \ + dbuserrorutils.hg \ dbusintrospection.hg \ dbusmessage.hg \ dbusmethodinvocation.hg \ diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4 index b40c8167..54faac87 100644 --- a/tools/m4/convert_gio.m4 +++ b/tools/m4/convert_gio.m4 @@ -5,13 +5,13 @@ _CONV_ENUM(G,BusType) _CONV_ENUM(G,CredentialsType) _CONV_ENUM(G,DataStreamByteOrder) _CONV_ENUM(G,DataStreamNewlineType) -_CONV_ENUM(G,DBusCapabilityFlags) -_CONV_ENUM(G,DBusMessageFlags) -_CONV_ENUM(G,DBusMessageHeaderField) -_CONV_ENUM(G,DBusMessageType) -_CONV_ENUM(G,DBusProxyFlags) -_CONV_ENUM(G,DBusSendMessageFlags) -_CONV_ENUM(G,DBusServerFlags) +_CONV_ENUM(GDBus,CapabilityFlags) +_CONV_ENUM(GDBus,MessageFlags) +_CONV_ENUM(GDBus,MessageHeaderField) +_CONV_ENUM(GDBus,MessageType) +_CONV_ENUM(GDBus,ProxyFlags) +_CONV_ENUM(GDBus,SendMessageFlags) +_CONV_ENUM(GDBus,ServerFlags) _CONV_ENUM(G,DriveStartFlags) _CONV_ENUM(G,DriveStartFlags) _CONV_ENUM(G,DriveStartStopType) @@ -70,26 +70,26 @@ _CONVERSION(`GCredentials*',`Glib::RefPtr<Credentials>',`Glib::wrap($3)') _CONVERSION(`GCredentials*',`Glib::RefPtr<const Credentials>',`Glib::wrap($3)') # DBusConnection -_CONVERSION(`const Glib::RefPtr<DBusConnection>&',`GDBusConnection*',__CONVERT_REFPTR_TO_P) -_CONVERSION(`GDBusConnection*',`Glib::RefPtr<DBusConnection>',Glib::wrap($3)) -_CONVERSION(`GDBusConnection*',`Glib::RefPtr<const DBusConnection>',Glib::wrap($3)) +_CONVERSION(`const Glib::RefPtr<Connection>&',`GDBusConnection*',__CONVERT_REFPTR_TO_P) +_CONVERSION(`GDBusConnection*',`Glib::RefPtr<Connection>',Glib::wrap($3)) +_CONVERSION(`GDBusConnection*',`Glib::RefPtr<const Connection>',Glib::wrap($3)) # DBusMessage -_CONVERSION(`const Glib::RefPtr<DBusMessage>&',`GDBusMessage*',__CONVERT_REFPTR_TO_P) -_CONVERSION(`GDBusMessage*',`Glib::RefPtr<DBusMessage>',`Glib::wrap($3)') -_CONVERSION(`const Glib::RefPtr<const DBusMessage>&',`GDBusMessage*',__CONVERT_CONST_REFPTR_TO_P) +_CONVERSION(`const Glib::RefPtr<Message>&',`GDBusMessage*',__CONVERT_REFPTR_TO_P) +_CONVERSION(`GDBusMessage*',`Glib::RefPtr<Message>',`Glib::wrap($3)') +_CONVERSION(`const Glib::RefPtr<const Message>&',`GDBusMessage*',__CONVERT_CONST_REFPTR_TO_P) # DBus*Info -_CONVERSION(`GDBusMethodInfo*',`Glib::RefPtr<DBusMethodInfo>',`Glib::wrap($3)') -_CONVERSION(`GDBusSignalInfo*',`Glib::RefPtr<DBusSignalInfo>',`Glib::wrap($3)') -_CONVERSION(`GDBusPropertyInfo*',`Glib::RefPtr<DBusPropertyInfo>',`Glib::wrap($3)') -_CONVERSION(`GDBusNodeInfo*',`Glib::RefPtr<DBusNodeInfo>',`Glib::wrap($3)') -_CONVERSION(`GDBusInterfaceInfo*',`Glib::RefPtr<DBusInterfaceInfo>',`Glib::wrap($3)') -_CONVERSION(`const Glib::RefPtr<DBusInterfaceInfo>&',`GDBusInterfaceInfo*',`Glib::unwrap($3)') -_CONVERSION(`GDBusInterfaceInfo*',`const Glib::RefPtr<DBusInterfaceInfo>',`Glib::wrap($3)') +_CONVERSION(`GDBusMethodInfo*',`Glib::RefPtr<MethodInfo>',`Glib::wrap($3)') +_CONVERSION(`GDBusSignalInfo*',`Glib::RefPtr<SignalInfo>',`Glib::wrap($3)') +_CONVERSION(`GDBusPropertyInfo*',`Glib::RefPtr<PropertyInfo>',`Glib::wrap($3)') +_CONVERSION(`GDBusNodeInfo*',`Glib::RefPtr<NodeInfo>',`Glib::wrap($3)') +_CONVERSION(`GDBusInterfaceInfo*',`Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)') +_CONVERSION(`const Glib::RefPtr<InterfaceInfo>&',`GDBusInterfaceInfo*',`Glib::unwrap($3)') +_CONVERSION(`GDBusInterfaceInfo*',`const Glib::RefPtr<InterfaceInfo>',`Glib::wrap($3)') # DBusProxy -_CONVERSION(`GDBusProxy*',`Glib::RefPtr<DBusProxy>',`Glib::wrap($3)') +_CONVERSION(`GDBusProxy*',`Glib::RefPtr<Proxy>',`Glib::wrap($3)') # DesktopAppInfo _CONVERSION(`GDesktopAppInfo*', `Glib::RefPtr<DesktopAppInfo>', `Glib::wrap($3)') |