Re: GSeal bugs in GtkAccelLabel hampering flexibility



On Mon, 2009-01-26 at 00:59 -0500, Yu Feng wrote:
> Hi Peter,
> 
> I agree with you to seal accel_string without any getter/setter sucks.
> 
> But some of my code may interest you. Look for class MenuLabel in the
> following file to see its public interface:

Thanks for the suggestion. I did in fact do similar. From within the
GtkAction subclass, you get a chance to set the GtkMenuItem*'s label
_before_ calling the parent class connect_proxy fuction.

> gnome2-globalmenu.googlecode.com/svn/trunk/libgnomenu/Gnomenu-1.0.gir
> 
> The dirty trick is to throw GtkAccelLabel away, then put two GtkLabels
> in one MenuItem. one of them aligns to the left, the other aligns to the
> right.
> 
> It is not exactly the the same as Gtk's accel labels, but so close that
> none of my users have noticed the diff. 

The computation of the proper alignments is off for me, unfortunately.
There are more exposed methods for setting the toggle size of a menu
item, but I couldn't find anything suitable to override the size of the
accelerator.

> I don't know if you can still assign GtkActions to them though.

Should be able to.. just won't have it display the accelerator.

GtkAction is quite a nice class. You can subclass it and provide custom
factories for making menu items / toolbar buttons of the desired type..
or set the GType to be created by the built-in functions.

It falls down slightly because the built-in connect_proxy member
function needs to be called (it hooks up some private stuff, and
refcounts etc..), but also manipulates the way a proxy object is
connected. You have to be careful how you override that, and doing so is
probably exploiting implementation details of just how the built-in
connect_proxy function operates.

Best regards,

-- 
Peter Clifton

Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA

Tel: +44 (0)7729 980173 - (No signal in the lab!)



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