Re: who define *_parent_class variable ?



Le Tue, 29 Apr 2008 09:31:19 +0200, Jean Bréfort a écrit :

> Le mardi 29 avril 2008 à 07:05 +0000, KLEIN Stéphane a écrit :
>> Le Tue, 29 Apr 2008 07:22:24 +0200, Jean Bréfort a écrit :
>> 
>> > Le lundi 28 avril 2008 à 21:07 +0000, KLEIN Stephane a écrit :
>> >> Hello,
>> >> 
>> >> in many gobject source code I've some variable named
>> >> "foo_bar_parent_class". Example in gedit source code :
>> >> 
>> >> * gedit_view_parent_class
>> >> * gedit_tab_parent_class
>> >> * gedit_statusbar_parent_class
>> >> 
>> >> I would like to know what is the macro definition that define this
>> >> variable ? In gobject document, I found this : G_DEFINE_TYPE() [1]
>> >> but this macro is never called in previous examples (gedit source
>> >> code).
>> >> 
>> >> Someone can tell to me what define *_parent_class variable ?
>> >> 
>> >> Thanks for your help,
>> >> Stephane
>> >> 
>> >> [1] http://library.gnome.org/devel/gobject/2.6/gobject-Type-
>> >> Information.html#G-DEFINE-TYPE:CAPS
>> > 
>> > In your foo_bar_class_init function, add this line:
>> > 
>> > foo_bar_parent_klass = g_type_class_peek_parent (klass);
>> 
>> In gedit source code, there aren't *_parent_class =
>> g_type_class_peek_parent(klass)
>> 
>> Example, I don't found it for :
>> 
>> * gedit_view_parent_class
>> * gedit_tab_parent_class
>> * gedit_statusbar_parent_class
>> 
>> I think there are a macro whose do it but who and where ?
>> 
>> Regards,
>> Stephane
>> 
>> 
> Look at the G_DEFINE_TYPE macro.

Yes, is that :

G_DEFINE_TYPE(GeditStatusbar, gedit_statusbar, GTK_TYPE_STATUSBAR)

Thanks,
Stephane




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