Category Archives: GNOME

A Default GtkWindow with Menu and Toolbars

I don’t like such applications on my N810:

The application could be ported to use a HildonWindow if compiled for the maemo platform. But it would be much easier if there were an abstract GTK+ widget which would allow it to add a menu and toolbars to a window in a (platform specific) default layout.

I imagine something like:

With this proposal, it would also be possible to implement a Mac-style MenuBar without a GtkMenuBar hack.

See Bug 533003.

p.s. I don’t like the name GtkMainWindow. Maybe something like GtkDefaultWindow or GtkSimpleWindow would be better.

Scrollable widgets in GTK+

In GTK+ 2 there are scrollable widgets like GtkTreeView, GtkTextView or GtkViewport but no GtkScrollable interface. Instead a scrollable widget is defined by a “set_scroll_adjustments” signal, which id is written to the GtkWidgetClass::set_scroll_adjustments_signal class variable.

If a scrollable widget is added to a GtkScrolledWindow the set_scroll_adjustments_signal is called and the hadjustment and vadjustment from the GtkScrolledWindow are passed as parameters to the scrollable widget. The scrollable widget than replaces its own adjustments with the ones it got from the GtkScrolledWindow. If the scrollable widget is removed from the GtkScrolledWindow it recreates its own adjustments.

This model seems to be simple, but all scrollable widgets need (and set) specific values for GtkAdjustment::lower, ::upper, ::page_increment and ::page_size and the adjustments are required by the size-allocate function. So the adjustments should actually be owned by the scrollable widget and not by the GtkScrolledWindow.

For GTK+ 3 I propose a simple GtkScrollable interface with a readable hadjustment and vadjustment property. If a widget which implements GtkScrollable is added to a GtkScrolledWindow the GtkScrolledWindow should use its adjustments.

See Bug 468689 and the attached patch.