[Vala] getting started with vala and glade
- From: Chris Bare <chris bare gmail com>
- To: vala-list gnome org
- Subject: [Vala] getting started with vala and glade
- Date: Fri, 27 May 2016 21:17:52 -0000
I have a very simple vala program that is trying to load a glade ui file.
The window appears briefly, but then the program exits without error.
What am I missing?
Note that the commented out code that does not use glade works as I expect:
using Gtk;
public class Thelma : Gtk.Application {
protected override void activate () {
/*
var window = new Gtk.ApplicationWindow (this);
var label = new Gtk.Label ("Hello GNOME!");
window.add (label);
window.set_title ("Welcome to GNOME");
window.set_default_size (200, 100);
window.show_all ();
*/
var builder = new Builder ();
builder.add_from_file ("test.ui");
var window = builder.get_object ("mainWindow") as
Gtk.ApplicationWindow;
window.show_all ();
}
}
public int main (string[] args) {
return new Thelma().run (args);
}
test.ui:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkApplicationWindow" id="mainWindow">
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Thelma</property>
</object>
</child>
</object>
</interface>
--
Chris Bare
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]