[Top][All Lists]

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

Re: simple task?

From: steve tell
Subject: Re: simple task?
Date: Fri, 7 Jul 2006 01:06:37 -0400 (EDT)

On Wed, 5 Jul 2006, Paul Emsley wrote:

Dear guile-gtkers,

I have, what I believe/hope to be a simple task:

I want to expose the menubar of my application [1] to the scheme level
so that others can add their own menu/menu items using scheme.

Let's suppose that I have global variable

GtkWidget *main_menubar

how do I expose it?

In gwave, a C + guile + guile-gkt-1.2 application, I do it with a C function like this:

SCM_DEFINE(get_wavewin_menubar, "get-wavewin-menubar", 0, 0, 0, (),
   "return the GtkMenuBar object for menubar in the main waveform window")
#define FUNC_NAME s_get_wavewin_menubar
        return sgtk_wrap_gtkobj(GTK_OBJECT(wtable->menubar));
#undef FUNC_NAME

Where wtable is a global pointer to a structure containing
a "GtkWidget *menubar"

I create the menubar in C, add it to the window, and then call a
guile hook to which procedures can be added to build all of the menus (and toolbars) for the window. Getting the various standard and plugin-extension menus to appear in the desired order requires some careful use of append-hook! vs. add-hook!.

In guile-gnome-platform, I've discovered that scm_c_gtype_instance_to_scm() appears to do the equivalent to what sgtk_wrap_gtkobj() did in guile-gtk 1.2.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]