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



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/




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