Panel plugins have a fixed size in trunk

Brian J. Tarricone bjt23 at cornell.edu
Wed Oct 3 02:44:20 CEST 2007


mmassonnet at gmail.com wrote:

> 	    if (orientation == GTK_ORIENTATION_HORIZONTAL)
> 	      gtk_widget_set_size_request (GTK_WIDGET(user_data->progress_bar),
> 	              BORDER, -1); /* Usually BORDER is defined to 8 */
> 	    else
> 	      gtk_widget_set_size_request (GTK_WIDGET(user_data->progress_bar),
> 	              -1, BORDER);

This is really only sorta correct.  A better solution is to ensure that 
the widgets inside the plugin will only need as much space as the panel 
will allow, by using the size reported by the panel to calculate the 
sizes of stuff inside the plugin.

For example, if you have an image in your plugin, you should calculate 
the image size based on the plugin size minus any borders, padding, 
x/ythickness, etc., and the sizes of any other widgets (say a text 
label) that sit above/below (horizonal panel) or to the left/right 
(vertical panel) of the image.  Forcing widgets to a particular size 
will just hide sizing bugs.

(Of course, there are probably some instances where you'd want to 
explicitly set the size of the widget, perhaps when doing some custom 
drawing.)

	-b



More information about the Xfce4-dev mailing list