Fun with Gtk+/Gnome args

I am trying to use the type system in Gtk+/Gnome to do some
introspection.  The first time I call gtk_object_arg_get_info() all goes
well.  Subsequent calls, however, fail.  Here is a small test program
that exhibits the problem:

/*** Test program ***/

#include <gtk/gtk.h>

void test( void );

static GtkType gtk_type;

int main( int argc, char *argv[] )

  gtk_init( &argc, &argv );


  /* Get the GtkType, and make sure the class is loaded */
  gtk_type = gtk_type_from_name( "GtkButton" );
  gtk_type_class( gtk_type );


  return 0;

void test( void )
  GtkArgInfo *arg_info   = g_new0( GtkArgInfo, 1 );
  gchar      *msg        = NULL;
  gchar      *arg_name      = "can_focus";
  gchar      *arg_value     = "True";

  /* Get argument info for this argument */
  msg = gtk_object_arg_get_info( gtk_type, arg_name, &arg_info );  
  if( NULL == msg ) /* all went ok */
      g_print( "%s\n", arg_value );
      g_print( "%s\n", msg );
      g_free( msg );

  g_free( arg_info ); 

/*** End test program ***/

Running this program gives the following output:

could not find argument "can_focus" in the `GtkButton' class ancestry

Any ideas what would cause this behavior?  Help much appreciated!


Do You Yahoo!?
Get your free address at

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