GNOME Bugzilla – Bug 150122
Construting PanelApplet widget with g_object_new does not work
Last modified: 2006-08-12 14:33:17 UTC
The PanelApplet factory function contains: applet = g_object_new (PANEL_TYPE_APPLET, NULL); panel_applet_setup (applet); But panel_applet_setup is static. This means that if we try to construct with g_object_new, panel_applet_setup is never called, therefore the applet widget doesn't work. [ We at gnome-python are trying to move all constructors to g_object_new based, so that users can subclass widgets at will to add signals and properties. ]
I tried moving panel_applet_setup to panel_applet_instance_init, but it stopped working with this warning: (geyes_applet2:6218): Gtk-WARNING **: Attempting to add a widget with type PanelApplet to a container of type BonoboPlug, but the widget is already inside a container of type BonoboPlug, the GTK+ FAQ at http://www.gtk.org/faq/ explains how to reparent a widget. You guys are doing some crazy hacks with PanelApplet. PanelApplet should be a subclass of BonoboControl, instead of aggregating it. A workaround would be to export the panel_applet_setup function to the public API, but that would mean only in gnome 2.10. :|
Indeed. This does ofcourse explain #149739. :-)
Hrm. This is not Urgent. To quote http://bugzilla.gnome.org/bug_status.html#priority : "This bug blocks usability of a large portion of the product..." Gustavo, maybe we need a bindings keyword to track bugs that are important to the bindings folks? If this is a common need, please email gnome-bugsquad@gnome.org and cc the bindings list so we can discuss it.
Should be fixed now: 2006-08-12 Vincent Untz <vuntz@gnome.org> * panel-applet.c: use G_DEFINE_TYPE (panel_applet_associate_schemas_in_dir): updated for parent_class renaming (panel_applet_size_request): ditto (panel_applet_size_allocate): ditto (panel_applet_expose): ditto (panel_applet_focus): ditto (panel_applet_realize): ditto (panel_applet_constructor): new, to automatically call panel_applet_setup() (panel_applet_class_init): set the constructor (panel_applet_init): renamed from panel_applet_instance_init() (panel_applet_get_type): killed (panel_applet_setup): no need to call panel_applet_setup() (panel_applet_factory_callback): ditto Should fix bug #150122 We can't directly subclass BonoboControl because we want a GtkEventBox.