<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Martin Pitt &#187; tutorial</title>
	<atom:link href="http://www.piware.de/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.piware.de</link>
	<description>addicted to Ubuntu development</description>
	<lastBuildDate>Mon, 19 Jul 2010 13:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>&#8220;hello dbus&#8221; in vala</title>
		<link>http://www.piware.de/2009/11/hello-dbus-in-vala/</link>
		<comments>http://www.piware.de/2009/11/hello-dbus-in-vala/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:06:03 +0000</pubDate>
		<dc:creator>pitti</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[d-bus]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vala]]></category>

		<guid isPermaLink="false">http://www.piware.de/?p=242</guid>
		<description><![CDATA[On the long flight back from UDS-Lucid I read the Vala tutorial on my ebook, and did some of the exercises. I was curious about Vala because it combines the speed and memory efficiency of C in a sane C#-like language with proper memory management, exceptions, and without the silly &#8220;close to the metal&#8221; faff [...]]]></description>
			<content:encoded><![CDATA[<p>On the long flight back from UDS-Lucid I read the <a href="http://live.gnome.org/Vala/Tutorial">Vala tutorial</a> on my ebook, and did some of the exercises. I was curious about Vala because it combines the speed and memory efficiency of C in a sane C#-like language with proper memory management, exceptions, and without the silly &#8220;close to the metal&#8221; faff that is usually required in C.</p>
<p>And indeed I wasn&#8217;t disappointed. It&#8217;s not as convenient as Python, but really not far from it, and it&#8217;s faaaast!</p>
<p>Today I finally got back to this and wrote my first D-Bus example in vala which does a  call to DeviceKit-disks:</p>
<blockquote><pre>
using DBus;

int main(string[] args)
{
    Connection con = Bus.get(BusType.SYSTEM);

    dynamic DBus.Object dk = con.get_object(
            "org.freedesktop.DeviceKit.Disks",
	    "/org/freedesktop/DeviceKit/Disks",
	    "org.freedesktop.DeviceKit.Disks");

    ObjectPath[] devs = dk.EnumerateDevices();
    foreach (ObjectPath o in devs)
	stdout.printf("%s\n", o);

    return 0;
}
</pre>
</blockquote>
<p>Compile and run it with</p>
<p><code>valac --pkg dbus-glib-1 dbus-dk.vala &#038;&#038; ./dbus-dk</code> </p>
<p>and voila!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piware.de/2009/11/hello-dbus-in-vala/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
