Re: Using g_type_fronm_name ()
- From: Sven Neumann <sven gimp org>
- To: Ariel Rios <ariel gnu org>
- Cc: gtk-list gnome org
- Subject: Re: Using g_type_fronm_name ()
- Date: 06 Aug 2002 16:03:45 +0200
Hi,
Ariel Rios <ariel gnu org> writes:
> How is g_type_from_name() suppose to work?
> I do not know what arg to pass to the function?
> I have tried with 'GtkWidget', "GtkType", etc to no avail.
>
>
> int
> main(){
> g_print ("hello\n");
> printf ("%ld\n", g_type_from_name ("GtkWidget"));
> return 1;
> }
g_type_from_name() can only work with types that have already been
registered with the type system. Try something like this instead:
int
main()
{
g_type_init ();
g_type_class_ref (GTK_TYPE_WIDGET);
g_print ("GtkObject: %ld\n", g_type_from_name ("GtkObject"));
g_print ("GtkWidget: %ld\n", g_type_from_name ("GtkWidget"));
return 0;
}
Salut, Sven
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]