Reading panel size
- From: Tony Houghton <h realh co uk>
- To: gnome-devel-list gnome org
- Subject: Reading panel size
- Date: Sat, 14 Feb 2004 00:12:29 +0000
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]