[maemo-developers] Proposal for new hildon-extras widget

From: Gabriel Schulhof nix at go-nix.ca
Date: Tue Apr 13 10:43:37 EEST 2010

I've been working on a HildonPannableArea/GtkTreeView-based multicolumn
widget to replace GtkMenu widgets. I wanted to do this because, as you
know, Pidgin has quite a complex menu structure.

I have created a pair of before/after videos that illustrate the new widget:

Before: http://www.youtube.com/watch?v=H1xmWLi1dJU
After: http://www.youtube.com/watch?v=GlahbMSx8kA

I would like to include this widget in hildon-extras. The architecture is
as follows:

GtkFixed -> HildonMenuView
IOW, HildonMenuView is a GtkFixed containing a bunch of
HildonMenuViewColumn widgets and a button.

HildonPannableArea -> HildonMenuViewColumn
IOW, HildonMenuViewColumn is a HildonPannableArea containing a GtkTreeView
which displays the menu items. It doesn't care about its height, but it
asks for as much width as the inside GtkTreeView needs.

GObject -> HildonMenuStore (implements GtkTreeModel)
IOW, this tree store takes a single level of a GtkMenu and turns it into a
GtkTreeModel. It forwards property changes via "row-changed" signals.

There's also a private file with some convenience functions.

I'm thinking that this would make it easy for applications (like Mapper)
that have complex menus to continue to make them available in a usable

I would also like to use this widget for Pidgin, however, I wouldn't want
to include it in the source tree. Instead, I'd like to link Pidgin to
hildon-extras. This would also give me a chance to move to hildon-extras'

And, to answer some of thp's points from our t.m.o private message
conversation (he's one of the maintainers of hildon-extras):

This /can/ be used as a drop-in replacement for GtkMenu, however, you need
to subclass HildonWindow, and override the toggle_menu function.
Alternatively, you can do this:

gboolean (*orig_toggle_menu) (HildonWindow *, guint, guint32) = NULL;

my_toggle_menu(HildonWindow *self, guint button, guint32 time)
  GtkMenu *menu = hildon_window_get_main_menu(self);
  if (menu) {
    /* Make a dialog containing this: */
    g_object_new(HILDON_TYPE_MENU_VIEW, "menu", menu, NULL);
    return TRUE;

  return orig_toggle_menu(self, button, time);

main(int argc, char **argv)
  /* the usual stuff */
  orig_toggle_menu =
= my_toggle_menu;

This will cause all your HildonWindow menus to appear as HildonMenuView
widgets inside dialogs. You still need to convert any popup menus you may

I also don't understand why we can't make hildon-extras into a proper
shared library. We can copy the versioning calculation magic gtk+ does in
their configure.ac to go from major.minor.micro to whatever libtool needs.
And also, we don't have to stick to gtk's commitment of no API breaks and
no ABI breaks. Having a shared library is, I think, a great advantage, and
I'm pretty sure that, at our scale, we can forego the strict API

/me dons asbestos suit

Please let me know what you think,


P.S.: Obviously, if this gets added to hildon-extras, I'll change the
namespace from Hildon to He.
More information about the maemo-developers mailing list