Tag Archives: Gnome

www.gnome.org

Creating GTK+ input methods

I have just implemented a GTK+ input method to allow input via multiple key presses, with a timeout, as on mobile phones.

(Update: here is a source tarball – improvements welcome. I’m now wondering how I can specify this as the default input method.)

I didn’t find any documentation about how to do this, but there are examples:

From these examples, I figured out the following, which I might try to get into the gtk-doc documentation later:

Functions that the shared library should export

The shared library must export:

  • im_module_init()
  • im_module_exit()
  • im_module_list()
  • im_module_create()

Updating gtk.immodules

The input modules must be listed in the /etc/gtk-2.0/gtk.immodules file, which is a cache of input modules information. Your Makefile should generate a new gtk.immodules file, using gtk-query-immodules-2.0, then install it.

Implementing a GtkIMContext

You must implement a GtkIMContext, an instance of which will be returned by your im_module_create() function.

Though most GObjects would have a *_get_type() function that calls g_type_register_static(), input modules need a *_register_type() function that takes a GTypeModule, which it provides to g_type_module_register_type(). This *_register_type() function should be called from your im_module_init() function. This means:

  • You can’t use the G_DEFINE_TYPE macro.
  • You can implement a *_get_type() function that just gets the GType if it has been registered by your *_register_type() function, but which fails otherwise. This seems to make if difficult (maybe impossible) to implement a GtkIMContext which is both directly usable and which may be a base class for other GtkIMContext implementations.

For “table-based” input methods, you can just derive from GtkIMContextSimple and call gtk_im_context_simple_add_table() with your table array, which specifies which sequences of characters can be used to specify an actual output character. When entering one of these intermediate characters an underline indicates that the user is in compose mode. Pressing the right arrow, or pressing a non-relevant character, accepts the displayed character. For instance, see the Tigrigna-Eritrean input method from GTK+, or the Esperanto input method in gtk-im-extra.

GtkIMContext has several virtual functions that you may want to override. These are not documented, but you can at least see their signatures in the GtkIMContext header file. The most important ones seem to be:

  • filter_keypress: This can emit the (undocumented) “commit” signal, sending a string when composing has finished, resulting in a character, and it can emit the “preedit_changed” signal, which will cause your get_preedit_string vfunc to be called.
  • get_preedit_string: This returns a string to be shown to the user, to indicate what character would be used if it were accepted. This can use Pango to show the pre-edit UI, such as underlined text to indicate a possible character.

GNOME bug-buddy magic

Today I noticed that GNOME’s bug-buddy crash reporter has become almost self-aware. The SoundJuicer audio ripper crashed (first time for me, and not reproducable). Bug-buddy reported the bug (without asking me for any sendmail nonsense), then showed me a clickable URL link to my bug. The magic:

  • It was actually not a new bug. It was an old bug, which bug-buddy/bugzilla had automatically identified as a duplicate, probably by comparing the stack trace. The comments in the bug report mentioned that it was actually caused by musicbrainz, but that musicbrainz fixed it in a later version. I added a comment about distros needing to update their musicbrainz version for the next person who finds themselves there.
  • A few seconds later, bugzilla sent me an email saying

    You recently submitted a bug report to GNOME Bugzilla using Bug-Buddy.

    Thank you for reporting this bug. This is actually caused by musicbrainz (used
    by sound-juicer). See for more information:
    http://bugs.musicbrainz.org/ticket/2262

That’s amazing.

Self-hosting Glom

Glom 1.3.5 has experimental support for self-hosting of its databases, so you should never again need to configure PosgreSQL.

It does this by starting its own PostgreSQL instance, supplying its own PostgreSQL configuration and data files, and connecting to it. Those files are stored in one directory, though I’d like to improve that directory structure. This vastly improves the user experience, so I expect this to bring a lot more users once I’ve shaken out the new bugs.

This should satisfy most people who were demanding support for SQLite instead of PostgreSQL. Unlike SQLite, this still allows you to share your database across the network with multiple users. Support for non-PostgreSQL external database servers is still possible, but that work is really not my priority.

I really do need to combine some of the dialogs. At the moment you see several dialogs, one after the other, to save a new file, choose a database name (and choose self-hosting or external hosting), then to connect or provide initial connection details.

glom_new_database_with_self_hosting

Wish Lists

As Festivus approaches, now is as good a time as any to symbolically thank a hard-working open source developer. Amazon wish lists are a pretty good way to do this. But few of you seem to have wish lists, so I can’t give you stuff.

Come on, give your users a wish list for once, instead of vice-versa.

GNOME Foundation Board elections, 2006

You have only until Saturday December 16th to vote in the GNOME Foundation Board elections. Read the discussions in foundation-list, find your “Official Ballot for 2006 GNOME Foundation Elections” email in your inbox, and use the “Vote token” to vote.

Generally, only half of us vote, so there is still time to change that this time. You could be one of the people who voted for the board that employed a dedicated sysadmin, funded developer documentation, created a beautiful marketing strategy, encouraged your local GNOME group, talked to your local politicians about using free software and open standards, created GNOME merchandise web sites, sponsored you to travel to GUADEC, gave you a free T-shirt, or whatever you care about most.

I voted already. I always vote for a mix of newcomers and veterans, generally picking the people who are passionate about specific tasks.

Glom: Showing related related records

The feature I mentioned in “SQL: joins and duplicates” is now implemented in Glom 1.3.3. It’s just a matter of choosing relationships from a tree rather than just a list, though it’s only 2 levels deep for now to keep it simple.

So if there are, for instance, Invoices with related Invoice Lines records, which refer to Products, then you could look at a Product details screen and see all the Invoices that use the Product (via their Invoice Lines records). If I added a 3rd level of child relationships then you could even see all the Customers (used by the Invoice table) that had ever been invoiced for the product.

Here’s a screenshot of the UI for the Licenses, Packages, Package Scans example:

glom_screenshot_related_related

The UI isn’t perfect. I don’t like that it’s enabled via a checkbox but I think the tree would be confusing if it was default. Trees in GtkComboBox widgets are also rendered as these confusing menus, but it could be replaced by a popup GtkTreeView some day. But I feel very satisfied that I’ve made it easy to do something that’s usually difficult, with only minor UI changes. Many thanks to Jerry Haltom for showing me how this could be done.

The SQL that’s generated is much the same as for regular related records (SELECT related_table.field1, related_table.field2 FROM related_table WHERE related_table_field3 = 123), but with an extra JOIN … AS … ON clause to link to the intermediate table, a slightly changed WHERE clause (to refer to that intermediate join), and a GROUP BY on the related table’s primary key to ensure that we get only one row for each related record. A sub-select query might be more efficient, but this allows me to reuse the existing code, and lets the user think in terms of the target related table rather than an intermediate one.

So using Glom’s –debug_sql now shows yet more complex SQL that you wouldn’t want to write yourself.

GNOME Code of Conduct: GNOME is people

Please do “sign” the GNOME Code of Conduct and show the world what nice people we are. It’s something to be proud of.

It’s a little silly that we must do this individually just to establish what we think is self-evident, but let’s just get it done. I’m hoping for an overwhelming response.

Update: 100 signatures is great, but it doesn’t yet feel overwhelming. A few more would send a convincing message.

Got him!

Extra work has been taking up the spare capacity, so another slot at Openismus GmbH opened up. Employee number 4 is Armin Burgmeier, developer of the much-loved Gobby collaborative editor. He’s working part-time.

He’ll start with some C++ wrapping work, using gtkmm’s gmmproc to generate C++ bindings for an existing open-source GObject-based C API, for a client in Austria. Surprisingly, there’s a lot of demand for this, but I guess it makes sense – It’s not particularly difficult, but it’s quicker when you know how, and commercial projects cannot wait a year until someone else gets around to it. It also takes some expertise to know when a C++ API looks right, and what kind of bugs to expect.

(This one is not C++ bindings for GStreamer. I’d love us to be paid to do that work.)

Additionally, this means that Openismus is ready to do paid work on Gobby if you need it.

Another part-time employee slot might open up in the next few weeks, so I’d welcome emails from candidates with significant GTK+ and gtkmm experience. Python would be a plus.

Laika Eclipse plugin

I sneaked out of bed early this morning to invest some time in setting up Eclipse, hoping it can speed up my current tedious build/check/fix/build routine while working in Scratchbox.

  • You’ll want to install the recommended eclipse-gcj package as well as the eclipse package, because it seems to make it faster.
  • The Laika plugin requires a newer CDT (C/C++ development plugin for Eclipse), because Ubuntu Edgy has an old (and apparently incompatible) one. You can install that via Help/Software Updates/Find and Install/Search for new features to install/Callisto Discovery Site/yadda yadda yadda.
    I guess this will clash one day with the Ubuntu-packaged CDT, when they update it, but that’s some fun for later.
  • You’ll get “permission denied” and “file does not exist” errors during the install unless you fix the permissions (maybe this is OK in a fresh Ubuntu Edgy install?), like so:
    /usr/lib/eclipse$ sudo chown youruser:youruser plugins
    /usr/lib/eclipse$ sudo chown youruser:youruser features
    Update: In later versions, you will also need to do the same thing in /usr/local/lib/eclipse/
  • Install the Laika plugin by the same method, after adding the http://www.cs.tut.fi/~laika/update remote location. Don’t use the URL as the human-readable name for that location, or it will fail.
  • In Window/Preferences, there are now Scratchbox preferences. The defaults are mostly good, but you’ll want to change the X Environment preferences to run your start_xephyr script instead of vnc. There are details about this in the Laika manual (in the left-hand menu on their web site).

When using File/New/Project, you’ll now have extra wizards under C and C++, such as “Standard Make C Project inside Scratchbox”. When you create one of these projects you’ll see convenient toolbar buttons to start the X Server, and to start the Maemo desktop (af-sb-init.sh start) inside scratchbox, on that display. You can even start your project with a GTK+ helloworld.

Note that clicking the Run button will show an “Internal Error” until you open that Run combobox, select “Run …” and select a path to a generated executable in the “Application” entry (the second one).

Eclipse has awfully obscure UI, and I can’t be the only one who thinks this. I wonder why it isn’t getting better as a result of being open, or maybe it used to be worse. Unfortunately, people have become used to IDEs that hate them (MS Visual Studio).

Workspace schworkschpace

Now there’s just the usual IDE problem of it forcing you to import (copy) your projects from other directories instead of just letting you open your existing project. (This is not Laika’s fault.)

As I’ve mentioned before, I don’t understand why Eclipse defaults to forcing me to put my source code in $HOME/workspaces, and copying existing projects into there. Just let me edit my files and build my executables without pretending you’re special. It’s good to make it easy to make your first helloworld project, but don’t make it hard for me to actually work with this thing afterwards.

The fix for this is to:

  • Open Window/Preferences, choose General/Startup and Shutdown, and select “prompt for workspace on startup”. Notice how it’s cryptically named – it affects project creation, not program startup, and it doesn’t prompt, it just lets you choose a non-standard workspace, without telling you why you’d want to do that (see the next point). And it’s hidden away among hundreds of other options, without even a tooltip to guide the user.
  • When creating a project (The import feature is now unnecessary), the Project Contents frame now lets you select an existing project’s path instead of $HOME/workspace. If there’s a project there already then it will just add the Eclipse files without moving or copying your existing files. If there had been no files there, it would have offered to create some. That’s implicit, hidden, and unexpected. This “feature” should be made explicitly available.
  • Update: Aargh, no, it silently overwrites your build files, such as autogen.sh, configure.ac, all your Makefile.am files, and even the license (!) in COPYING. Bastard.

Further ranting: Why oh why can’t an Eclipse project contain characters such as “-“? Why go to the trouble of implementing UI to prevent users from entering this, instead of just fixing whatever text escaping bug it’s hiding.

Update: I was looking forward to code-completion, but I had to turn it off in Window/Preferences/C/C++/Editor/Content Assist and unclicking all 3 triggers. One minute of hang (100% CPU) whenever I type -> is not working out for me. (Or only 20 seconds when I tell it to search only the current project and not the include files.) When the user clicks or types away from the line, the code-completion search really should silently cancel.