<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:html="http://www.w3.org/1999/html" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Ross Burton</title><link>http://www.burtonini.com/blog</link><description>A potted account of Ross' life</description><language>en</language><ttl>60</ttl><dc:creator>Ross Burton</dc:creator><admin:generatorAgent rdf:resource="http://pyblosxom.sourceforge.net/"/><admin:errorReportsTo rdf:resource="mailto:ross@burtonini.com"/><item><title>Sound Juicer &quot;They Keep Hiding The Truth And Rights&quot; 2.10.1</title><guid isPermaLink="false">computers/sound-juicer/sj-2.10-1</guid><link>http://www.burtonini.com/blog/computers/sound-juicer/sj-2.10-1</link><description>Sound Juicer &quot;They Keep Hiding The Truth And Rights&quot; 2.10.1 is out as usual , fixing a couple of crashers ...</description><content:encoded><![CDATA[    <p>
      Sound Juicer "They Keep Hiding The Truth And Rights" 2.10.1 is out <a
      href="http://www.burtonini.com/computing/sound-juicer-2.10.1.tar.gz">as
      usual</a>, fixing a couple of crashers and adding more translations.
    </p>
    <ul>
      <li>Initialise audio profiles earlier (John Palmieri)</li>
      <li>Remove bad checks which can crash (Andrei Yurkevich)</li>
    </ul>
    <p>
      Translations by Adam Weinberger (en_CA), Ahmad Riza H Nst (id), Canonical
      Ltd (xh), Jyotsna Shrestha (ne), Mugurel Tudor (ro), Raphael Higino
      (pt_BR), and Steve Murphy (rw).
    </p>
]]></content:encoded><category domain="http://www.burtonini.com">/computers/sound-juicer</category><dc:date>2005-04-04T17:27:24Z</dc:date></item><item><title>GObject/DBus Magic</title><guid isPermaLink="false">computers/dbus-2005-04-04-14-14</guid><link>http://www.burtonini.com/blog/computers/dbus-2005-04-04-14-14</link><description>I am Colin Walters's fanboy. That is all. I suppose I should elaborate on that. I've just build a shiny ...</description><content:encoded><![CDATA[    <p>
      I am Colin Walters's fanboy.  That is all.
    </p>
    <p>
      I suppose I should elaborate on that.  I've just build a shiny new DBus
      release (from CVS, but for all intents and purposes it is 0.32), and had a
      quick experiment with the new GLib bindings.  In the good old days the
      GLib bindings provided mainloop integration and not much else, but not any
      more...  I started by creating a simple GObject which has an <tt>echo</tt>
      method, this is pretty standard stuff but the <tt>echo</tt> prototype is:
    </p>
    <pre>gboolean echo_echo (Echo *echo, const char in_s, char **out_s, GError **error);</pre>
    <p>
      It's nice and simple, <tt>out_s</tt> is set to a reversed copy of
      <tt>in_s</tt>. I then wrote an XML file which describes the object.  In
      the future I believe this will be generated by parsing the C code just as
      gtk-doc does now, but I can handle writing it manually for now:
    </p>
<pre>
&lt;?xml version="1.0"?&gt;
&lt;node name="/com/openedhand/DBus/Tests/Echo"&gt;
  &lt;interface name="com.openedhand.DBus.Tests.Echo"&gt;
    &lt;annotation name="org.freedesktop.DBus.GLib.CSymbol" value="echo"/&gt;
    &lt;method name="Echo"&gt;
      &lt;annotation name="org.freedesktop.DBus.GLib.CSymbol" value="echo_echo"/&gt;
      &lt;arg type="s" name="string" direction="in"/&gt;
      &lt;arg type="s" name="echo_string" direction="out"/&gt;
    &lt;/method&gt;
  &lt;/interface&gt;
&lt;/node&gt;
</pre>
    <p>
      This file defines the names of the interfaces, objects, and methods in the
      DBus world, and also how they map to the real GObject.  This file is then
      used to generate two header files: server-side glue for the GObject to the
      bus, and client-side wrappers around the bus.  Ignoring the boring
      connecting to the bus and error checking, connecting this GObject to the
      bus is pretty simple:
    </p>
    <pre>
#include "EchoObjectGlue.h" /* Defines dbus_glib_echo_object_info */

  ...
  obj = g_object_new (ECHO_TYPE, NULL);
  dbus_g_object_class_install_info (G_OBJECT_GET_CLASS (obj), &amp;dbus_glib_echo_object_info);
  dbus_g_connection_register_g_object (connection,
                                       "/com/openedhand/DBus/Tests/Echo",
                                       obj);
    </pre>
    <p>
      No more <a
      href="http://www-106.ibm.com/developerworks/linux/library/l-dbus.html">manual
      argument parsing</a> on the server, which is excellent.  Even more
      exciting is what happens on the client (without error handling but
      <em>nothing else removed</em>):
    </p>
    <pre>
#include &lt;dbus/dbus-glib-bindings.h&gt;
#include "EchoObjectBindings.h"
  ...
  DBusGConnection *connection;
  DBusGProxy *proxy;
  char *s_out = NULL;
  
  connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
  proxy = dbus_g_proxy_new_for_name_owner (connection,
                                           "com.openedhand.DBus.Tests.Echo",
                                           "/com/openedhand/DBus/Tests/Echo",
                                           "com.openedhand.DBus.Tests.Echo",
                                           NULL);
  com_openedhand_DBus_Tests_Echo_echo (proxy, "Hello, World", &amp;s_out, NULL); /* Defined in EchoObjectBindings.h */  
  printf("Got '%s'\n", s_out);
</pre>
    <p>
      The tedious create message-add arguments-send message-wait for reply is
      gone, and wrapped up inside auto-generated code and introspection
      frameworks.  I believe this is going to make a massive difference to the
      rate of DBus adoption in GNOME, as until now the prospect of putting
      complicated structures and methods on the bus wasn't very appealing.  Now
      it's simple and doesn't result in massive code bloat from duplicated code
      to manipulate the bus messages.
    </p>
    <p>
      <strong>Update:</strong> I've put a <a href="http://www.burtonini.com/computing/dbus-glib.tar.gz">tarball of the source</a> online.  I've also been informed by Colin that Havoc wrote half of the code, so I'm now fanboying both Havoc and Colin.
    </p>
    <p>
      <small>NP: <cite>Babylon Rewound</cite>, Thievery Corporation</small>
    </p>
]]></content:encoded><category domain="http://www.burtonini.com">/computers</category><dc:date>2005-04-04T13:14:00Z</dc:date></item></channel></rss>