Archive for the ‘Gnome’ Category


The (too large) minimum width of a GtkEntry in Gtk+-3.2

In Bluefish,Gnome,open source,Programming on December 14, 2011 by oli4444

Bluefish has a side-pane in it’s main interface, which is implemented using a GtkHPaned widget. Users may drag the handle to increase or decrease the side pane. Now lets see what happens if the user makes the sidebar smaller than the widgets in there. I created a mini example application that works with both Gtk+-2 and Gtk+-3. There is a GtkEntry in the left sidebar, and a GtkTextView on the right. This is a screenshot with Gtk+-2:

Initial view of the example application

Now see what happens if you drag the handle to the left in Gtk+-2:

Gtk+-2 making the widget smallerThe widget now becomes smaller, and it is cropped on the right side, which looks natural.

Now see what happens if you drag the handle to the left in Gtk+-3.2:

What it looks like inb Gtk+-3.2The widget is cropped from the left side, which has the content, which looks awful. Also there is a huge empty space after the “Hello World” because the GtkEntry minimum width is very large.

My suggestions for improvement:

  • decrease the minimum width of the GtkEntry to 30 pixels or so
  • when cropping widgets, crop from the right if the widget is on the left side of the handle, crop from the left if the widget is on the right side of the handle. That suggests that the user drags the handle as a layer on top over the widget which feels much more natural.

b.t.w. GtkEntry is not the only widget that has a too-large minimum width. In Bluefish we also use libgucharmap, and the gucharmap widget forces an even wider sidebar in Gtk+-3.2.



GtkTable and GtkLabel with wrap on Gtk+-3, and trying to stay compatible with Gtk+-2…

In Bluefish,Gnome,open source,Programming on November 30, 2011 by oli4444

Bluefish has several dialogs that use a GtkLabel with wrap enabled inside a GtkTable. Since the width-for-height changes in Gtk+-3.2 these GtkLabel’s take an enormous amount of vertical space. If this launchpad bug is correct it will use enough vertical space to put every word on a new line.

The suggestion in that bugreport is to switch to GtkGrid. This is a good suggestion, but is has a drawback. In Gtk+-2 there is no way to set widget specifc expand properties in a GtkGrid (in a GtkTable this is done with gtk_table_attach()). In Gtk+-3 new properties have been added to GtkWidget to control whether a widget may expand or not. We (Bluefish developers) try to remain compatible with Gtk+-2 at the moment. So what to do? GtkGrid may solve our problem in Gtk+-3 but causes problems in Gtk+-2, and GtkTable solves our problem in Gtk+-2 but causes problems in Gtk+-3 ?

Luckily I found a workaround:


This fixes the problem with a GtkLabel with wrap in a GtkTable in Gtk+-3.2. So for the moment we stick with GtkTable with this workaround.


Bluefish 2.2.0 released

In Bluefish,Gnome,Gnome shell,open source on November 27, 2011 by oli4444

Bluefish 2.2.0 is a new major release and the start for the 2.2 series. Under the hood Bluefish 2.2.0 has a massive number of changes: Bluefish now works with gtk-3 (gtk-2 is still supported), and the syntax scanner had a major overhaul to make it faster, which is especially noticeable when working on large files.

Another big change in Bluefish 2.2.0 is the new search and replace function. It has been completely redesigned: the simple search function is now integrated in the main window, and the new function supports both search and replace in files on disk (next to already opened documents). Other new features include a toggle comment function that is context-aware (add <!– –> comments in html code, use // comments in javascript code, /* */ in php code, etc. even if all of these languages are in a single file) and a select block feature that automatically selects the current context block and can be used multiple times to select the parent blocks. Another new feature of the syntax recognition is the autocompletion of user-defined functions, and a jump function that will bring you immediately the the definition of a function.

Next to all the new features many existing features have been improved and polished. Furthermore support for new languages has been added, such as Google Go, D, Vala and Ada.

I created an introduction movie using the built in screen recording option of the gnome 3 shell, which has no sound recording. I recorded my voice with audacity and tried to merge them both with pitivi. Pitivi just hanged at rendering 98% no matter what I tried. Then I switched to openshot, which crashed a few times but it did render my video. Unfortunatelythe result was bigger than the original video and sound files, with worse video quality. Anyway, you can see the result on youtube:

p.s. the 2.2.1 release of Bluefish will have a zen-coding plugin!


Bluefish, Ubuntu or Gtk bug?

In Bluefish,Gnome,open source,Programming,Ubuntu on October 25, 2011 by oli4444

There is a weird widget scaling issue happening with Bluefish compiled on Ubuntu 11.10 with gtk-3.2.0 that I don’t see on the same Ubuntu 11.10 with Bluefish compiled with gtk-2.24.6 nor on Fedora 15 compiled with Bluefish compiled with either gtk-3.0.12 or gtk-2.24.4.

Bluefish has a GtkHPaned widget to show a sidebar (by default on the left). Inside that sidebar is a GtkNotebook, and inside that notebook is a GtkComboBox. The text string in the GtkComboBox sometimes becomes quite long. Normally this string is just shortened by gtk as can be seen below (the string is file:///home/olivier etc. etc.):

On Ubuntu 11.10 with gtk-3.2, however, this string defines the GtkComboBox minimum width, and if you try to move the GtkHPaned handle to the left it makes all of the contents inside the GtkHPaned move to the left, outside the window border (watch the left side of the GtkNoteBook, see that one of the tabs is moved outside the window? See that the contents of the GtkTreeView are moved outside the window?):

In this example there is a long string in the active entry of the GtkComboBox, but if there is a short string active and a long string only in the popup menu, the issue still appears. So the minimum width is defined by the longest string in the GtkListModel.

In the documentation I cannot find if a GtkComboBox should shrink smaller than the text that is possibly in the popup menu. But I do know that this has never been a problem before on any gtk version up to gtk-3.0 (but Fedora 16 is not yet released, so my only Gtk-3.2 box has Ubuntu 11.10), so I’m wondering if the bug is in Bluefish, Ubuntu or Gtk?

Update 1: I can reproduce this on Fedora 16 beta, so this is not an Ubuntu issue, it is either Gtk-3.2 or Bluefish

Update 2: thanks to the comment from Benjamin Otte I fixed part of the issue by setting the ellipsize property to the GtkComboBox text renderer. However it is still not really back to normal nice behavior. The GtkComboBox furthermore has weird/buggy behavior if ellipsize is disabled. If there used to be a long string in the model, but that string is gone, it still wants a very big width. I think at least this bit is buggy.


After 5 year a new release for Directoryassistant

In Gnome,Linux desktop,open source on October 10, 2011 by oli4444

After ~5 years without a release, I released Directoryassistant 2.1. Directory Assistant is a small application for managing addresses and contact information in a LDAP address book. I originally wrote it because I organized my addresses in an ldap store so I could use them in different programs, but my girlfriend did not, so we always had incomplete or out-of-sync information. Nowadays we have the same addressbook on all our computers and smartphones in our household.

Directoryassistant 2.1 is just a minor feature enhancement release. I guess the next version will be major again because right now it still uses gtk+-2 and python-gtk2, so the next thing to do would be gtk+-3 compatibility and python with GObject-Introspection.


Bluefish startup time

In Bluefish,Gnome,open source,Programming on September 16, 2011 by oli4444

It seems to be trendy to blog about startup times. So lets talk about the recent changes bluefish startup time. So what caused the changes? The current subversion trunk compiles on gtk-3, while the latest stable release (2.0.3) did not, most notably because it uses GtkItemFactory to generate menu’s. I did several optimizations for the new code already: I moved all the bluefish-specific stock icons  from external png files to inline-pixmaps to reduce the file seek times, and I changed from seperate toolbar and menu definition files to a single file again to reduce the disk seek times.

So is the new gtk-3 compatible version faster? Both versions built against the same gtk-2 release shows that the old version was faster. On my development machine (core 2 duo 3.1 GHz) the time is too short to see a real difference (total startup took 0.6 s) So I tested this on an older computer (IBM T43 laptop with 1.8GHz Pentium M and a SSD) to make it easier to measure the startup time. I measured several times to make the results more accurate:

GtkItemFactory uses a struct that is directly compiled into the binary. GtkUIManager uses a XML format that first needs to be parsed. In Bluefish we load this file from disk which adds some seek time (but the laptop has a SSD so that should not be much). Could this change be the cause of the 0.3 s difference?

Luckily not everything is slower, the syntax scanning speed has increased a lot over the last releases. This is measured on the same laptop:

Given that the scanner engine did spend close to 50% of it’s time settings GtkTextTag’s (see the Bluefish editor widget design) the boost is pretty impressive.


Gnome shell starting to become my favourite

In Gnome,Gnome shell,Linux desktop,open source,Unity on August 19, 2011 by oli4444

I have several different computers, running Gnome 2, Gnome 3, Unity and Mac OSX. New interfaces always take a while to get used to, so after the initial launch of Gnome 3 and Unity the “classic” Gnome 2 interface was still my favourite to get my work done.

Gnome 3 has the best looks (yes, I like it better than OSX), but to get my work done I don’t need the best looks. A long time ago I ran Enlightenment with the aliens theme to have a very cool desktop, but I always switched the Sawfish when I had some real programming to do.

So what is making Gnome 3 making my first choice? The main reason for that is the keyboard control. Hit <alt><f1> or the <windows> key and start typing some characters of the program name and hit enter. Better, start typing the name of the bluefish project file that I used recently and hit enter, and I have my project open. I don’t have to type the exact name of the command (typing “te” already selects “gnome-terminal” for me, “tru” selects my “bluefish_trunk” bluefish project file, “fi” selects firefox, etc.) which makes it very fast and convenient. Switching virtual desktops (called workspaces in gnome 3) is <ctrl><alt><up> or <ctrl><alt><down>, and when I need a new desktop it is automatically created by hitting <down> one extra time.

Some other things I like a lot: tiling widows side by side by dragging a window to the right/left, and restoring the original size when moving the window again. However, I would like to be able to widen the windows after tiling, the left window can be widened on the bottom-right corner, but there is no way to make the left window a bit wider. I like <alt><`> for switching between windows of the same application (it feels natural because it is so close to <alt><tab>). I like <alt><f2> to start new commands, especially when using <ctrl><enter> to start that command in a new terminal.

What would make things even better for me:

  • <Alt><tab> behavior per desktop per window. I just doesn’t make sense to me that switching between two web-pages in two firefox windows is different from switching between two web-pages in chrome-and-firefox. I often <alt><tab> between a couple of terminal windows and bluefish windows. The default just switches applications, and I usually need a specific session of that application on the same virtual desktop. The alternate tab extension however, makes me tab between all open windows on all virtual desktops (which usually is a long list).
  • Easier mouse access to virtual desktops. The hot corner is left, but to switch to a different virtual desktop without key combination, I have to move the mouse all the way to the right (which is a long way on a widescreen display). I have the workspaces menu extension installed to have the virtual desktops in the top bar, but it needs two mouseclicks to switch between two desktops. An improvement could be to make the top-right of the screen a second hot corner that activates the workspaces area by default (I have the right-hot-corner extension installed, but I first have to move the mouse to the top right for the hot corner, and then to the middle to activate the workspaces area).
  • Better use of the vertical screen space. The top bar of each window is quite high, and it only has a close button and you use it to drag the window. Especially when maximising a window the top space of the screen has a lot of unused space. This is an area where Unity tries to do good things (except that the menu thing in unity is slow and buggy as I posted earlier). Luckily Bluefish has a fullscreen feature!
  • Make it the default to open a new window. For most programs I use I have multiple open windows (terminals, bluefish sessions, firefox sessions etc.). If I want to switch to an open window it is much faster to select that window in the overview mode than clicking the icon in the dash (which selects just one of the open sessions which is anyway usually not the one you need). I want to use the dash to start a new session, regardless if I have a session running already. Having the hold <ctrl> while clicking is annoying. Same for starting a program using the keyboard control: if I type “fi” and hit enter, I don’t want any of my existing firefox sessions, I want a new session!