Re: gtk_widget_get_child_requisition always returns (0,0)



On Wed, Jun 27, 2007, Spencer, Bob wrote:
> 
> I'm using version (0.0.18) of hildon-desktop from svn.  I'm adding a
> button to a panel.  The widget has called "gtk_widget_set_size_request
> (button, 48, 48);"  but in the panel it doesn't recognize this request.
> Looking into it I found:
> 	hildon-desktop-panel.c, 
> 		hildon_desktop_panel_real_add_button (...) {
> 			...
> 	~ln 352: 	gtk_widget_get_child_requisition (widget, &req);
> //always returns (0,0)
> 			...
> 		}
> gtk_widget_get_child_requisition(...) is always returning (0,0) for the
> req. width and height.  This causes the default values to be used
> (80,80).
> 
> If I replace the call with gtk_widget_size_request (widget, &req); then
> I always get the requested width/height.  
> >From the docs:
> http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-get
> -child-requisition it seems that the panel should get the right values
> with the current code. 
> 
> I checked whether making calls in a different order affected anything,
> e.g. 
> 	gtk_widget_set_size_request (button, 48, 48);
> 	gtk_container_add (GTK_CONTAINER (panel_plugin), button);
> 	gtk_widget_show_all (button)
>  and not
> 	gtk_widget_set_size_request (button, 48, 48);
> 	gtk_widget_show_all (button)
> 	gtk_container_add (GTK_CONTAINER (panel_plugin), button);
> Both cases fail to cause the panel to get values from the requisition.

Hi,

could you try to set the size_request to the panel item instead of the
button?

Something like:
       gtk_widget_set_size_request (panel_plugin, 48, 48);
       gtk_container_add (GTK_CONTAINER (panel_plugin), button);
       gtk_widget_show_all (panel_plugin)

-- 
Johan




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