Add some conceptual changes

This commit is contained in:
Matthias Clasen 2010-05-09 02:27:09 -04:00
parent 8315eb77d5
commit bb7106c5df
3 changed files with 66 additions and 33 deletions

View File

@ -1,35 +1,68 @@
<chapter> <chapter>
<title>Migrating from dbus-glib to GDBus</title> <title>Migrating from dbus-glib to GDBus</title>
<table id="dbus-glib-vs-gdbus"> <section>
<title>dbus-glib functions and their GDBus counterparts</title> <title>Conceptual differences</title>
<tgroup cols="2">
<thead> <para>
<row><entry>dbus-glib</entry><entry>GDBus</entry></row> The central concepts of D-Bus are modelled in a very similar way
</thead> in dbus-glib and GDBus. Both have a objects representing connections,
<tbody> proxies and method invocations. But there are some important
<row><entry>dbus_g_bus_get()</entry><entry>g_bus_get_sync(), also see differences:
g_bus_get()</entry></row> <itemizedlist>
<row><entry>dbus_g_proxy_new_for_name()</entry><entry>g_dbus_proxy_new_sync(), also see <listitem><para>
g_dbus_proxy_new()</entry></row> dbus-glib uses libdbus, GDBus doesn't. Instead, it relies on GIO
<row><entry>dbus_g_proxy_add_signal()</entry><entry>not needed, use the generic #GDBusProxy::g-signal</entry></row> streams as transport layer, and has its own implementation for the
<row><entry>dbus_g_proxy_connect_signal()</entry><entry>use g_signal_connect() with #GDBusProxy::g-signal</entry></row> the D-Bus connection setup and authentication.
<row><entry>dbus_g_connection_register_g_object()</entry><entry>g_dbus_connection_register_object()</entry></row> </para></listitem>
<row><entry>dbus_g_connection_unregister_g_object()</entry><entry>g_dbus_connection_unregister_object()</entry></row> <listitem><para>
<row><entry>dbus_g_object_type_install_info()</entry><entry>introspection data is installed while registering dbus-glib uses the GObject type system for method arguments and
an object, see g_dbus_connection_register_object()</entry></row> return values, including a homegrown container specialization
<row><entry>dbus_g_proxy_begin_call()</entry><entry>g_dbus_proxy_invoke_method()</entry></row> mechanism. GDBus relies uses the #GVariant type system which is
<row><entry>dbus_g_proxy_end_call()</entry><entry>g_dbus_proxy_invoke_method_finish()</entry></row> explicitly designed to match D-Bus types.
<row><entry>dbus_g_proxy_call()</entry><entry>g_dbus_proxy_invoke_method_sync()</entry></row> </para></listitem>
<row><entry>dbus_g_error_domain_register()</entry><entry>g_dbus_error_register_error_domain()</entry></row> <listitem><para>
<row><entry>dbus_g_error_has_name()</entry><entry>no direct equivalent, see g_dbus_error_get_remote_error()</entry></row> The typical way to export an object in dbus-glib involves generating
<row><entry>dbus_g_method_return()</entry><entry>g_dbus_method_invocation_return_value()</entry></row> glue code from XML introspection data using <command>dbus-binding-tool</command>. GDBus does not (yet?) use code generation; you are expected to
<row><entry>dbus_g_method_return_error()</entry><entry>g_dbus_method_invocation_return_error() and variants</entry></row> embed the introspection data in your application code.
<row><entry>dbus_g_method_get_sender()</entry><entry>g_dbus_method_invocation_get_sender()</entry></row> </para></listitem>
</tbody> </itemizedlist>
</tgroup> </para>
</table> </section>
<para>
More hints for migrating from dbus-glib to GDBus will appear here shortly... <section>
</para> <title>Dbus-glib API conversion</title>
<table id="dbus-glib-vs-gdbus">
<title>dbus-glib APIs and their GDBus counterparts</title>
<tgroup cols="2">
<thead>
<row><entry>dbus-glib</entry><entry>GDBus</entry></row>
</thead>
<tbody>
<row><entry>#DBusGConnection</entry></entry>#GDBusConnection</entry></row>
<row><entry>#DBusGProxy</entry></entry>#GDBusProxy</entry></row>
<row><entry>#DBusGMethodInvocation</entry></entry>#GDBusMethodInvocatoin</entry></row>
<row><entry>dbus_g_bus_get()</entry><entry>g_bus_get_sync(), also see
g_bus_get()</entry></row>
<row><entry>dbus_g_proxy_new_for_name()</entry><entry>g_dbus_proxy_new_sync(), also see
g_dbus_proxy_new()</entry></row>
<row><entry>dbus_g_proxy_add_signal()</entry><entry>not needed, use the generic #GDBusProxy::g-signal</entry></row>
<row><entry>dbus_g_proxy_connect_signal()</entry><entry>use g_signal_connect() with #GDBusProxy::g-signal</entry></row>
<row><entry>dbus_g_connection_register_g_object()</entry><entry>g_dbus_connection_register_object()</entry></row>
<row><entry>dbus_g_connection_unregister_g_object()</entry><entry>g_dbus_connection_unregister_object()</entry></row>
<row><entry>dbus_g_object_type_install_info()</entry><entry>introspection data is installed while registering
an object, see g_dbus_connection_register_object()</entry></row>
<row><entry>dbus_g_proxy_begin_call()</entry><entry>g_dbus_proxy_invoke_method()</entry></row>
<row><entry>dbus_g_proxy_end_call()</entry><entry>g_dbus_proxy_invoke_method_finish()</entry></row>
<row><entry>dbus_g_proxy_call()</entry><entry>g_dbus_proxy_invoke_method_sync()</entry></row>
<row><entry>dbus_g_error_domain_register()</entry><entry>g_dbus_error_register_error_domain()</entry></row>
<row><entry>dbus_g_error_has_name()</entry><entry>no direct equivalent, see g_dbus_error_get_remote_error()</entry></row>
<row><entry>dbus_g_method_return()</entry><entry>g_dbus_method_invocation_return_value()</entry></row>
<row><entry>dbus_g_method_return_error()</entry><entry>g_dbus_method_invocation_return_error() and variants</entry></row>
<row><entry>dbus_g_method_get_sender()</entry><entry>g_dbus_method_invocation_get_sender()</entry></row>
</tbody>
</tgroup>
</table>
</section>
</chapter> </chapter>

View File

@ -46,7 +46,7 @@
* *
* Routines for working with D-Bus addresses. A D-Bus address is a string * Routines for working with D-Bus addresses. A D-Bus address is a string
* like "unix:tmpdir=/tmp/my-app-name". The exact format of addresses * like "unix:tmpdir=/tmp/my-app-name". The exact format of addresses
* is explained in detail in the <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html#addresses">D-Bus specification</link>. * is explained in detail in the <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html&num;addresses">D-Bus specification</link>.
*/ */
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -41,7 +41,7 @@
* used when registering objects with g_dbus_connection_register_object(). * used when registering objects with g_dbus_connection_register_object().
* *
* The format of D-BUs introspection XML is specified in the * The format of D-BUs introspection XML is specified in the
* <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format">D-Bus specification</link>. * <link linkend="http://dbus.freedesktop.org/doc/dbus-specification.html&num;introspection-format">D-Bus specification</link>.
*/ */
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */