Le 16/12/2010 02:37, Matthew Brush a écrit :
On 12/15/2010 08:27 AM, Colomban Wendling wrote:
Le 15/12/2010 16:30, Matthew Brush a écrit :
[…] After work I will try and come up with a better solution that still doesn't require patching Geany. If anyone has any suggestions on how to get a handle on the vte frame widget from a plugin that would be great, the comments in and around the get_vte_frame() function explain my difficulties.
Well, the first idea that comes to my mind is to check if the widget inside the tab is actually a VTE. I guess there is GObject-like API for the VTE, such as VTE_IS_TERMINAL(obj), so you can check whether the packed child in the tab is really the one you're searching for. Well, take into account that Geany might add a frame/scrolled window/whatever before the VTE, but you should be able to do the check correctly.
Thanks for the hint. The problem should now be fixed, at least as good as I can figure without modifying Geany.
https://github.com/codebrainz/geany-sidebarterm
Feedback welcome.
I'd implemented this in a slightly more generic fashion, something like one of these (untested) examples: http://nopaste.geany.org/p/f321377d7
The advantage is that it does not depend on the actual widget hierarchy, and simply checks if there is a VTE terminal anywhere behind (or at, depending on the implementation) a given widget.
The disadvantage is that since it uses non-terminal recursion, a too deep widget hierarchy would crash it. However, I doubt it is reasonable to think this might happen, so I'd think it is not an issue. In the same idea, one could say that it'd be slower. Probably true, especially if the widget contains a complicated widget hierarchy and no VTE. But I'd think it is probably not a real problem, since it's a one-time operation and anyway the UI toolkit most likely already does similar walkthrough very often (resize, or even repaint).
My two cents :) Regards, Colomban