Index: demo.ui
===================================================================
--- demo.ui	(revision 18146)
+++ demo.ui	(working copy)
@@ -224,4 +224,27 @@
             </object>
         </child>
     </object>
+    <object class="GtkWindow" id="window2">
+        <property name="default_height">250</property>
+        <property name="default_width">440</property>
+        <signal name="destroy" handler="gtk_widget_destroyed"/>
+                <child>
+                    <object class="GtkLabel" id="label">
+                        <property name="visible">True</property>
+                        <property name="label">Label for window 2</property>
+                    </object>
+                </child>
+    </object>
+    <object class="GtkWindow" id="window3">
+        <property name="default_height">250</property>
+        <property name="default_width">440</property>
+        <signal name="destroy" handler="gtk_widget_destroyed"/>
+                <child>
+                    <object class="GtkButton" id="button1">
+                        <property name="visible">True</property>
+                        <property name="label">Quit me</property>
+                        <signal name="clicked" handler="gtk_main_quit"/>
+                    </object>
+                </child>
+    </object>
 </interface>
Index: builder.c
===================================================================
--- builder.c	(revision 18146)
+++ builder.c	(working copy)
@@ -43,6 +43,35 @@
 	}
       gtk_builder_connect_signals (builder, NULL);
       window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
+      if (window == NULL)
+      {
+        g_debug ("No window1, trying window2");
+        window = GTK_WIDGET (gtk_builder_get_object (builder, "window2"));
+      }
+      if (window == NULL)
+      {
+        g_debug ("No window2, trying window3");
+        window = GTK_WIDGET (gtk_builder_get_object (builder, "window3"));
+      }
+      if (window == NULL)
+      {
+        GtkWidget *button;
+        g_debug ("No windows found, trying button1");
+        button = GTK_WIDGET (gtk_builder_get_object (builder, "button1"));
+        if (button != NULL)
+        {
+          g_debug("Found button1");
+          window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+          gtk_window_set_title(GTK_WINDOW(window), "Manually created window");
+          gtk_widget_set_size_request (window, 400, 300);
+          gtk_container_add (GTK_CONTAINER(window), button);
+          g_signal_connect(G_OBJECT(window), "delete-event",
+                           G_CALLBACK(gtk_main_quit), NULL);
+        } else {
+          g_debug("No button1 either");
+          g_assert_not_reached();
+        }
+      }
     }
 
   if (!GTK_WIDGET_VISIBLE (window))
