summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkbuilder.xml
blob: 6e4eb82fd64e0d5d1fb129a25e56933d9024f35e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkbuilder">
    <refnamediv>
        <refname>gtk.Builder</refname>
        <refpurpose>Build an interface from an XML UI definition.</refpurpose>
    </refnamediv>

    <refsect1>
        <title>Synopsis</title>

    <classsynopsis language="python">
        <ooclass><classname>gtk.Builder</classname></ooclass>
        <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
    <constructorsynopsis language="python">
        <methodname><link linkend="constructor-gtkbuilder">gtk.Builder</link></methodname>
        <methodparam></methodparam>
    </constructorsynopsis>
    
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--add-from-file">add_from_file</link></methodname>
        <methodparam><parameter role="keyword">filename</parameter></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--add-from-string">add_from_string</link></methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--add-objects-from-file">add_objects_from_file</link></methodname>
        <methodparam><parameter role="keyword">filename</parameter></methodparam>
        <methodparam><parameter role="keyword">object_ids</parameter></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--add-objects-from-string">add_objects_from_string</link></methodname>
        <methodparam><parameter role="keyword">buffer</parameter></methodparam>
        <methodparam><parameter role="keyword">object_ids</parameter></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--connect-signals">connect_signals</link></methodname>
        <methodparam><parameter role="keyword">object</parameter></methodparam>
        <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
    </methodsynopsis>
    <!-- NOT YET IMPLEMENTED <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder-connect-signals-full">connect_signals_full</link></methodname>
        <methodparam><parameter role="keyword">func</parameter></methodparam>
        <methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
    </methodsynopsis> FINISH NON YET IMPLEMENTED -->
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--get-object">get_object</link></methodname>
        <methodparam><parameter role="keyword">name</parameter></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--get-objects">get_objects</link></methodname>
        <methodparam></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--get-translation-domain">get_translation_domain</link></methodname>
        <methodparam></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--get-type-from-name">get_type_from_name</link></methodname>
        <methodparam><parameter role="keyword">type_name</parameter></methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder--set-translation-domain">set_translation_domain</link></methodname>
        <methodparam><parameter role="keyword">domain</parameter></methodparam>
    </methodsynopsis>
    <!-- NOT YET IMPLEMENTED <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder-value-from-string">value_from_string</link></methodname>
        <methodparam><parameter role="keyword">pspec</parameter></methodparam>
        <methodparam><parameter role="keyword">string</methodparam>
        <methodparam><parameter role="keyword">value</methodparam>
    </methodsynopsis>
    <methodsynopsis language="python">
        <methodname><link linkend="method-gtkbuilder-value-from-string-type">value_from_string_type</link></methodname>
        <methodparam><parameter role="keyword">type</parameter></methodparam>
        <methodparam><parameter role="keyword">string</methodparam>
        <methodparam><parameter role="keyword">value</methodparam>
    </methodsynopsis> FINISH NON YET IMPLEMENTED -->
    
    </classsynopsis>
    </refsect1>

    <refsect1>
        <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkbuilder">gtk.Builder</link>
</synopsis>

    </refsect1>

    <refsect1 id="properties-gtkbuilder">
        <title>gtk.Builder Properties</title>

        <blockquote role="properties">
            <informaltable pgwide="1" frame="none">
                <tgroup cols="3">
                    <colspec column="1" colwidth="1in"/>
                    <colspec column="2" colwidth="1in"/>
                    <colspec column="3" colwidth="3.5in"/>
                    <tbody>
                        <row valign="top">
                            <entry>"translation-domain"</entry>
                            <entry>Read/Write</entry>
                            <entry>The translation domain used when translating property
                            values that have been marked as translatable in interface descriptions.
                            If the translation domain is None, GtkBuilder uses gettext(),
                            otherwise dgettext(). Default value: None
                            </entry>
                        </row>
                    </tbody>
                </tgroup>
            </informaltable>
        </blockquote>
    </refsect1>

    <refsect1>
        <title>Description</title>

        <para>
            A <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link>
            is an auxiliary object that reads textual descriptions of a user interface and
            instantiates the described objects. To pass a description to a
            <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link>, call
            <methodname><link linkend="method-gtkbuilder--add-from-file">add_from_file</link></methodname>() or
            <methodname><link linkend="method-gtkbuilder--add-from-string">add_from_string</link></methodname>().
            These methods can be called multiple times; the builder merges the content of all descriptions.
        </para>
        <para>
            A <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link>
            holds a reference to all objects that it has constructed and drops these references
            when it is finalized. This finalization can cause the destruction of non-widget objects
            or widgets which are not contained in a toplevel window. For toplevel windows constructed
            by a builder, it is the responsibility of the user to call
            <methodname><link linkend="method-gtkwidget--destroy">gtk.Widget.destroy</link></methodname>()
            to get rid of them and all the widgets they contain.
        </para>
        <para>
            The methods <methodname><link linkend="method-gtkbuilder--get-object">get_object</link></methodname>()
            and <methodname><link linkend="method-gtkbuilder--get-objects">get_objects</link></methodname>()
            can be used to access the widgets in the interface by the names assigned to them inside the UI description.
            Toplevel windows returned by these methods will stay around until the user explicitly
            destroys them with <methodname><link linkend="method-gtkwidget--destroy">gtk.Widget.destroy</link></methodname>().
            Other widgets will either be part of a larger hierarchy constructed by the builder (in which case you
            should not have to worry about their lifecycle), or without a parent, in which case they have to be added
            to some container to make use of them.
        </para>
        <para>
            The methods <methodname><link linkend="method-gtkbuilder--connect-signals">connect_signals</link></methodname>()
            and variants thereof can be used to connect handlers to the named signals in the description.
        </para>
        <refsect2 id="gtkbuilder-ui-definition">
            <title>gtk.Builder UI definition</title>
            <para>
                <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link> parses textual
                descriptions of user interfaces which are specified in an XML format which
                can be roughly described by the DTD below. We refer to these descriptions as GtkBuilder UI definitions
                or just UI definitions if the context is clear. Do not confuse GtkBuilder UI Definitions with
                GtkUIManager UI Definitions, which are more limited in scope.
            </para>
<programlisting>
<![CDATA[
<!ELEMENT interface (requires|object)* >
<!ELEMENT object    (property|signal|child|ANY)* >
<!ELEMENT property  PCDATA >
<!ELEMENT signal    EMPTY >
<!ELEMENT requires  EMPTY >
<!ELEMENT child     (object|ANY*) >
<!ATTLIST interface domain                 #IMPLIED >
<!ATTLIST object    id                     #REQUIRED
                    class                  #REQUIRED
                    type-func              #IMPLIED
                    constructor            #IMPLIED >
<!ATTLIST requires  lib                    #REQUIRED
                    version                #REQUIRED >
<!ATTLIST property  name                   #REQUIRED
                    translatable           #IMPLIED 
                    comments               #IMPLIED
                    context                #IMPLIED >
<!ATTLIST signal    name                   #REQUIRED
                    handler                #REQUIRED
                    after                  #IMPLIED
                    swapped                #IMPLIED
                    object                 #IMPLIED
                    last_modification_time #IMPLIED >
<!ATTLIST child     type                   #IMPLIED
                    internal-child         #IMPLIED >
]]>
</programlisting>
            <para>
                The toplevel element is &#60;interface&#62;. It optionally takes a "domain" attribute,
                which will make the builder look for translated strings using dgettext() in the domain
                specified. This can also be done by calling
                <methodname><link linkend="method-gtkbuilder--set-translation-domain">set_translation_domain</link></methodname>()
                on the builder. Objects are described by &#60;object&#62; elements, which can contain &#60;property&#62;
                elements to set properties, &#60;signal&#62; elements which connect signals to handlers, and &#60;child&#62;
                elements, which describe child objects (most often widgets inside a container, but also e.g. actions
                in an action group, or columns in a tree model). A &#60;child&#62; element contains an &#60;object&#62;
                element which describes the child object. The target toolkit version(s) are described by &#60;requires&#62;
                elements, the "lib" attribute specifies the widget library in question (currently the only supported value
                is "gtk+") and the "version" attribute specifies the target version in the form "&#60;major&#62;.&#60;minor&#62;".
                The builder will error out if the version requirements are not met.
            </para>
            <para>
                Typically, the specific kind of object represented by an &#60;object&#62; element is specified by the
                "class" attribute. If the type has not been loaded yet, GTK+ tries to find the _get_type() from the
                class name by applying heuristics. This works in most cases, but if necessary, it is possible to specify
                the name of the _get_type() explictly with the "type-func" attribute. As a special case,
                <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link> allows to use an object that
                has been constructed by a <link linkend="class-gtkuimanager"><classname>gtk.UIManager</classname></link>
                in another part of the UI definition by specifying the id of the
                <link linkend="class-gtkuimanager"><classname>gtk.UIManager</classname></link> in the "constructor" attribute
                and the name of the object in the "id" attribute.
            </para>
            <para>
                Objects must be given a name with the "id" attribute, which allows the application to retrieve them from
                the builder with <methodname><link linkend="method-gtkbuilder--get-object">get_object</link></methodname>().
                An id is also necessary to use the object as property value in other parts of the UI definition.
            </para>
            <note>
                Prior to GTK+ 2.20, <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link>
                was setting the "name" property of constructed widgets to the "id" attribute. In GTK+ 2.20 or newer, you
                have to use <link linkend="method-gtkbuildable--set-name"><methodname>gtk.Buildable.get_name</methodname></link>()
                instead of <link linkend="method-gtkwidget--get-name"><methodname>gtk.Widget.get_name</methodname></link>()
                to obtain the "id", or set the "name" property in your UI definition.
            </note>
            <para>
                Setting properties of objects is pretty straightforward with the &#60;property&#62;element: the "name"
                attribute specifies the name of the property, and the content of the element specifies the value. If the
                "translatable" attribute is set to a true value, GTK+ uses gettext() (or dgettext() if the builder has
                a translation domain set) to find a translation for the value. This happens before the value is parsed,
                so it can be used for properties of any type, but it is probably most useful for string properties.
                It is also possible to specify a context to disambiguate short strings, and comments which may
                help the translators.
            </para>
            <para>
                GtkBuilder can parse textual representations for the most common property types: characters, strings,
                integers, floating-point numbers, booleans (strings like "TRUE", "t", "yes", "y", "1" are interpreted as
                <literal>True</literal>, strings like "FALSE, "f", "no", "n", "0" are interpreted as <literal>False</literal>),
                enumerations (can be specified by their name, nick or integer value), flags (can be specified by their
                name, nick, integer value, optionally combined with "|", e.g. "gtk.VISIBLE|gtk.REALIZED")
                and colors (in a format understood by <link linkend="function-gdk--color-parse"><methodname>gtk.gdk.color_parse</methodname></link>()).
                Objects can be referred to by their name.
                Pixbufs can be specified as a filename of an image file to load. In general, GtkBuilder allows
                forward references to objects — an object doesn't have to be constructed before it can be referred to.
                The exception to this rule is that an object has to be constructed before it can be used as the value
                of a construct-only property.
            </para>
            <para>
                Signal handlers are set up with the &#60;signal&#62; element. The "name" attribute specifies the name
                of the signal, and the "handler" attribute specifies the function to connect to the signal. By default,
                GTK+ tries to find the handler using g_module_symbol()<!--NOT IMPLEMENTED IN PYGTK:, but this can be changed by passing a custom
                GtkBuilderConnectFunc to gtk_builder_connect_signals_full()-->. The remaining attributes, "after", "swapped"
                and "object", have the same meaning as the corresponding parameters of the g_signal_connect_object() or
                g_signal_connect_data() functions. A "last_modification_time" attribute is also allowed, but it does not
                have a meaning to the builder.
            </para>
            <para>
                Sometimes it is necessary to refer to widgets which have implicitly been constructed by GTK+ as part of
                a composite widget, to set properties on them or to add further children (e.g. the vbox of a
                <link linkend="class-gtkdialog"><classname>gtk.Dialog</classname></link>).
                This can be achieved by setting the "internal-child" propery of the &#60;child&#62; element to a true value.
                Note that <link linkend="class-gtkbuilder"><classname>gtk.Builder</classname></link>
                still requires an &#60;object&#62; element for the internal child, even if it has already been constructed.
            </para>
            <para>
                A number of widgets have different places where a child can be added (e.g. tabs vs. page content in
                notebooks). This can be reflected in a UI definition by specifying the "type" attribute on a
                &#60;child&#62; The possible values for the "type" attribute are described in the sections describing
                the widget-specific portions of UI definitions.
            </para>
        </refsect2>
        
        <refsect2 id="gtkbuilder-ui-definition-example">
            <title>A gtk.Builder UI definition example</title>
<programlisting>
<![CDATA[
<interface>
  <object class="GtkDialog" id="dialog1">
    <child internal-child="vbox">
      <object class="GtkVBox" id="vbox1">
        <property name="border-width">10</property>
        <child internal-child="action_area">
          <object class="GtkHButtonBox" id="hbuttonbox1">
            <property name="border-width">20</property>
            <child>
              <object class="GtkButton" id="ok_button">
                <property name="label">gtk-ok</property>
                <property name="use-stock">TRUE</property>
                <signal name="clicked" handler="ok_button_clicked"/>
              </object>
            </child>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>
]]>
</programlisting>
            <para>
                Beyond this general structure, several object classes define their own XML DTD
                fragments for filling in the ANY placeholders in the DTD above. Note that a
                custom element in a &#60;child&#62; element gets parsed by the custom tag handler of
                the parent object, while a custom element in an &#60;object&#62; element gets parsed
                by the custom tag handler of the object.
            </para>

            <para>
              These XML fragments are explained in the documentation of their respective objects in the
              GTK+ Reference Manual.
            </para>
        </refsect2>
    </refsect1>

    <refsect1 id="constructor-gtkbuilder">
        <title>Constructor</title>

        <programlisting><constructorsynopsis language="python">
            <methodname>gtk.Builder</methodname>
            <methodparam></methodparam>
        </constructorsynopsis></programlisting>

        <variablelist>
            <varlistentry>
                <term><emphasis>Returns</emphasis>&nbsp;:</term>
                <listitem><simpara>a new builder object.</simpara></listitem>
            </varlistentry>
        </variablelist>

        <para>
            Creates a new builder object.
        </para>
    </refsect1>

    <refsect1>
        <title>Methods</title>

        <refsect2 id="method-gtkbuilder--add-from-file">
            <title>gtk.Builder.add_from_file</title>

            <programlisting><methodsynopsis language="python">
                <methodname>add_from_file</methodname>
                <methodparam><parameter>filename</parameter></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">filename</parameter>&nbsp;:</term>
                        <listitem><simpara>The name of the file to parse.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>A positive value on success, 0 if an error occurred.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>add_from_file</methodname>() method parses a file containing a GtkBuilder UI
                definition and merges it with the current contents of builder.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--add-from-string">
            <title>gtk.Builder.add_from_string</title>

            <programlisting><methodsynopsis language="python">
                <methodname>add_from_string</methodname>
                <methodparam><parameter>buffer</parameter></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">buffer</parameter>&nbsp;:</term>
                        <listitem><simpara>The string to parse.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>A positive value on success, 0 if an error occurred.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>add_from_string</methodname>() method parses a string containing a GtkBuilder UI
                definition and merges it with the current contents of builder.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--add-objects-from-file">
            <title>gtk.Builder.add_objects_from_file</title>

            <programlisting><methodsynopsis language="python">
                <methodname>add_objects_from_file</methodname>
                <methodparam><parameter>filename</parameter></methodparam>
                <methodparam><parameter>object_ids</parameter></methodparam>
            </methodsynopsis></programlisting>

            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">filename</parameter>&nbsp;:</term>
                        <listitem><simpara>The name of the file to parse.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><parameter role="keyword">object_ids</parameter>&nbsp;:</term>
                        <listitem><simpara>A list of objects to build.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>A positive value on success, 0 if an error occurred.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.14 and above.</para>
            </note>

            <para>
                The <methodname>add_objects_from_file</methodname>() method parses a file containing a GtkBuilder UI
                definition building only the requested objects and merges it with the current contents of builder.
            </para>
            <para>
                Note that if you are adding an object that depends on an object that is not its child (for instance
                a <link linkend="class-gtktreeview"><classname>gtk.TreeView</classname></link> that depends on its
                <link linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link>), you have to
                explicitely list all of them in <parameter>object_ids</parameter>.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--add-objects-from-string">
            <title>gtk.Builder.add_objects_from_string</title>

            <programlisting><methodsynopsis language="python">
                <methodname>add_objects_from_string</methodname>
                <methodparam><parameter>buffer</parameter></methodparam>
                <methodparam><parameter>object_ids</parameter></methodparam>
            </methodsynopsis></programlisting>

            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">buffer</parameter>&nbsp;:</term>
                        <listitem><simpara>The string to parse.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><parameter role="keyword">object_ids</parameter>&nbsp;:</term>
                        <listitem><simpara>A list of objects to build.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>A positive value on success, 0 if an error occurred.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.14 and above.</para>
            </note>

            <para>
                The <methodname>add_objects_from_string</methodname>() method parses a string containing a GtkBuilder UI
                definition building only the requested objects and merges it with the current contents of builder.
            </para>
            <para>
                Note that if you are adding an object that depends on an object that is not its child (for instance
                a <link linkend="class-gtktreeview"><classname>gtk.TreeView</classname></link> that depends on its
                <link linkend="class-gtktreemodel"><classname>gtk.TreeModel</classname></link>), you have to
                explicitely list all of them in <parameter>object_ids</parameter>.
            </para>

        </refsect2>

        <refsect2 id="method-gtkbuilder--connect-signals">
            <title>gtk.Builder.connect_signals</title>

            <programlisting><methodsynopsis language="python">
                <methodname>connect_signals</methodname>
                <methodparam><parameter>object</parameter></methodparam>
                <methodparam><parameter>user_data</parameter></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">object</parameter>&nbsp;:</term>
                        <listitem><simpara>A mapping or an instance.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><parameter role="keyword">user_data</parameter>&nbsp;:</term>
                        <listitem><simpara>User data for every signal handler.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>connect_signals</methodname>() method uses Python's introspective
                features to look at the keys (if object is a mapping) or attributes (if object is an instance)
                and tries to match them with the signal handler names given in the interface description.
                The callbacks referenced by each matched key or attribute are connected to their matching signals.
            </para>

	    <para>
	        For each of handlers that cannot be found, a <classname>RuntimeWarning</classname>
	        is issued.  Also, if there is at least one such missing handler,
		<methodname>connect_signals</methodname> will return a list of their names,
		else return value is None.
	    </para>

	    <note>
	        <para><classname>RuntimeWarning</classname> and return value for missing
		  handlers was added in PyGTK 2.14.</para>
	    </note>
	</refsect2>

        <refsect2 id="method-gtkbuilder--get-object">
            <title>gtk.Builder.get_object</title>

            <programlisting><methodsynopsis language="python">
                <methodname>get_object</methodname>
                <methodparam><parameter>name</parameter></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">name</parameter>&nbsp;:</term>
                        <listitem><simpara>Name of object to get.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>The object named name or None if it could
                        not be found in the object tree.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>get_object</methodname>() method gets the object named name.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--get-objects">
            <title>gtk.Builder.get_objects</title>

            <programlisting><methodsynopsis language="python">
                <methodname>get_objects</methodname>
                <methodparam></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>A list containing all the objects constructed
                        by the GtkBuilder instance</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>get_objects</methodname>() method gets all objects that have
                been constructed by builder.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--get-translation-domain">
            <title>gtk.Builder.get_translation_domain</title>

            <programlisting><methodsynopsis language="python">
                <methodname>get_translation_domain</methodname>
                <methodparam></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>The translation domain.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>get_translation_domain</methodname>() gets the translation domain of builder.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--get-type-from-name">
            <title>gtk.Builder.get_type_from_name</title>

            <programlisting><methodsynopsis language="python">
                <methodname>get_type_from_name</methodname>
                <methodparam><parameter>type_name</parameter></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">type_name</parameter>&nbsp;:</term>
                        <listitem><simpara>The name to lookup.</simpara></listitem>
                </varlistentry>
                <varlistentry>
                    <term><emphasis>Returns</emphasis>&nbsp;:</term>
                        <listitem><simpara>The GType found for type_name or G_TYPE_INVALID if no type was found</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>get_type_from_name</methodname>() method looks up a type by name,
                using the virtual function that GtkBuilder has for that purpose.
            </para>
        </refsect2>

        <refsect2 id="method-gtkbuilder--set-translation-domain">
            <title>gtk.Builder.set_translation_domain</title>

            <programlisting><methodsynopsis language="python">
                <methodname>set_translation_domain</methodname>
                <methodparam><parameter>domain</parameter></methodparam>
            </methodsynopsis></programlisting>
            
            <variablelist>
                <varlistentry>
                    <term><parameter role="keyword">domain</parameter>&nbsp;:</term>
                        <listitem><simpara>The translation domain or None.</simpara></listitem>
                </varlistentry>
            </variablelist>

            <note>
                <para>This method is available in PyGTK 2.12 and above.</para>
            </note>

            <para>
                The <methodname>set_translation_domain</methodname>() method sets the translation
                domain of builder. See GtkBuilder:translation-domain property.
            </para>
        </refsect2>
    </refsect1>
</refentry>