Re: Getting type/arg info without running a GUI?



You should call gtk_object_get_type () and gtk_window_get_type (),
before
you can use corresponding gtk_type_from_name ()

The idea is, that in first invocation gtk_xxx_get_type () initializes
corresponding type class, including registering its name, and only after
that you can query that class by its name.

Lauris

> Still no luck.  Here is the test program I am trying
> to run, if it helps:
> 

/* Cut */

> 
> void
> print_types( void )
> {
>   GtkType    gtk_type;
>   GtkType    type_object = gtk_type_from_name(
> "GtkObject" );
>   GtkArg    *arg = NULL;
>   guint      n_args;
>   guint      i = 0;
>   gpointer   gtk_class = NULL;
> 
>   gtk_type = gtk_type_from_name( "GtkWindow" );
>   gtk_type_describe_heritage( gtk_type );
> 
>   gtk_class = gtk_type_class( type_object );
>   gtk_class = gtk_type_class( gtk_type );
>   g_return_if_fail( NULL != gtk_class );
> 
> 
>   while( TRUE )
>     {
>       arg = gtk_object_query_args(gtk_type,
>                                 NULL,
>                                 &n_args);
>   
>       for( i = 0; i < n_args; i++ )
>       {
>         g_print( "%s\n", arg[i].name );
>       }
> 
>       g_free( arg );
>       arg = NULL;
> 
>       if( type_object == gtk_type ) break;
>       
>       gtk_type = gtk_type_parent( gtk_type );   
>       gtk_type_class( gtk_type );   
>       g_return_if_fail( NULL != gtk_class );
>     }
> 
> }
> 
> John





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