Re: Custom widget headache
- From: David Nečas (Yeti) <yeti physics muni cz>
- To: gtk-app-devel-list gnome org
- Subject: Re: Custom widget headache
- Date: Wed, 31 May 2006 16:33:16 +0200
On Wed, May 31, 2006 at 04:15:38PM +0200, Daniel Haude wrote:
Hello folks,
I'm trying to build a custom widget, following the route that is outlined
for the "GtkDial" widget in the GTK+ tutorial. I'm already stuck at the
very beginning -- type registration. My widget is called "cw_area", and I
followed the usual naming conventions
Well, not exactly. Structs of MyFoo are normally called
_MyFoo, not MyFoo_t, the same for classes: MyFooClass and
struct _MyFooClass.
...
GtkType cw_area_get_type()
{
static GtkType area_type = 0;
ENTER
if (!area_type) {
static const GtkTypeInfo area_info = {
"CwArea",
sizeof (CwArea),
sizeof (CwAreaClass),
(GtkClassInitFunc) cw_area_class_init,
(GtkObjectInitFunc) cw_area_init,
/* reserved_1 */ NULL,
/* reserved_1 */ NULL,
(GtkClassInitFunc) NULL
};
area_type = gtk_type_unique(GTK_TYPE_WIDGET, &area_info);
}
EXIT
return area_type;
}
If the Gtk+ tutorial
http://www.gtk.org/tutorial/
mentions GtkType, GtkTypeInfo or gtk_type_unique() anywhere,
it should be immediately fixed.
I don't know what exactly happens if one tries to use the
old Gtk+ 1.x type functions together with GObject, but
screwup is a likely possibility.
Please ditch the Gtk+ tutorial which told you to use the
GtkType stuff and rewrite the code to use GObject accodring
to The Real Gtk+ Tutorial.
Yeti
--
Anonyms eat their boogers.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]