Re: Getting type/arg info without running a GUI?
- From: David Benson <daveb idealab com>
- To: John Margaglione <jmargaglione yahoo com>
- Cc: gnome-devel-list gnome org
- Subject: Re: Getting type/arg info without running a GUI?
- Date: Wed, 13 Sep 2000 09:21:56 -0700 (PDT)
types are added by the *_get_type () functions for each
class. these are in turn called by (say) the various GTK_TYPE_*
macros.
so add merely:
(void) GTK_TYPE_WINDOW;
and you'll get window and its children.
to get them all i think you may be able to use
g_module to lookup all the symbols ending with _get_type().
- dave
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]