I am having a problem getting certain GTK arguments to behave when
looking them up in the type system. In particular, when I ask for the
"has_focus" or "can_focus" arguments for a GtkButton (using
gtk_object_arg_get_info), I get this error.
could not find argument "can_focus" in the `GtkButton' class ancestry
The program has no problem finding the "has_default", "label",
"can_default", etc. arguments.
When I write a sample program using exactly the same function calls to
get the argument descriptors, the Gtk type system finds "can_focus" and
"has_focus". I see no reason for this behavior. The fact that the
error message reports that it knows that it has a type of GtkButton and
knows that there is no "can_focus" argument means that the type system
has been loaded, but it's just not finding the argument.
So, what could cause the type system to fail like that? I have attached
my test program for kicks.
Thanks,
John
*** Begin test program ***
#include <gtk/gtk.h>
int main( int argc, char *argv[] )
{
GtkType gtk_type;
GtkArgInfo *arg_info = g_new0( GtkArgInfo, 1 );
gchar *msg = NULL;
gchar *result = NULL;
gchar *temp = NULL;
gchar *arg_type_name = "GtkButton";
gchar *arg_name = "can_focus";
gchar *arg_value = "True";
gtk_type_init();
GTK_TYPE_BUTTON;
/* Get the GtkType, and make sure the class is loaded */
gtk_type = gtk_type_from_name( "GtkButton" );
gtk_type_class( gtk_type );
/* Get argument info for this argument */
msg = gtk_object_arg_get_info( gtk_type, arg_name, &arg_info );
if( NULL == msg ) /* all went ok */
{
if( GTK_FUNDAMENTAL_TYPE(arg_info->type) == GTK_TYPE_BOOL )
{
if( NULL == arg_value )
{
g_print( "Null value for arg: %s\n", arg_name );
result = g_strdup( "FALSE" );
}
else
{
temp = g_strdup( arg_value );
g_strup( temp );
result = g_strdup( temp );
g_free( temp );
}
}
else if( GTK_FUNDAMENTAL_TYPE(arg_info->type) == GTK_TYPE_STRING )
{
/* Surround this thing by quotation marks */
if( NULL == arg_value )
result = g_strdup( "\"NULL\"" );
else
result = g_strdup_printf( "\"%s\"", arg_value );
}
else if( GTK_FUNDAMENTAL_TYPE(arg_info->type) == GTK_TYPE_POINTER
)
{
if( NULL == arg_value )
result = g_strdup( "NULL" );
else
result = g_strdup( arg_value );
}
else
{
if( NULL == arg_value )
result = g_strdup( "0" );
else
result = g_strdup( arg_value );
}
}
else
{
g_print( "Unknown type: %s\n", arg_name );
result = g_strdup( "NULL" );
}
g_free( arg_info );
if( NULL != msg ) g_free( msg );
g_print( "%s\n", result );
return 0;
}
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
Glade-devel maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/glade-devel