gtk_widget_get_child_requisition always returns (0,0)



Title: gtk_widget_get_child_requisition always returns (0,0)

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.

Let me know if I need to make a different call in my plugin, or if we can change the call.
Cheers!
Bob



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