Re: Reading panel size



Hi Tony,

I had this problem some months ago with my applet library, when changing
from gnome 2.2 to 2.4. 
I don't remember exactly the way to solve it, it was abit tricky. But
you can have a look into gai/gai-gnome.c download from
http://gai.sf.net There is some working code.

Best regards,
 Jonas


On Sat, 14 Feb 2004 00:12:29 +0000
Tony Houghton <h realh co uk> wrote:

> 
> I've wasted a whole evening trying to get my applet to read the size
> of the panel.
> 
> I started with the facilities provided by the PanelApplet object, but
> they're useless, because it only generates "change-size" signals for
> certain sizes (multiples of 12?), and panel_applet_get_size() rounds
> up to those sizes - except when it rounds down for very small sizes.
> Maybe panel_applet_set_size_hints() can fix this, but it's
> undocumented :-(.
> 
> Next I looked at the fish applet, which adds to the PanelApplet a
> GtkFrame containing a GtkDrawingArea. It reads the GtkDrawingArea's
> allocation and responds to "size-allocate" signals on it.
> 
> My applet has a GtkHBox (or VBox for vertical panels) as the outermost
> widget within the PanelApplet, containing a number of other widgets
> depending on configuration. So I used the box widget's allocation in
> the same way as the fish applet. But it always returns a size of 1 and
> doesn't generate size-allocate signals. I tried putting the box inside
> a GtkFrame (inside the PanelApplet object) with no border, but it
> didn't help.
> 
> My applet can also be run in a window; in this case the GtkHBox is
> inside a GtkEventBox inside the top-level window. This way it works
> fine:- the EventBox generates "size-allocate" signals and its
> allocation field contains the correct values.
> 
> One probably important difference is that the windowed version reads
> its start-up size from gconf and adds GtkPixmaps with known size to
> the GtkHBox before trying to do anything with allocations.
> 
> The trouble is I can't do it in that order with the panel applet
> because I don't know how big to make the pixmaps until I know the size
> of the panel!
> 
> So how am I supposed to read the size of my PanelApplet before adding
> any widgets of fixed size to it so that I know what size of widgets to
> add?
> 
> -- 
> TH * http://www.realh.co.uk
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list
> 



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