Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am doing the tutorial in the link http://www.micahcarrick.com/gtk-glade-tutorial-part-1.html

When I run the gtk-builder-convert tutorial.glade tutorial.xml I get the following error

    Traceback (most recent call last):
    File "/usr/bin/gtk-builder-convert", line 799, in <module>
    sys.exit(main(sys.argv))
    File "/usr/bin/gtk-builder-convert", line 787, in main
    conv.parse_file(input_filename)
    File "/usr/bin/gtk-builder-convert", line 162, in parse_file
    self._parse()
    File "/usr/bin/gtk-builder-convert", line 234, in _parse
    assert glade_iface, ("Badly formed XML, there is "

    AssertionError: Badly formed XML, there is no <glade-interface> tag.

the glade file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<interface>
    <!-- interface-requires gtk+ 3.0 -->
    <object class="GtkWindow" id="window">
        <property name="can_focus">False</property>
        <property name="title" translatable="yes">GTK+ Text Editor</property>
        <signal name="destroy" handler="on_window_destroy" swapped="no"/>
        <child>
            <placeholder/>
        </child>
    </object>
</interface>

Note: the glade file was generated using Glade 3.14.0 in ubuntu 12.10

share|improve this question
    
if I manually change the tag <interface> to <glade-interface> in the glade file and then run the command gtk-builder-convert then the xml file is generated. I still would like to know why auto generated tag did not work –  Alwin Doss Jan 22 '13 at 12:03
add comment

1 Answer

The last time I programmed in Glade/GTK, it didn't require "gtk-builder-convert". The .glade file that glade provides is itself xml file you need. Just program your code as if you already have converted the file to .xml (btw, i'm using glade 3.12.1). As:

#include <gtk/gtk.h>

void on_window_destroy (GtkWidget *object, gpointer user_data) {
    gtk_main_quit();
}

int main (int argc, char *argv[]) {
    GtkBuilder *builder;
    GtkWidget *window;

    gtk_init (&argc, &argv);

    builder = gtk_builder_new ();
    gtk_builder_add_from_file (builder, "ui.glade", NULL);

    window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
    g_signal_connect (window, "destroy", G_CALLBACK (on_window_destroy), NULL);

    gtk_widget_show (window);       
    gtk_main ();

    return 0;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.