Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool to convert .Glade (or xml) file to C source

Tags:

c

windows

gtk

glade

I am looking for tool that can convert .Glade (or xml) file to C source.
I have tried g2c (Glade To C Translator) but i am looking for windows binary.

Any one does know any good tool for window.

Thanks,
PP.

like image 816
User7723337 Avatar asked Dec 18 '22 00:12

User7723337


2 Answers

You don't need a tool. Just write a script in your favorite scripting language to format your glade file as a C string literal:

For example, let's call it glade_file.c:

const gchar *my_glade_file = 
    "<interface>"
        "<object class=\"GtkDialog\">"
            "<et-cetera />"
        "</object>"
    "</interface>";

Compile glade_file.c into your program, then do this when you build your interface:

extern const gchar *my_glade_file;
result = gtk_builder_add_from_string(builder, my_glade_file, -1, &error);
like image 99
ptomato Avatar answered Dec 29 '22 13:12

ptomato


glade2 works for me. though if you are using new glade3 features it won't help you..

like image 34
Alexey Yakovenko Avatar answered Dec 29 '22 15:12

Alexey Yakovenko