grim/guifications3
Clone
Summary
Browse
Changes
Graph
added the install prefix to gflib-genheader
cmake
2010-12-13, Gary Kramlich
999ee3e165df
added the install prefix to gflib-genheader
#include
<glib.h>
#include
<gflib/gf_lib.h>
static
void
gf_gen_hierarchy_start_object
(
GfTypeQueryContext
*
ctx
,
const
GTypeQuery
*
query
,
gpointer
data
)
{
GType
parent
=
g_type_parent
(
query
->
type
);
guint
depth
=
g_type_depth
(
query
->
type
);
printf
(
"
\t
<object name=
\"
%s
\"
parent=
\"
%s
\"
class_size=
\"
%u
\"
"
"instance_size=
\"
%u
\"
depth=
\"
%u
\"
>
\n
"
,
query
->
type_name
,
g_type_name
(
parent
),
query
->
class_size
,
query
->
instance_size
,
depth
);
}
static
void
gf_gen_hierarchy_end_object
(
GfTypeQueryContext
*
ctx
,
const
GTypeQuery
*
query
,
gpointer
data
)
{
printf
(
"
\t
</object>
\n
"
);
}
static
void
gf_gen_hierarchy_param
(
GfTypeQueryContext
*
ctx
,
const
GParamSpec
*
pspec
,
gpointer
data
)
{
printf
(
"
\t\t
<param name=
\"
%s
\"
flags=
\"
%d
\"
value_type=
\"
%s
\"
>
\n
"
,
pspec
->
name
,
pspec
->
flags
,
g_type_name
(
pspec
->
value_type
));
printf
(
"
\t\t\t
<nick>%s</nick>
\n
"
,
g_param_spec_get_nick
(
pspec
));
printf
(
"
\t\t\t
<blurb>%s</blurb>
\n
"
,
g_param_spec_get_blurb
(
pspec
));
printf
(
"
\t\t
</param>
\n
"
);
}
static
void
gf_gen_hierarchy_signal
(
GfTypeQueryContext
*
ctx
,
const
GSignalQuery
*
query
,
gpointer
data
)
{
guint
p
;
printf
(
"
\t\t
<signal name=
\"
%s
\"
flags=
\"
%d
\"
return_type=
\"
%s
\"
"
"n_params=
\"
%d
\"
"
,
query
->
signal_name
,
query
->
signal_flags
,
g_type_name
(
query
->
return_type
),
query
->
n_params
);
if
(
query
->
n_params
>
0
)
{
printf
(
">
\n
"
);
for
(
p
=
0
;
p
<
query
->
n_params
;
p
++
)
{
const
gchar
*
name
=
g_type_name
(
query
->
param_types
[
p
]);
printf
(
"
\t\t\t
<param type=
\"
%s
\"
/>
\n
"
,
name
);
}
printf
(
"
\t\t
</signal>
\n
"
);
}
else
{
printf
(
"/>
\n
"
);
}
}
static
GfTypeQuery
query
=
{
gf_gen_hierarchy_start_object
,
gf_gen_hierarchy_end_object
,
gf_gen_hierarchy_param
,
gf_gen_hierarchy_signal
,
};
gint
main
(
gint
argc
,
gchar
**
argv
)
{
GfTypeQueryContext
*
tctx
=
NULL
;
GOptionContext
*
octx
=
NULL
;
octx
=
g_option_context_new
(
NULL
);
g_option_context_add_group
(
octx
,
gf_get_option_group
());
g_option_context_parse
(
octx
,
&
argc
,
&
argv
,
NULL
);
gf_lib_init
(
&
argc
,
&
argv
);
tctx
=
gf_type_query_context_new
(
&
query
,
TRUE
,
NULL
,
NULL
);
printf
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
);
printf
(
"<objects>
\n
"
);
gf_type_query_context_run
(
tctx
,
GF_TYPE_OBJECT
);
g_object_unref
(
tctx
);
printf
(
"</objects>
\n
"
);
return
0
;
}