JACK M
JACK M

Reputation: 2841

How to extract the menu bar of a GTK program

The key function of the applet is extracting the menu bar of a GTK program(after being extracted the menu bar of the original program should disappear), formatting the menu items to another form and displaying them.

I have googled for a long time but found almost nothing. Any help is appreciated.

Upvotes: 2

Views: 188

Answers (1)

drahnr
drahnr

Reputation: 6886

Note that this is an idea nothing more nothing less.

If you can get a pointer to the containing GtkWindow just walk the widget tree and check with GTK_IS_MENU_BAR() if the widget is a GtkMenuBar. If so, add a reference, detach it, reparent it, remove the additional ref.

You could have a look at the source of ubuntu's app indicator (not sure if that is the right project name) or the newly created gtk-inspector (formerly known as hacky gtk-parasite) which can inspect/modify widgets on the fly from a third party application.

Upvotes: 1

Related Questions