<?xml version="1.0" encoding="utf-8"?>
<!-- generator="wordpress/2.0.11" -->
<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/"
	>

<channel>
	<title>context switch</title>
	<link>http://log.emmanuelebassi.net</link>
	<description>Random babblings of a geek.</description>
	<pubDate>Fri, 10 Oct 2008 22:04:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.11</generator>
	<language>en</language>
			<item>
		<title>Good Intentions/2</title>
		<link>http://log.emmanuelebassi.net/archives/2008/04/good-intentions2/</link>
		<comments>http://log.emmanuelebassi.net/archives/2008/04/good-intentions2/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 21:30:50 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>C</category>

		<category>developer</category>

		<category>gtk</category>

		<category>clutter</category>

		<category>crack</category>

		<category>json-glib</category>

		<category>glib</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2008/04/good-intentions2/</guid>
		<description><![CDATA[gtk+: I&#8217;ve been working again on the RecentManager and in trunk you&#8217;ll see some new stuff, namely:

use GIO to determine the MIME type of a URI, on every platform supported
use the file monitoring API to avoid polling the storage file
add a GtkSettings property for clamping the recently used resources list to a 30 days limit

more [...]]]></description>
			<content:encoded><![CDATA[<p><strong>gtk+</strong>: I&#8217;ve been working again on the <a href="http://library.gnome.org/devel/gtk/stable/GtkRecentManager.html">RecentManager</a> and in <code>trunk</code> you&#8217;ll see some new stuff, namely:</p>
<ul>
<li>use GIO to determine the MIME type of a URI, on every platform supported</li>
<li>use the file monitoring API to avoid polling the storage file</li>
<li>add a GtkSettings property for clamping the recently used resources list to a 30 days limit</li>
</ul>
<p>more stuff I&#8217;d like to add is:</p>
<ul>
<li>small parser changes to <a href="http://library.gnome.org/devel/glib/stable/glib-Bookmark-file-parser.html">GBookmarkFile</a>, to reflect changes in the spec</li>
<li>bulk addition, for applications storing multiple items when quitting</li>
<li>new API needed to follow the usability review in bug <a href="http://bugzilla.gnome.org/show_bug.cgi?id=349541">349541</a></li>
<li>moving the RecentItem icon code to GIO, and add API to extract the thumbnail</li>
</ul>
<p><strong>twitter</strong>: I&#8217;ve been using <a href="http://twitter.com">Twitter</a> a lot in the past two weeks; it&#8217;s nice, it makes it easier to copy and paste a quote or a thought, and the 160 characters limit is an interesting challenge. As it&#8217;s been ages since I last wrote an application<sup><a href="#footnote-1-261" id="footnote-link-1-261" class="footnote-link footnote-identifier-link" title="lately all I&#8217;ve been doing was writing libraries">1</a></sup>, I decided to start writing a Twitter reader/writer &mdash; using <a href="http://www.gtk.org">GTK+</a>, <a href="http://www.clutter-project.org">Clutter</a> and Tidy; without much thinking, I opened gvim and started writing code in C<sup><a href="#footnote-2-261" id="footnote-link-2-261" class="footnote-link footnote-identifier-link" title="hey, that&#8217;s what I do for a living, it&#8217;s hard to switch off; plus, I could reuse some of the platform libraries">2</a></sup> &mdash; so, the obvious thing that happened was that I ended up writing a library <em>yet again</em> in order to use Twitter&#8217;s web API. luckily for me, libsoup has now a really nice API to work with; all you need is <code>GET</code> and <code>POST</code> to their RESTful API, retrieve the result, parse it through JSON-GLib, hide everything inside a new GObject and you have a wrapper around a web service. the application, you say? oh, I was sure I forgot something. well, it&#8217;s <a href="http://github.com/ebassi/tweet/tree/master">coming along</a> &mdash; it just needs some work still.
</p>
<ol start="1" class="footnotes"><li id="footnote-1-261" class="footnote">lately all I&#8217;ve been doing was writing libraries [<a href="#footnote-link-1-261" class="footnote-link footnote-back-link">&#8617;</a>]</li><li id="footnote-2-261" class="footnote">hey, that&#8217;s what I do for a living, it&#8217;s hard to switch off; plus, I could reuse some of the platform libraries [<a href="#footnote-link-2-261" class="footnote-link footnote-back-link">&#8617;</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2008/04/good-intentions2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rhyme the rhyme well</title>
		<link>http://log.emmanuelebassi.net/archives/2008/04/rhyme-the-rhyme-well/</link>
		<comments>http://log.emmanuelebassi.net/archives/2008/04/rhyme-the-rhyme-well/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 21:43:34 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>GNOME</category>

		<category>developer</category>

		<category>clutter</category>

		<category>crack</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2008/04/rhyme-the-rhyme-well/</guid>
		<description><![CDATA[Jason, it&#8217;s not just the canvas: writing a simple 2D canvas is trivial &#8212; that&#8217;s why a lot of applications end up writing their own homegrown one.
The hard bits are the animation framework, the event handling and down to the integration with the existing platform. A generic canvas is hard, and you probably don&#8217;t want [...]]]></description>
			<content:encoded><![CDATA[<p>Jason, it&#8217;s not just <a href="http://jasondclinton.livejournal.com/65125.html">the canvas</a>: writing a simple 2D canvas is trivial &mdash; that&#8217;s why a lot of applications end up writing their own homegrown one.</p>
<p>The hard bits are the animation framework, the event handling and down to the integration with the existing platform. A generic canvas is hard, and you probably don&#8217;t want it to be developed inside gtk+ (not even for 3.0) &mdash; just like Cairo is not developed inside gtk+ but supersedes part of gtk+&#8217;s API.</p>
<p>As for 3D acceleration &mdash; I&#8217;m obviously biased here, so everyone should take what I write with a <del datetime="2008-04-10T21:32:48+00:00">grain</del>truckload of salt &mdash; but I maintain my view that if GNOME (and Linux) started heavily pushing towards more support for OpenGL, then we could get more market share<sup><a href="#footnote-1-256" id="footnote-link-1-256" class="footnote-link footnote-identifier-link" title="think Compiz, and how many more users it brought home just with a spinning cube">1</a></sup>, more visibility and thus more leverage to make the currently closed source drivers more open. Intel understood this; AMD is now getting it; I&#8217;m pretty sure nVidia will &mdash; or they will be simply pushed into irrelevance by the open drivers developed by the community<sup><a href="#footnote-2-256" id="footnote-link-2-256" class="footnote-link footnote-identifier-link" title="unless you are a gamer, and need the very best card as soon as it&#8217;s out just to play Crisis">2</a></sup>. Let&#8217;s face it: other platforms and toolkits are pushing heavily on hardware accelerated 3D effects.</p>
<p>Let&#8217;s start aggressively work to get the platform into the XXI century.</p>
<p><strong>update@2008-10-11T12:21+0100</strong> &mdash; just as a sidenote: if you have a good CPU, Mesa and software rendering, Clutter <em>will work</em>. It won&#8217;t be fast for some operations (like scaling and, possibly, rotating), but in that case you should probably start contributing to Mesa to make it fast (there&#8217;s a lot of room for improvement).
</p>
<ol start="1" class="footnotes"><li id="footnote-1-256" class="footnote">think Compiz, and how many more users it brought home just with a spinning cube [<a href="#footnote-link-1-256" class="footnote-link footnote-back-link">&#8617;</a>]</li><li id="footnote-2-256" class="footnote">unless you are a gamer, and need the very best card as soon as it&#8217;s out just to play Crisis [<a href="#footnote-link-2-256" class="footnote-link footnote-back-link">&#8617;</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2008/04/rhyme-the-rhyme-well/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Paint the Silence</title>
		<link>http://log.emmanuelebassi.net/archives/2007/12/paint-the-silence/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/12/paint-the-silence/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 23:30:45 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>developer</category>

		<category>lazyweb</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/12/paint-the-silence/</guid>
		<description><![CDATA[Weee, long time, no blog.
Dear Lazyweb,
is it at all possible to coerce the devilspawn also known as libtool to actually be quiet when compiling and printing something like the kernel compilation outpout - that is, something like:

  GEN autogenerated.c
  CC file1.c
  CC file2.c
  LINK output
  INSTALL output

I know how to [...]]]></description>
			<content:encoded><![CDATA[<p><em>Weee, long time, no blog.</em></p>
<p>Dear Lazyweb,</p>
<p>is it at all possible to coerce the devilspawn also known as libtool to actually be quiet when compiling and printing something like the kernel compilation outpout - that is, something like:</p>
<pre>
  GEN autogenerated.c
  CC file1.c
  CC file2.c
  LINK output
  INSTALL output
</pre>
<p>I know how to do that with a plain Makefile, and how to do it for autogenerated files like the enumeration types and the GLib marshallers, but I have no clue where to start to make libtool behave.</p>
<p>Thanks,<br />
 Emmanuele
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/12/paint-the-silence/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rome Wasn&#8217;t Built in a Day</title>
		<link>http://log.emmanuelebassi.net/archives/2007/10/rome-wasnt-built-in-a-day/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/10/rome-wasnt-built-in-a-day/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 09:33:39 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>developer</category>

		<category>clutter</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/10/rome-wasnt-built-in-a-day/</guid>
		<description><![CDATA[People often arrive on the #clutter channel1 with troubles building Clutter from SVN: dependencies, installation in non-common prefixes, etc.
Luckily, GNOME has Jhbuild, which is easy to set up2 and also allows custom modulesets for handling dependencies inside a separate root - to avoid messing up your box.
So, if you want to play with Clutter, here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>People often arrive on the <code>#clutter</code> channel<sup><a href="#footnote-1-232" id="footnote-link-1-232" class="footnote-link footnote-identifier-link" title="IRC: irc.gnome.org - join today!">1</a></sup> with troubles building <a href="http://www.clutter-project.org">Clutter</a> from SVN: dependencies, installation in non-common prefixes, etc.</p>
<p>Luckily, GNOME has <a href="http://live.gnome.org/Jhbuild">Jhbuild</a>, which is easy to set up<sup><a href="#footnote-2-232" id="footnote-link-2-232" class="footnote-link footnote-identifier-link" title="the wiki page linked has it running in less than ten easy steps">2</a></sup> and also allows custom modulesets for handling dependencies inside a separate root - to avoid messing up your box.</p>
<p>So, if you want to play with Clutter, here&#8217;s two Jhbuild modulesets:</p>
<ul>
<li><a href="http://folks.o-hand.com/~ebassi/clutter-0.4.modules">clutter-0.4.modules</a> - for the stable branch of Clutter, if you are developing applications</li>
<li><a href="http://folks.o-hand.com/~ebassi/clutter-0.6.modules">clutter-0.6.modules</a> - for the development branch of Clutter, if you want to contribute to Clutter itself, or you want to write bindings for it</li>
</ul>
<p>Just download the moduleset file of the branch you want to use, copy it into the <code>modulesets</code> directory of the Jhbuild checkout and then:</p>
<pre>
  jhbuild -m clutter-0.4 build pyclutter
</pre>
<p>or, if you have a fresh checkout of Jhbuild, simply do:</p>
<pre>
  jhbuild -m http://folks.o-hand.com/~ebassi/clutter-0.4.modules build pyclutter
</pre>
<p><em>thanks to Frederic Peters for fixing remote modulesets and pointing this out</em></p>
<p>The command lines above will build the stable Python bindings for the stable branch of Clutter, fetching all the needed dependencies. If you&#8217;re stuck on some external dependency, though, feel free to drop into <code>#clutter</code> and ask for help<sup><a href="#footnote-3-232" id="footnote-link-3-232" class="footnote-link footnote-identifier-link" title="be sure to specify which distribution you have">3</a></sup>.</p>
<p><strong>Update@2007-10-12T17:51+0100</strong>: I&#8217;ve added the following meta-packages:</p>
<ul>
<li><em>meta-clutter-core</em>, depending on Clutter</li>
<li><em>meta-clutter-suite</em>, depending on <em>meta-clutter-core</em>, Clutter-GStreamer, Clutter-GTK+ and Clutter-Cairo</li>
<li><em>meta-clutter-python</em>, depending on <em>meta-clutter-suite</em> and PyClutter</li>
</ul>
<p>You can use the meta-packages to pull in everything you need. As soon as I figure out a way to reliably depend on the other languages runtime environments, I&#8217;ll probably add their own meta-packages and a <em>meta-clutter-bindings</em> as well.</p>
<p>Have fun!
</p>
<ol start="1" class="footnotes"><li id="footnote-1-232" class="footnote">IRC: irc.gnome.org - join today! [<a href="#footnote-link-1-232" class="footnote-link footnote-back-link">&#8617;</a>]</li><li id="footnote-2-232" class="footnote">the wiki page linked has it running in less than ten easy steps [<a href="#footnote-link-2-232" class="footnote-link footnote-back-link">&#8617;</a>]</li><li id="footnote-3-232" class="footnote">be sure to specify which distribution you have [<a href="#footnote-link-3-232" class="footnote-link footnote-back-link">&#8617;</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/10/rome-wasnt-built-in-a-day/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Porcelain</title>
		<link>http://log.emmanuelebassi.net/archives/2007/10/porcelain/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/10/porcelain/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 22:19:45 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>C</category>

		<category>developer</category>

		<category>clutter</category>

		<category>git</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/10/porcelain/</guid>
		<description><![CDATA[Today I committed to Clutter trunk ClutterScript, the initial support for defining the scenegraph using external files. You can think of it as the GtkBuilder equivalent for Clutter.
During the 0.3 development cycle we considered using XML and JSON, and opted for the latter because while XML is quite easy for applications to write, JSON is [...]]]></description>
			<content:encoded><![CDATA[<p>Today I <a href="http://svn.o-hand.com/view/clutter?rev=1477&#038;view=rev">committed</a> to <a href="http://www.clutter-project.org">Clutter</a> trunk <code>ClutterScript</code>, the initial support for <a href="http://bugzilla.openedhand.com/show_bug.cgi?id=424">defining the scenegraph using external files</a>. You can think of it as the <code>GtkBuilder</code> equivalent for Clutter.</p>
<p>During the 0.3 development cycle we considered using XML and JSON, and opted for the latter because while XML is quite easy for applications to write, <acronym title="JavaScript Object NotatioN"><a href="http://json.org">JSON</a></acronym> is more geared towards human to read<sup><a href="#footnote-1-231" id="footnote-link-1-231" class="footnote-link footnote-identifier-link" title="obviously nothing prevents adding an XML parser, and use both">1</a></sup>. Also, JSON syntax is really parser-friendly, with only three barewords and six symbols.</p>
<p>Another nice thing about JSON is that many high-level languages already have some JSON module, so manipulating data streams would be quite easy for, let&#8217;s say, Perl or Python before feeding those streams to Clutter.</p>
<p>Defining a simple scene with JSON and <code>ClutterScript</code> is quite easy:</p>
<pre>
{
  <span style="color:red">&#8220;id&#8221;</span> : <span style="color:red">&#8220;main-stage&#8221;</span>,
  <span style="color:red">&#8220;type&#8221;</span> : <span style="color:red">&#8220;ClutterStage&#8221;</span>,
  <span style="color:red">&#8220;fullscreen&#8221;</span> : <span style="color:purple">true</span>,
  <span style="color:red">&#8220;children&#8221;</span> : [
    {
      <span style="color:red">&#8220;id&#8221;</span> : <span style="color:red">&#8220;red-button&#8221;</span>,
      <span style="color:red">&#8220;type&#8221;</span> : <span style="color:red">&#8220;ClutterRectangle&#8221;</span>,
      <span style="color:red">&#8220;x&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;y&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;width&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;height&#8221;</span> : <span style="color:purple">100</span>
      <span style="color:red">&#8220;color&#8221;</span> : <span style="color:red">&#8220;#ff0000ff&#8221;</span>
    },
    {
      <span style="color:red">&#8220;id&#8221;</span> : <span style="color:red">&#8220;green-button&#8221;</span>,
      <span style="color:red">&#8220;type&#8221;</span> : <span style="color:red">&#8220;ClutterRectangle&#8221;</span>,
      <span style="color:red">&#8220;x&#8221;</span> : <span style="color:purple">300</span>,
      <span style="color:red">&#8220;y&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;width&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;height&#8221;</span> : <span style="color:purple">100</span>
      <span style="color:red">&#8220;color&#8221;</span> : <span style="color:red">&#8220;#00ff00ff&#8221;</span>
    },
    {
      <span style="color:red">&#8220;id&#8221;</span> : <span style="color:red">&#8220;blue-button&#8221;</span>,
      <span style="color:red">&#8220;type&#8221;</span> : <span style="color:red">&#8220;ClutterRectangle&#8221;</span>,
      <span style="color:red">&#8220;x&#8221;</span> : <span style="color:purple">600</span>,
      <span style="color:red">&#8220;y&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;width&#8221;</span> : <span style="color:purple">100</span>,
      <span style="color:red">&#8220;height&#8221;</span> : <span style="color:purple">100</span>
      <span style="color:red">&#8220;color&#8221;</span> : <span style="color:red">&#8220;#0000ffff&#8221;</span>
    }
  ]
}
</pre>
<p>This will draw a red, a green and a blue square, 100&#215;100 pixels of size, inside a full screen stage.<br />
You can then retrieve the <code>"main-stage"</code> object (as well as any other object using its id) and connect signals and manipulate them with the usual Clutter API.</p>
<p>At the moment <code>ClutterScript</code> is not 100% complete - I still need to add support for defining behaviours (mostly a matter of defining an object syntax); complex properties parsing; merging (and, possibly, unmerging) of &#8220;snippets&#8221; of objects. Plus, obviously, more sanity checks in the scene building code.</p>
<p>To parse JSON there are a few C libraries, but I opted for writing a GObject-based one - which, in one of my usual moments of <em>lack</em> of originality, I called <a href="http://folks.o-hand.com/~ebassi/docs/json-glib/">JSON-GLib</a>. Clutter uses an in-tree copy because I might need API changes to make Clutter parsing code easier, but the library is already auto-tooled, tested and 100% documented (it is missing GObject deserialization, but that will have to wait). JSON-GLib is released under the terms of the LGPL and it&#8217;s available in my personal git repository, which you can clone with the usual:</p>
<pre>
  git clone http://folks.o-hand.com/~ebassi/git/json-glib.git
</pre>
<p><strong>Update@2007-10-09T15:07+0100</strong>: Just landed in <code>trunk</code>: defining behaviours (not every type, complex types like the path-based ones are still to be implemented), merging tests and more sanity checks. Defining a rotate behaviour boils down to:</p>
<pre>
{
  <span style="color:red">&#8220;id&#8221;</span>          : <span style="color:red">&#8220;rotate-behaviour&#8221;</span>,
  <span style="color:red">&#8220;type&#8221;</span>        : <span style="color:red">&#8220;ClutterBehaviourRotate&#8221;</span>,
  <span style="color:red">&#8220;angle-begin&#8221;</span> : <span style="color:purple">0.0</span>,
  <span style="color:red">&#8220;angle-end&#8221;</span>   : <span style="color:purple">360.0</span>,
  <span style="color:red">&#8220;axis&#8221;</span>        : <span style="color:red">&#8220;z-axis&#8221;</span>,
  <span style="color:red">&#8220;direction&#8221;</span>   : <span style="color:red">&#8220;cw&#8221;</span>,
  <span style="color:red">&#8220;alpha&#8221;</span>       : {
    <span style="color:red">&#8220;timeline&#8221;</span> : { <span style="color:red">&#8220;loop&#8221;</span> : <span style="color:purple">true</span>, <span style="color:red">&#8220;num-frames&#8221;</span> : <span style="color:purple">300</span>, <span style="color:red">&#8220;fps&#8221;</span> : <span style="color:purple">60</span> },
    <span style="color:red">&#8220;function&#8221;</span> : <span style="color:red">&#8220;sine&#8221;</span>
  }
}
</pre>
<p>Really soon now: all behaviours, complex properties and more.
</p>
<ol start="1" class="footnotes"><li id="footnote-1-231" class="footnote">obviously nothing prevents adding an XML parser, and use both [<a href="#footnote-link-1-231" class="footnote-link footnote-back-link">&#8617;</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/10/porcelain/feed/</wfw:commentRss>
		</item>
		<item>
		<title>When the Levee Breaks</title>
		<link>http://log.emmanuelebassi.net/archives/2007/09/when-the-levee-breaks/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/09/when-the-levee-breaks/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 13:40:37 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>Perl</category>

		<category>fun</category>

		<category>developer</category>

		<category>git</category>

		<category>die-cvs-die</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/09/when-the-levee-breaks/</guid>
		<description><![CDATA[Yesterday I decided to start working on the porting of the Gtk2::SourceView Perl module to the new upstream API. For my convenience, and because I know I&#8217;ll probably screw up, I decided to use a local git repository so I can experiment with all the branches I want before hitting CVS. Yes, you read that [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I decided to start working on the porting of the <a href="http://search.cpan.org/~ebassi/Gtk2-SourceView-1.000/">Gtk2::SourceView</a> Perl module to the new <a href="http://svn.gnome.org/viewcvs/gtksourceview/trunk/">upstream</a> API. For my convenience, and because I know I&#8217;ll probably screw up, I decided to use a local git repository so I can experiment with all the branches I want before hitting CVS. Yes, you read that right: the Perl GTK+/GNOME bindings still use CVS on SourceForge.net<sup><a href="#footnote-1-230" id="footnote-link-1-230" class="footnote-link footnote-identifier-link" title="there has been talk about moving them to GNOME CVS, then to SVN, but in the end the maintenance burden would be too high, and some of the members of the team would need at least SVN accounts anyway">1</a></sup>. Thus, I decided to import the whole gtk2-perl repository into a git one using <code>git-cvsimport</code>, and - lo and behold - after four hours of checkout, I got it on my machine, complete of full history.</p>
<p>The layout of the bindings modules is composed of a single CVS module and all the Perl modules are inside it; this is far from optimal with git<sup><a href="#footnote-2-230" id="footnote-link-2-230" class="footnote-link footnote-identifier-link" title="or any other SCM software that is not CVS, for that matter">2</a></sup>, so I proceeded to split up each Perl module into its own repository, with the help of <code><a href="http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html">git-filter-branch</a></code> - a new command taken from the <a href="http://en.wikipedia.org/wiki/Cogito_%28software%29">Cogito</a> suite and added to the 1.5.3 release of git.</p>
<p>The filter-branch command is extremely powerful: it rewrites the history of a repository (which is a destructive operation) by passing a filter function on it. It has a set of predefined filters and contexts of operations, so what you need to do to split out a sub-directory into its own repository is call:</p>
<pre>
  $ git filter-branch --subdirectory-filter <em>directory</em> <em>refspec</em>
</pre>
<p>and after that you get all the files filtered out marked as new or modified, so you can use <code>git reset --hard</code> to get rid of them, and have your sub-directory contents as the only recognised content of the repository.</p>
<p>Unfortunately, you can&#8217;t really filter out a direct import of a CVS repository: <code>git-cvsimport</code> stores branches and tags, and filtering will most likely create dangling objects; so, what I did was cloning the original repository, to get rid of the local branches, and remove all the tags:</p>
<pre>
  $ git clone --no-hardlinks /tmp/gtk2-perl Gtk2-SourceView.git
  $ for TAG in `git tag`; do git tag -f -d ${TAG}; done
</pre>
<p>The <code>--no-hardlinks</code> switch is important for later - I have to thank <a href="http://use.perl.org/~rjbs/journal/34411">Ricardo Signes</a> for this tip; in short: it makes git use real copies instead of hardlinking files when cloning a local repository, and will make the garbage collection and pruning phases actually work and prune the unused objects from the git database.</p>
<p>At this point, I just filter-branched and reset:</p>
<pre>
  $ git filter-branch --subdirectory-filter Gtk2-SourceView HEAD
  $ git reset --hard
</pre>
<p>and then called:</p>
<pre>
  $ git gc --aggressive
  $ git prune
</pre>
<p>and finally obtained my local git repository of the Gtk2-SourceView module from the original CVS repository - with all the history on <code>HEAD</code> preserved. The good part is that the entire set of operations is very repetitive, so it&#8217;s suitable for scripting<sup><a href="#footnote-3-230" id="footnote-link-3-230" class="footnote-link footnote-identifier-link" title="I did write a small script which extracted every Perl module sub-directory into its own git repository - but it&#8217;s mostly 50 lines sugarcoating the core 5 lines of actual work">3</a></sup>. Yey for git! <img src='http://log.emmanuelebassi.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />
</p>
<ol start="1" class="footnotes"><li id="footnote-1-230" class="footnote">there has been talk about moving them to GNOME CVS, then to SVN, but in the end the maintenance burden would be too high, and some of the members of the team would need at least SVN accounts anyway [<a href="#footnote-link-1-230" class="footnote-link footnote-back-link">&#8617;</a>]</li><li id="footnote-2-230" class="footnote">or any other <acronym title="Source Code Management">SCM</acronym> software that is not CVS, for that matter [<a href="#footnote-link-2-230" class="footnote-link footnote-back-link">&#8617;</a>]</li><li id="footnote-3-230" class="footnote">I did write a <a href="http://www.gnome.org/~ebassi/scripts/git-cvs-split">small script</a> which extracted every Perl module sub-directory into its own git repository - but it&#8217;s mostly 50 lines sugarcoating the core 5 lines of actual work [<a href="#footnote-link-3-230" class="footnote-link footnote-back-link">&#8617;</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/09/when-the-levee-breaks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flying Teapot</title>
		<link>http://log.emmanuelebassi.net/archives/2007/08/flying-teapot/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/08/flying-teapot/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 10:23:34 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>C</category>

		<category>announce</category>

		<category>developer</category>

		<category>clutter</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/08/flying-teapot/</guid>
		<description><![CDATA[Clutter 0.4.0 was, finally, released two days ago. Not only the core and add-on libraries but also the language bindings are available for this new stable release cycle.
We already started working on trunk for the 0.5/0.6 development cycle, which should hopefully lead up to another stable release in six months; there already is a nice [...]]]></description>
			<content:encoded><![CDATA[<p>Clutter 0.4.0 was, finally, <a href="http://www.clutter-project.org/blog/?p=26">released two days ago</a>. Not only the core and <a href="http://www.clutter-project.org/blog/?p=27">add-on libraries</a> but also the <a href="http://www.clutter-project.org/blog/?p=28">language bindings</a> are available for this new stable release cycle.</p>
<p>We already started working on <code>trunk</code> for the 0.5/0.6 development cycle, which should hopefully lead up to another stable release in six months; there already is a <a href="http://bugzilla.o-hand.com/buglist.cgi?product=Clutter&#038;target_milestone=0.6">nice list of features</a> we are working on, but I&#8217;d like to see more requests, more patches ( <img src='http://log.emmanuelebassi.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) and people working on even more language bindings.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/08/flying-teapot/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Of Angels And Angles</title>
		<link>http://log.emmanuelebassi.net/archives/2007/03/of-angels-and-angles/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/03/of-angels-and-angles/#comments</comments>
		<pubDate>Thu, 08 Mar 2007 17:46:51 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>C</category>

		<category>open-source</category>

		<category>developer</category>

		<category>gtk</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/03/of-angels-and-angles/</guid>
		<description><![CDATA[GtkApplication class: I&#8217;ve updated the application class page on the wiki. Now, it has an updated layout of the API (which is what I&#8217;m currently working on) and the design requirements it should fulfil. While writing it I had some sort of epiphany about the whole library consolidation effort and its perception among the platform [...]]]></description>
			<content:encoded><![CDATA[<p><strong>GtkApplication class</strong>: I&#8217;ve updated the <a href="http://live.gnome.org/GTK+/ApplicationClass">application class</a> page on the wiki. Now, it has an updated layout of the API (which is what I&#8217;m currently working on) and the design requirements it should fulfil. While writing it I had some sort of epiphany about the whole library consolidation effort and its perception among the platform developers. <em><a href="http://live.gnome.org/ProjectRidley">Project Ridley</a></em> as it stands is a double-edged sword: on one hand we&#8217;d like to have <a href="http://www.chipx86.com/blog/?p=205">more functionalities</a> moved from external libraries to GLib and GTK+; on the other hand, the size of the platform libraries maintainer teams is not growing at the same rate. If we are to move widgets, features and whatnot to GTK+ we must be sure not only that someone is actively working on them after inclusion, but also that someone is willing to work on the rest of the codebase, in order to review the patches leading to the inclusion of new functionalities. So, waiting for <em>Project Ridley</em> to come to the rescue is not going to cut it anymore: if you are proposing to move some functionality from a library to GLib or GTK+ be prepared to work on the whole code and not only on your pet feature.</p>
<p><strong>GtkUnique</strong>: since a &#8220;single instance application class&#8221; doesn&#8217;t really make any sense without an &#8220;application class&#8221; to make it inherit from, I&#8217;m punting the GtkUnique inclusion in GTK+ until the application class lands in first - and that makes it part of the post-2.12 masterplan; hence, I&#8217;m going to remove the gtk namespace from gtkunique and releasing it as a standalone library for the time being. I&#8217;ll commit the namespace switch before this weekend: it&#8217;ll switch from <code>GtkUnique</code> to <code>Unique</code>; everything else will stay the same. Remember to check it out from GNOME SVN server:</p>
<pre>
  svn co http://svn.gnome.org/svn/gtkunique/trunk
</pre>
<p><strong>GConfig</strong>: as I mentioned in the <a href="http://log.emmanuelebassi.net/archives/2007/03/live-wire/">last blog post</a>, I&#8217;m working on the next iteration of GConf. Aside from ongoing design and API churning, I&#8217;ve also submitted a <a href="http://guadec.org/node/533">talk proposal</a> for the next GUADEC about how to tackle the whole &#8216;GConf issue&#8217;. GConf is part of the core GNOME platform, and it has been so since 2000; it&#8217;s almost seven years old, and now it begins to show its age. Since <a href="http://mail.gnome.org/archives/gconf-list/2001-February/msg00010.html">2001</a>, Havoc has been asking the community to implement the same <a href="http://www.gnome.org/projects/gconf/plans.html">set of (five) features</a>; no one has answered his call yet. Maybe the community is to be blamed for this; maybe we need to rethink part of the GConf design to allow someone other than &#8216;the usual suspects&#8217; to fix GConf shortcomings and add new features. For instance: the backend API is a really nasty piece of code and it&#8217;s not easy to drop a new backend into an existing GConf installation; probably, that&#8217;s also why, after all these years, we still have only the XML and had to wait a long time for the evo-ldap backends. I&#8217;m going to put a page on the wiki with what kind of API I&#8217;m thinking about.</p>
<p><strong>talks</strong>: aside from the GConf talk, I&#8217;ve also proposed <a href="http://guadec.org/node/529">a talk/tutorial about the Perl bindings for GTK+</a>. I&#8217;ll also do two talks about Perl, GObject and GTK+ at <a href="http://conferences.yapceurope.org/npw2007/">this year&#8217;s Nordic Perl Workshop</a> which will be held at the end of April in Copenhagen.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/03/of-angels-and-angles/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Live Wire</title>
		<link>http://log.emmanuelebassi.net/archives/2007/03/live-wire/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/03/live-wire/#comments</comments>
		<pubDate>Fri, 02 Mar 2007 13:09:36 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>C</category>

		<category>project-ridley</category>

		<category>developer</category>

		<category>fosdem</category>

		<category>gtk</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/03/live-wire/</guid>
		<description><![CDATA[Back from FOSDEM 2007, after a little detour in Helsinki.
I&#8217;ve opened a bug for the places support in GtkFileChooser: #413076. Attached to it you&#8217;ll find a patch; it should be taken with a grain of salt: it&#8217;s still a work in progress, but implements the main features and shows how the new API should work. [...]]]></description>
			<content:encoded><![CDATA[<p>Back from FOSDEM 2007, after a little detour in Helsinki.</p>
<p>I&#8217;ve opened a bug for the <a href="http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/">places support</a> in <code>GtkFileChooser</code>: <a href="http://bugzilla.gnome.org/show_bug.cgi?id=413076">#413076</a>. Attached to it you&#8217;ll find <a href="http://bugzilla.gnome.org/attachment.cgi?id=83546&#038;action=view">a patch</a>; it should be taken with a grain of salt: it&#8217;s still a work in progress, but implements the main features and shows how the new API should work. In short, if your application need to use some predefined, user visible folder and you want to provide a link inside the file chooser, you need to create your bookmark file, drop it somewhere and call:</p>
<pre>
gtk_file_chooser_add_shortcuts_from_file (file_chooser
                                          <span style="color:red">&#8220;/path/to/bookmarks.xbel&#8221;</span>,
                                          <span style="color:purple">NULL</span>);
</pre>
<p>We&#8217;d need an intltool able to recognise the <code>title</code> (and eventually <code>description</code>) markup elements of the bookmark files and merge them into the translation pool, so that you can have the places already localised (the machinery is already in place in the patch). I&#8217;ll keep working on it, and finish up the implementation of the automagic places that applications can install in a common place and have it appear in every file chooser, based on the group or application name used in the bookmark.</p>
<p>I&#8217;m also working again on the <a href="http://live.gnome.org/GTK%2B/ApplicationClass">Application class</a> (the wiki page is really out of date with the current iteration I have been workin on - I&#8217;ll update it as soon as possible); now that the session management code has landed in <code>libegg</code> I will add hooks into the application class to have it do The Right Thing®.  Other than an application class, GTK+ really needs a desktop abstraction - a simple API to know whether we are connected to a network, or to control the screensaver, or to launch the default browser/mailer/editor/whatever.  For that to work properly we should really have a working configuration system like GConf moved below GTK+.  I did some prototype API for a configuration engine, mostly stealing<span style="color:blue">^W</span>taking inspiration from alexl work on GVFS (which already has a nice and clean API); will probably have something usable soon.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/03/live-wire/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Like Eating Glass</title>
		<link>http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/#comments</comments>
		<pubDate>Thu, 22 Feb 2007 16:52:35 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>GNOME</category>

		<category>C</category>

		<category>open-source</category>

		<category>developer</category>

		<category>gtk</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/</guid>
		<description><![CDATA[Desktop-devel-list (d-d-l) is an interesting place.  You follow discussions that usually tend to fork off, moving through tangential arguments; but, in the end, some stuff keeps turning up.  Lately, for instance, every thread seems to end up on discussing about Tracker.
Let&#8217;s take the discussion about having a GNOME &#8220;media center version&#8221;; you could [...]]]></description>
			<content:encoded><![CDATA[<p>Desktop-devel-list (d-d-l) is an interesting place.  You follow discussions that usually tend to fork off, moving through tangential arguments; but, in the end, some stuff keeps turning up.  Lately, for instance, every thread seems to end up on discussing about Tracker.</p>
<p>Let&#8217;s take the discussion about having a GNOME &#8220;media center version&#8221;; you could think that such a discussion will end up laying out some ideas about a media center.  Wrong: we ended up discussing about special folders - an argument that has already been discussed to the death.  Obviously, if you read d-d-l all day you can&#8217;t really expect having time to <strong>actually work</strong> on the features (or the crack) proposed on the list.  So, for a change, I decided to do stuff after saying what could be done.  I decided to take an idea that has been floating around for ages and implement it.</p>
<p>This is a simple FileChooserDialog, but the places list have been generated using a bookmark file (read using <code><a href="http://developer.gnome.org/doc/API/2.0/glib/glib-Bookmark-file-parser.html">GBookmarkFile</a></code>) in <code>$HOME/.local/share/places/gtk-bookmarks.xbel</code> instead of <code>$HOME/.gtk-bookmarks</code>:</p>
<div style="text-align:center"><a id="p197" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/filechooser-using-bookmark-file/" title="FileChooser using bookmark file"><img id="image197" src="http://log.emmanuelebassi.net/wp-content/2007/02/filechooser-bookmarks.png" alt="FileChooser using bookmark file" /></a><br />
<em style="font-size:80%">It&#8217;s completely identical to the FileChooser in trunk, really, but the places on the left are parsed using <a href="http://developer.gnome.org/doc/API/2.0/glib/glib-Bookmark-file-parser.html">this</a></em>.</div>
<p>The code, obviously, merges the places saved using the old format.</p>
<p>This, instead, is a trivial Perl application that can read all the places; it can also edit them, add new places and remove old ones:</p>
<div style="text-align:center"><a id="p199" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/gtk-shortcuts-editor/" title="GTK+ shortcuts editor"><img id="image199" src="http://log.emmanuelebassi.net/wp-content/2007/02/gtk-bookmark-editor.png" alt="GTK+ shortcuts editor" /></a></div>
<p>The fun part about switching the file chooser to the bookmark files is that it&#8217;s public API, so everyone can read, change and write these locations.  We can add new locations to an application like we add Glade files, and let the file chooser populate itself by loading a file; so, instead of using:</p>
<pre>
  gtk_file_chooser_add_shortcut_folder (file_chooser, some_location);
</pre>
<p>we could use:</p>
<pre>
  gtk_file_chooser_add_shortcuts (file_chooser, PKGDATADIR "/shortcuts.xbel");
</pre>
<p><em>But wait</em>, the keen reader familiar with the issue will interrupt, <em>the whole point of this mess is localising the name the user sees in the interface</em>.  Indeed, that&#8217;s why the bookmarks have a title and a description; through intltool we can extract those two and put them into the po file for the translators to work on - exactly like we do for the Glade files.  Before displaying the bookmark will pass the string through gettext, which will return the localised alias using the application&#8217;s domain - or we could add <code>domain</code> argument to the <code>gtk_file_chooser_add_shortcuts()</code> function above.</p>
<p>The file chooser can also load shortcuts automatically, using the application name to filter out what&#8217;s interesting.</p>
<p>Is this the most correct solution for this problem?  I don&#8217;t really know, even though using bookmarks and applications make more sense than using dot-desktop files and MIME types (come on?  MIME types?  Like I should bind a directory to specific types of content and not to the applications that are most likely to use them - and what are &#8220;MIME types&#8221; anyway?).  At least, however, this is a start and there&#8217;s some code to comment on.</p>
<p>The patches are roughly done, but the real treat would be to split the places section of the file chooser widget into its own widget and let other applications, like nautilus, use it directly without having to cut and past tons of code out of GTK+.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/02/like-eating-glass/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Come and See</title>
		<link>http://log.emmanuelebassi.net/archives/2007/02/come-and-see/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/02/come-and-see/#comments</comments>
		<pubDate>Fri, 09 Feb 2007 15:18:23 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>Life</category>

		<category>recent-files</category>

		<category>developer</category>

		<category>fosdem</category>

		<category>london</category>

		<category>gtk</category>

		<category>music</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/02/come-and-see/</guid>
		<description><![CDATA[Decemberists: Yesterday evening, The Decemberists were in London, and made a wonderful concert at Shepherd Bush.  I&#8217;ve fallen in love with the band after vieweing the video of their song Sixteen Military Wives and I started getting my hands on their whole discography (right now, only the singles are missing).  They played mostly [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Decemberists</strong>: Yesterday evening, <a href="http://en.wikipedia.org/wiki/The_Decemberists">The Decemberists</a> were in London, and made a wonderful concert at Shepherd Bush.  I&#8217;ve fallen in love with the band after vieweing the video of their song <em>Sixteen Military Wives</em> and I started getting my hands on their whole discography (right now, only the singles are missing).  They played mostly songs from their new album, <em><a href="http://en.wikipedia.org/wiki/The_Crane_Wife">The Crane Wife</a></em>, which is really as good as it can get (so go out and buy it now).</p>
<p><strong>gnome-utils</strong>: It seems that <a href="http://log.emmanuelebassi.net/archives/2007/01/small-stakes/">my plea</a> for someone to work on GFloppy has been useful; right now, Paul Betts and Riccardo Setti are <a href="http://www.barisione.org/blog.html?p=65">working</a> on a replacement using HAL and libparted, and are also getting the ball rolling for adding formatting support directly in HAL.  Guys, you rock!</p>
<p><strong>GTK+</strong>: I&#8217;ve been working on fixing some bugs of the <code>GtkRecentChooserMenu</code> widget; specifically, <a href="http://bugzilla.gnome.org/show_bug.cgi?id=377164">bug #377164</a> and bug <a href="http://bugzilla.gnome.org/show_bug.cgi?id=405696">#405696</a>.  While I was at it, I finally closed the FIXME I left in code, for supporting both appending and prepending custom menu items in the recent files menu, and finally added a test case for the widget, so I can track regressions.</p>
<div style="text-align:center"><a id="p195" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/archives/2007/02/come-and-see/recent-files-menu/" title="Recent files menu"><img id="image195" src="http://log.emmanuelebassi.net/wp-content/2007/02/recent-menu-test-custom.png" alt="Recent files menu" /></a><br/><br />
<em style="font-size:80%">Obligatory screenshot of the test application</em></div>
<p><strong>FOSDEM &#8216;07</strong>: Like last year, at the end of February I&#8217;ll be in Bruxelles, attending <a href="http://fosdem.org/2007/">FOSDEM</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/02/come-and-see/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Well That Was Easy</title>
		<link>http://log.emmanuelebassi.net/archives/2007/01/well-that-was-easy/</link>
		<comments>http://log.emmanuelebassi.net/archives/2007/01/well-that-was-easy/#comments</comments>
		<pubDate>Thu, 18 Jan 2007 19:59:15 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>developer</category>

		<category>ohand</category>

		<category>clutter</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2007/01/well-that-was-easy/</guid>
		<description><![CDATA[After a bit more than six months of work, Clutter 0.2.0 is finally out!
We put a lot of effort in making the API a bit less rough around the edges, and adding new features at the same time.  Like the new Behaviour objects which can be used to control multiple actors using a function [...]]]></description>
			<content:encoded><![CDATA[<p>After a bit more than six months of work, <a href="http://www.clutter-project.org">Clutter</a> 0.2.0 is <a href="http://www.clutter-project.org/sources/">finally out</a>!</p>
<p>We put a lot of effort in making the API a bit less rough around the edges, and adding new features at the same time.  Like the new Behaviour objects which can be used to control multiple actors using a function of time; or the fixed point API, which should make Clutter work fast even on embedded devices; or the Pango integration, which should keep the texture memory usage low and give you all the features of pango.  On top of that, there&#8217;s the new memory management semantic of the actors - now working like GTK+ widgets: now you just ave to add an actor to a group, and the group itself will be responsible of deallocating the memory when the group gets destroyed.</p>
<p>Along with the core library there&#8217;s a GStreamer integration library, which you can use to add audio and video support to a Clutter application; a Cairo integration library, for drawing directly on a Clutter texture actor; and, obviously, Perl and Python bindings, so that you don&#8217;t have to use C to use Clutter.</p>
<p>Clutter is still a work in progress, and we at OpenedHand hope to add even more new features in the 0.3 development cycle - some of them are already planned and in the works right now.  What we need are application developers willing to use Clutter and telling us what we need to add to Clutter to make it rock even more.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2007/01/well-that-was-easy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>John Saw That Number</title>
		<link>http://log.emmanuelebassi.net/archives/2006/12/john-saw-that-number/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/12/john-saw-that-number/#comments</comments>
		<pubDate>Tue, 19 Dec 2006 21:37:42 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>Python</category>

		<category>announce</category>

		<category>developer</category>

		<category>ohand</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2006/12/john-saw-that-number/</guid>
		<description><![CDATA[Thanks to Ross and his mad python-fu skillz, now we have a working Python binding for gtkunique - for the brave souls which may want to use it.
The repositories locations have been changed, after the servers update at OpenedHand, so here&#8217;s where the fun is:

  trunk:  bzr branch http://folks.o-hand.com/~ebassi/bzr/gtkunique
  python: bzr branch [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://burtonini.com">Ross</a> and his mad python-fu skillz, now we have a working Python binding for <a href="http://log.emmanuelebassi.net/archives/2006/10/love-and-communication/">gtkunique</a> - for the brave souls which may want to use it.</p>
<p>The repositories locations have been changed, after the <a href="http://www.burtonini.com/blog/2006/12/06/">servers update</a> at <a href="http://o-hand.com">OpenedHand</a>, so here&#8217;s where the fun is:</p>
<pre>
  <b>trunk</b>:  bzr branch http://folks.o-hand.com/~ebassi/bzr/gtkunique
  <b>python</b>: bzr branch http://folks.o-hand.com/~ebassi/bzr/pygtkunique
  <b>perl</b>:   bzr branch http://folks.o-hand.com/~ebassi/bzr/gtkunique-perl
</pre>
<p>Testing is greatly appreciated.</p>
<p><strong>gtkunique future</strong>: GtkUnique is API frozen, and feature complete as far as I&#8217;m concerned (bug fixing and eventual feature requests notwithstanding).  I&#8217;ve opened a bug for integration into GTK+: <a href="http://bugzilla.gnome.org/show_bug.cgi?id=378260">#378260</a>.  You can watch it and give your opinion there.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/12/john-saw-that-number/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Boogie Woogie Bugle Boy</title>
		<link>http://log.emmanuelebassi.net/archives/2006/08/boogie-woogie-bugle-boy/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/08/boogie-woogie-bugle-boy/#comments</comments>
		<pubDate>Tue, 01 Aug 2006 22:50:13 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>C</category>

		<category>recent-files</category>

		<category>developer</category>

		<category>gtk</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2006/08/boogie-woogie-bugle-boy/</guid>
		<description><![CDATA[Lately there has been some activity in projects moving from EggRecent to GtkRecent.  Obviously, this led to questions and bugs opened about the API.
One of the questions is: if I had a EggRecentModel singleton what should I use now?. Since EggRecent needed a EggRecentModel around for the entire lifetime of the recently used files [...]]]></description>
			<content:encoded><![CDATA[<p>Lately there has been some activity in projects moving from EggRecent to GtkRecent.  Obviously, this led to questions and bugs opened about the API.</p>
<p>One of the questions is: <i>if I had a <code>EggRecentModel</code> singleton what should I use now?</i>. Since EggRecent needed a <code>EggRecentModel</code> around for the entire lifetime of the recently used files list, you had to keep at least a singleton around; you also had to pass it to the objects (not widgets) displaying the list, because each istance of the objects would modify the list itself.  <code>GtkRecentManager</code> does not need that, since the widgets usually use their own internal instance of the manager and they don&#8217;t change the list in any way. So you can create a new <code>GtkRecentManager</code> and keep it around as a singleton (remember to call <code>g_object_unref()</code> on it when finished, otherwise you&#8217;ll leak it):</p>
<pre>
GtkRecentManager *manager_singleton = gtk_recent_manager_new ();
</pre>
<p>and then pass it to the widgets:</p>
<pre>
GtkWidget *dialog =
  gtk_recent_chooser_dialog_new_with_manager (<b>&#8220;Recent Documents&#8221;</b>
                                              parent,
                                              manager_singleton,
                                              GTK_STOCK_CLOSE,  GTK_RESPONSE_CLOSE,
                                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                              NULL);
</pre>
<p>Nevertheless, you should really use <code>gtk_recent_manager_get_default()</code> which will do the right thing, and pass you a per-process instance and you won&#8217;t have to care about its memory management (no <code>g_object_unref()</code> when quitting). Also, using <code>gtk_recent_manager_get_default()</code> means that you don&#8217;t have to use the _with_manager variant of the widgets constructor, as they will use the per-process <code>GtkRecentManager</code> by default.  Using your own <code>GtkRecentManager</code> makes sense only if you want to use the &#8220;filename&#8221; constructor-only property to specify your own storage file (and you should do that only if you know what you are doing):</p>
<pre>
GtkRecentManager *manager = gtk_recent_manager_get_default ();

  ...

GtkWidget *dialog =
  gtk_recent_chooser_dialog_new (<b>&#8220;Recent Documents&#8221;</b>
                                 parent,
                                 GTK_STOCK_CLOSE,  GTK_RESPONSE_CLOSE,
                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                 NULL);
</pre>
<p>Another question is the dreaded <i><a href="http://bugzilla.gnome.org/show_bug.cgi?id=349541">I want an inline list of recent files in the File menu</a></i>; I&#8217;ll redirect you to the bug report linked for the rationales about why I think the inline list sucks, and should be removed from the UIs of GNOME applications in favour of the sub-menu.  Anyhow, for those Unbelievers still using this Windows-cloned relic of the past, here&#8217;s a simple function for adding an inline list to an existing <code>GtkUIManager</code> instance; it&#8217;s part of a <a href="http://www.gnome.org/~ebassi/recent-uimanager-inline.c">example of integration between GtkRecent and the UI manager</a> I sent to the gtk-devel mailing list before GUADEC.</p>
<pre>
<span style="color:green;font-weight:bold;">static void</span>
add_inline_recent_items (guint         merge_id,
                         GtkUIManager *ui_manager)
{
  GtkActionGroup *action_group;
  GtkRecentManager *manager;
  GList *items, *l;
  guint i;

  action_group = gtk_action_group_new (<b>&#8220;recent-info&#8221;</b>);
  gtk_ui_manager_insert_action_group (ui_manager, action_group, <span style="color:red">0</span>);

  manager = gtk_recent_manager_get_default ();

  <span style="color:blue">/* we don&#8217;t care about sorting and filtering, but it can
   * be done using g_list_sort_with_data() and clamping the
   * resulting list to the desired length
   */</span>
  gtk_recent_manager_set_limit (manager, <span style="color:red">4</span>);
  items = gtk_recent_manager_get_items (manager);

  <span style="color:blue">/* no items: attach an insensitive place holder */</span>
  <span style="color:orange;font-weight:bold;">if</span> (!items)
    {
      GtkAction *action;

      action = g_object_new (<span style="color:red">GTK_TYPE_ACTION</span>,
      			     <b>&#8220;name&#8221;</b>, <b>&#8220;recent-info-empty&#8221;</b>,
			     <b>&#8220;label&#8221;</b>, <b>&#8220;No recently used files&#8221;</b>,
			     <b>&#8220;sensitive&#8221;</b>, <span style="color:red">FALSE</span>,
			     <span style="color:red">NULL</span>);
      gtk_action_group_add_action (action_group, action);
      g_object_unref (action);

      gtk_ui_manager_add_ui (ui_manager, merge_id,
  			     <b>&#8220;/MenuBar/FileMenu/RecentFiles&#8221;</b>,
			     <b>&#8220;recent-info-empty&#8221;</b>,
			     <b>&#8220;recent-info-empty&#8221;</b>,
			     <span style="color:red">GTK_UI_MANAGER_MENUITEM</span>,
			     <span style="color:red">FALSE</span>);

      <span style="color:orange;font-weight:bold;">return</span>;
    }

  <span style="color:orange;font-weight:bold">for</span> (i = <span style="color:red">0</span>, l = items;
       l != <span style="color:red">NULL</span>;
       i += <span style="color:red">1</span>, l = l->next)
    {
      GtkRecentInfo *info = l->data;
      gchar *name = g_strdup_printf (<b>&#8220;recent-info-%d-%lu&#8221;</b>,
      				     i,
				     (gulong) time (<span style="color:red">NULL</span>));
      gchar *action_name = g_strdup (name);
      GtkAction *action;

      action = g_object_new (<span style="color:red">GTK_TYPE_ACTION</span>,
      			     <b>&#8220;name&#8221;</b>, action_name,
			     <b>&#8220;label&#8221;</b>, gtk_recent_info_get_display_name (info),
			     <b>&#8220;stock_id&#8221;</b>, <span style="color:red">NULL</span>,
			     <span style="color:red">NULL</span>);
      g_object_set_data_full (G_OBJECT (action), <b>&#8220;gtk-recent-info&#8221;</b>,
                              gtk_recent_info_ref (info),
			      (GDestroyNotify) gtk_recent_info_unref);
      g_signal_connect (action, <b>&#8220;activate&#8221;</b>,
                        G_CALLBACK (recent_activate_cb), <span style="color:red">NULL</span>);
      gtk_action_group_add_action (action_group, action);
      g_object_unref (action);

      <span style="color:blue">/* all you need is a UI definition with a &#8220;placeholder&#8221; element called
       * &#8220;RecentFiles&#8221; under a &#8220;menu&#8221; element called &#8220;FileMenu&#8221;.
       */</span>
      gtk_ui_manager_add_ui (ui_manager, merge_id,
  			     <b>&#8220;/MenuBar/FileMenu/RecentFiles&#8221;</b>,
			     name,
			     action_name,
			     <span style="color:red">GTK_UI_MANAGER_MENUITEM</span>,
			     <span style="color:red">FALSE</span>);

      g_print (<b>&#8220;* adding action `%s&#8217;n&#8221;</b>, action_name);

      g_free (action_name);
      g_free (name);
    }

  <span style="color:blue">/* unref the info objects so that they will be destroyed when
   * the actions to which they are bound are destroyed with the
   * UIManager instance
   */</span>
  g_list_foreach (items, (GFunc) gtk_recent_info_unref, <span style="color:red">NULL</span>);
  g_list_free (items);
}
</pre>
<p>This code should give you an idea on how to implement your own version. Making the menu reloading the inline list means removing the UI definitions using the <code>merge_id</code> integer and calling this function again inside a callback attached to the &#8220;changed&#8221; signal of a <code>GtkRecentManager</code> instance, and it is left as an exercise for the reader. <img src='http://log.emmanuelebassi.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div style="text-align:center">
<a id="p171" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/archives/2006/08/boogie-woogie-bugle-boy/gtkrecent-and-gtkuimanager/" title="GtkRecent and GtkUIManager"><img id="image171" src="http://log.emmanuelebassi.net/wp-content/uploads/2006/08/Screenshot-recent-uimanager.png" alt="GtkRecent and GtkUIManager" /></a>
</div>
<p>I&#8217;m really sorry that the UIManager integration did not happen in time for 2.10; it means that some applications will have to implement it by themselves until GTK+ 2.12 is out with a common implementation. In the meantime, continue asking me or opening bugs in Bugzilla.</p>
<p><b>Update@2006-08-02T09:51+0100:</b> the complete code now has the &#8220;reload-when-list-change&#8221; feature.  Remember: you may cut and paste this code for a <b>basic</b> support of recent files inside an inline menu; there are at least another couple of ways to implement the same level of support, and mostly it depends on how you handle your own documents.  I&#8217;d like for GTK+ or libgnome or GLib to have a &#8220;document&#8221; class abstracting most of this and other stuff, like Cocoa on OSX has the <code>NSDocument</code> class.</p>
<p><b>Update@2006-08-02T16:05+0100:</b> another update - I&#8217;ve fixed a couple of leaks (a <code>GtkAction</code> is a <code>GObject</code> and not a <code>GtkObject</code>) and added the sorting function for the inlined list.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/08/boogie-woogie-bugle-boy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How Good It Can Be</title>
		<link>http://log.emmanuelebassi.net/archives/2006/06/how-good-it-can-be/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/06/how-good-it-can-be/#comments</comments>
		<pubDate>Fri, 09 Jun 2006 09:37:44 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Linux</category>

		<category>Perl</category>

		<category>Python</category>

		<category>rants</category>

		<category>developer</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2006/06/how-good-it-can-be/</guid>
		<description><![CDATA[Corey, why on earth should we switch from an entire set of system configuration tools written in Perl to another one written in Python?  Just for the sake of Python?  Just because there are more Python zealots^Whackers on GNOME than there are Perl ones?
I understand that Ubuntu loves Python, but please: rewriting every [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.advogato.org/person/Burgundavia/diary.html?start=83">Corey</a>, why on earth should we switch from an entire set of system configuration tools written in Perl to another one written in Python?  Just for the sake of Python?  Just because there are more Python zealots<span style="color:blue">^W</span>hackers on GNOME than there are Perl ones?</p>
<p>I understand that Ubuntu loves Python, but please: rewriting every tool in Python just for the sake of it is totally useless.  What Python gives us over Perl, for system configuration backends?  (No, it&#8217;s not a rethorical question: I&#8217;m serious).
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/06/how-good-it-can-be/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
