global menubars in GTK+



(oh no, not this again)

I was looking at the variety of different methods that are now being
employed on different platforms (MacOSX, Hildon, etc.) to implement
global menubar type options, and was wondering if we couldn't get some
synergy happening in GTK+.

I had a look at rhult's IGE [1] and came to the conclusion that it
wasn't really an optimal solution to the problem because:

     1. it's working from GtkWidgets (i.e. GtkMenuItem), which seems
        like a faulty abstraction.. it would be much better to work from
        GtkAction
     2. it provides API to rearrange items in the menubar (e.g. for
        MacOSX), which seems wrong to me

After thinking about this for a bit, it seems to me like it would be
better to build an API based on GtkUIManager for the following reasons:

     1. Everything connects to a GtkAction
     2. It would be possible to pass a different .ui file per platform
        or use menu-merging to rearrange parts of the menu layout per
        platform
     3. Setting shortcut keys for actions could be easily done via a
        macro [2] in the API or in the app

This API would be implemented as a module that allowed for simple
overriding (e.g. for MacOSX, an embedded UI or even desktop GNOME).

My initial thought is something simple like:

        gtk_has_global_menu (void) -> Boolean
        gtk_ui_manager_set_global_menu (GtkUIManager *manager, char *path) -> void

This sort of API could be made available in an external library, but it
seems like something that could be quite useful inside GTK+.

Thoughts?

--davyd

[1] http://live.gnome.org/GTK%2B/OSX/Integration
[2] #ifdef MACOSX
    #define SHORTCUT(c) ("<Command>" x)
    #else
    #define SHORTCUT(x) ("<Ctrl>" x)
    #endif

-- 
Davyd Madeley

http://www.davyd.id.au/
08B0 341A 0B9B 08BB 2118  C060 2EDD BB4F 5191 6CDA



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]