Revert accidental commit
[platform/upstream/glib.git] / docs / reference / gobject / tmpl / objects.sgml
1 <!-- ##### SECTION Title ##### -->
2 GObject
3
4 <!-- ##### SECTION Short_Description ##### -->
5 The base object type
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 GObject is the fundamental type providing the common attributes and methods 
10 for all object types in GTK+, Pango and other libraries based on GObject. 
11 The GObject class provides methods for object construction and destruction, 
12 property access methods, and signal support. 
13 Signals are described in detail in <xref linkend="gobject-Signals"/>.
14 </para>
15 <para id="floating-ref">
16 #GInitiallyUnowned is derived from #GObject. The only difference between
17 the two is that the initial reference of a #GInitiallyUnowned is flagged 
18 as a <firstterm>floating</firstterm> reference.
19 This means that it is not specifically claimed to be "owned" by
20 any code portion. The main motivation for providing floating references is
21 C convenience. In particular, it allows code to be written as:
22 <example><programlisting>
23   container = create_container();
24   container_add_child (container, create_child());
25 </programlisting></example>
26 If <function>container_add_child()</function> will g_object_ref_sink() the
27 passed in child, no reference of the newly created child is leaked.
28 Without floating references, <function>container_add_child()</function>
29 can only g_object_ref() the new child, so to implement this code without
30 reference leaks, it would have to be written as:
31 <example><programlisting>
32   Child *child;
33   container = create_container();
34   child = create_child();
35   container_add_child (container, child);
36   g_object_unref (child);
37 </programlisting></example>
38 The floating reference can be converted into 
39 an ordinary reference by calling g_object_ref_sink().
40 For already sunken objects (objects that don't have a floating reference
41 anymore), g_object_ref_sink() is equivalent to g_object_ref() and returns
42 a new reference.
43 Since floating references are useful almost exclusively for C convenience,
44 language bindings that provide automated reference and memory ownership
45 maintenance (such as smart pointers or garbage collection) therefore don't
46 need to expose floating references in their API.
47 </para>
48 <para>
49 Some object implementations may need to save an objects floating state
50 across certain code portions (an example is #GtkMenu), to achive this, the
51 following sequence can be used:
52 </para>
53
54 <example><programlisting>
55   /* save floating state */
56   gboolean was_floating = g_object_is_floating (object);
57   g_object_ref_sink (object);
58   /* protected code portion */
59   ...;
60   /* restore floating state */
61   if (was_floating)
62     g_object_force_floating (object);
63   g_obejct_unref (object); /* release previously acquired reference */
64 </programlisting></example>
65
66 <!-- ##### SECTION See_Also ##### -->
67 <para>
68 #GParamSpecObject, g_param_spec_object()
69 </para>
70
71 <!-- ##### SECTION Stability_Level ##### -->
72
73
74 <!-- ##### STRUCT GObject ##### -->
75 <para>
76 All the fields in the <structname>GObject</structname> structure are private 
77 to the #GObject implementation and should never be accessed directly.
78 </para>
79
80
81 <!-- ##### SIGNAL GObject::notify ##### -->
82 <para>
83 The notify signal is emitted on an object when one of its properties 
84 has been changed. Note that getting this signal doesn't guarantee that the
85 value of the property has actually changed, it may also be emitted when
86 the setter for the property is called to reinstate the previous value.
87 </para>
88
89 @pspec: the #GParamSpec of the property which changed
90 @:
91 @gobject: the object which received the signal.
92
93 <!-- ##### STRUCT GObjectClass ##### -->
94 <para>
95 The class structure for the <structname>GObject</structname> type.
96 </para>
97 <example>
98 <title>Implementing singletons using a constructor</title>
99 <programlisting>
100 static MySingleton *the_singleton = NULL;
101
102 static GObject*
103 my_singleton_constructor (GType                  type,
104                           guint                  n_construct_params,
105                           GObjectConstructParam *construct_params)
106 {
107   GObject *object;
108   
109   if (!the_singleton)
110     {
111       object = G_OBJECT_CLASS (parent_class)->constructor (type,
112                                                            n_construct_params,
113                                                            construct_params);
114       the_singleton = MY_SINGLETON (object);
115     }
116   else
117     object = g_object_ref (G_OBJECT (the_singleton));
118
119   return object;
120 }
121 </programlisting></example>
122
123 @g_type_class: the parent class
124 @constructor:  the @constructor function is called by g_object_new () to 
125   complete the object initialization after all the construction properties are
126   set. The first thing a @constructor implementation must do is chain up to the
127   @constructor of the parent class. Overriding @constructor should be rarely 
128   needed, e.g. to handle construct properties, or to implement singletons.
129 @set_property: the generic setter for all properties of this type. Should be
130   overridden for every type with properties. Implementations of @set_property
131   don't need to emit property change notification explicitly, this is handled
132   by the type system.
133 @get_property: the generic getter for all properties of this type. Should be
134   overridden for every type with properties.
135 @dispose: the @dispose function is supposed to drop all references to other 
136   objects, but keep the instance otherwise intact, so that client method 
137   invocations still work. It may be run multiple times (due to reference 
138   loops). Before returning, @dispose should chain up to the @dispose method 
139   of the parent class.
140 @finalize: instance finalization function, should finish the finalization of 
141   the instance begun in @dispose and chain up to the @finalize method of the 
142   parent class.
143 @dispatch_properties_changed: emits property change notification for a bunch
144   of properties. Overriding @dispatch_properties_changed should be rarely 
145   needed.
146 @notify: the class closure for the notify signal
147
148 <!-- ##### STRUCT GObjectConstructParam ##### -->
149 <para>
150 The <structname>GObjectConstructParam</structname> struct is an auxiliary 
151 structure used to hand #GParamSpec/#GValue pairs to the @constructor of
152 a #GObjectClass.
153 </para>
154
155 @pspec: the #GParamSpec of the construct parameter
156 @value: the value to set the parameter to
157
158 <!-- ##### USER_FUNCTION GObjectGetPropertyFunc ##### -->
159 <para>
160 The type of the @get_property function of #GObjectClass. 
161 </para>
162
163 @object: a #GObject
164 @property_id: the numeric id under which the property was registered with
165    g_object_class_install_property().
166 @value: a #GValue to return the property value in
167 @pspec: the #GParamSpec describing the property
168
169
170 <!-- ##### USER_FUNCTION GObjectSetPropertyFunc ##### -->
171 <para>
172 The type of the @set_property function of #GObjectClass. 
173 </para>
174
175 @object: a #GObject
176 @property_id: the numeric id under which the property was registered with
177    g_object_class_install_property().
178 @value: the new value for the property
179 @pspec: the #GParamSpec describing the property
180
181
182 <!-- ##### USER_FUNCTION GObjectFinalizeFunc ##### -->
183 <para>
184 The type of the @finalize function of #GObjectClass.
185 </para>
186
187 @object: the #GObject being finalized
188
189
190 <!-- ##### MACRO G_TYPE_IS_OBJECT ##### -->
191 <para>
192 Returns a boolean value of %FALSE or %TRUE indicating whether
193 the passed in type id is a %G_TYPE_OBJECT or derived from it.
194 </para>
195
196 @type: Type id to check for is a %G_TYPE_OBJECT relationship.
197 @Returns: %FALSE or %TRUE, indicating whether @type is a %G_TYPE_OBJECT.
198
199
200 <!-- ##### MACRO G_OBJECT ##### -->
201 <para>
202 Casts a #GObject or derived pointer into a (GObject*) pointer.
203 Depending on the current debugging level, this function may invoke
204 certain runtime checks to identify invalid casts.
205 </para>
206
207 @object: Object which is subject to casting.
208
209
210 <!-- ##### MACRO G_IS_OBJECT ##### -->
211 <para>
212 Checks whether a valid #GTypeInstance pointer is of type %G_TYPE_OBJECT.
213 </para>
214
215 @object: Instance to check for being a %G_TYPE_OBJECT.
216
217
218 <!-- ##### MACRO G_OBJECT_CLASS ##### -->
219 <para>
220 Casts a derived #GObjectClass structure into a #GObjectClass structure.
221 </para>
222
223 @class: a valid #GObjectClass
224
225
226 <!-- ##### MACRO G_IS_OBJECT_CLASS ##### -->
227 <para>
228 Checks whether @class "is a" valid #GObjectClass structure of type
229 %G_TYPE_OBJECT or derived.
230 </para>
231
232 @class: a #GObjectClass
233
234
235 <!-- ##### MACRO G_OBJECT_GET_CLASS ##### -->
236 <para>
237 Returns the class structure associated to a #GObject instance.
238 </para>
239
240 @object: a #GObject instance.
241
242
243 <!-- ##### MACRO G_OBJECT_TYPE ##### -->
244 <para>
245 Return the type id of an object.
246 </para>
247
248 @object: Object to return the type id for.
249 @Returns: Type id of @object.
250
251
252 <!-- ##### MACRO G_OBJECT_TYPE_NAME ##### -->
253 <para>
254 Returns the name of an object's type.
255 </para>
256
257 @object: Object to return the type name for.
258 @Returns: Type name of @object. The string is owned by the type system and 
259 should not be freed.
260
261
262 <!-- ##### MACRO G_OBJECT_CLASS_TYPE ##### -->
263 <para>
264 Return the type id of a class structure.
265 </para>
266
267 @class: a valid #GObjectClass
268 @Returns: Type id of @class.
269
270
271 <!-- ##### MACRO G_OBJECT_CLASS_NAME ##### -->
272 <para>
273 Return the name of a class structure's type.
274 </para>
275
276 @class: a valid #GObjectClass
277 @Returns: Type name of @class. The string is owned by the type system and 
278 should not be freed.
279
280
281 <!-- ##### FUNCTION g_object_class_install_property ##### -->
282 <para>
283 Installs a new property. This is usually done in the class initializer.
284 </para>
285
286 @oclass: a #GObjectClass
287 @property_id: the id for the new property
288 @pspec: the #GParamSpec for the new property
289
290
291 <!-- ##### FUNCTION g_object_class_find_property ##### -->
292 <para>
293 Looks up the #GParamSpec for a property of a class.
294 </para>
295
296 @oclass: a #GObjectClass
297 @property_name: the name of the property to look up
298 @Returns: the #GParamSpec for the property, or %NULL if the class doesn't have
299 a property of that name
300
301
302 <!-- ##### FUNCTION g_object_class_list_properties ##### -->
303 <para>
304 Returns an array of #GParamSpec* for all properties of a class.
305 </para>
306
307 @oclass: a #GObjectClass
308 @n_properties: return location for the length of the returned array
309 @Returns: an array of #GParamSpec* which should be freed after use
310
311
312 <!-- ##### FUNCTION g_object_class_override_property ##### -->
313 <para>
314 Registers @property_id as referring to a property with the
315 name @name in a parent class or in an interface implemented
316 by @oclass. This allows this class to <firstterm>override</firstterm>
317 a property implementation in a parent class or to provide
318 the implementation of a property from an interface.
319 </para>
320 <note>
321 <para>
322 Internally, overriding is implemented by creating a property of type
323 #GParamSpecOverride; generally operations that query the properties of
324 the object class, such as g_object_class_find_property() or
325 g_object_class_list_properties() will return the overridden
326 property. However, in one case, the @construct_properties argument of
327 the @constructor virtual function, the #GParamSpecOverride is passed
328 instead, so that the @param_id field of the #GParamSpec will be
329 correct.  For virtually all uses, this makes no difference. If you
330 need to get the overridden property, you can call
331 g_param_spec_get_redirect_target().
332 </para>
333 </note>
334
335 @oclass: a #GObjectClass
336 @property_id: the new property ID
337 @name: the name of a property registered in a parent class or
338        in an interface of this class.
339
340
341 <!-- ##### FUNCTION g_object_interface_install_property ##### -->
342 <para>
343 Add a property to an interface; this is only useful for interfaces
344 that are added to GObject-derived types. Adding a property to an
345 interface forces all objects classes with that interface to have a
346 compatible property. The compatible property could be a newly
347 created #GParamSpec, but normally
348 g_object_class_override_property() will be used so that the object
349 class only needs to provide an implementation and inherits the
350 property description, default value, bounds, and so forth from the
351 interface property.
352 </para>
353 <para>
354 This function is meant to be called from the interface's default
355 vtable initialization function (the @class_init member of
356 #GTypeInfo.) It must not be called after after @class_init has
357 been called for any object types implementing this interface.
358 </para>
359
360 @g_iface: any interface vtable for the interface, or the default
361  vtable for the interface.
362 @pspec: the #GParamSpec for the new property
363 @Since: 2.4
364
365
366 <!-- ##### FUNCTION g_object_interface_find_property ##### -->
367 <para>
368 Find the #GParamSpec with the given name for an
369 interface. Generally, the interface vtable passed in as @g_iface
370 will be the default vtable from g_type_default_interface_ref(), or,
371 if you know the interface has already been loaded,
372 g_type_default_interface_peek().
373 </para>
374
375 @g_iface: any interface vtable for the interface, or the default
376   vtable for the interface
377 @property_name: name of a property to lookup.
378 @Returns: the #GParamSpec for the property of the
379   interface with the name @property_name, or %NULL
380   if no such property exists.
381 @Since: 2.4
382
383
384 <!-- ##### FUNCTION g_object_interface_list_properties ##### -->
385 <para>
386 Lists the properties of an interface.Generally, the interface
387 vtable passed in as @g_iface will be the default vtable from
388 g_type_default_interface_ref(), or, if you know the interface has
389 already been loaded, g_type_default_interface_peek().
390 </para>
391
392 @g_iface: any interface vtable for the interface, or the default
393  vtable for the interface
394 @n_properties_p: location to store number of properties returned.
395 @Returns: a pointer to an array of pointers to #GParamSpec structures.
396   The paramspecs are owned by GLib, but the array should
397   be freed with g_free() when you are done with it.
398 @Since: 2.4
399
400
401 <!-- ##### FUNCTION g_object_new ##### -->
402 <para>
403 Creates a new instance of a #GObject subtype and sets its properties.
404 </para>
405 <para>
406 Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) 
407 which are not explicitly specified are set to their default values.
408 </para>
409
410 @object_type: the type id of the #GObject subtype to instantiate
411 @first_property_name: the name of the first property
412 @Varargs: the value of the first property, followed optionally by more
413      name/value pairs, followed by %NULL
414 @Returns: a new instance of @object_type
415
416
417 <!-- ##### FUNCTION g_object_newv ##### -->
418 <para>
419 Creates a new instance of a #GObject subtype and sets its properties.
420 </para>
421 <para>
422 Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) 
423 which are not explicitly specified are set to their default values.
424 </para>
425
426 @object_type: the type id of the #GObject subtype to instantiate
427 @n_parameters: the length of the @parameters array
428 @parameters: an array of #GParameter
429 @Returns: a new instance of @object_type
430
431
432 <!-- ##### STRUCT GParameter ##### -->
433 <para>
434 The <structname>GParameter</structname> struct is an auxiliary structure used
435 to hand parameter name/value pairs to g_object_newv().
436 </para>
437
438 @name: the parameter name
439 @value: the parameter value
440
441 <!-- ##### FUNCTION g_object_ref ##### -->
442 <para>
443 Increases the reference count of @object.
444 </para>
445
446 @object: a #GObject
447 @Returns: the same @object
448
449
450 <!-- ##### FUNCTION g_object_unref ##### -->
451 <para>
452 Decreases the reference count of @object.
453 When its reference count drops to 0, the object is finalized 
454 (i.e. its memory is freed).
455 </para>
456
457 @object: a #GObject
458
459
460 <!-- ##### FUNCTION g_object_ref_sink ##### -->
461 <para>
462 Increase the reference count of @object, and possibly remove the 
463 <link linkend="floating-ref">floating</link> reference, if @object
464 has a floating reference.
465 </para>
466 <para>
467 In other words, if the object is floating, then this call "assumes 
468 ownership" of the floating reference, converting it to a normal reference 
469 by clearing the floating flag while leaving the reference count unchanged. 
470 If the object is not floating, then this call adds a new normal reference 
471 increasing the reference count by one.
472 </para>
473
474 @object: a #GObject
475 @Returns: @object
476 @Since: 2.10
477
478
479 <!-- ##### TYPEDEF GInitiallyUnowned ##### -->
480 <para>
481 All the fields in the <structname>GInitiallyUnowned</structname> structure 
482 are private to the #GInitiallyUnowned implementation and should never be 
483 accessed directly.
484 </para>
485
486
487 <!-- ##### TYPEDEF GInitiallyUnownedClass ##### -->
488 <para>
489 The class structure for the <structname>GInitiallyUnowned</structname> type.
490 </para>
491
492
493 <!-- ##### MACRO G_TYPE_INITIALLY_UNOWNED ##### -->
494 <para>
495 The type for #GInitiallyUnowned.
496 </para>
497
498
499
500 <!-- ##### FUNCTION g_object_is_floating ##### -->
501 <para>
502 Checks wether @object has a <link linkend="floating-ref">floating</link>
503 reference.
504 </para>
505
506 @object: a #GObject
507 @Returns: %TRUE if @object has a floating reference
508 @Since: 2.10
509
510
511 <!-- ##### FUNCTION g_object_force_floating ##### -->
512 <para>
513 This function is intended for #GObject implementations to re-enforce a
514 <link linkend="floating-ref">floating</link> object reference.
515 Doing this is seldomly required, all
516 #GInitiallyUnowned<!-- -->s are created with a floating reference which 
517 usually just needs to be sunken by calling g_object_ref_sink().
518 </para>
519
520 @object: a #GObject
521 @Since: 2.10
522
523
524 <!-- ##### USER_FUNCTION GWeakNotify ##### -->
525 <para>
526 A #GWeakNotify function can be added to an object as a callback that gets
527 triggered when the object is finalized. Since the object is already being
528 finalized when the #GWeakNotify is called, there's not much you could do 
529 with the object, apart from e.g. using its adress as hash-index or the like. 
530 </para>
531
532 @data: data that was provided when the weak reference was established
533 @where_the_object_was: the object being finalized
534
535
536 <!-- ##### FUNCTION g_object_weak_ref ##### -->
537 <para>
538 Adds a weak reference callback to an object. Weak references are used for
539 notification when an object is finalized. They are called "weak references" 
540 because they allow you to safely hold a pointer to an object without calling 
541 g_object_ref() (g_object_ref() adds a strong reference, that is, forces the 
542 object to stay alive).
543 </para>
544
545 @object: #GObject to reference weakly
546 @notify: callback to invoke before the object is freed
547 @data: extra data to pass to notify
548
549
550 <!-- ##### FUNCTION g_object_weak_unref ##### -->
551 <para>
552 Removes a weak reference callback to an object.
553 </para>
554
555 @object: #GObject to remove a weak reference from
556 @notify: callback to search for
557 @data: data to search for
558
559
560 <!-- ##### FUNCTION g_object_add_weak_pointer ##### -->
561 <para>
562 Adds a weak reference from weak_pointer to @object to indicate that
563 the pointer located at @weak_pointer_location is only valid during the 
564 lifetime of @object. When the @object is finalized, @weak_pointer will 
565 be set to %NULL.
566 </para>
567
568 @object: The object that should be weak referenced.
569 @weak_pointer_location: The memory address of a pointer.
570
571
572 <!-- ##### FUNCTION g_object_remove_weak_pointer ##### -->
573 <para>
574 Removes a weak reference from @object that was previously added
575 using g_object_add_weak_pointer(). The @weak_pointer_location has
576 to match the one used with g_object_add_weak_pointer().
577 </para>
578
579 @object: The object that is weak referenced.
580 @weak_pointer_location: The memory address of a pointer.
581
582
583 <!-- ##### USER_FUNCTION GToggleNotify ##### -->
584 <para>
585 A callback function used for notification when the state
586 of a toggle reference changes. See g_object_add_toggle_ref().
587 </para>
588
589 @data: Callback data passed to g_object_add_toggle_ref()
590 @object: The object on which g_object_add_toggle_ref() was called.
591 @is_last_ref: %TRUE if the toggle reference is now the
592   last reference to the object. %FALSE if the toggle
593   reference was the last reference and there are now other
594   references.
595
596
597 <!-- ##### FUNCTION g_object_add_toggle_ref ##### -->
598 <para>
599 Increases the reference count of the object by one and sets a
600 callback to be called when all other references to the object are
601 dropped, or when this is already the last reference to the object
602 and another reference is established.
603 </para>
604 <para>
605 This functionality is intended for binding @object to a proxy
606 object managed by another memory manager. This is done with two
607 paired references: the strong reference added by
608 g_object_add_toggle_ref() and a reverse reference to the proxy
609 object which is either a strong reference or weak reference.
610 </para>
611 <para>
612 The setup is that when there are no other references to @object,
613 only a weak reference is held in the reverse direction from @object
614 to the proxy object, but when there are other references held to
615 @object, a strong reference is held. The @notify callback is called
616 when the reference from @object to the proxy object should be
617 <firstterm>toggled</firstterm> from strong to weak (@is_last_ref
618 true) or weak to strong (@is_last_ref false).
619 </para>
620 <para>
621 Since a (normal) reference must be held to the object before
622 calling g_object_toggle_ref(), the initial state of the reverse
623 link is always strong.
624 </para>
625 <para>
626 Multiple toggle references may be added to the same gobject,
627 however if there are multiple toggle references to an object, none
628 of them will ever be notified until all but one are removed.  For
629 this reason, you should only ever use a toggle reference if there
630 is important state in the proxy object.
631 </para>
632
633 @object: a #GObject
634 @notify: a function to call when this reference is the
635   last reference to the object, or is no longer
636   the last reference.
637 @data: data to pass to @notify
638 @Since: 2.8
639
640
641 <!-- ##### FUNCTION g_object_remove_toggle_ref ##### -->
642 <para>
643 Removes a reference added with g_object_add_toggle_ref(). The
644 reference count of the object is decreased by one.
645 </para>
646
647 @object: a #GObject
648 @notify: a function to call when this reference is the
649   last reference to the object, or is no longer
650   the last reference.
651 @data: data to pass to @notify
652 @Since: 2.8
653
654
655 <!-- ##### FUNCTION g_object_connect ##### -->
656 <para>
657 A convenience function to connect multiple signals at once.
658 </para>
659 <para>
660 The signal specs expected by this function have the form
661 "modifier::signal_name", where modifier can be one of the following:
662 <variablelist>
663 <varlistentry>
664 <term>signal</term>
665 <listitem><para>
666 equivalent to <literal>g_signal_connect_data (...)</literal>
667 </para></listitem>
668 </varlistentry>
669 <varlistentry>
670 <term>object_signal</term>
671 <term>object-signal</term>
672 <listitem><para>
673 equivalent to <literal>g_signal_connect_object (...)</literal>
674 </para></listitem>
675 </varlistentry>
676 <varlistentry>
677 <term>swapped_signal</term>
678 <term>swapped-signal</term>
679 <listitem><para>
680 equivalent to <literal>g_signal_connect_data (..., G_CONNECT_SWAPPED)</literal>
681 </para></listitem>
682 </varlistentry>
683 <varlistentry>
684 <term>swapped_object_signal</term>
685 <term>swapped-object-signal</term>
686 <listitem><para>
687 equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED)</literal>
688 </para></listitem>
689 </varlistentry>
690 <varlistentry>
691 <term>signal_after</term>
692 <term>signal-after</term>
693 <listitem><para>
694 equivalent to <literal>g_signal_connect_data (..., G_CONNECT_AFTER)</literal>
695 </para></listitem>
696 </varlistentry>
697 <varlistentry>
698 <term>object_signal_after</term>
699 <term>object-signal-after</term>
700 <listitem><para>
701 equivalent to <literal>g_signal_connect_object (..., G_CONNECT_AFTER)</literal>
702 </para></listitem>
703 </varlistentry>
704 <varlistentry>
705 <term>swapped_signal_after</term>
706 <term>swapped-signal-after</term>
707 <listitem><para>
708 equivalent to <literal>g_signal_connect_data (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
709 </para></listitem>
710 </varlistentry>
711 <varlistentry>
712 <term>swapped_object_signal_after</term>
713 <term>swapped-object-signal-after</term>
714 <listitem><para>
715 equivalent to <literal>g_signal_connect_object (..., G_CONNECT_SWAPPED | G_CONNECT_AFTER)</literal>
716 </para></listitem>
717 </varlistentry>
718 </variablelist>
719 </para>
720 <informalexample>
721 <programlisting>
722   menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW,
723                                                    "type", GTK_WINDOW_POPUP,
724                                                    "child", menu,
725                                                    NULL),
726                                      "signal::event", gtk_menu_window_event, menu,
727                                      "signal::size_request", gtk_menu_window_size_request, menu,
728                                      "signal::destroy", gtk_widget_destroyed, &amp;menu-&gt;toplevel,
729                                      NULL);
730 </programlisting>
731 </informalexample>
732
733 @object: a #GObject
734 @signal_spec: the spec for the first signal
735 @Varargs: #GCallback for the first signal, followed by data for the first signal, 
736           followed optionally by more signal spec/callback/data triples, 
737           followed by %NULL
738 @Returns: @object
739
740
741 <!-- ##### FUNCTION g_object_disconnect ##### -->
742 <para>
743 A convenience function to disconnect multiple signals at once.
744 </para>
745 <para>
746 The signal specs expected by this function have the form "any_signal", which
747 means to disconnect any signal with matching callback and data, or 
748 "any_signal::signal_name", which only disconnects the signal named "signal_name". 
749 </para>
750
751 @object: a #GObject
752 @signal_spec: the spec for the first signal
753 @Varargs: #GCallback for the first signal, followed by data for the first signal, 
754           followed optionally by more signal spec/callback/data triples, 
755           followed by %NULL
756
757
758 <!-- ##### FUNCTION g_object_set ##### -->
759 <para>
760 Sets properties on an object.
761 </para>
762
763 @object: a #GObject
764 @first_property_name: name of the first property to set
765 @Varargs: value for the first property, followed optionally by more
766           name/value pairs, followed by %NULL
767
768
769 <!-- ##### FUNCTION g_object_get ##### -->
770 <para>
771 Gets properties of an object.
772 </para>
773 <para>
774 In general, a copy is made of the property contents and the caller is
775 responsible for freeing the memory in the appropriate manner for the type, 
776 for instance by calling g_free() or g_object_unref().
777 </para>
778 <example>
779 <title>Using g_object_get(<!-- -->)</title>
780 <para>
781 An example of using g_object_get() to get the contents
782 of three properties - one of type #G_TYPE_INT,
783 one of type #G_TYPE_STRING, and one of type #G_TYPE_OBJECT:
784 </para>
785 <programlisting>
786  gint intval;
787  gchar *strval;
788  GObject *objval; 
789  
790  g_object_get (my_object,
791                "intproperty", &amp;intval,
792                "strproperty", &amp;strval,
793                "objproperty", &amp;objval,
794                NULL);
795
796  /* Do something with intval, strval, objval */
797  
798  g_free (strval);
799  g_object_unref (objval);
800 </programlisting>
801 </example>
802
803 @object: a #GObject
804 @first_property_name: name of the first property to get
805 @Varargs: return location for the first property, followed optionally by more
806           name/return location pairs, followed by %NULL
807
808
809 <!-- ##### FUNCTION g_object_notify ##### -->
810 <para>
811 Emits a "notify" signal for the property @property_name on @object. 
812 </para>
813
814 @object: a #GObject
815 @property_name: the name of a property installed on the class of @object.
816
817
818 <!-- ##### FUNCTION g_object_freeze_notify ##### -->
819 <para>
820 Stops emission of "notify" signals on @object. The signals are
821 queued until g_object_thaw_notify() is called on @object. 
822 </para>
823 <para>
824 This is necessary for accessors that modify multiple properties to prevent
825 premature notification while the object is still being modified.
826 </para>
827
828 @object: a #GObject
829
830
831 <!-- ##### FUNCTION g_object_thaw_notify ##### -->
832 <para>
833 Reverts the effect of a previous call to g_object_freeze_notify().
834 This causes all queued "notify" signals on @object to be emitted.
835 </para>
836
837 @object: a #GObject
838
839
840 <!-- ##### FUNCTION g_object_get_data ##### -->
841 <para>
842 Gets a named field from the objects table of associations (see g_object_set_data()).
843 </para>
844
845 @object: #GObject containing the associations
846 @key: name of the key for that association
847 @Returns: the data if found, or %NULL if no such data exists.
848
849
850 <!-- ##### FUNCTION g_object_set_data ##### -->
851 <para>
852 Each object carries around a table of associations from
853 strings to pointers.  This function lets you set an association.
854 </para>
855 <para>
856 If the object already had an association with that name,
857 the old association will be destroyed.
858 </para>
859
860 @object: #GObject containing the associations.
861 @key: name of the key
862 @data: data to associate with that key
863
864
865 <!-- ##### FUNCTION g_object_set_data_full ##### -->
866 <para>
867 Like g_object_set_data() except it adds notification
868 for when the association is destroyed, either by setting it 
869 to a different value or when the object is destroyed.
870 </para>
871
872 @object: #GObject containing the associations
873 @key: name of the key
874 @data: data to associate with that key
875 @destroy: function to call when the association is destroyed
876
877
878 <!-- ##### FUNCTION g_object_steal_data ##### -->
879 <para>
880 Remove a specified datum from the object's data associations,
881 without invoking the association's destroy handler.
882 </para>
883
884 @object: #GObject containing the associations
885 @key: name of the key
886 @Returns: the data if found, or %NULL if no such data exists.
887
888
889 <!-- ##### FUNCTION g_object_get_qdata ##### -->
890 <para>
891 This function gets back user data pointers stored via
892 g_object_set_qdata().
893 </para>
894
895 @object:  The GObject to get a stored user data pointer from
896 @quark:   A #GQuark, naming the user data pointer
897 @Returns: The user data pointer set, or %NULL
898
899
900 <!-- ##### FUNCTION g_object_set_qdata ##### -->
901 <para>
902 This sets an opaque, named pointer on an object.
903 The name is specified through a #GQuark (retrived e.g. via
904 g_quark_from_static_string()), and the pointer
905 can be gotten back from the @object with g_object_get_qdata()
906 until the @object is finalized.
907 Setting a previously set user data pointer, overrides (frees)
908 the old pointer set, using #NULL as pointer essentially
909 removes the data stored.
910 </para>
911
912 @object: The GObject to set store a user data pointer
913 @quark:  A #GQuark, naming the user data pointer
914 @data:   An opaque user data pointer
915
916
917 <!-- ##### FUNCTION g_object_set_qdata_full ##### -->
918 <para>
919 This function works like g_object_set_qdata(), but in addition,
920 a void (*destroy) (gpointer) function may be specified which is
921 called with @data as argument when the @object is finalized, or
922 the data is being overwritten by a call to g_object_set_qdata()
923 with the same @quark.
924 </para>
925
926 @object:  The GObject to set store a user data pointer
927 @quark:   A #GQuark, naming the user data pointer
928 @data:    An opaque user data pointer
929 @destroy: Function to invoke with @data as argument, when @data needs to be freed
930
931
932 <!-- ##### FUNCTION g_object_steal_qdata ##### -->
933 <para>
934 This function gets back user data pointers stored via
935 g_object_set_qdata() and removes the @data from object
936 without invoking it's destroy() function (if any was
937 set).
938 Usually, calling this function is only required to update
939 user data pointers with a destroy notifier, for example:
940 <programlisting>
941 void
942 object_add_to_user_list (GObject     *object,
943                          const gchar *new_string)
944 {
945   /* the quark, naming the object data */
946   GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
947   /* retrive the old string list */
948   GList *list = g_object_steal_qdata (object, quark_string_list);
949   
950   /* prepend new string */
951   list = g_list_prepend (list, g_strdup (new_string));
952   /* this changed 'list', so we need to set it again */
953   g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
954 }
955 static void
956 free_string_list (gpointer data)
957 {
958   GList *node, *list = data;
959   
960   for (node = list; node; node = node->next)
961     g_free (node->data);
962   g_list_free (list);
963 }
964 </programlisting>
965 Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata()
966 would have left the destroy function set, and thus the partial string list would
967 have been freed upon g_object_set_qdata_full().
968 </para>
969
970 @object:  The GObject to get a stored user data pointer from
971 @quark:   A #GQuark, naming the user data pointer
972 @Returns: The user data pointer set, or %NULL
973
974
975 <!-- ##### FUNCTION g_object_set_property ##### -->
976 <para>
977 Sets a property on an object.
978 </para>
979
980 @object: a #GObject
981 @property_name: the name of the property to set
982 @value: the value
983
984
985 <!-- ##### FUNCTION g_object_get_property ##### -->
986 <para>
987 Gets a property of an object.
988 </para>
989 <para>
990 In general, a copy is made of the property contents and the caller is
991 responsible for freeing the memory by calling g_value_unset().
992 </para>
993 <para>
994 Note that g_object_get_property() is really intended for language
995 bindings, g_object_get() is much more convenient for C programming.
996 </para>
997
998 @object: a #GObject
999 @property_name: the name of the property to get
1000 @value: return location for the property value
1001
1002
1003 <!-- ##### FUNCTION g_object_new_valist ##### -->
1004 <para>
1005 Creates a new instance of a #GObject subtype and sets its properties.
1006 </para>
1007 <para>
1008 Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) 
1009 which are not explicitly specified are set to their default values.
1010 </para>
1011
1012 @object_type: the type id of the #GObject subtype to instantiate
1013 @first_property_name: the name of the first property
1014 @var_args: the value of the first property, followed optionally by more
1015      name/value pairs, followed by %NULL
1016 @Returns: a new instance of @object_type
1017
1018
1019 <!-- ##### FUNCTION g_object_set_valist ##### -->
1020 <para>
1021 Sets properties on an object.
1022 </para>
1023
1024 @object: a #GObject
1025 @first_property_name: name of the first property to set
1026 @var_args: value for the first property, followed optionally by more
1027            name/value pairs, followed by %NULL
1028
1029
1030 <!-- ##### FUNCTION g_object_get_valist ##### -->
1031 <para>
1032 Gets properties of an object. 
1033 </para>
1034 <para>
1035 In general, a copy is made of the property contents and the caller is
1036 responsible for freeing the memory in the appropriate manner for the type, 
1037 for instance by calling g_free() or g_object_unref().
1038 </para>
1039 <para>
1040 See g_object_get().
1041 </para>
1042
1043 @object: a #GObject
1044 @first_property_name: name of the first property to get
1045 @var_args: return location for the first property, followed optionally by more
1046            name/return location pairs, followed by %NULL
1047
1048
1049 <!-- ##### FUNCTION g_object_watch_closure ##### -->
1050 <para>
1051 This function essentially limits the life time of the @closure
1052 to the life time of the object. That is, when the object is finalized,
1053 the @closure is invalidated by calling g_closure_invalidate() on it,
1054 in order to prevent invocations of the closure with a finalized 
1055 (nonexisting) object. Also, g_object_ref() and g_object_unref() are added
1056 as marshal guards to the @closure, to ensure that an extra reference
1057 count is held on @object during invocation of the @closure.
1058 Usually, this function will be called on closures that use this @object
1059 as closure data.
1060 </para>
1061
1062 @object:  GObject restricting lifetime of @closure
1063 @closure: GClosure to watch
1064
1065
1066 <!-- ##### FUNCTION g_object_run_dispose ##### -->
1067 <para>
1068 Releases all references to other objects. This can be used to break 
1069 reference cycles.
1070 </para>
1071 <note><para>
1072 This functions should only be called from object system implementations.
1073 </para></note>
1074
1075 @object: a #GObject
1076
1077
1078 <!-- ##### MACRO G_OBJECT_WARN_INVALID_PROPERTY_ID ##### -->
1079 <para>
1080 This macros should be used to emit a standard warning about unexpected 
1081 properties in set_property() and get_property() implementations.
1082 </para>
1083
1084 @object: the #GObject on which set_property() or get_property() was called
1085 @property_id: the numeric id of the property
1086 @pspec: the #GParamSpec of the property
1087
1088