Work on Deskbar is slowing down

Unfortunatly, I made even less changes to Deskbar-Applet than last week. I did some minor changes and started on integrating support for Deskbar.

I ran into a very annoying problem with threads in GTK+. I know that GTK+ is only thread-aware and you have to surround the critical parts with gtk.gdk.threads_enter() and gtk.gdk.threads_leave(). I already did this where the results are added to the ListStore/TreeView storing the matches. However, now and then I get a Xlib asynchronous error. I couldn't find a situation where I can reproduce this error reliably. I would be glad if anybody could give some tips on working with threads and GTK+.

Changes in detail:

  • Pressing enter launches the first match
  • Installing modules via Drag & Drop in preferences is now possible
  • Selected text will be inserted into the entry if Deskbar is triggered



Just curious; The "first match" is the one on the top of the results list or the nearest to the bar? (I have deskbar at the bottom of the screen so there's a difference).

Hehe :o)

It's easier to simply add code to be executed on the main loop to the idle handler.

You can't just call enter/leave() when you are doing stuff from the thread, you also need to do it for all GTK+ usage in the main thread (including your call to gtk.main())

You'll keep things much easier if you don't try to do GTK+ work from a thread; just instead install an idle. The idle will be run in the main thread and you can do your GTK+ work there.

(In fact, from the perspective of using the deskbar embedded inside the Online Desktop big bar, *please* don't use GTK+ from other threads. Making the rest of our GTK+ usage follow the thread rules would be a big pain :-)

I'm running into xlib errors when using threads in yelp as well. Owen has the correct solution. Basically, every call to gtk needs to be surrounded by gtk.gdk.threads_enter()


@Marc Fargas:

The first match is always the one on the top. It doesn't matter in which panel Deskbar is, because it will open a separate window anyway.