For the price of a cup of tea

April 17, 2006 on 8:34 pm | In Hacking, GNOME, recent-files |

Here’s a screenshot of testaction test showing the GtkRecentAction action for use with the GtkUIManager. The action is bound to a menuitem tag inside the UI definition markup.

GtkRecentAction test

The code needs cleaning up and the hooking up of the GtkRecentChooser interface virtual methods, but it’s not a big issue; setting all the recent chooser knobs using the recent chooser API is not the most beautiful approach I could come up with, though. But so is setting all the properties using specially crafted functions.

The next issue is inlining the list inside a menu (to make the Gedit maintainers happy ;-) ). The current (and soon to be deprecated) EggRecent code used the awful EggRecentViewGtk object and its evil spawn (EggRecentViewUIManager and the most devilish EggRecentViewBonobo). The GtkRecent approach “get the list from the recent manager and build the menu items” works for hand-built menus, but for menus created using the UI manager there’s no real option, as there’s no way to create a list of items from a GtkAction. One way to implement it might be adding a GList * (*create_menu_items) (GtkAction *action); virtual method inside GtkActionClass.

Update 2006-04-18@03:51: the tracking bug with my initial draft for the GtkRecentAction is #338843

Now listening: Belle and Sebastian, The Life Pursuit

3 Comments »

RSS feed for comments on this post. TrackBack URI

  1. I don’t see where exactly the problem is: can’t “GtkRecentViewUIManager” just maintain a GtkActionGroup containing a GtkAction for each (visible, after filtering) item in the model, updated whenever that list changes? And given the UI path where to merge its UI, clean & (re)build its UI with a fresh merge ID whenever the list of visible items changes? I don’t think that’s “messy” at all, in fact that’s how we do it in epiphany for menus with dynamic content.

    How would your idea above work with the activate signal? That gets only the action, so there’s no way to know from which menu item it was activated and therefore no way to get which recent file to open…

    Comment by chpe — Monday, April 17 2006 #

  2. chpe: I know how the current users of the EggRecentViewUIManager do that (I did maintain that code for almost a year, after all), and I think that the involved machinery is awful, code-wise. The amount of hackery involved in such an object is why the egg-recent code sucks so much; if possible, I’d like to avoid that, in favour of a cleaner approach. extending the UIManager is not a problem: it can be done without too much hassle.

    actions can have multiple signals: the GtkRecentAction class has an “item-activated” signal which is fired each time an item in the sub-menu (which is a GtkRecentChooserMenu) is activated.

    Comment by ebassi — Monday, April 17 2006 #

  3. Time For Lovin’…

    You can see I’m listening to the Beastie Boys, right now
    In the last three days I’ve finally managed to resolve as fixed these GTK+ bugs:

    Bug 347375 – Not possible to set startup notification ID on a GtkWindow
    Bug 418219 – GtkRecentCho…

    Trackback by context switch — Thursday, March 15 2007 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

What's a blog without spam: the consummate WP-Hashcash?

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^