|
Packit |
1470ea |
|
|
Packit |
1470ea |
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="tour-get_object" xml:lang="uk">
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<link type="next" xref="tour-application"/>
|
|
Packit |
1470ea |
<revision version="0.1" date="2013-06-17" status="stub"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Ekaterina Gerasimova</name>
|
|
Packit |
1470ea |
<email its:translate="no">kittykat3756@gmail.com</email>
|
|
Packit |
1470ea |
<years>2013</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Gordon Hill</name>
|
|
Packit |
1470ea |
<email its:translate="no">caseyweederman@gmail.com</email>
|
|
Packit |
1470ea |
<years>2013</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>Add the window specified in the UI file to the application using
|
|
Packit |
1470ea |
GtkBuilder.</desc>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>GtkBuilder</title>
|
|
Packit |
1470ea |
<links type="prevnext" style="top"/>
|
|
Packit |
1470ea |
<links type="series" style="floatend">
|
|
Packit |
1470ea |
<title>Get started with GNOME</title>
|
|
Packit |
1470ea |
</links>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GtkBuilder accepts UI descriptions and turns them into Gtk applications.
|
|
Packit |
1470ea |
In this case, the UI description is in the file <file>helloworld.glade</file>
|
|
Packit |
1470ea |
and can be read by the get_object() method.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<example>
|
|
Packit |
1470ea |
Load the UI file using GtkBuilder and get the window object
|
|
Packit |
1470ea |
using the <gui>Name</gui> (or <gui>ID</gui>) chosen in Glade, and add the
|
|
Packit |
1470ea |
window object to the application:
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
_onStartup() {
|
|
Packit |
1470ea |
let builder = new Gtk.Builder();
|
|
Packit |
1470ea |
builder.add_from_file('helloworld.glade');
|
|
Packit |
1470ea |
this._window = builder.get_object('window1');
|
|
Packit |
1470ea |
this.application.add_window(this._window);
|
|
Packit |
1470ea |
}
|
|
Packit |
1470ea |
};
|
|
Packit |
1470ea |
]]>
|
|
Packit |
1470ea |
</example>
|
|
Packit |
1470ea |
<links type="prevnext"/>
|
|
Packit |
1470ea |
</page>
|