After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 150122 - Construting PanelApplet widget with g_object_new does not work
Construting PanelApplet widget with g_object_new does not work
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: libpanel-applet
git master
Other All
: Normal normal
: ---
Assigned To: Panel Maintainers
Panel Maintainers
Depends on:
Blocks: 150087
 
 
Reported: 2004-08-14 10:56 UTC by Gustavo Carneiro
Modified: 2006-08-12 14:33 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Gustavo Carneiro 2004-08-14 10:56:19 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. ]
Comment 1 Gustavo Carneiro 2004-08-14 12:48:58 UTC
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. :|
Comment 2 Johan Svedberg 2004-08-20 20:15:11 UTC
Indeed. This does ofcourse explain #149739. :-)
Comment 3 Luis Villa 2005-01-03 00:06:14 UTC
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.
Comment 4 Vincent Untz 2006-08-12 14:33:17 UTC
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.