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



Perhaps you need to call gtk_window_get_type() after gtk_type_int() and
gtk_signals_init() in order that the gtk_type_from_name will know what a
"GtkWindow" is. Same applies to any other objects you want the type of
since they are dynamically registered.

I suspec that gtk_type_init only registers the base object system types
like GtkObject.

Ian

On Wed, 13 Sep 2000, John Margaglione wrote:

> 
> Still no luck.  Here is the test program I am trying
> to run, if it helps:
> 
> 
> #include <gtk/gtk.h>
> 
> void
> print_types( void );
> 
> int
> main (int argc, char *argv[])
> {
>   gtk_type_init();
>   gtk_signal_init();
> 
>   /* Adding these lines makes it all work
>    *
>    * gtk_init( &argc, &argv );
>    * gtk_window_new( GTK_WINDOW_TOPLEVEL );
>    *
>    */
> 
>   print_types();
> 
>   return 0;
> }
> 
> 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
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
> 
> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list
> 





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