<?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>Sat, 21 Jun 2008 11:35:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.11</generator>
	<language>en</language>
			<item>
		<title>The Engine Driver</title>
		<link>http://log.emmanuelebassi.net/archives/2006/11/the-engine-driver/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/11/the-engine-driver/#comments</comments>
		<pubDate>Sun, 26 Nov 2006 23:56:56 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>gnome-dictionary</category>

		<category>gnome-utils</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2006/11/the-engine-driver/</guid>
		<description><![CDATA[Here we are again with the Dictionary hacking; I left my development trunk with barely enough time to close crashers and brown paper bags patchs, and now I&#8217;m finally able to return working on it.
Here&#8217;s an interesting bug, about the poor discoverability of the look up process.  First of all: discoverability? Is that even [...]]]></description>
			<content:encoded><![CDATA[<p>Here we are again with the Dictionary hacking; I left my development trunk with barely enough time to close crashers and brown paper bags patchs, and now I&#8217;m finally able to return working on it.</p>
<p>Here&#8217;s an interesting bug, about the <a href="http://bugzilla.gnome.org/show_bug.cgi?id=348656">poor discoverability of the look up process</a>.  First of all: <em>discoverability</em>? Is that even a word? Who the hell filed that bug? <em>Opened by Emmanue&#8230;</em> ehr&#8230; <em>looks uncomfortably away</em>.</p>
<p>Anyway, linguistic issues aside, the issue is interesting: some complained that the old Dictionary had a <acronym title="Big Fuckin' Button">BFB</acronym> and the new Dictionary has, well, nothing - the word is searched by activating the entry. This makes sense if you are typing the word, but it breaks down if you are pasting a word into the entry as you have to reach out for the keyboard and press enter. The idea was adding a &#8220;Go&#8221; button, removable by turning off a knob inside GConf. Then I realised that the label bound to the entry could be removed in favour of a button with no relief; it would keep the current appearance of the Dictionary while adding the &#8220;mouse-only&#8221; interaction requested (and by having a mnemonic, you can also activate the entry using the button&#8217;s mnemonic tag). It&#8217;s an experiment: the bug I linked has a full patch for the button+GConf knob (courtesy of Stephen Cook, <em>kudos</em> to him), so if people are going to throw themselves out of the window, I&#8217;ll gladly forget my solution and apply the patch.</p>
<p>Another couple of squashed bugs: <a href="http://bugzilla.gnome.org/show_bug.cgi?id=333132">you cannot edit a dictionary source</a> and even if you could, <a href="http://bugzilla.gnome.org/show_bug.cgi?id=351601">the advanced settings do not work</a> anyway. Both these bugs are really missing implementations of existing features: the source editing was mostly in place before the code freeze of GNOME 2.16, while the advanced settings required two widgets (the database chooser and the strategy chooser) that weren&#8217;t ready in time for the <acronym title="User Interface">UI</acronym> freeze of last January. Now that I have written both widgets and that I have time to finish what I started, the source dialog has been overhauled, and it allows choosing the database and the matching strategy for the chosen source, both when adding and when editing it.</p>
<div style="text-align:center">
<a id="p185" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/archives/2006/11/the-engine-driver/strategy-chooser/" title="strategy chooser"><img id="image185" src="http://log.emmanuelebassi.net/wp-content/2006/11/dictionary-strategy.png" alt="strategy chooser" /></a>
</div>
<p>Speaking of the strategy chooser, I&#8217;ve added it to the sidebar, and like the database chooser allows you to set a matching strategy for the session, so you can use the default strategy (the same set for the source) or whatever strategies the source supports; I&#8217;ll add a &#8220;reset and use the default&#8221; button, which is also currently missing from the database chooser.</p>
<p>Here&#8217;s the real tricky bug: <a href="http://bugzilla.gnome.org/show_bug.cgi?id=349547">adding the speller widget to the dictionary applet</a>. I thought about it, and how integrating the speller inside the applet, now that we have that widget. While inside the application having a sidebar makes sense, the same doesn&#8217;t not hold for the applet, as it would make it really big. For this reason, I added the speller widget (and every other page inside the sidebar) as pages of a notebook; you can switch between each of them using a drop-down menu - effectively making the whole applet work like the application&#8217;s sidebar.</p>
<p>As for the new features: four months ago I began hacking on a parser for the DICT file format, which is used to store a database (a single &#8220;dictionary&#8221; in a dictionary source) for <code>dictd</code> to use. It took a bit to get ahold of the actual format, but once found I wrote a small parser object, modelled on the <code>GKeyFile</code> object used to parse the desktop entry files. You can use it to load the dictionary and the index from data, or from file; you can just preload the index or load everything; you can even begin with an empty object, fill stuff and write it down. Unfortunately, it doesn&#8217;t support compressed files - but it should be enough for closing this <a href="http://bugzilla.gnome.org/show_bug.cgi?id=349547">bug</a>, and work as a base for the StarDict dictionary parser (this I&#8217;ll have to write really from scratch, as the C++ parser code sucks horribly).</p>
<div style="text-align:center">
<a id="p184" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/archives/2006/11/the-engine-driver/dictionary-with-syntax-highlighting/" title="dictionary with syntax highlighting"><img id="image184" src="http://log.emmanuelebassi.net/wp-content/2006/11/dictionary-syntax.png" alt="dictionary with syntax highlighting" /></a>
</div>
<p>Finally, from the old-dictionary-feature-ported-to-the-new-dictionary department, the <a href="http://bugzilla.gnome.org/show_bug.cgi?id=342851">syntax highlighting</a> has come back! Well, not entirely: just the links and the phonetics have been reinstated, and links still don&#8217;t work.  Links are colored using the <code>gtk-link-color</code> style property, which is also used by link buttons and the like (if your application renders hyperlinks or something like them, please use that style property!).  The reason why I disabled the syntax highlighting was that there&#8217;s no formal definition for the dictionary syntax: it really can break at any given time - as you&#8217;ll see when using it; also, the highlighting code was really messy, so I had to rewrite it and that took time.</p>
<p>All of this is going to hit <code>HEAD</code> this week or so.</p>
<p>There are plenty of other bugs lying around in Bugzilla, though; I hope to have more time during December to look at them and squash some more; but you know the drill: if you have your own pet bug scratch an itch and provide a patch. <img src='http://log.emmanuelebassi.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/11/the-engine-driver/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rainbows and Pots of Gold</title>
		<link>http://log.emmanuelebassi.net/archives/2006/07/rainbows-and-pots-of-gold/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/07/rainbows-and-pots-of-gold/#comments</comments>
		<pubDate>Mon, 24 Jul 2006 11:55:35 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<category>gnome-utils</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2006/07/rainbows-and-pots-of-gold/</guid>
		<description><![CDATA[Of docked windows, bugs and the Dictionary applet
One of the two major UI issues for the new Dictionary was the absence of the speller.  Since that has been somewhat fixed, even if it still lacks some polish, I decided to address the other, that is the fact that the Dictionary applet uses a docked [...]]]></description>
			<content:encoded><![CDATA[<h4>Of docked windows, bugs and the Dictionary applet</h4>
<p>One of the two major UI issues for the new Dictionary was the absence of the speller.  Since that has been somewhat <a href="http://log.emmanuelebassi.net/archives/2006/05/all-you-want/">fixed</a>, even if it still lacks some polish, I decided to address the other, that is the fact that the Dictionary applet uses a docked window instead of a full window.</p>
<p>The rationale for having a docked window instead of a floating one was that a docked window is alwas at the same place, linked to the applet, so if you want to check a word you can&#8217;t possibily &#8220;lose&#8221; the Dictionary and have to cycle through the window or workspaces list - which is the whole point of having the applet on a panel.  If you want a &#8220;fire and forget&#8221; Dictionary you can always create a launcher on you panel and click on it.</p>
<p>One problem with this rationale is that the dictionaries usually return preformatted text, which is understandable - they should work on ANSI terminals too; but this creates a dilemma: should we remove the formatting from the text, allowing the text view widget to reflow its content without changing the size of the window? Or should we keep the formatting and resize the window?</p>
<p>Docked window should not be resized by the user; I don&#8217;t resize the clock applet&#8217;s drop-down, or the drawer applet, or any menu: I expect them to change their size according to their content.  So, if we want to avoid what could be perceived as a regression by some users and keep the formatting of the dictionary entries, we must resize the window according to its content whenever is possible.</p>
<p>Here comes <a href="http://bugzilla.gnome.org/show_bug.cgi?id=332753">the</a> <a href="http://bugzilla.gnome.org/show_bug.cgi?id=346893">bug</a>:</p>
<div style="text-align:center">
<a id="p162" style="text-align:center" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/?attachment_id=162" title="Neat Bug"><img id="image162" src="http://log.emmanuelebassi.net/wp-content/uploads/2006/07/smalldict.png" alt="Neat Bug" /></a>
</div>
<p>I haven&#8217;t been able to hit, let alone reproduce, this bug until a couple of days ago.  Actually, I tried again with 2.14.0 and I could not hit it, so I think the issue is much more weird that I&#8217;ve thought <img src='http://log.emmanuelebassi.net/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /> .  Anyway: if you exposed the definition window before searching something, the window would not be resized.  The actual fix took less than ten minutes (writing, compiling, adding the stock applet to the panel, killing the applet, launching the newly compiled applet from terminal and hijacking the factory included) and consisted in a couple of lines.</p>
<div style="text-align:center">
<a id="p165" style="text-align:center" rel="attachment" class="imagelink" href="http://log.emmanuelebassi.net/?attachment_id=165" title="Bug vanished"><img id="image165" src="http://log.emmanuelebassi.net/wp-content/uploads/2006/07/fixeddict.png" alt="Bug vanished"/></a>
</div>
<p>I&#8217;ve closed both reports, essentially because inside all code paths that lead to the visualization of the window now take care of checking its size against its content.  If you hit this weird bug again with HEAD file a bug about it, but please, <i>please</i> avoid asking that the window should be resizable.  The definition window should just work; if it does require the user to change it, it&#8217;s a bug.</p>
<div style="text-align:center">
<a class="imagelink" href="http://log.emmanuelebassi.net/wp-content/uploads/2006/07/dict-speller.png" title="Similar words"><img id="image167" src="http://log.emmanuelebassi.net/wp-content/uploads/2006/07/dict-speller.png" width="300" height="185" alt="Similar words"/></a>
</div>
<h4>Of side bars, widgets and UI changes</h4>
<p>In related news, I&#8217;ve finally been able to spend some time updating Dictionary&#8217;s UI; the Speller widget is now embedded into a real side bar (like the one Evince and Totem use, albeit I used my own code), and there&#8217;s also a list showing the databases available on the dictionary source used; if you double click on a database, the following queries will be made against that database only (the setting is not permanent: you&#8217;ll have to update the source definition for this to happen).</p>
<div style="text-align:center">
<a class="imagelink" href="http://log.emmanuelebassi.net/wp-content/uploads/2006/07/dict-databases.png" title="Available databases"><img id="image166" src="http://log.emmanuelebassi.net/wp-content/uploads/2006/07/dict-databases.png" alt="Available databases" width="300" height="185"/></a>
</div>
<p>Still, the time I planned to spend and the features I intended to add to the Dictionary (and the rest of gnome-utils) are way below par, as you can see on <a href="http://live.gnome.org/GnomeUtils/RoadMap">gnome-utils roadmap</a>. I can mostly blame moving to London and the wedding, but the thruth is that after the feat of rewriting the entire Dictionary (backend, main frontend and applet) in three months I felt a little bit burned out.  The real upside, though, is that I can still hack new features like these without spending too much time (the sidebar and the database chooser are the result of 12 hours of hacking, after two months of not touching the code base except for the occasional bug fixing) thinking: &#8220;what was I thinking when I wrote this code&#8221; (except for the occasional: &#8220;hrm, what was I drinking before writing this code&#8221;); this means that the rewrite turned out pretty good: compare to adding the docked window inside the applet, a minor feature that required rewriting the entire thing.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/07/rainbows-and-pots-of-gold/feed/</wfw:commentRss>
		</item>
		<item>
		<title>All You Want</title>
		<link>http://log.emmanuelebassi.net/archives/2006/05/all-you-want/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/05/all-you-want/#comments</comments>
		<pubDate>Tue, 23 May 2006 14:16:52 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>gnome-dictionary</category>

		<category>gnome-utils</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/archives/2006/05/all-you-want/</guid>
		<description><![CDATA[this week end I decided to work full time on the dictionary; I ended up fixing a bunch of bugs and RFEs, namely

no more dialogs in case of word not found
a visual indicator of progress inside the main window
the re-addition of the &#8220;speller&#8221; widget
themed icons and bugzilla version inside the launcher

the error dialogs have been [...]]]></description>
			<content:encoded><![CDATA[<p>this week end I decided to work full time on the dictionary; I ended up fixing a bunch of bugs and <acronym title="Requests For Enhancement">RFEs</acronym>, namely</p>
<ul>
<li>no more dialogs in case of word not found</li>
<li>a visual indicator of progress inside the main window</li>
<li>the re-addition of the &#8220;speller&#8221; widget</li>
<li>themed icons and bugzilla version inside the launcher</li>
</ul>
<p>the error dialogs have been switched to an inline error message inside the defbox; I&#8217;d like to add an icon too, but there&#8217;s no direct placement of a pixbuf inside a GtkTextView: if you want pixel-positioning you must use a GtkImage widget.</p>
<p>I&#8217;ve added a throbber widget, using the same code nautilus and epiphany use.  while I&#8217;d like for the &#8220;spinner&#8221; widget to get into gtk+, I don&#8217;t really like the idea of having it on the dictionary <acronym title="User Interface">UI</acronym>: it makes the dictionary look like a browser or something, which is not.  on the other hand, I don&#8217;t know what to use to visually indicate that the dictionary is working and it&#8217;s not blocked; if you have an idea (even though code would be better) please let me know.</p>
<p>and, finally, I&#8217;ve re-done the <i>infamous speller widget</i>, the list of similar words that comes up when no words have been found.  it&#8217;s like the old widget, for the time being, but I intend to twist it a little bit more.  it remebers its state across sessions (like the whole dictionary does), and I&#8217;ll add a knob for disabling it in case you want your own personal grammar nazi on the desktop.  &lt;sarcasm&gt;thanks to all the people that bitched about it on bugzilla and never felt the urge to move their collective asses and help instead&lt;/sarcasm&gt;.  really - if half of the energy some people spend bitching <ins datetime="2006-05-24T11:18:56+00:00">on Bugzilla</ins> about missing features could be transformed in electricity we wouldn&#8217;t need to make wars for oil anymore.</p>
<p>anyway, here&#8217;s the obligatory screenshot:</p>
<p><a class="imagelink" href="http://log.emmanuelebassi.net/wp-content/uploads/2006/05/gdict-speller.png" title="GdictSpeller"><img id="image143" src="http://log.emmanuelebassi.net/wp-content/uploads/2006/05/gdict-speller.png" alt="GdictSpeller" style="width:256px;height:174px;" class="centered"/></a></p>
<p>the code needs to be cleaned up a little bit, and some cvs surgery is needed as I changed some of the layout of the files;  I expect to land my development trunk on <a href="http://cvs.gnome.org/viewcvs/gnome-utils">cvs.gnome.org</a> this weekend.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/05/all-you-want/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Broken</title>
		<link>http://log.emmanuelebassi.net/archives/2006/01/broken/</link>
		<comments>http://log.emmanuelebassi.net/archives/2006/01/broken/#comments</comments>
		<pubDate>Sat, 28 Jan 2006 01:35:40 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>C</category>

		<category>gnome-dictionary</category>

		<category>gnome-utils</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2006/01/28/broken/</guid>
		<description><![CDATA[The next release of gnome-utils, 2.13.90, will make libgdict adhere to the API/ABI freeze, even if it&#8217;s not part of the Gnome Developer Platform but only of the Desktop.
The freeze had been in effect since the last release (January 18th), and I planned not to change libgdict API; unfortunately, when writing the support for the [...]]]></description>
			<content:encoded><![CDATA[<p>The next release of gnome-utils, 2.13.90, will make libgdict adhere to the <acronym title="Application Programming Interface">API</acronym>/<acronym title="Application Binary Interface">ABI</acronym> <a title="Gnome Live! - Release Planning / Freezes" href="http://live.gnome.org/ReleasePlanning_2fFreezes">freeze</a>, even if it&#8217;s not part of the Gnome Developer Platform but only of the Desktop.</p>
<p>The freeze had been in effect since the last release (January 18th), and I planned not to change libgdict <acronym title="Application Programming Interface">API</acronym>; unfortunately, when writing the support for the <code>document_font_name</code> GConf key, which was introduced in Gnome 2.12 and that should be honoured by any application showing arbitrarily long texts to the user, I noticed that a call to <code>gtk_widget_modify_font</code> to a <code>GtkContainer</code> does not propagate to the containers&#8217;s children.  The widget the Dictionary uses to display the text of the definitions is, in fact, a composite widget (a <code>GtkVBox</code>) as it needs to hold the text display and the find bar; the inner widgets are held inside a private structure, and are not visible to the outside.</p>
<p>If I wanted to work around this, I would have written something like this function inside the code of the libgdict users:</p>
<pre class="code">
static void
gtk_container_modify_font_children (GtkContainer *container,
				    const gchar  *font_name)
{
  GList *children, *l;
  PangoFontDescription *font_desc;

  g_return_if_fail (GTK_IS_CONTAINER (container));

  font_desc = NULL;
  if (font_name)
    {
      font_desc = pango_font_description_from_string (font_name);
      g_return_if_fail (font_desc != NULL);
    }

  children = gtk_container_get_children (container);
  for (l = children; l != NULL; l = l->next)
     {
        GtkWidget *widget = GTK_WIDGET (l->data);

	gtk_widget_modify_font (widget, font_desc);
     }

  g_list_free (children);

  if (font_desc)
    pango_font_description_free (font_desc);
}
</pre>
<p>But it would not have worked; I wanted to change the font of the <code>GtkTextView</code> widget inside the <code>GdictDefbox</code>, while the function above would have changed font for all internal widgets - including the find pane.</p>
<p>Assigning a name to the <code>GtkTextView</code> widget, say &#8220;text-display&#8221;, by using the <code>gtk_widget_set_name</code> function, and changing the code of the inner loop to something like this:</p>
<pre class="code">
...
  for (l = children; l != NULL; l = l->next)
     {
        GtkWidget *widget = GTK_WIDGET (l->data);
	const gchar *name = gtk_widget_get_name (widget);

	if (strcmp (name, "text-display") == 0)
          gtk_widget_modify_font (widget, font_desc);
     }
...
</pre>
<p>I would have avoided the <acronym title="Application Programming Interface">API</acronym> breakage inside libgdict - but I would also have created a performance bottleneck, since I transformed a constant time operation into a linear time one (from an assignment to a list walk) - plus, I don&#8217;t know what happens into <code>gtk_widget_modify_font</code>; also, I would have created a documentation issue, since I now would have to document the widget&#8217;s name and hope that nobody would ever have the urge to change the <code>GdictDefbox</code> font - at least, not after having had lunch.</p>
<p>Giving a name to the inner children of a composite widget is always a good practice - it makes handling these kind of situations easier; but between an hackish approach and a breakage of an <acronym title="Application Programming Interface">API</acronym> freeze, I would rather choose the latter.  Hacks tend to get sticky, and you get a <a title="context switch - dictionary applet/2" href="http://log.emmanuelebassi.net/2005/10/20/dictionary-applet2/">design by accretion</a> if you let them stick around enough.</p>
<p>So, I opten for adding a new property to the <code>GdictDefbox</code> widget, called <code>font-name</code>, and its two accessor functions:</p>
<pre class="code">
G_CONST_RETURN gchar *gdict_defbox_get_font_name (GdictDefbox *defbox);
void                  gdict_defbox_set_font_name (GdictDefbox *defbox,
						  const gchar *font_name);
</pre>
<p>Which are just proxies for the <code>gtk_widget_modify_font</code> function.  Since nobody uses libgdict (it&#8217;s been out there only for the folks using Ubuntu or jhbuild), the breakage is really minimal; nevertheless, I feel a bit guilty for not having tested this stuff before, in time for the freeze.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2006/01/broken/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Source</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/source/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/source/#comments</comments>
		<pubDate>Fri, 30 Dec 2005 15:50:53 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/12/30/source/</guid>
		<description><![CDATA[Feeling a little better, today: temperature steadily under 37°C, little to no headaches.
I&#8217;ve hacked the last bits of the Add Source dialog of Dictionary, and committed away a bunch of other fixes, including one for a crasher spotted by Paolo Borelli, a bunch of UI fixes by Dennis Cranston and corrections for my bad english [...]]]></description>
			<content:encoded><![CDATA[<p>Feeling a little better, today: temperature steadily under 37°C, little to no headaches.</p>
<p>I&#8217;ve hacked the last bits of the Add Source dialog of Dictionary, and committed away a bunch of other fixes, including one for a crasher spotted by <a href="www.advogato.org/person/pbor">Paolo Borelli</a>, a bunch of <acronym title="User Interface">UI</acronym> fixes by Dennis Cranston and corrections for my bad english by Clytie Siddall.  Thanks to all of them: with their help, the next release of Dictionary will suck a lot less.</p>
<p>The <i>Add Source</i> dialog makes me feel a little proud:</p>
<p><img alt="gnome-dictionary-source-add-1" class="centered" src="http://log.emmanuelebassi.net/images/shots/gnome-dictionary-source-add-1.png" title="GNOME Dictionary: Source Add dialog"/></p>
<p>Here you can see the dialog when you click the &#8220;Add&#8221; button; you can set the description of the source and its transport.  Choosing a transport will automagically show the preferences bound to that transport:</p>
<p><img alt="gnome-dictionary-source-add-2" class="centered" src="http://log.emmanuelebassi.net/images/shots/gnome-dictionary-source-add-2.png" title="GNOME Dictionary: Source Add dialog"/></p>
<p>Obviously, since libgdict supports only the Dictionary Protocol transport, you have only one choice, but expect other transports to be available from the next release of GNOME.  The &#8220;Advanced Settings&#8221; pane will expose the Database and Strategy settings:</p>
<p><img alt="gnome-dictionary-source-add-3" class="centered" src="http://log.emmanuelebassi.net/images/shots/gnome-dictionary-source-add-3.png" title="GNOME Dictionary: Source Add dialog"/></p>
<p>Those two combo boxes should automagically query the dictionary source using the <code>GdictContext</code> bound to the transport the user has chosen; unfortunately, they don&#8217;t - yet.  I hope to get around this issue before the code freeze, but I really don&#8217;t know if I&#8217;m going to make it in time.</p>
<p>If you want to have a look at how it all works, I&#8217;ve prepared a little <a href="http://log.emmanuelebassi.net/resources/source-dialog.ogg">screencast</a> (courtesy of <a title="Istanbul" href="http://live.gnome.org/Istanbul">Istanbul</a>).</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome+dictionary" rel="tag">gnome+dictionary</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/source/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inkscape</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/inkscape/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/inkscape/#comments</comments>
		<pubDate>Thu, 29 Dec 2005 15:30:51 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/12/29/inkscape/</guid>
		<description><![CDATA[On a IRC conversation, I was told that the Dictionary icon sucked.  Thus, after having a look at the Tango Project and their beatiful icons, I fired up Inkscape and worked on another version of the icon:

It still sucks, but now it sucks in 3D!
I&#8217;ll file a bug report to remove the old &#8220;gdict&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>On a <acronym title="Internet Relay Chat">IRC</acronym> conversation, I was told that the Dictionary icon sucked.  Thus, after having a look at the <a title="Tango Project" href="http://tango-project.org">Tango Project</a> and their beatiful icons, I fired up <a title="Inkscape" href="http://www.inkscape.org">Inkscape</a> and worked on another version of the icon:</p>
<p><img alt="Dictionary" class="centered" src="http://log.emmanuelebassi.net/images/gnome-dictionary.png"/></p>
<p>It still sucks, but now it sucks <b>in 3D</b>!</p>
<p>I&#8217;ll file a bug report to remove the old &#8220;gdict&#8221; icon from the theme, and ask the GNOME artists to do a new version, with more than one size.
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/inkscape/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Spawn of hell</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/spawn-of-hell/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/spawn-of-hell/#comments</comments>
		<pubDate>Fri, 16 Dec 2005 16:51:46 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/12/16/spawn-of-hell/</guid>
		<description><![CDATA[auto-tools: from the same people that brought you EMACS.
After two hours of struggling with that damned make distcheck, in order to smoke test the merge of the new-dictionary branch of gnome-utils, I&#8217;ve finally been greeted by:

===================================================
gnome-utils-2.13.4.tar.gz is ready for distribution
===================================================

After a bit of clean up, I&#8217;m going to commit it to HEAD.
Update 20051216@19:18 The new [...]]]></description>
			<content:encoded><![CDATA[<p><b>auto-tools</b>: from the same people that brought you <acronym title="EMACS Makes A Computer Slow">EMACS</acronym>.</p>
<p>After two hours of struggling with that damned <code>make distcheck</code>, in order to smoke test the merge of the <code>new-dictionary</code> branch of gnome-utils, I&#8217;ve finally been greeted by:</p>
<pre>
===================================================
gnome-utils-2.13.4.tar.gz is ready for distribution
===================================================
</pre>
<p>After a bit of clean up, I&#8217;m going to commit it to HEAD.</p>
<p><b>Update 20051216@19:18</b> The new GNOME Dictionary is in gnome-utils HEAD; the old Dictionary is gone into the Attic.  I for one welcome our new dictionary overlords.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome+utils" rel="tag">gnome+utils</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/spawn-of-hell/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary Applet/11 and final</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet11-and-final/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet11-and-final/#comments</comments>
		<pubDate>Thu, 15 Dec 2005 17:59:14 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/12/15/dictionary-applet11-and-final/</guid>
		<description><![CDATA[After two months, here&#8217;s to you:

The New! And Improved! Dictionary Applet.
Soon to hit gnome-utils HEAD on the repository mirrors near you!
[hacking]
[gnome]
[gnome+dictionary]

]]></description>
			<content:encoded><![CDATA[<p>After <a href="">two months</a>, here&#8217;s to you:</p>
<p><img alt="dictionary comparison" class="centered" src="http://log.emmanuelebassi.net/images/shots/dictionary-comparison.png"/></p>
<p>The <b>New! And Improved!</b> Dictionary Applet.</p>
<p>Soon to hit gnome-utils HEAD on the repository mirrors near you!</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome+dictionary" rel="tag">gnome+dictionary</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet11-and-final/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary Applet/10</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet10/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet10/#comments</comments>
		<pubDate>Tue, 13 Dec 2005 02:33:55 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/?p=89</guid>
		<description><![CDATA[The merge of the new-dictionary branch into gnome-utils HEAD is fast approaching: I&#8217;ve set the deadline to the end of the week - in time to write off the last bits of the preferences dialog:


the sources tab of the preferences dialog

Right now, you can&#8217;t add or activate a new dictionary source, unless you write the [...]]]></description>
			<content:encoded><![CDATA[<p>The merge of the <code>new-dictionary</code> branch into gnome-utils HEAD is fast approaching: I&#8217;ve set the deadline to the end of the week - in time to write off the last bits of the preferences dialog:</p>
<div class="center">
<img alt="gdict-pref-dialog" class="centered" src="http://log.emmanuelebassi.net/images/shots/gdict-pref-dialog-1.png"/><br/><br />
<span class="caption">the sources tab of the preferences dialog</span>
</div>
<p>Right now, you can&#8217;t add or activate a new dictionary source, unless you write the <code>.desktop</code> file and drop it into <code>$HOME/.gnome2/gnome-dictionary</code>, and then change the <code>/apps/gnome-dictionary/source</code> key inside GConf - but I plan to have this nailed down in the next couple of days (the UI for both display and edit has already been designed using Glade).</p>
<div class="center">
<img alt="gdict-pref-dialog" class="centered" src="http://log.emmanuelebassi.net/images/shots/gdict-pref-dialog-2.png"/><br/><br />
<span class="caption">the printing tab of the preferences dialog</span>
</div>
<p>The font selection thingy for the printed output is, instead, already working.</p>
<p><b>Known regressions:</b> the text highlighting is still missing, and I don&#8217;t know if it&#8217;s going to make it not only before the merge deadline, but also before UI freeze.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome+dictionary" rel="tag">gnome+dictionary</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet10/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary Applet/9</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet9/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet9/#comments</comments>
		<pubDate>Thu, 08 Dec 2005 22:32:32 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/?p=88</guid>
		<description><![CDATA[I&#8217;ve added printing support - after a bit of struggle with GnomePrint:

The output format is stolen^Winspired by Gedit, and the font is hardcoded as Serif, 12; I&#8217;ve already added a GConf key to the shipped schema - GConf integration, as well as preferences are still in a state of flux.  Now that the printing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added printing support - after a bit of struggle with GnomePrint:</p>
<p><a title="Dictionary now features better printing output" href="http://log.emmanuelebassi.net/images/shots/gnome-dictionary-print-full.jpg"><img class="centered" title="gnome dictionary print" src="http://log.emmanuelebassi.net/images/shots/gnome-dictionary-print.png"/></a></p>
<p>The output format is stolen<span style="color:blue">^W</span>inspired by Gedit, and the font is hardcoded as <i>Serif, 12</i>; I&#8217;ve already added a GConf key to the shipped schema - GConf integration, as well as preferences are still in a state of flux.  Now that the printing is mostly nailed down, I&#8217;ll resume work on the UI side, by adding a status bar and the preferences dialog.  Also, work on the applet will begin as soon as these issues are solved; the applet should be, in fact, very easy to code.</p>
<p><b>Note</b>: It seems that a critical warning is issued each time a print dialog is destroyed and then recreated - like some signals handlers that aren&#8217;t correctely disconnected; I&#8217;ll have a look at it, but it seems a bug of libgnomeprint as far as I can tell. <b>Update 20051212@02:53:</b> it is now <a title="Bug 323836 - Critical warnings inside libgnomeprint" href="http://bugzilla.gnome.org/show_bug.cgi?id=323836">bug #323836</a> of libgnomeprintui</p>
<p>Also, judging from the memory consumption, I&#8217;m afraid of some leakage inside libgdict (mostly).  I&#8217;ll have a run with Valgrind, and see what&#8217;s going on under the hood.  <b>Update 20051210@16:33:</b> it seems that I was fooled by the system monitor memory usage graph, as I found two simple leaks (due to me being a sloppy coder), accountable of just 6kB lost - and just once per process, since one was inside the singleton init, and the other inside the <code>GdictSourceLoader</code> directory walking.  Both are now fixed inside my development trunk.  I&#8217;m positive that, if the trend continues, the new code might land inside HEAD the next two weeks - given that the preferences dialog and the dictionary source creation code are pretty much done, and that the applet will be easy to code.  Once we reach feature freeze time (in January), I&#8217;ll devote myself in writing a good user&#8217;s manual.  Some might think that the next release will be a regression, but believe me: the trade-off of a few features for code readability, maintainability and overall performance is well worth it; features will be re-implemented in no time.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome-+dictionary" rel="tag">gnome+dictionary</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/dictionary-applet9/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Maintainership/2</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/maintainership2/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/maintainership2/#comments</comments>
		<pubDate>Wed, 07 Dec 2005 22:17:19 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/12/08/maintainership2/</guid>
		<description><![CDATA[I&#8217;ve just committed my development trunk of Dictionary on the CVS, as usual to new-dictionary branch.
Features

a navigation menu, with shortcuts for first/previous/next/last definitions
a Ctrl+Shift+G shortcut for search backwards
a &#8220;Save a Copy&#8221; menu item, used to save the content of the query to a text file;

It also features a stub for the user&#8217;s manual and some [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just committed my development trunk of Dictionary on the CVS, as usual to <code>new-dictionary</code> branch.</p>
<h4>Features</h4>
<ul>
<li>a navigation menu, with shortcuts for first/previous/next/last definitions</li>
<li>a <span class="shortcut">Ctrl+Shift+G</span> shortcut for search backwards</li>
<li>a &#8220;Save a Copy&#8221; menu item, used to save the content of the query to a text file;</li>
</ul>
<p>It also features a stub for the user&#8217;s manual and some clean-ups for the build system.</p>
<h4>What&#8217;s next?</h4>
<p>I&#8217;m working on the printing system and the preferences dialog.</p>
<p>I&#8217;ve decided to remove the font preference, in order to make it the same of the desktop; I don&#8217;t want yet another font chooser.  The only place where it makes sense to have another font is when printing - and for that we might just have a key in GConf.</p>
<p>Also, the text highlighting is going to be scaled down: since we are going to use multiple dictionary sources, over multiple languages, we really don&#8217;t know <i>a priori</i> some things, like how the enumerations will look like.  The only text modifiers I&#8217;m going to keep will be <code>[...]</code> attributions (which will be rendered using italics); <code>\...\</code> phonetics (which will be rendered in a styled color, default: gray); <code>{...}</code> links (which will be rendered in a styled color, default: blue).</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/gnome+dictionary" rel="tag">gnome+dictionary</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/maintainership2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Maintainership</title>
		<link>http://log.emmanuelebassi.net/archives/2005/12/maintainership/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/12/maintainership/#comments</comments>
		<pubDate>Wed, 07 Dec 2005 01:50:49 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/12/07/maintainership/</guid>
		<description><![CDATA[Vincent kindly asked me to join the maintainer team of gnome-utils, and I more than gladly accepted.
In order to celebrate the event, here&#8217;s the latest screenshot of my development trunk for Dictionary:

the new Dictionary
As you can see, the current state is not far from the actual, stable, Dictionary:

the old Dictionary
What&#8217;s missing:

the text parsing
the menu callbacks
the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vnoel.wordpress.com">Vincent</a> kindly asked me to join the maintainer team of <a href="http://live.gnome.org/GnomeUtils">gnome-utils</a>, and I more than gladly accepted.</p>
<p>In order to celebrate the event, here&#8217;s the latest screenshot of my development trunk for Dictionary:</p>
<p><img alt="gnome dictionary new" class="centered" title="GNOME Dictionary" src="http://log.emmanuelebassi.net/images/shots/gnome-dictionary-new.png"/><br />
<span class="caption">the new Dictionary</span></p>
<p>As you can see, the current state is not far from the actual, stable, Dictionary:</p>
<p><img alt="gnome dictionary old" class="centered" title="GNOME Dictionary" src="http://www.gnome.org/~vnoel/screenshots/gdict-2.11.2.png"/><br />
<span class="caption">the old Dictionary</span></p>
<p>What&#8217;s missing:</p>
<ul>
<li>the text parsing</li>
<li>the menu callbacks</li>
<li>the preferences dialog</li>
<li>the user&#8217;s manual</li>
<li>print support</li>
</ul>
<p>The feature equivalence could require a bit more time than foreseen - especially the printing part and the manual - but I plan to have everything in place befor Christmas: think of it as my gift.</p>
<p>I plan to commit the new-dictionary to HEAD as soon as I have finished the menu callbacks and the preferences dialog.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/12/maintainership/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary Applet/8</title>
		<link>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet8/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet8/#comments</comments>
		<pubDate>Tue, 29 Nov 2005 11:21:31 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/?p=81</guid>
		<description><![CDATA[I&#8217;ve finally been able to begin working on the new GNOME Dictionary widgets.  While GdictEntry still has issues - related to the speed of word look up and the entry completion - and has already hit CVS, in the last two days I&#8217;ve been hacking on the definition display widget, or GdictDefbox (I&#8217;ve retained [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally been able to begin working on the new GNOME Dictionary widgets.  While <code>GdictEntry</code> still has issues - related to the speed of word look up and the entry completion - and has already hit CVS, in the last two days I&#8217;ve been hacking on the definition display widget, or <code>GdictDefbox</code> (I&#8217;ve retained the name from the old code).</p>
<p>The new Defbox code is a little bit more simple - things like links are not implemented (yet, even though I found them questionable), and the output is not quite as good looking as the old one; here&#8217;s the obligatory screenshot:</p>
<p><img alt="gdict-defbox" title="GdictDefbox" class="centered" src="http://log.emmanuelebassi.net/images/shots/gdict-defbox-1.png"/></p>
<div class="caption">
<p>the new GdictDefbox</p>
</div>
<p>Aside from code cleanliness and the new multiple back-end system, what differences there are with the old Defbox?  First of all, this is a composite widget and not just a TextView-derived widget; this allows neat things like the next feature, that is the embedded search pane:</p>
<p><img alt="gdict-defbox" title="GdictDefbox" class="centered" src="http://log.emmanuelebassi.net/images/shots/gdict-defbox-2.png"/></p>
<div class="caption">
<p>the embedded search pane</p>
</div>
<p>It should Just Work&reg;: <span class="shortcut">Ctrl+F</span> to view it, <span class="shortcut">Ctrl+G</span> for the next match, <span class="shortcut">Esc</span> to close it.  Say goodbye to silly find dialogs.</p>
<p><img alt="gdict-defbox" title="GdictDefbox" class="centered" src="http://log.emmanuelebassi.net/images/shots/gdict-defbox-3.png"/></p>
<div class="caption">
<p>the embedded search pane at work</p>
</div>
<p>The new GdictDefbox also allows jumping from one definition to another, by tracking them internally.</p>
<p>With <code>GdictDefbox</code> nailed down, a simple Dictionary application and applet might already be created; I plan to improve the definition box&#8217;s output and put it on par with the current one (plus enabling theming of the colors/sizes using <code>GtkStyle</code>) before actually coding the new Dictionary - but keep checking out the <code>new-dictionary</code> branch of gnome-utils in the next week or so.</p>
<p><b>Update 20051129@13:49:</b> the spiffy new <code>GdictDefbox</code> is CVS as of some minutes.  Go and try it using the <code>gnome-dictionary/libgdict/test-defbox.c</code> test case.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/development" rel="tag">development</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet8/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary Applet/7</title>
		<link>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet7/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet7/#comments</comments>
		<pubDate>Thu, 24 Nov 2005 12:49:51 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>Hacking</category>

		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/11/24/dictionary-applet7/</guid>
		<description><![CDATA[New week, new adventures
Actually, the number of new adventures has been strictly limited by my birthday first, and by a strange feeling of drowsiness that lasted all week (and still lasts as I&#8217;m writing this).  Probably, it&#8217;s due to the fact that I&#8217;ve been sleeping like four hours per night since the last week-end. [...]]]></description>
			<content:encoded><![CDATA[<p><i>New week, new adventures</i></p>
<p>Actually, the number of <i>new adventures</i> has been strictly limited by my birthday first, and by a strange feeling of drowsiness that lasted all week (and still lasts as I&#8217;m writing this).  Probably, it&#8217;s due to the fact that I&#8217;ve been sleeping like four hours per night since the last week-end.  Yep, that&#8217;s probably it.</p>
<h3>Dictionary Sources</h3>
<p>The stuff (which should land in CVS as soon as I can fix up a test unit for it) coded in two days is the spiffy new dictionary source configuration file. Since we could have multiple dictionary sources, and thus multiple contextes, we also need a way to tell Dictionary what to use.  Steal<span style="color:blue">^H^H^H^H</span>Taking inspiration from the new Gedit plugin systems which uses <code>.desktop</code> files for defining meta-data bound to a plug-in (author, name, description, etc.), I&#8217;ve designed a <code>.desktop</code> file for dictionary sources:</p>
<pre class="code">
[Dictionary]
_Name=Default
_Description=Default Dictionary server
Transport=dictd
Hostname=dict.org
Port=2628
</pre>
<p>The <code>Transport</code> does the trick: it specifies which <code>GdictContext</code> implementation should be used.  Each dictionary source file is interpreted by the <code>GdictSource</code> class, which loads the <code>.desktop</code> file from an absolute path and creates the right <code>GdictContext</code> for you.</p>
<p>These sources should go inside default directories - right now, the only hard-coded directory is <code>$DATADIR/gdict-1.0/sources</code>, but GNOME Dictionary will also check into <code>$HOME/.gnome2/gdict-1.0/sources</code> (and, in the end, I&#8217;d like to use $XDG_DATA_DIRS/gdict-1.0/sources).  All the dictionary source files found in those directory will be loaded by the <code>GdictSourceLoader</code> object; using this object, you&#8217;ll be able to access the whole sources list or directly get the <code>GdictSource</code> for a particular name.  Oh, and if you look at the format of the dictionary source file, you&#8217;ll see that both the Name and Description keys are localizable.</p>
<p>As soon as I begin adding transports (in form of <code>GdictContext</code> implementations) to GNOME Dictionary, more dictionary sources will be made available; if I add run-time plug-ins to libgdict in the future (maybe the next development cycle), those plug-ins will have to provide a dictionary source file in order to be used.</p>
<p>How does this change the code for a dictionary client? Now, you&#8217;ll have to load the dictionary sources and get the source you want, say the default one:</p>
<pre class="code">
  GMainLoop *main_loop;
  GdictSourceLoader *loader;
  GdictSource *default;
  GdictContext *context;

  main_loop = g_main_loop_new (<b class="code-string">NULL</b>, <b class="code-string">FALSE</b>);

  loader = gdict_source_loader_new ();
  source = gdict_source_loader_get_source (loader, <b class="code-string">&quot;Default&quot;</b>);

  context = gdict_source_get_context (source);
  g_signal_connect (context, <b class="code-string">&quot;definition-found&quot;</b>,
                    G_CALLBACK (definition_found_cb), <b class="code-string">NULL</b>);

  gdict_context_define_word (context, <b class="code-string">&quot;vera&quot;</b>, <b class="code-string">&quot;GNOME&quot;</b>, <b class="code-const">NULL</b>);

  g_main_loop_run (main_loop);

  g_object_unref (context);
  g_object_unref (source);
  g_object_unref (loader);
</pre>
<p>As you see - nothing more complex that adding those lines.</p>
<p><b>Update 20051124@1435:</b> I&#8217;ve committed my development trunk to the <code>new-dictionary</code> branch of gnome-utils.  The <code>src</code> directory doesn&#8217;t build yet, since there&#8217;s not much to build, but everything works in <code>libgdict</code>, where all the fun is <acronym title="At The Moment">ATM</acronym>.  Now that we have most of the infrastructure in place, the <acronym title="User Interface">UI</acronym> should soon follow. I&#8217;ll make smaller check-ins, from now on.</p>
<p><b>Update 20051124@2126:</b> I&#8217;ve coded in 10 minutes (while commuting from my university to home) and committed simple test suite for <code>GdictSource</code> and <code>GdictSourceLoader</code> (it works only if you install the dictionary source file - but it should give you an idea on how it works); I&#8217;ve also fixed a couple of dumb bugs (did I&#8217;ve already said that I&#8217;m a sloppy coder?) discovered when coding the test suite.  While I&#8217;m waiting for Marta, I&#8217;ll begin porting <code>GdictDefbox</code>.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]
</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet7/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dictionary Applet/6</title>
		<link>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet6/</link>
		<comments>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet6/#comments</comments>
		<pubDate>Mon, 21 Nov 2005 09:59:32 +0000</pubDate>
		<dc:creator>ebassi</dc:creator>
		
		<category>GNOME</category>

		<category>gnome-dictionary</category>

		<guid isPermaLink="false">http://log.emmanuelebassi.net/2005/11/21/dictionary-applet6/</guid>
		<description><![CDATA[The new GNOME Dictionary code has landed in CVS this morning! woot!
I hope I didn&#8217;t fuck everything up - as usual when I&#8217;m dealing with CVS.  viewcvs seems to be fine - and the tree seems to build.
ATM, you won&#8217;t find much - just the context stuff and the dictionary protocol client implementation (with [...]]]></description>
			<content:encoded><![CDATA[<p>The new GNOME Dictionary code has landed in CVS this morning! <i>woot!</i></p>
<p>I hope I didn&#8217;t fuck everything up - as usual when I&#8217;m dealing with CVS.  <a href="http://cvs.gnome.org/viewcvs/gnome-utils/gnome-dictionary/?only_with_tag=new-dictionary">viewcvs</a> seems to be fine - and the tree seems to build.</p>
<p><acronym title="At This Moment">ATM</acronym>, you won&#8217;t find much - just the context stuff and the dictionary protocol client implementation (with a test program); see the <a href="http://cvs.gnome.org/viewcvs/*checkout*/gnome-utils/gnome-dictionary/TODO?rev=1.1.2.1">TODO</a> for what comes next.</p>
<p>[<a class="technorati-tag" href="http://technorati.com/tag/gnome" rel="tag">gnome</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/hacking" rel="tag">hacking</a>]<br />
[<a class="technorati-tag" href="http://technorati.com/tag/cvs" rel="tag">cvs</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://log.emmanuelebassi.net/archives/2005/11/dictionary-applet6/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
