Re: Replace context menu of GTK applications



Am Mo 23 Apr 2012 20:54:35 CEST schrieb David NeÄas:
On Mon, Apr 23, 2012 at 08:18:05PM +0200, Simon Schneegans wrote:
I asked this question on another mailing list. There I got the hint
to ask here, maybe you can help me!

I'm going to write my bachelor thesis on different menu types (e.g.
Pie Menus). For this reason I'd like to replace the context menu of
GTK applications (the menu opened by right-clicking). I don't want
to recompile those applications, some kind of plugin technique would
be awesome!

I thought of two possible approaches:

1. - I know it's possible to do this with the main application menu
(like all the different global menus are doing it).
     - So here's my question: Is that possible for context menus as
well? Is there an API for this purpose? If so, what's the way to go?
Documentation on this topic is very sparse...

2. - Write a GTK module and try to do it with some GObject
fancyness. May this work?

GtkMenuFoo classes use a number of internal Gtk+ calls and might not be
reasonably replaceable from outside.  So I suggest to simply change the
implementation of menus in Gtk+ source code, recompile it and let
programs use your modified Gtk+ (by setting LD_LIBRARY_PATH).  This is
trivial compared to your suggestions.  In any case, you may run into
some implicit assertions in the programs about how menus work.

Also, there is no fundamental difference between application, context
and whatever else menus.  They are all GtkMenu widgets and programs may
actually use a single GtkMenu object in different places.

Yeti



Thanks for your reply! I'll try to go this way.

Just one more question: I compiled GTK 3.4.1 from source and made some programs use this library. Everything works as supposed, just the appearance of the applications is a bit odd; they don't follow the theme set for my user account. They look a bit like win95 used to look.

What may be the reason for this behaviour? Is there some configuration needed? On my system exactly the same version of GTK is installed...

Thanks,
Simon



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