Search code examples
gtkglade

How do I create a GtkApplicationWindow widget with Glade?


It would be useful to me to have access to a GtkApplicationWindow object from my code, but I want to use Glade to initialise its properties.

How can I create a GtkApplicationWindow widget in Glade?


Solution

  • In your ui xml change

    <object class="GtkWindow" id="foo">
    

    to

    <object class="GtkApplicationWindow" id="foo">
    

    and after retrieving the window via gtk builder set the application property:

    GTK_WINDOW (gtk_builder_get_object (xml, "foo"));
    g_object_set(main_window, "application", application, NULL);