Explicitly don't search XDG_DATA_DIRS for system services, and document it
[platform/upstream/dbus.git] / doc / dbus-tutorial.xml
index a5b210b..5c385f0 100644 (file)
@@ -6,18 +6,16 @@
 
 <article id="index">
   <articleinfo>
-    <title>D-BUS Tutorial</title>
-    <releaseinfo>Version 0.4.1</releaseinfo>
-    <date>15 July 2005</date>
+    <title>D-Bus Tutorial</title>
+    <releaseinfo>Version 0.5.0</releaseinfo>
+    <date>20 August 2006</date>
     <authorgroup>
       <author>
        <firstname>Havoc</firstname>
        <surname>Pennington</surname>
        <affiliation>
          <orgname>Red Hat, Inc.</orgname>
-         <address>
-           <email>hp@pobox.com</email>
-         </address>
+         <address><email>hp@pobox.com</email></address>
        </affiliation>
       </author>
       <author>
@@ -29,9 +27,7 @@
        <surname>Palmieri</surname>
        <affiliation>
          <orgname>Red Hat, Inc.</orgname>
-         <address>
-           <email>johnp@redhat.com</email>
-         </address>
+         <address><email>johnp@redhat.com</email></address>
        </affiliation>
       </author>
       <author>
        <surname>Walters</surname>
        <affiliation>
          <orgname>Red Hat, Inc.</orgname>
-         <address>
-           <email>walters@redhat.com</email>
-         </address>
+         <address><email>walters@redhat.com</email></address>
        </affiliation>
       </author>
     </authorgroup>
   </articleinfo>
 
+  <sect1 id="meta">
+    <title>Tutorial Work In Progress</title>
+    
+    <para>
+      This tutorial is not complete; it probably contains some useful information, but 
+      also has plenty of gaps. Right now, you'll also need to refer to the D-Bus specification,
+      Doxygen reference documentation, and look at some examples of how other apps use D-Bus.
+    </para>
+
+    <para>
+      Enhancing the tutorial is definitely encouraged - send your patches or suggestions to the
+      mailing list. If you create a D-Bus binding, please add a section to the tutorial for your 
+      binding, if only a short section with a couple of examples.
+    </para>
+
+  </sect1>
+
   <sect1 id="whatis">
-    <title>What is D-BUS?</title>
+    <title>What is D-Bus?</title>
     <para>
-      D-BUS is a system for <firstterm>interprocess communication</firstterm>
+      D-Bus is a system for <firstterm>interprocess communication</firstterm>
       (IPC). Architecturally, it has several layers:
 
       <itemizedlist>
         </listitem>
         <listitem>
           <para>
-            <firstterm>Wrapper libraries</firstterm> based on particular
-            application frameworks.  For example, libdbus-glib and
+            <firstterm>Wrapper libraries</firstterm> or <firstterm>bindings</firstterm> 
+            based on particular application frameworks.  For example, libdbus-glib and
             libdbus-qt. There are also bindings to languages such as
             Python. These wrapper libraries are the API most people should use,
-            as they simplify the details of D-BUS programming. libdbus is 
+            as they simplify the details of D-Bus programming. libdbus is 
             intended to be a low-level backend for the higher level bindings.
             Much of the libdbus API is only useful for binding implementation.
           </para>
     </para>
 
     <para>
-      If you just want to use D-BUS and don't care how it works, jump directly
-      to <xref linkend="concepts"/>.
-      Otherwise, read on.
-    </para>
-
-    <para>
       libdbus only supports one-to-one connections, just like a raw network
       socket. However, rather than sending byte streams over the connection, you
       send <firstterm>messages</firstterm>. Messages have a header identifying
     </para>
 
     <sect2 id="uses">
-      <title>D-BUS applications</title>
+      <title>D-Bus applications</title>
       <para>
         There are many, many technologies in the world that have "Inter-process
         communication" or "networking" in their stated purpose: <ulink
         url="http://www.zeroc.com/ice.html">Internet Communications Engine (ICE)</ulink>,
         and probably hundreds more.
         Each of these is tailored for particular kinds of application.
-        D-BUS is designed for two specific cases:
+        D-Bus is designed for two specific cases:
         <itemizedlist>
           <listitem>
             <para>
       <para>
         For the within-desktop-session use case, the GNOME and KDE desktops 
         have significant previous experience with different IPC solutions
-        such as CORBA and DCOP. D-BUS is built on that experience and 
+        such as CORBA and DCOP. D-Bus is built on that experience and 
         carefully tailored to meet the needs of these desktop projects 
-        in particular. D-BUS may or may not be appropriate for other 
+        in particular. D-Bus may or may not be appropriate for other 
         applications; the FAQ has some comparisons to other IPC systems.
       </para>
       <para>
         </blockquote>
       </para>
       <para>
-        D-BUS may happen to be useful for purposes other than the one it was
+        D-Bus may happen to be useful for purposes other than the one it was
         designed for. Its general properties that distinguish it from 
         other forms of IPC are:
         <itemizedlist>
           <listitem>
             <para>
               Many implementation and deployment issues are specified rather
-              than left ambiguous.
+              than left ambiguous/configurable/pluggable.
             </para>
           </listitem>
           <listitem>
     <title>Concepts</title>
     <para>
       Some basic concepts apply no matter what application framework you're
-      using to write a D-BUS application. The exact code you write will be
+      using to write a D-Bus application. The exact code you write will be
       different for GLib vs. Qt vs. Python applications, however.
     </para>
     
     </para>
 
     <sect2 id="objects">
-      <title>Objects and Object Paths</title>
+      <title>Native Objects and Object Paths</title>
       <para>
-        Each application using D-BUS contains <firstterm>objects</firstterm>,
-        which generally map to GObject, QObject, C++ objects, or Python objects
-        (but need not).  An object is an <emphasis>instance</emphasis> rather
-        than a type.  When messages are received over a D-BUS connection, they
-        are sent to a specific object, not to the application as a whole.
+        Your programming framework probably defines what an "object" is like;
+        usually with a base class. For example: java.lang.Object, GObject, QObject,
+        python's base Object, or whatever. Let's call this a <firstterm>native object</firstterm>.
       </para>
       <para>
-        To allow messages to specify their destination object, there has to be a
-        way to refer to an object. In your favorite programming language, this
-        is normally called a <firstterm>pointer</firstterm> or
-        <firstterm>reference</firstterm>. However, these references are
-        implemented as memory addresses relative to the address space of your
-        application, and thus can't be passed from one application to another.
+        The low-level D-Bus protocol, and corresponding libdbus API, does not care about native objects. 
+        However, it provides a concept called an 
+        <firstterm>object path</firstterm>. The idea of an object path is that 
+        higher-level bindings can name native object instances, and allow remote applications 
+        to refer to them.
       </para>
       <para>
-        To solve this, D-BUS introduces a name for each object. The name 
+        The object path
         looks like a filesystem path, for example an object could be 
         named <literal>/org/kde/kspread/sheets/3/cells/4/5</literal>. 
         Human-readable paths are nice, but you are free to create an 
       </para>
     </sect2>    
 
+    <sect2 id="members">
+      <title>Methods and Signals</title>
+
+      <para>
+        Each object has <firstterm>members</firstterm>; the two kinds of member
+        are <firstterm>methods</firstterm> and
+        <firstterm>signals</firstterm>. Methods are operations that can be
+        invoked on an object, with optional input (aka arguments or "in
+        parameters") and output (aka return values or "out parameters").
+        Signals are broadcasts from the object to any interested observers 
+        of the object; signals may contain a data payload.
+      </para>
+
+      <para>
+        Both methods and signals are referred to by name, such as 
+        "Frobate" or "OnClicked".
+      </para>
+
+    </sect2>
+
     <sect2 id="interfaces">
       <title>Interfaces</title>
       <para>
         just as it is in GLib or Qt or Java. Interfaces define the 
         <emphasis>type</emphasis> of an object instance.
       </para>
+      <para>
+        DBus identifies interfaces with a simple namespaced string,
+        something like <literal>org.freedesktop.Introspectable</literal>.
+        Most bindings will map these interface names directly to 
+        the appropriate programming language construct, for example 
+        to Java interfaces or C++ pure virtual classes.
+      </para>
     </sect2>
-      
-    <sect2 id="messages">
-      <title>Message Types</title>
+
+    <sect2 id="proxies">
+      <title>Proxies</title>
       <para>
-        Messages are not all the same; in particular, D-BUS has 
-        4 built-in message types:
-        <itemizedlist>
-          <listitem>
-            <para>
-              Method call messages ask to invoke a method 
-              on an object.
-            </para>
-          </listitem>
-          <listitem>
-            <para>
-              Method return messages return the results 
-              of invoking a method.
-            </para>
-          </listitem>
-          <listitem>
-            <para>
-              Error messages return an exception caused by 
-              invoking a method.
-            </para>
-          </listitem>
-          <listitem>
-            <para>
-              Signal messages are notifications that a given signal 
-              has been emitted (that an event has occurred). 
-              You could also think of these as "event" messages.
-            </para>
-          </listitem>
-        </itemizedlist>
+        A <firstterm>proxy object</firstterm> is a convenient native object created to 
+        represent a remote object in another process. The low-level DBus API involves manually creating 
+        a method call message, sending it, then manually receiving and processing 
+        the method reply message. Higher-level bindings provide proxies as an alternative.
+        Proxies look like a normal native object; but when you invoke a method on the proxy 
+        object, the binding converts it into a DBus method call message, waits for the reply 
+        message, unpacks the return value, and returns it from the native method..
       </para>
       <para>
-        A method call maps very simply to messages, then: you send a method call
-        message, and receive either a method return message or an error message
-        in reply.
+        In pseudocode, programming without proxies might look like this:
+        <programlisting>
+          Message message = new Message("/remote/object/path", "MethodName", arg1, arg2);
+          Connection connection = getBusConnection();
+          connection.send(message);
+          Message reply = connection.waitForReply(message);
+          if (reply.isError()) {
+             
+          } else {
+             Object returnValue = reply.getReturnValue();
+          }
+        </programlisting>
+      </para>
+      <para>
+        Programming with proxies might look like this:
+        <programlisting>
+          Proxy proxy = new Proxy(getBusConnection(), "/remote/object/path");
+          Object returnValue = proxy.MethodName(arg1, arg2);
+        </programlisting>
       </para>
     </sect2>
 
     <sect2 id="bus-names">
       <title>Bus Names</title>
-      
+
       <para>
-        Object paths, interfaces, and messages exist on the level of 
-        libdbus and the D-BUS protocol; they are used even in the 
-        1-to-1 case with no message bus involved.
+        When each application connects to the bus daemon, the daemon immediately
+        assigns it a name, called the <firstterm>unique connection name</firstterm>.
+        A unique name begins with a ':' (colon) character. These names are never 
+        reused during the lifetime of the bus daemon - that is, you know 
+        a given name will always refer to the same application.
+        An example of a unique name might be
+        <literal>:34-907</literal>. The numbers after the colon have 
+        no meaning other than their uniqueness.
       </para>
 
       <para>
-        Bus names, on the other hand, are a property of the message bus daemon.
-        The bus maintains a mapping from names to message bus connections.
-        These names are used to specify the origin and destination
-        of messages passing through the message bus. When a name is mapped 
+        When a name is mapped 
         to a particular application's connection, that application is said to 
         <firstterm>own</firstterm> that name.
       </para>
 
       <para>
-        On connecting to the bus daemon, each application immediately owns a
-        special name called the <firstterm>unique connection name</firstterm>.
-        A unique name begins with a ':' (colon) character; no other names are
-        allowed to begin with that character. Unique names are special because
-        they are created dynamically, and are never re-used during the lifetime
-        of the same bus daemon. You know that a given unique name will have the
-        same owner at all times.  An example of a unique name might be
-        <literal>:34-907</literal>. The numbers after the colon have 
-        no meaning other than their uniqueness.
-      </para>
-
-      <para>
         Applications may ask to own additional <firstterm>well-known
         names</firstterm>. For example, you could write a specification to
         define a name called <literal>com.mycompany.TextEditor</literal>.
         Your definition could specify that to own this name, an application
         should have an object at the path
         <literal>/com/mycompany/TextFileManager</literal> supporting the
-        interface <literal>org.freedesktop.FileHandler</literal>.        
+        interface <literal>org.freedesktop.FileHandler</literal>.
       </para>
       
       <para>
         monitor the lifetime of other applications.
       </para>
 
+      <para>
+        Bus names can also be used to coordinate single-instance applications.
+        If you want to be sure only one
+        <literal>com.mycompany.TextEditor</literal> application is running for
+        example, have the text editor application exit if the bus name already
+        has an owner.
+      </para>
+
     </sect2>
 
     <sect2 id="addresses">
       <title>Addresses</title>
 
       <para>
-        Applications using D-BUS are either servers or clients.  A server
+        Applications using D-Bus are either servers or clients.  A server
         listens for incoming connections; a client connects to a server. Once
         the connection is established, it is a symmetric flow of messages; the
         client-server distinction only matters when setting up the 
       </para>
 
       <para>
-        A D-BUS <firstterm>address</firstterm> specifies where a server will
+        If you're using the bus daemon, as you probably are, your application 
+        will be a client of the bus daemon. That is, the bus daemon listens 
+        for connections and your application initiates a connection to the bus 
+        daemon.
+      </para>
+
+      <para>
+        A D-Bus <firstterm>address</firstterm> specifies where a server will
         listen, and where a client will connect.  For example, the address
         <literal>unix:path=/tmp/abcdef</literal> specifies that the server will
         listen on a UNIX domain socket at the path
         <literal>/tmp/abcdef</literal> and the client will connect to that
         socket. An address can also specify TCP/IP sockets, or any other
-        transport defined in future iterations of the D-BUS specification.
+        transport defined in future iterations of the D-Bus specification.
       </para>
 
       <para>
-        When using D-BUS with a message bus, the bus daemon is a server 
-        and all other applications are clients of the bus daemon.
+        When using D-Bus with a message bus daemon,
         libdbus automatically discovers the address of the per-session bus 
         daemon by reading an environment variable. It discovers the 
         systemwide bus daemon by checking a well-known UNIX domain socket path
       </para>
 
       <para>
-        If you're using D-BUS without a bus daemon, it's up to you to 
+        If you're using D-Bus without a bus daemon, it's up to you to 
         define which application will be the server and which will be 
         the client, and specify a mechanism for them to agree on 
-        the server's address.
+        the server's address. This is an unusual case.
       </para>
 
     </sect2>
         The interface is also optional, primarily for historical 
         reasons; DCOP does not require specifying the interface, 
         instead simply forbidding duplicate method names 
-        on the same object instance. D-BUS will thus let you 
+        on the same object instance. D-Bus will thus let you 
         omit the interface, but if your method name is ambiguous 
         it is undefined which method will be invoked.
       </para>
-      
+
+    </sect2>
+
+    <sect2 id="messages">
+      <title>Messages - Behind the Scenes</title>
+      <para>
+        D-Bus works by sending messages between processes. If you're using 
+        a sufficiently high-level binding, you may never work with messages directly.
+      </para>
+      <para>
+        There are 4 message types:
+        <itemizedlist>
+          <listitem>
+            <para>
+              Method call messages ask to invoke a method 
+              on an object.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              Method return messages return the results 
+              of invoking a method.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              Error messages return an exception caused by 
+              invoking a method.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              Signal messages are notifications that a given signal 
+              has been emitted (that an event has occurred). 
+              You could also think of these as "event" messages.
+            </para>
+          </listitem>
+        </itemizedlist>
+      </para>
+      <para>
+        A method call maps very simply to messages: you send a method call
+        message, and receive either a method return message or an error message
+        in reply.
+      </para>
+      <para>
+        Each message has a <firstterm>header</firstterm>, including <firstterm>fields</firstterm>, 
+        and a <firstterm>body</firstterm>, including <firstterm>arguments</firstterm>. You can think 
+        of the header as the routing information for the message, and the body as the payload.
+        Header fields might include the sender bus name, destination bus name, method or signal name, 
+        and so forth. One of the header fields is a <firstterm>type signature</firstterm> describing the 
+        values found in the body. For example, the letter "i" means "32-bit integer" so the signature 
+        "ii" means the payload has two 32-bit integers.
+      </para>
+    </sect2>
+
+    <sect2 id="callprocedure">
+      <title>Calling a Method - Behind the Scenes</title>
+
+      <para>
+        A method call in DBus consists of two messages; a method call message sent from process A to process B, 
+        and a matching method reply message sent from process B to process A. Both the call and the reply messages
+        are routed through the bus daemon. The caller includes a different serial number in each call message, and the
+        reply message includes this number to allow the caller to match replies to calls.
+      </para>
+
+      <para>
+        The call message will contain any arguments to the method.
+        The reply message may indicate an error, or may contain data returned by the method.
+      </para>
+
+      <para>
+        A method invocation in DBus happens as follows:
+        <itemizedlist>
+          <listitem>
+            <para>
+              The language binding may provide a proxy, such that invoking a method on 
+              an in-process object invokes a method on a remote object in another process. If so, the 
+              application calls a method on the proxy, and the proxy
+              constructs a method call message to send to the remote process.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              For more low-level APIs, the application may construct a method call message itself, without
+              using a proxy.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              In either case, the method call message contains: a bus name belonging to the remote process; the name of the method; 
+              the arguments to the method; an object path inside the remote process; and optionally the name of the 
+              interface that specifies the method.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The method call message is sent to the bus daemon.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The bus daemon looks at the destination bus name. If a process owns that name, 
+              the bus daemon forwards the method call to that process. Otherwise, the bus daemon
+              creates an error message and sends it back as the reply to the method call message.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The receiving process unpacks the method call message. In a simple low-level API situation, it 
+              may immediately run the method and send a method reply message to the bus daemon.
+              When using a high-level binding API, the binding might examine the object path, interface,
+              and method name, and convert the method call message into an invocation of a method on 
+              a native object (GObject, java.lang.Object, QObject, etc.), then convert the return 
+              value from the native method into a method reply message.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The bus daemon receives the method reply message and sends it to the process that 
+              made the method call.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The process that made the method call looks at the method reply and makes use of any 
+              return values included in the reply. The reply may also indicate that an error occurred.
+              When using a binding, the method reply message may be converted into the return value of 
+              of a proxy method, or into an exception.
+            </para>
+          </listitem>
+        </itemizedlist>
+      </para>
+
+      <para>
+        The bus daemon never reorders messages. That is, if you send two method call messages to the same recipient, 
+        they will be received in the order they were sent. The recipient is not required to reply to the calls
+        in order, however; for example, it may process each method call in a separate thread, and return reply messages
+        in an undefined order depending on when the threads complete. Method calls have a unique serial 
+        number used by the method caller to match reply messages to call messages.
+      </para>
+
+    </sect2>
+
+    <sect2 id="signalprocedure">
+      <title>Emitting a Signal - Behind the Scenes</title>
+
+      <para>
+        A signal in DBus consists of a single message, sent by one process to any number of other processes. 
+        That is, a signal is a unidirectional broadcast. The signal may contain arguments (a data payload), but 
+        because it is a broadcast, it never has a "return value." Contrast this with a method call 
+        (see <xref linkend="callprocedure"/>) where the method call message has a matching method reply message.
+      </para>
+
+      <para>
+        The emitter (aka sender) of a signal has no knowledge of the signal recipients. Recipients register
+        with the bus daemon to receive signals based on "match rules" - these rules would typically include the sender and 
+        the signal name. The bus daemon sends each signal only to recipients who have expressed interest in that 
+        signal.
+      </para>
+
+      <para>
+        A signal in DBus happens as follows:
+        <itemizedlist>
+          <listitem>
+            <para>
+              A signal message is created and sent to the bus daemon. When using the low-level API this may be 
+              done manually, with certain bindings it may be done for you by the binding when a native object
+              emits a native signal or event.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The signal message contains the name of the interface that specifies the signal;
+              the name of the signal; the bus name of the process sending the signal; and 
+              any arguments 
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              Any process on the message bus can register "match rules" indicating which signals it 
+              is interested in. The bus has a list of registered match rules.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              The bus daemon examines the signal and determines which processes are interested in it.
+              It sends the signal message to these processes.
+            </para>
+          </listitem>
+          <listitem>
+            <para>
+              Each process receiving the signal decides what to do with it; if using a binding, 
+              the binding may choose to emit a native signal on a proxy object. If using the 
+              low-level API, the process may just look at the signal sender and name and decide
+              what to do based on that.
+            </para>
+          </listitem>
+        </itemizedlist>
+      </para>
+
+    </sect2>
+
+    <sect2 id="introspection">
+      <title>Introspection</title>
+
+      <para>
+        D-Bus objects may support the interface <literal>org.freedesktop.DBus.Introspectable</literal>.
+        This interface has one method <literal>Introspect</literal> which takes no arguments and returns
+        an XML string. The XML string describes the interfaces, methods, and signals of the object.
+        See the D-Bus specification for more details on this introspection format.
+      </para>
+
     </sect2>
 
   </sect1>
 
     <para>
       The GLib binding is defined in the header file
-      &lt;dbus/dbus-glib.h&gt;.
+      <literal>&lt;dbus/dbus-glib.h&gt;</literal>.
     </para>
 
     <sect2 id="glib-typemappings">
-      <title>D-BUS - GLib type mappings</title>
+      <title>D-Bus - GLib type mappings</title>
       <para>
-       The heart of the GLib bindings for D-BUS is the mapping it
-       provides between D-BUS "type signatures" and GLib types
-       (<literal>GType</literal>). The D-BUS type system is composed of
+       The heart of the GLib bindings for D-Bus is the mapping it
+       provides between D-Bus "type signatures" and GLib types
+       (<literal>GType</literal>). The D-Bus type system is composed of
        a number of "basic" types, along with several "container" types.
       </para>
       <sect3 id="glib-basic-typemappings">
            <tgroup cols="4">
              <thead>
                <row>
-                 <entry>D-BUS basic type</entry>
+                 <entry>D-Bus basic type</entry>
                  <entry>GType</entry>
                  <entry>Free function</entry>
                  <entry>Notes</entry>
                  <entry><literal>INT16</literal></entry>
                  <entry><literal>G_TYPE_INT</literal></entry>
                  <entry></entry>
-                 <entry>Will be changed to a G_TYPE_INT16 once GLib has it</entry>
+                 <entry>Will be changed to a <literal>G_TYPE_INT16</literal> once GLib has it</entry>
                  </row><row>
                  <entry><literal>UINT16</literal></entry>
                  <entry><literal>G_TYPE_UINT</literal></entry>
                  <entry></entry>
-                 <entry>Will be changed to a G_TYPE_UINT16 once GLib has it</entry>
+                 <entry>Will be changed to a <literal>G_TYPE_UINT16</literal> once GLib has it</entry>
                  </row><row>
                  <entry><literal>INT32</literal></entry>
                  <entry><literal>G_TYPE_INT</literal></entry>
                  <entry></entry>
-                 <entry>Will be changed to a G_TYPE_INT32 once GLib has it</entry>
+                 <entry>Will be changed to a <literal>G_TYPE_INT32</literal> once GLib has it</entry>
                  </row><row>
                  <entry><literal>UINT32</literal></entry>
                  <entry><literal>G_TYPE_UINT</literal></entry>
                  <entry></entry>
-                 <entry>Will be changed to a G_TYPE_UINT32 once GLib has it</entry>
+                 <entry>Will be changed to a <literal>G_TYPE_UINT32</literal> once GLib has it</entry>
                  </row><row>
                  <entry><literal>INT64</literal></entry>
                  <entry><literal>G_TYPE_GINT64</literal></entry>
                  </row><row>
                  <entry><literal>STRING</literal></entry>
                  <entry><literal>G_TYPE_STRING</literal></entry>
-                 <entry>g_free</entry>
+                 <entry><literal>g_free</literal></entry>
                  <entry></entry>
                  </row><row>
                  <entry><literal>OBJECT_PATH</literal></entry>
                  <entry><literal>DBUS_TYPE_G_PROXY</literal></entry>
-                 <entry>g_object_unref</entry>
+                 <entry><literal>g_object_unref</literal></entry>
                  <entry>The returned proxy does not have an interface set; use <literal>dbus_g_proxy_set_interface</literal> to invoke methods</entry>
                </row>
              </tbody>
       <sect3 id="glib-container-typemappings">
        <title>Container type mappings</title>
        <para>
-         The D-BUS type system also has a number of "container"
+         The D-Bus type system also has a number of "container"
          types, such as <literal>DBUS_TYPE_ARRAY</literal> and
-         <literal>DBUS_TYPE_STRUCT</literal>.  The D-BUS type system
+         <literal>DBUS_TYPE_STRUCT</literal>.  The D-Bus type system
          is fully recursive, so one can for example have an array of
          array of strings (i.e. type signature
          <literal>aas</literal>).
          "natural".
        </para>
        <para>
-         First, D-BUS type signatures which have an "obvious"
-         corresponding builtin GLib type are mapped using that type:
+         First, D-Bus type signatures which have an "obvious"
+         corresponding built-in GLib type are mapped using that type:
          <informaltable>
            <tgroup cols="6">
              <thead>
                <row>
-                 <entry>D-BUS type signature</entry>
+                 <entry>D-Bus type signature</entry>
                  <entry>Description</entry>
                  <entry>GType</entry>
                  <entry>C typedef</entry>
                  <entry>Array of strings</entry>
                  <entry><literal>G_TYPE_STRV</literal></entry>
                  <entry><literal>char **</literal></entry>
-                 <entry>g_strfreev</entry>
+                 <entry><literal>g_strfreev</literal></entry>
                  <entry></entry>
                  </row><row>
                  <entry><literal>v</literal></entry>
                  <entry>Generic value container</entry>
                  <entry><literal>G_TYPE_VALUE</literal></entry>
                  <entry><literal>GValue *</literal></entry>
-                 <entry>g_value_unset</entry>
+                 <entry><literal>g_value_unset</literal></entry>
                  <entry>The calling conventions for values expect that method callers have allocated return values; see below.</entry>
                </row>
              </tbody>
          contained type.  Why we need this we will see below.
        </para>
        <para>
-         The approach taken is to create these types in the D-BUS GLib
-         bindings; however, there is nothing D-BUS specific about them.
+         The approach taken is to create these types in the D-Bus GLib
+         bindings; however, there is nothing D-Bus specific about them.
          In the future, we hope to include such "fundamental" types in GLib
          itself.
          <informaltable>
            <tgroup cols="6">
              <thead>
                <row>
-                 <entry>D-BUS type signature</entry>
+                 <entry>D-Bus type signature</entry>
                  <entry>Description</entry>
                  <entry>GType</entry>
                  <entry>C typedef</entry>
          </informaltable>
        </para>
        <para>
-         D-BUS also includes a special type DBUS_TYPE_DICT_ENTRY which
+         D-Bus also includes a special type DBUS_TYPE_DICT_ENTRY which
          is only valid in arrays.  It's intended to be mapped to a "dictionary"
          type by bindings.  The obvious GLib mapping here is GHashTable.  Again,
          however, there is no builtin <literal>GType</literal> for a GHashTable.
            <tgroup cols="6">
              <thead>
                <row>
-                 <entry>D-BUS type signature</entry>
+                 <entry>D-Bus type signature</entry>
                  <entry>Description</entry>
                  <entry>GType</entry>
                  <entry>C typedef</entry>
       <sect3 id="glib-generic-typemappings">
        <title>Arbitrarily recursive type mappings</title>
        <para>
-         Finally, it is possible users will want to write or invoke D-BUS
+         Finally, it is possible users will want to write or invoke D-Bus
          methods which have arbitrarily complex type signatures not
          directly supported by these bindings.  For this case, we have a
          <literal>DBusGValue</literal> which acts as a kind of special
     </sect2>
     <sect2 id="sample-program-1">
       <title>A sample program</title>
-      <para>Here is a D-BUS program using the GLib bindings.
+      <para>Here is a D-Bus program using the GLib bindings.
 <programlisting>      
 int
 main (int argc, char **argv)
@@ -836,7 +1074,7 @@ main (int argc, char **argv)
       <para>
        You have a number of choices for method invocation.  First, as
        used above, <literal>dbus_g_proxy_call</literal> sends a
-       method call to the remote object, and blocks until reply is
+       method call to the remote object, and blocks until reply is
        recieved.  The outgoing arguments are specified in the varargs
        array, terminated with <literal>G_TYPE_INVALID</literal>.
        Next, pointers to return values are specified, followed again
@@ -878,9 +1116,9 @@ main (int argc, char **argv)
       <itemizedlist>
        <listitem>
          <para>
-           An internal D-BUS error, such as an out-of-memory
+           An internal D-Bus error, such as an out-of-memory
            condition, an I/O error, or a network timeout.  Errors
-           generated by the D-BUS library itself have the domain
+           generated by the D-Bus library itself have the domain
            <literal>DBUS_GERROR</literal>, and a corresponding code
            such as <literal>DBUS_GERROR_NO_MEMORY</literal>.  It will
            not be typical for applications to handle these errors
@@ -889,8 +1127,8 @@ main (int argc, char **argv)
        </listitem>
        <listitem>
          <para>
-           A remote D-BUS exception, thrown by the peer, bus, or
-           service.  D-BUS remote exceptions have both a textual
+           A remote D-Bus exception, thrown by the peer, bus, or
+           service.  D-Bus remote exceptions have both a textual
            "name" and a "message".  The GLib bindings store this
            information in the <literal>GError</literal>, but some
            special rules apply.
@@ -1073,12 +1311,89 @@ main (int argc, char **argv)
        </para>
       </sect3>
     </sect2>
+
+    <sect2 id="glib-generated-bindings">
+      <title>Generated Bindings</title>
+      <para>
+        By using the Introspection XML files, convenient client-side bindings
+        can be automatically created to ease the use of a remote DBus object.
+      </para>
+      <para>
+        Here is a sample XML file which describes an object that exposes
+        one method, named <literal>ManyArgs</literal>.
+        <programlisting>
+&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;node name="/com/example/MyObject"&gt;
+  &lt;interface name="com.example.MyObject"&gt;
+    &lt;method name="ManyArgs"&gt;
+      &lt;arg type="u" name="x" direction="in" /&gt;
+      &lt;arg type="s" name="str" direction="in" /&gt;
+      &lt;arg type="d" name="trouble" direction="in" /&gt;
+      &lt;arg type="d" name="d_ret" direction="out" /&gt;
+      &lt;arg type="s" name="str_ret" direction="out" /&gt;
+    &lt;/method&gt;
+  &lt;/interface&gt;
+&lt;/node&gt;
+</programlisting>
+      </para>
+      <para>
+        Run <literal>dbus-binding-tool --mode=glib-client
+          <replaceable>FILENAME</replaceable> &gt;
+          <replaceable>HEADER_NAME</replaceable></literal> to generate the header
+        file.  For example: <command>dbus-binding-tool --mode=glib-client
+          my-object.xml &gt; my-object-bindings.h</command>.  This will generate
+        inline functions with the following prototypes:
+        <programlisting>
+/* This is a blocking call */
+gboolean
+com_example_MyObject_many_args (DBusGProxy *proxy, const guint IN_x,
+                                const char * IN_str, const gdouble IN_trouble,
+                                gdouble* OUT_d_ret, char ** OUT_str_ret,
+                                GError **error);
+
+/* This is a non-blocking call */
+DBusGProxyCall*
+com_example_MyObject_many_args_async (DBusGProxy *proxy, const guint IN_x,
+                                      const char * IN_str, const gdouble IN_trouble,
+                                      com_example_MyObject_many_args_reply callback,
+                                      gpointer userdata);
+
+/* This is the typedef for the non-blocking callback */
+typedef void
+(*com_example_MyObject_many_args_reply)
+(DBusGProxy *proxy, gdouble OUT_d_ret, char * OUT_str_ret,
+ GError *error, gpointer userdata);
+</programlisting>
+        The first argument in all functions is a <literal>DBusGProxy
+        *</literal>, which you should create with the usual
+        <literal>dbus_g_proxy_new_*</literal> functions.  Following that are the
+        "in" arguments, and then either the "out" arguments and a
+        <literal>GError *</literal> for the synchronous (blocking) function, or
+        callback and user data arguments for the asynchronous (non-blocking)
+        function.  The callback in the asynchronous function passes the
+        <literal>DBusGProxy *</literal>, the returned "out" arguments, an
+        <literal>GError *</literal> which is set if there was an error otherwise
+        <literal>NULL</literal>, and the user data.
+      </para>
+      <para>
+        As with the server-side bindings support (see <xref
+        linkend="glib-server"/>), the exact behaviour of the client-side
+        bindings can be manipulated using "annotations".  Currently the only
+        annotation used by the client bindings is
+        <literal>org.freedesktop.DBus.GLib.NoReply</literal>, which sets the
+        flag indicating that the client isn't expecting a reply to the method
+        call, so a reply shouldn't be sent.  This is often used to speed up
+        rapid method calls where there are no "out" arguments, and not knowing
+        if the method succeeded is an acceptable compromise to half the traffic
+        on the bus.
+      </para>
+    </sect2>
   </sect1>
 
   <sect1 id="glib-server">
     <title>GLib API: Implementing Objects</title>
     <para>
-      At the moment, to expose a GObject via D-BUS, you must
+      At the moment, to expose a GObject via D-Bus, you must
       write XML by hand which describes the methods exported
       by the object.  In the future, this manual step will
       be obviated by the upcoming GLib introspection support.
@@ -1107,7 +1422,7 @@ main (int argc, char **argv)
 </programlisting>
     </para>
     <para>
-      This XML is in the same format as the D-BUS introspection XML
+      This XML is in the same format as the D-Bus introspection XML
       format. Except we must include an "annotation" which give the C
       symbols corresponding to the object implementation prefix
       (<literal>my_object</literal>).  In addition, if particular
@@ -1118,13 +1433,13 @@ main (int argc, char **argv)
     </para>
     <para>
       Once you have written this XML, run <literal>dbus-binding-tool --mode=glib-server <replaceable>FILENAME</replaceable> &gt; <replaceable>HEADER_NAME</replaceable>.</literal> to
-      generate a header file.  For example: <command>dbus-binding-tool --mode=glib-server my-objet.xml &gt; my-object-glue.h</command>.
+      generate a header file.  For example: <command>dbus-binding-tool --mode=glib-server my-object.xml &gt; my-object-glue.h</command>.
     </para>
     <para>
       Next, include the generated header in your program, and invoke
-      <literal>dbus_g_object_class_install_info</literal>, passing the
-      object class and "object info" included in the header.  For
-      example:
+      <literal>dbus_g_object_class_install_info</literal> in the class
+      initializer, passing the object class and "object info" included in the
+      header.  For example:
       <programlisting>
        dbus_g_object_type_install_info (COM_FOO_TYPE_MY_OBJECT, &amp;com_foo_my_object_info);
       </programlisting>
@@ -1177,554 +1492,161 @@ main (int argc, char **argv)
                                                obj);
       </programlisting>
     </para>
-  </sect1>
-
-  <sect1 id="python-client">
-    <title>Python API: Using Remote Objects</title>
-    <para>
-      The Python bindings provide a simple to use interface for talking over D-BUS.
-      Where possible much of the inner-workings of D-BUS are hidden behind what looks
-      like normal Python objects.
-    </para>
-    <sect2 id="python-typemappings">
-      <title>D-BUS - Python type mappings</title>
-      <para>
-        While python itself is a largely untyped language D-BUS provides a simple type system
-        for talking with other languages which may be strongly typed.  Python for the most part
-        tries automatically map python objects to types on the bus.  It is none the less good to 
-        know what the type mappings are so one can better utilize services over the bus.
-      </para>
-      <sect3 id="python-basic-typemappings">
-        <title>Basic type mappings</title>
-       <para>
-         Below is a list of the basic types, along with their associated
-         mapping to a Python object.
-         <informaltable>
-           <tgroup cols="3">
-             <thead>
-               <row>
-                 <entry>D-BUS basic type</entry>
-                 <entry>Python wrapper</entry>
-                 <entry>Notes</entry>
-               </row>
-             </thead>
-             <tbody>
-               <row>
-                 <entry><literal>BYTE</literal></entry>
-                 <entry><literal>dbus.Byte</literal></entry>
-                 <entry></entry>
-                 </row><row>
-                 <entry><literal>BOOLEAN</literal></entry>
-                 <entry><literal>dbus.Boolean</literal></entry>
-                 <entry>Any variable assigned a True or False boolean value will automatically be converted into a BOOLEAN over the bus</entry>
-                 </row><row>
-                 <entry><literal>INT16</literal></entry>
-                 <entry><literal>dbus.Int16</literal></entry>
-                 <entry></entry>
-                 </row><row>
-                 <entry><literal>UINT16</literal></entry>
-                 <entry><literal>dbus.UInt16</literal></entry>
-                 <entry></entry>
-                 </row><row>
-                 <entry><literal>INT32</literal></entry>
-                 <entry><literal>dbus.Int32</literal></entry>
-                 <entry>This is the default mapping for Python integers</entry>
-                 </row><row>
-                 <entry><literal>UINT32</literal></entry>
-                 <entry><literal>dbus.UInt32</literal></entry>
-                 <entry></entry>
-                 </row><row>
-                 <entry><literal>INT64</literal></entry>
-                 <entry><literal>dbus.Int64</literal></entry>
-                 <entry></entry>
-                 </row><row>
-                 <entry><literal>UINT64</literal></entry>
-                 <entry><literal>dbus.UInt64</literal></entry>
-                 <entry></entry>
-                 </row><row>
-                 <entry><literal>DOUBLE</literal></entry>
-                 <entry><literal>dbus.Double</literal></entry>
-                 <entry>Any variable assigned a floating point number will automatically be converted into a DOUBLE over the bus</entry>
-                 </row><row>
-                 <entry><literal>STRING</literal></entry>
-                 <entry><literal>dbus.String</literal></entry>
-                 <entry>Any variable assigned a quoted string will automatically be converted into a STRING over the bus</entry>
-                 </row><row>
-                 <entry><literal>OBJECT_PATH</literal></entry>
-                 <entry><literal>dbus.ObjectPath</literal></entry>
-                 <entry></entry>
-               </row>
-             </tbody>
-           </tgroup>
-         </informaltable>
-       </para>
-      </sect3>
-      <sect3 id="python-container-typemappings">
-       <title>Container type mappings</title>
-       <para>
-         The D-BUS type system also has a number of "container"
-         types, such as <literal>DBUS_TYPE_ARRAY</literal> and
-         <literal>DBUS_TYPE_STRUCT</literal>.  The D-BUS type system
-         is fully recursive, so one can for example have an array of
-         array of strings (i.e. type signature
-         <literal>aas</literal>).
-       </para>
-       <para>
-         D-BUS container types have native corresponding built-in Python types
-         so it is easy to use them.
-         <informaltable>
-           <tgroup cols="3">
-             <thead>
-               <row>
-                 <entry>D-BUS type</entry>
-                 <entry>Python type</entry>
-                  <entry>Python wrapper</entry>
-                 <entry>Notes</entry>
-               </row>
-             </thead>
-             <tbody>
-               <row>
-                 <entry><literal>ARRAY</literal></entry>
-                 <entry><literal>Python lists</literal></entry>
-                  <entry><literal>dbus.Array</literal></entry>
-                 <entry>Python lists, denoted by square brackets [], are converted into arrays and visa versa.
-                 The one restriction is that when sending a Python list each element of the list must be of the same
-                 type.  This is because D-BUS arrays can contain only one element type.  Use Python tuples for mixed types.
-                  
-                  When using the wrapper you may also specify a type or signature of the elements contained in the Array.
-                  This is manditory when passing an empty Array to a method on the bus because Python can not guess at the 
-                  contents of an empty array.  For example if a method is expecting an Array of int32's and you need to pass
-                  it an empty Array you would do it as such:
-                  
-                  <programlisting>emptyint32array = dbus.Array([], type=dbus.Int32)</programlisting>
-
-                  or
-
-                  <programlisting>emptyint32array = dbus.Array([], signature="i")</programlisting>
-
-                  Note that dbus.Array derives from list so it acts just like a python list.
-                  </entry>
-                 </row>
-               <row>
-                 <entry><literal>STRUCT</literal></entry>
-                 <entry><literal>Python tuple</literal></entry>
-                  <entry><literal>dbus.Struct</literal></entry>
-                 <entry>Python tuples, denoted by parentheses (,), are converted into structs and visa versa.
-                 Tuples can have mixed types.</entry>
-               </row>
-               <row>
-                 <entry><literal>DICTIONARY</literal></entry>
-                 <entry><literal>Python dictionary</literal></entry>
-                  <entry><literal>dbus.Dictionary</literal></entry>
-                 <entry>D-BUS doesn't have an explicit dictionary type.  Instead it uses LISTS of DICT_ENTRIES to
-                 represent a dictionary.  A DICT_ENTRY is simply a two element struct containing a key/value pair.
-                 Python dictionaries are automatically converted to a LIST of DICT_ENTRIES and visa versa.
-                  
-                  Since dictonaries are described as lists of dict_entries we also need the signature in order
-                  to pass empty dictionaries.  The wrapper provides a way of specifying this through the key_type/value_type
-                  type parameters or the signature parameters.  To send an empty Dictionary where the key is a string
-                  and the value is a string you would do it as such:
-                  
-                  <programlisting>emptystringstringdict = dbus.Dictionary({}, key_type=dbus.String, value_type=dbus.Value)</programlisting>
-
-                  or
-
-                  <programlisting>emptystringstringdict = dbus.Dictionary({}, signature="ss")</programlisting>
-        
-                  Note that dbus.Dictionary derives from dict so it acts just like a python dictionary.
-                  </entry>
-               </row>
-               <row>
-                 <entry><literal>VARIANT</literal></entry>
-                 <entry><literal>any type</literal></entry>
-                  <entry><literal>dbus.Variant</literal></entry>
-                 <entry>A variant is a container for any type.  Python exports its methods to accept only variants 
-                  since we are an untyped language and can demarshal into any Python type.
-                   
-                   To send a variant you must first wrap it in a<literal>dbus.Variant</literal>.  If no type or signiture is 
-                   given to the variant the marshaler will get the type from the contents.</entry>
-               </row>
-
-             </tbody>
-           </tgroup>
-         </informaltable>
-       </para>
-      </sect3>
-    </sect2>
-    <sect2 id="python-invoking-methods">
-      <title>Invoking Methods</title>
-      <para>Here is a D-BUS program using the Python bindings to get a listing of all names on the session bus.
-<programlisting>      
-import dbus
-
-bus = dbus.SessionBus()
-proxy_obj = bus.bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
-dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.DBus')
-
-print dbus_iface.ListNames()
-</programlisting>
-      </para>
-      <para>
-        Notice I get an interface on the proxy object and use that to make the call.  While the specifications
-       state that you do not need to specify an interface if the call is unambiguous (i.e. only one method implements
-       that name) due to a bug on the bus that drops messages which don't have an interface field you need to specify
-       interfaces at this time.  In any event it is always good practice to specify the interface of the method you 
-       wish to call to avoid any side effects should a method of the same name be implemented on another interface.
-      </para>
-      <para>
-        You can specify the interface for a single call using the dbus_interface keyword.
-<programlisting>
-proxy_obj.ListNames(dbus_interface = 'org.freedesktop.DBus')
-</programlisting>
-      </para>
-      <para>
-        This is all fine and good if all you want to do is call methods on the bus and then exit.  In order to 
-        do more complex things such as use a GUI or make asynchronous calls you will need a mainloop.  You would use
-       asynchronous calls because in GUI applications it is very bad to block for any long period of time.  This cause
-       the GUI to seem to freeze.  Since replies to D-BUS messages can take an indeterminate amount of time using async 
-       calls allows you to return control to the GUI while you wait for the reply.  This is exceedingly easy to do in
-       Python.  Here is an example using the GLib/GTK+ mainloop.
-<programlisting>
-import gobject 
-import dbus
-if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
-    import dbus.glib
-
-def print_list_names_reply(list):
-    print str(list) 
-
-def print_error(e):
-    print str(e)
-    
-bus = dbus.SessionBus()
-proxy_obj = bus.bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
-dbus_iface = dbus.Interface(proxy_obj, 'org.freedesktop.DBus')
-
-dbus_iface.ListNames(reply_handler=print_list_names_reply, error_handler=print_error)
-
-mainloop = gobject.MainLoop()
-mainloop.run()
-</programlisting>
-      </para>
-      <para>
-        In the above listing you will notice the reply_handler and error_handler keywords.  These tell the method that
-       it should be called async and to call print_list_names_reply or print_error depending if you get a reply or an error.
-       The signature for replys depends on the number of arguments being sent back.  Error handlers always take one parameter
-       which is the error object returned.
-      </para>
-      <para>
-        You will also notice that I check the version of the dbus bindings before importing dbus.glib.  In older versions
-       glib was the only available mainloop.  As of version 0.41.0 we split out the glib dependency to allow for other mainloops
-       to be implemented.  Notice also the python binding version does not match up with the D-BUS version.  Once we reach 1.0
-       this should change with Python changes simply tracking the D-BUS changes.
-        While the glib mainloop is the only mainloop currently implemented, integrating other mainloops should
-       be very easy to do.  There are plans for creating a a generic mainloop to be the default for non gui programs.
-      </para>
-    </sect2>
-    <sect2 id="python-listening-for-signals">
-      <title>Listening for Signals</title>
-      <para>
-        Signals are emitted by objects on the bus to notify listening programs that an event has occurred.  There are a couple of ways
-        to register a signal handler on the bus.  One way is to attach to an already created proxy using the connect_to_signal method
-       which takes a signal name and handler as arguments.  Let us look at an example of connecting to the HAL service to receive
-       signals when devices are added and removed and when devices register a capability.  This example assumes you have HAL already running.
-<programlisting>
-import gobject 
-import dbus
-if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
-    import dbus.glib
-
-def device_added_callback(udi):
-    print 'Device with udi %s was added' % (udi)
-
-def device_removed_callback(udi):
-    print 'Device with udi %s was added' % (udi)
-
-def device_capability_callback(udi, capability):
-    print 'Device with udi %s added capability %s' % (udi, capability)
-
-bus = dbus.SystemBus()
-hal_manager_obj = bus.get_object('org.freedesktop.Hal', 
-                                 '/org/freedesktop/Hal/Manager')
-hal_manager = dbus.Interface(hal_manager_obj,
-                             'org.freedesktop.Hal.Manager')
-
-hal_manager.connect_to_signal('DeviceAdded', device_added_callback)
-hal_manager.connect_to_signal('DeviceRemoved', device_removed_callback)
-hal_manager.connect_to_signal('NewCapability', device_capability_callback)
-
-mainloop = gobject.MainLoop()
-mainloop.run()
-</programlisting>
-      </para>
-      <para>
-        The drawback of using this method is that the service that you are connecting to has to be around when you register
-       your signal handler.  While HAL is guaranteed to be around on systems that use it this is not always the case for every
-       service on the bus.  Say our program started up before HAL, we could connect to the signal by adding a signal receiver
-       directly to the bus.
-<programlisting>
-bus.add_signal_receiver(device_added_callback,
-                        'DeviceAdded',
-                        'org.freedesktop.Hal.Manager',
-                        'org.freedesktop.Hal',
-                        '/org/freedesktop/Hal/Manager')
-
-bus.add_signal_receiver(device_removed_callback,
-                        'DeviceRemoved',
-                        'org.freedesktop.Hal.Manager',
-                        'org.freedesktop.Hal',
-                        '/org/freedesktop/Hal/Manager')
-
-bus.add_signal_receiver(device_capability_callback,
-                        'DeviceAdded',
-                        'org.freedesktop.Hal.Manager',
-                        'org.freedesktop.Hal',
-                        '/org/freedesktop/Hal/Manager')
-</programlisting>
-      </para>
-      <para>
-        All this can be done without creating the proxy object if one wanted to but in most cases you would want to have 
-       a reference to the object so once a signal was received operations could be executed on the object.
-      </para>
-      <sidebar>
-        <title>Signal matching on arguments</title>
-        <para>
-          Starting with D-Bus 0.36 and the (0, 43, 0) version of the python 
-          bindings you can now add a match on arguments being sent in a signal.
-          This is useful for instance for only getting NameOwnerChanged
-          signals for your service.  Lets say we create a name on the bus called
-          'org.foo.MyName' we could also add a match to just get 
-          NameOwnerChanges for that name as such:
-<programlisting>
-bus.add_signal_receiver(myname_changed,
-                        'NameOwnerChanged',
-                        'org.freedesktop.DBus',
-                        'org.freedesktop.DBus',
-                        '/org/freedesktop/DBus',
-                        arg0='org.foo.MyName')
-</programlisting>
 
-          It is as simple as that.  To match the second arg you would use arg1=,
-          the third arg2=, etc.
-        </para>
-      </sidebar>
-      <sidebar>
-        <title>Cost of Creating a Proxy Object</title>
-       <para>
-         Note that creating proxy objects can have an associated processing cost.  When introspection is implemented
-         a proxy may wait for introspection data before processing any requests.  It is generally good practice to
-         create proxies once and reuse the proxy when calling into the object.  Constantly creating the same proxy 
-         over and over again can become a bottleneck for your program.
-       </para>
-      </sidebar>
+    <sect2 id="glib-annotations">
+      <title>Server-side Annotations</title>
       <para>
-        TODO: example of getting information about devices from HAL
+        There are several annotations that are used when generating the
+        server-side bindings.  The most common annotation is
+        <literal>org.freedesktop.DBus.GLib.CSymbol</literal> but there are other
+        annotations which are often useful.
+        <variablelist>
+          <varlistentry>
+            <term><literal>org.freedesktop.DBus.GLib.CSymbol</literal></term>
+            <listitem>
+              <para>
+                This annotation is used to specify the C symbol names for
+                the various types (interface, method, etc), if it differs from the
+                name DBus generates.
+              </para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term><literal>org.freedesktop.DBus.GLib.Async</literal></term>
+            <listitem>
+              <para>
+                This annotation marks the method implementation as an
+                asynchronous function, which doesn't return a response straight
+                away but will send the response at some later point to complete
+                the call.  This is used to implement non-blocking services where
+                method calls can take time.
+              </para>
+              <para>
+                When a method is asynchronous, the function prototype is
+                different. It is required that the function conform to the
+                following rules:
+                <itemizedlist>
+                  <listitem>
+                    <para>
+                      The function must return a value of type <literal>gboolean</literal>;
+                      <literal>TRUE</literal> on success, and <literal>FALSE</literal>
+                      otherwise. TODO: the return value is currently ignored.
+                    </para>
+                  </listitem>
+                  <listitem>
+                    <para>
+                      The first parameter is a pointer to an instance of the object.
+                    </para>
+                  </listitem>
+                  <listitem>
+                    <para>
+                      Following the object instance pointer are the method
+                      input values.
+                    </para>
+                  </listitem>
+                  <listitem>
+                    <para>
+                      The final parameter must be a
+                      <literal>DBusGMethodInvocation *</literal>.  This is used
+                      when sending the response message back to the client, by
+                      calling <literal>dbus_g_method_return</literal> or
+                      <literal>dbus_g_method_return_error</literal>.
+                    </para>
+                  </listitem>
+                </itemizedlist>
+              </para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term><literal>org.freedesktop.DBus.GLib.Const</literal></term>
+            <listitem>
+              <para>This attribute can only be applied to "out"
+              <literal>&lt;arg&gt;</literal> nodes, and specifies that the
+              parameter isn't being copied when returned.  For example, this
+              turns a 's' argument from a <literal>char **</literal> to a
+              <literal>const char **</literal>, and results in the argument not
+              being freed by DBus after the message is sent.
+              </para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term><literal>org.freedesktop.DBus.GLib.ReturnVal</literal></term>
+            <listitem>
+              <para>
+                This attribute can only be applied to "out"
+                <literal>&lt;arg&gt;</literal> nodes, and alters the expected
+                function signature.  It currently can be set to two values:
+                <literal>""</literal> or <literal>"error"</literal>.  The
+                argument marked with this attribute is not returned via a
+                pointer argument, but by the function's return value.  If the
+                attribute's value is the empty string, the <literal>GError
+                *</literal> argument is also omitted so there is no standard way
+                to return an error value.  This is very useful for interfacing
+                with existing code, as it is possible to match existing APIs.
+                If the attribute's value is <literal>"error"</literal>, then the
+                final argument is a <literal>GError *</literal> as usual.
+              </para>
+              <para>
+                Some examples to demonstrate the usage. This introspection XML:
+                <programlisting>
+&lt;method name="Increment"&gt;
+  &lt;arg type="u" name="x" /&gt;
+  &lt;arg type="u" direction="out" /&gt;
+&lt;/method&gt;
+                </programlisting>
+                Expects the following function declaration:
+                <programlisting>
+gboolean
+my_object_increment (MyObject *obj, gint32 x, gint32 *ret, GError **error);
+                </programlisting>
+              </para>
+              <para>
+                This introspection XML:
+                <programlisting>
+&lt;method name="IncrementRetval"&gt;
+  &lt;arg type="u" name="x" /&gt;
+  &lt;arg type="u" direction="out" &gt;
+    &lt;annotation name="org.freedesktop.DBus.GLib.ReturnVal" value=""/&gt;
+  &lt;/arg&gt;
+&lt;/method&gt;
+                </programlisting>
+                Expects the following function declaration:
+                <programlisting>
+gint32
+my_object_increment_retval (MyObject *obj, gint32 x)
+                </programlisting>
+              </para>
+              <para>
+                This introspection XML:
+                <programlisting>
+&lt;method name="IncrementRetvalError"&gt;
+  &lt;arg type="u" name="x" /&gt;
+  &lt;arg type="u" direction="out" &gt;
+    &lt;annotation name="org.freedesktop.DBus.GLib.ReturnVal" value="error"/&gt;
+  &lt;/arg&gt;
+&lt;/method&gt;
+                </programlisting>
+                Expects the following function declaration:
+                <programlisting>
+gint32
+my_object_increment_retval_error (MyObject *obj, gint32 x, GError **error)
+                </programlisting>
+              </para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
       </para>
     </sect2>
   </sect1>
 
-  <sect1 id="python-server">
-    <title>Python API: Implementing Objects</title>
+  <sect1 id="python-client">
+    <title>Python API</title>
     <para>
-      Implementing object on the bus is just as easy as invoking methods or listening for signals on the bus.
+      The Python API, dbus-python, is now documented separately in
+      <ulink url="http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html">the dbus-python tutorial</ulink> (also available in doc/tutorial.txt,
+      and doc/tutorial.html if built with python-docutils, in the dbus-python
+      source distribution).
     </para>
-    <sidebar>
-      <title>Version Alert</title>
-      <para>
-        The Python D-BUS bindings require version 2.4 or greater of Python when creating D-BUS objects.
-      </para>
-    </sidebar>
-
-    <sect2 id="python-inheriting-from-dbus-object">
-      <title>Inheriting From dbus.service.Object</title>
-      <para>
-        In order to export a Python object over the bus one must first get a bus name and then create
-        a Python object that inherits from dbus.service.Object.  The following is the start of an example
-       HelloWorld object that we want to export over the session bus.
-<programlisting>
-import gobject 
-import dbus
-import dbus.service
-if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
-    import dbus.glib
-
-class HelloWorldObject(dbus.service.Object):
-    def __init__(self, bus_name, object_path='/org/freedesktop/HelloWorldObject'):
-        dbus.service.Object.__init__(self, bus_name, object_path)
-
-session_bus = dbus.SessionBus()
-bus_name = dbus.service.BusName('org.freedesktop.HelloWorld', bus=session_bus)
-object = HelloWorldObject(bus_name)
-
-mainloop = gobject.MainLoop()
-mainloop.run()
-</programlisting>
-      </para>
-      <para>
-        Here we got the session bus, then created a BusName object which requests a name on the bus.
-       We pass that bus name to the HelloWorldObject object which inherits from dbus.service.Object.
-       We now have an object on the bus but it is pretty useless.
-      </para>
-    </sect2>
-    <sect2 id="python-exporting-methods">
-      <title>Exporting Methods Over The Bus</title>
-      <para>
-        Let's make this object do something and export a method over the bus.
-<programlisting>
-import gobject
-import dbus
-import dbus.service
-if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
-    import dbus.glib
-
-class HelloWorldObject(dbus.service.Object):
-    def __init__(self, bus_name, object_path='/org/freedesktop/HelloWorldObject'):
-        dbus.service.Object.__init__(self, bus_name, object_path)
-
-    @dbus.service.method('org.freedesktop.HelloWorldIFace')
-    def hello(self):
-        return 'Hello from the HelloWorldObject'
-      
-session_bus = dbus.SessionBus()
-bus_name = dbus.service.BusName('org.freedesktop.HelloWorld', bus=session_bus)
-object = HelloWorldObject(bus_name)
-
-mainloop = gobject.MainLoop()
-mainloop.run()
-</programlisting>
-      </para>
-      <sidebar>
-        <title>Python Decorators</title>
-       <para>
-         Notice the @ symbol on the line before the hello method.  This is a new directive introduced in
-         Python 2.4.  It is called a decorator and it "decorates" methods.  All you have to know is that
-         it provides metadata that can then be used to alter the behavior of the method being decorated.
-         In this case we are telling the bindings that the hello method should be exported as a D-BUS method
-         over the bus.
-       </para>
-      </sidebar>
-      <para>
-        As you can see we exported the hello method as part of the org.freedesktop.HelloWorldIFace interface.
-       It takes no arguments and returns a string to the calling program. Let's create a proxy and invoke this
-       method.
-<programlisting>      
-import dbus
-
-bus = dbus.SessionBus()
-proxy_obj = bus.bus.get_object('org.freedesktop.HelloWorld', '/org/freedesktop/HelloWorldObject')
-iface = dbus.Interface(proxy_obj, 'org.freedesktop.HelloWorldIFace')
-
-print iface.hello()
-</programlisting>
-      </para>
-      <para>
-        When invoking methods exported over the bus the bindings automatically know how many parameters
-       the method exports.  You can even make a method that exports an arbitrary number of parameters.
-       Also, whatever you return will automatically be transfered as a reply over the bus. Some examples.
-<programlisting>
-    @dbus.service.method('org.freedesktop.HelloWorldIFace')
-    def one_arg(self, first_arg):
-        return 'I got arg %s' % first_arg
-      
-    @dbus.service.method('org.freedesktop.HelloWorldIFace')
-    def two_args(self, first_arg, second_arg):
-        return ('I got 2 args', first_arg, second_arg)
-
-    @dbus.service.method('org.freedesktop.HelloWorldIFace')
-    def return_list(self):
-        return [1, 2, 3, 4, 5, 6]
-    
-    @dbus.service.method('org.freedesktop.HelloWorldIFace')
-    def return_dict(self):
-        return {one: '1ne', two: '2wo', three: '3ree'}
-</programlisting>
-      </para>
-    </sect2>
-    <sect2 id="python-emitting-signals">
-      <title>Emitting Signals</title>
-      <para>
-        Setting up signals to emit is just as easy as exporting methods.  It uses the same syntax as methods.
-<programlisting>
-import gobject
-import dbus
-import dbus.service
-if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
-    import dbus.glib
-
-class HelloWorldObject(dbus.service.Object):
-    def __init__(self, bus_name, object_path='/org/freedesktop/HelloWorldObject'):
-        dbus.service.Object.__init__(self, bus_name, object_path)
-
-    @dbus.service.method('org.freedesktop.HelloWorldIFace')
-    def hello(self):
-        return 'Hello from the HelloWorldObject'
-      
-    @dbus.service.signal('org.freedesktop.HelloWorldIFace')
-    def hello_signal(self, message):
-        pass
-       
-session_bus = dbus.SessionBus()
-bus_name = dbus.service.BusName('org.freedesktop.HelloWorld', bus=session_bus)
-object = HelloWorldObject(bus_name)
-
-object.hello_signal('I sent a hello signal')
-
-mainloop = gobject.MainLoop()
-mainloop.run()
-</programlisting>
-      </para>
-      <para>
-        Adding a @dbus.service.signal decorator to a method turns it into a signal emitter.  You can put code
-       in this method to do things like keep track of how many times you call the emitter or to print out debug
-       messages but for the most part a pass noop will do.  Whenever you call the emitter a signal will be emitted
-       with the parameters you passed in as arguments.  In the above example we send the message 'I sent a hello signal'
-       with the signal.
-      </para>
-    </sect2>
-    <sect2 id="python-inheriting-and-overriding">
-      <title>Inheriting from HelloWorldObject</title>
-      <para>
-        One of the cool things you can do in Python is inherit from another D-BUS object.  We use this trick in
-       the bindings to provide a default implementation for the org.freedesktop.DBus.Introspectable interface.
-       Let's inherit from the HelloWorldObject example above and overide the hello method to say goodbye.
-<programlisting>
-class HelloWorldGoodbyeObject(HelloWorldObject):
-    def __init__(self, bus_name, object_path='/org/freedesktop/HelloWorldGoodbyeObject'):
-        HelloWorldObject.__init__(self, bus_name, object_path)
-
-    @dbus.service.method('org.freedesktop.HelloWorldGoodbyeIFace')
-    def hello(self):
-        return 'Goodbye'
-
-goodbye_object = HelloWorldGoodbyeObject(bus_name)
-</programlisting>
-      </para>
-       <para>
-       Let's now call both methods with a little help from interfaces.
-<programlisting>      
-import dbus
-
-bus = dbus.SessionBus()
-proxy_obj = bus.bus.get_object('org.freedesktop.HelloWorld', '/org/freedesktop/HelloWorldGoodbyeObject')
-
-print proxy_obj.hello(dbus_interface='org.freedesktop.HelloWorldIFace')
-print proxy_obj.hello(dbus_interface='org.freedesktop.HelloWorldGoodbyeIFace')
-</programlisting>
-      </para>
-      <para>
-        This should print out 'Hello from the HelloWorldObject' followed by a 'Goodbye'.
-      </para>
-    </sect2>
-    <sect2 id="python-conclusion">
-      <title>Conclusion</title>
-      <para>
-        As you can see, using D-BUS from Python is an extremely easy proposition.  Hopefully
-       the tutorial has been helpful in getting you started.  If you need anymore help please
-       feel free to post on the <ulink url="http://lists.freedesktop.org/mailman/listinfo/dbus/">mailing list</ulink>.
-       The Python bindings are still in a state of flux and there may be API changes in the future.
-       This tutorial will be updated if such changes occur.
-      </para>
-    </sect2>
   </sect1>
 
   <sect1 id="qt-client">