s/signal_newc/signal_new/ to adapt to recent GSignal changes.
[atk.git] / atk / atkobject.c
blob42912b9a4fb8d981072917297a998b80dc83e66f
1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include <string.h>
22 #include <glib-object.h>
24 #include "atk.h"
26 /* New GObject properties registered by AtkObject */
27 enum
29 PROP_0, /* gobject convention */
31 PROP_NAME,
32 PROP_DESCRIPTION,
33 PROP_PARENT, /* ancestry has changed */
34 PROP_CHILD, /* a child has been added or removed */
35 PROP_STATE, /* AtkStateSet for the object has changed */
36 PROP_TEXT, /* Used only by AtkText implementors */
37 PROP_CARET, /* Used only by AtkText implementors */
38 PROP_SELECTION,
39 PROP_VALUE,
40 PROP_VISIBLE_DATA,
41 PROP_ROLE,
42 PROP_TABLE_CAPTION,
43 PROP_TABLE_COLUMN_DESCRIPTION,
44 PROP_TABLE_COLUMN_HEADER,
45 PROP_TABLE_ROW_DESCRIPTION,
46 PROP_TABLE_ROW_HEADER,
47 PROP_TABLE_SUMMARY,
48 PROP_MODEL,
49 PROP_LAST /* gobject convention */
52 enum {
53 CHILDREN_CHANGED,
54 FOCUS_EVENT,
55 LAST_SIGNAL
58 static void atk_object_class_init (AtkObjectClass *klass);
59 static void atk_object_init (AtkObject *accessible,
60 AtkObjectClass *klass);
61 static AtkRelationSet* atk_object_real_ref_relation_set (AtkObject *accessible);
63 static void atk_object_real_set_property(GObject *object,
64 guint prop_id,
65 const GValue *value,
66 GParamSpec *pspec);
67 static void atk_object_real_get_property(GObject *object,
68 guint prop_id,
69 GValue *value,
70 GParamSpec *pspec);
71 static void atk_object_finalize (GObject *object);
72 static void atk_object_real_set_role (AtkObject *object,
73 AtkRole role);
75 static guint atk_object_signals[LAST_SIGNAL] = { 0, };
77 static gpointer parent_class = NULL;
79 static const gchar* atk_object_name_property_name = "accessible-name";
80 static const gchar* atk_object_name_property_state = "accessible-state";
81 static const gchar* atk_object_name_property_description = "accessible-description";
82 static const gchar* atk_object_name_property_child = "accessible-child";
83 static const gchar* atk_object_name_property_parent = "accessible-parent";
84 static const gchar* atk_object_name_property_text = "accessible-text";
85 static const gchar* atk_object_name_property_caret = "accessible-caret";
86 static const gchar* atk_object_name_property_selection = "accessible-selection";
87 static const gchar* atk_object_name_property_value = "accessible-value";
88 static const gchar* atk_object_name_property_visible = "accessible-visible-data";
89 static const gchar* atk_object_name_property_role = "accessible-role";
90 static const gchar* atk_object_name_property_table_caption = "accessible-table-caption";
91 static const gchar* atk_object_name_property_table_column_description = "accessible-table-column-description";
92 static const gchar* atk_object_name_property_table_column_header = "accessible-table-column-header";
93 static const gchar* atk_object_name_property_table_row_description = "accessible-table-row-description";
94 static const gchar* atk_object_name_property_table_row_header = "accessible-table-row-header";
95 static const gchar* atk_object_name_property_table_summary = "accessible-table-summary";
96 static const gchar* atk_object_name_property_model = "accessible-model";
98 GType
99 atk_object_get_type (void)
101 static GType type = 0;
103 if (!type)
105 static const GTypeInfo typeInfo =
107 sizeof (AtkObjectClass),
108 (GBaseInitFunc) NULL,
109 (GBaseFinalizeFunc) NULL,
110 (GClassInitFunc) atk_object_class_init,
111 (GClassFinalizeFunc) NULL,
112 NULL,
113 sizeof (AtkObject),
115 (GInstanceInitFunc) atk_object_init,
117 type = g_type_register_static (G_TYPE_OBJECT, "AtkObject", &typeInfo, 0) ;
119 return type;
122 static void
123 atk_object_class_init (AtkObjectClass *klass)
125 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
127 parent_class = g_type_class_ref (G_TYPE_OBJECT);
129 gobject_class->set_property = atk_object_real_set_property;
130 gobject_class->get_property = atk_object_real_get_property;
131 gobject_class->finalize = atk_object_finalize;
133 klass->ref_relation_set = atk_object_real_ref_relation_set;
134 klass->set_role = atk_object_real_set_role;
137 * We do not define default signal handlers here
139 klass->focus_event = NULL;
140 klass->children_changed = NULL;
142 g_object_class_install_property (gobject_class,
143 PROP_NAME,
144 g_param_spec_string (atk_object_name_property_name,
145 "Accessible Name",
146 "Object instance\'s name formatted for "
147 "assistive technology access",
148 NULL,
149 G_PARAM_READWRITE));
150 g_object_class_install_property (gobject_class,
151 PROP_DESCRIPTION,
152 g_param_spec_string (atk_object_name_property_description,
153 "Accessible Description",
154 "Description of an object, formatted for "
155 "assistive technology access",
156 NULL,
157 G_PARAM_READWRITE));
158 g_object_class_install_property (gobject_class,
159 PROP_STATE,
160 g_param_spec_int (atk_object_name_property_state,
161 "Accessible State Set",
162 "The accessible state set of this object "
163 "or its UI component",
165 G_MAXINT,
167 G_PARAM_READWRITE));
168 g_object_class_install_property (gobject_class,
169 PROP_CHILD,
170 g_param_spec_object (atk_object_name_property_child,
171 "Accessible Child",
172 "Is used to notify that a child has been added or removed ",
173 ATK_TYPE_OBJECT,
174 G_PARAM_READWRITE));
175 g_object_class_install_property (gobject_class,
176 PROP_PARENT,
177 g_param_spec_object (atk_object_name_property_parent,
178 "Accessible Parent",
179 "Is used to notify that the parent has changed ",
180 ATK_TYPE_OBJECT,
181 G_PARAM_READWRITE));
182 g_object_class_install_property (gobject_class,
183 PROP_TEXT,
184 g_param_spec_object (atk_object_name_property_text,
185 "Accessible Text",
186 "Is used to notify that the text has changed ",
187 ATK_TYPE_OBJECT,
188 G_PARAM_READWRITE));
189 g_object_class_install_property (gobject_class,
190 PROP_CARET,
191 g_param_spec_int (atk_object_name_property_caret,
192 "Accessible Caret",
193 "Is used to notify that the caret position has changed ",
195 G_MAXINT,
197 G_PARAM_READWRITE));
198 g_object_class_install_property (gobject_class,
199 PROP_SELECTION,
200 g_param_spec_object (atk_object_name_property_selection,
201 "Accessible Selection",
202 "Is used to notify that the selection has changed ",
203 ATK_TYPE_OBJECT,
204 G_PARAM_READWRITE));
205 g_object_class_install_property (gobject_class,
206 PROP_VALUE,
207 g_param_spec_double (atk_object_name_property_value,
208 "Accessible Value",
209 "Is used to notify that the value has changed ",
210 0.0,
211 G_MAXDOUBLE,
212 0.0,
213 G_PARAM_READWRITE));
214 g_object_class_install_property (gobject_class,
215 PROP_VISIBLE_DATA,
216 g_param_spec_object (atk_object_name_property_visible,
217 "Accessible Visible Data",
218 "Is used to notify that the visual appearance of the object has changed ",
219 ATK_TYPE_OBJECT,
220 G_PARAM_READWRITE));
221 g_object_class_install_property (gobject_class,
222 PROP_ROLE,
223 g_param_spec_int (atk_object_name_property_role,
224 "Accessible Role",
225 "The accessible role this object ",
227 G_MAXINT,
229 G_PARAM_READWRITE));
230 g_object_class_install_property (gobject_class,
231 PROP_TABLE_CAPTION,
232 g_param_spec_object (atk_object_name_property_table_caption,
233 "Accessible Table Caption",
234 "Is used to notify that the table caption has changed ",
235 ATK_TYPE_OBJECT,
236 G_PARAM_READWRITE));
237 g_object_class_install_property (gobject_class,
238 PROP_TABLE_COLUMN_HEADER,
239 g_param_spec_object (atk_object_name_property_table_column_header,
240 "Accessible Table Column Header",
241 "Is used to notify that the table column header has changed ",
242 ATK_TYPE_OBJECT,
243 G_PARAM_READWRITE));
244 g_object_class_install_property (gobject_class,
245 PROP_TABLE_COLUMN_DESCRIPTION,
246 g_param_spec_int (atk_object_name_property_table_column_description,
247 "Accessible Table Column Description",
248 "Is used to notify that the table columnscription has changed ",
250 G_MAXINT,
252 G_PARAM_READWRITE));
253 g_object_class_install_property (gobject_class,
254 PROP_TABLE_ROW_HEADER,
255 g_param_spec_object (atk_object_name_property_table_row_header,
256 "Accessible Table Row Header",
257 "Is used to notify that the table row header has changed ",
258 ATK_TYPE_OBJECT,
259 G_PARAM_READWRITE));
260 g_object_class_install_property (gobject_class,
261 PROP_TABLE_ROW_DESCRIPTION,
262 g_param_spec_int (atk_object_name_property_table_row_description,
263 "Accessible Table Row Description",
264 "Is used to notify that the table row description has changed ",
266 G_MAXINT,
268 G_PARAM_READWRITE));
269 g_object_class_install_property (gobject_class,
270 PROP_TABLE_SUMMARY,
271 g_param_spec_object (atk_object_name_property_table_summary,
272 "Accessible Table Summary",
273 "Is used to notify that the table summary has changed ",
274 ATK_TYPE_OBJECT,
275 G_PARAM_READWRITE));
276 g_object_class_install_property (gobject_class,
277 PROP_MODEL,
278 g_param_spec_object (atk_object_name_property_model,
279 "Accessible Model",
280 "Is used to notify that the model for Table or Tree has changed ",
281 ATK_TYPE_OBJECT,
282 G_PARAM_READWRITE));
284 * The signal "children_changed" supports two details:
285 * "add" and "remove"
287 atk_object_signals[CHILDREN_CHANGED] =
288 g_signal_new ("children_changed",
289 G_TYPE_FROM_CLASS (klass),
290 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
291 G_STRUCT_OFFSET (AtkObjectClass, children_changed),
292 NULL, NULL,
293 g_cclosure_marshal_VOID__UINT_POINTER,
294 G_TYPE_NONE,
295 2, G_TYPE_UINT, ATK_TYPE_OBJECT);
296 atk_object_signals[FOCUS_EVENT] =
297 g_signal_new ("focus_event",
298 G_TYPE_FROM_CLASS (klass),
299 G_SIGNAL_RUN_LAST,
300 G_STRUCT_OFFSET (AtkObjectClass, focus_event),
301 NULL, NULL,
302 g_cclosure_marshal_VOID__BOOLEAN,
303 G_TYPE_NONE,
304 1, G_TYPE_BOOLEAN);
307 static void
308 atk_object_init (AtkObject *accessible,
309 AtkObjectClass *klass)
313 GType
314 atk_implementor_get_type (void)
316 static GType type = 0;
318 if (!type)
320 static const GTypeInfo typeInfo =
322 sizeof (AtkImplementorIface),
323 (GBaseInitFunc) NULL,
324 (GBaseFinalizeFunc) NULL,
327 type = g_type_register_static (G_TYPE_INTERFACE, "AtkImplementorIface", &typeInfo, 0) ;
330 return type;
334 * atk_object_get_name:
335 * @accessible: an #AtkObject
337 * Gets the accessible name of the accessible.
339 * Returns: a character string representing the accessible name of the object.
341 G_CONST_RETURN gchar*
342 atk_object_get_name (AtkObject *accessible)
344 AtkObjectClass *klass;
346 g_return_val_if_fail (accessible != NULL, NULL);
347 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
349 klass = ATK_OBJECT_GET_CLASS (accessible);
350 if (klass->get_name)
351 return (klass->get_name) (accessible);
352 else
353 return NULL;
357 * atk_object_get_description:
358 * @accessible: an #AtkObject
360 * Gets the accessible description of the accessible.
362 * Returns: a character string representing the accessible description
363 * of the accessible.
366 G_CONST_RETURN gchar*
367 atk_object_get_description (AtkObject *accessible)
369 AtkObjectClass *klass;
371 g_return_val_if_fail (accessible != NULL, NULL);
372 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
374 klass = ATK_OBJECT_GET_CLASS (accessible);
375 if (klass->get_description)
376 return (klass->get_description) (accessible);
377 else
378 return NULL;
382 * atk_object_get_parent:
383 * @accessible: an #AtkObject
385 * Gets the accessible parent of the accessible.
387 * Returns: a #AtkObject representing the accessible parent of the accessible
389 AtkObject*
390 atk_object_get_parent (AtkObject *accessible)
392 AtkObjectClass *klass;
394 g_return_val_if_fail (accessible != NULL, NULL);
395 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
397 klass = ATK_OBJECT_GET_CLASS (accessible);
398 if (klass->get_parent)
399 return (klass->get_parent) (accessible);
400 else
401 return NULL;
405 * atk_object_get_n_accessible_children:
406 * @accessible: an #AtkObject
408 * Gets the number of accessible children of the accessible.
410 * Returns: an integer representing the number of accessible children
411 * of the accessible.
413 gint
414 atk_object_get_n_accessible_children (AtkObject *accessible)
416 AtkObjectClass *klass;
418 g_return_val_if_fail (accessible != NULL, 0);
419 g_return_val_if_fail (ATK_IS_OBJECT (accessible), 0);
421 klass = ATK_OBJECT_GET_CLASS (accessible);
422 if (klass->get_n_children)
423 return (klass->get_n_children) (accessible);
424 else
425 return 0;
429 * atk_object_ref_accessible_child:
430 * @accessible: an #AtkObject
431 * @i: a gint representing the position of the child, starting from 0
433 * Gets a reference to the specified accessible child of the object.
434 * The accessible children are 0-based so the first accessible child is
435 * at index 0, the second at index 1 and so on.
437 * Returns: an #AtkObject representing the specified accessible child
438 * of the accessible.
440 AtkObject*
441 atk_object_ref_accessible_child (AtkObject *accessible,
442 gint i)
444 AtkObjectClass *klass;
446 g_return_val_if_fail (accessible != NULL, NULL);
447 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
449 klass = ATK_OBJECT_GET_CLASS (accessible);
450 if (klass->ref_child)
451 return (klass->ref_child) (accessible, i);
452 else
453 return NULL;
457 * atk_object_ref_relation_set:
458 * @accessible: an #AtkObject
460 * Gets the #AtkRelationSet associated with the object.
462 * Returns: an #AtkRelationSet representing the relation set of the object.
464 AtkRelationSet*
465 atk_object_ref_relation_set (AtkObject *accessible)
467 AtkObjectClass *klass;
469 g_return_val_if_fail (accessible != NULL, NULL);
470 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
472 klass = ATK_OBJECT_GET_CLASS (accessible);
473 if (klass->ref_relation_set)
474 return (klass->ref_relation_set) (accessible);
475 else
476 return NULL;
480 * atk_role_register:
481 * @name: a character string describing the new role.
483 * Registers the role specified by @name.
485 * Returns: an #AtkRole for the new role.
487 AtkRole
488 atk_role_register (const gchar *name)
490 /* TODO: associate name with new type */
491 static guint type = ATK_ROLE_LAST_DEFINED;
492 return (++type);
496 * atk_object_get_role:
497 * @accessible: an #AtkObject
499 * Gets the role of the accessible.
501 * Returns: an #AtkRole which is the role of the accessible
503 AtkRole
504 atk_object_get_role (AtkObject *accessible) {
505 AtkObjectClass *klass;
507 g_return_val_if_fail (accessible != NULL, ATK_ROLE_UNKNOWN);
508 g_return_val_if_fail (ATK_IS_OBJECT (accessible), ATK_ROLE_UNKNOWN);
510 klass = ATK_OBJECT_GET_CLASS (accessible);
511 if (klass->get_role)
512 return (klass->get_role) (accessible);
513 else
514 return ATK_ROLE_UNKNOWN;
518 * atk_object_ref_state_set:
519 * @accessible: an #AtkObject
521 * Gets a reference to the state set of the accessible; the caller must
522 * unreference it when it is no longer needed.
524 * Returns: a reference to an #AtkStateSet which is the state
525 * set of the accessible
527 AtkStateSet*
528 atk_object_ref_state_set (AtkObject *accessible) {
529 AtkObjectClass *klass;
531 g_return_val_if_fail (accessible != NULL, NULL);
532 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
534 klass = ATK_OBJECT_GET_CLASS (accessible);
535 if (klass->ref_state_set)
536 return (klass->ref_state_set) (accessible);
537 else
538 return NULL;
542 * atk_object_get_index_in_parent:
543 * @accessible: an #AtkObject
545 * Gets the 0-based index of this accessible in its parent; returns -1 if the
546 * accessible does not have an accessible parent.
548 * Returns: an integer which is the index of the accessible in its parent
550 gint
551 atk_object_get_index_in_parent (AtkObject *accessible)
553 AtkObjectClass *klass;
555 g_return_val_if_fail (accessible != NULL, -1);
556 g_return_val_if_fail (ATK_OBJECT (accessible), -1);
558 klass = ATK_OBJECT_GET_CLASS (accessible);
559 if (klass->get_index_in_parent)
560 return (klass->get_index_in_parent) (accessible);
561 else
562 return -1;
566 * atk_object_set_name:
567 * @accessible: an #AtkObject
568 * @name: a character string to be set as the accessible name
570 * Sets the accessible name of the accessible.
572 void
573 atk_object_set_name (AtkObject *accessible,
574 const gchar *name)
576 AtkObjectClass *klass;
578 g_return_if_fail (accessible != NULL);
579 g_return_if_fail (ATK_IS_OBJECT (accessible));
580 g_return_if_fail (name != NULL);
582 klass = ATK_OBJECT_GET_CLASS (accessible);
583 if (klass->set_name)
585 (klass->set_name) (accessible, name);
586 g_object_notify (G_OBJECT (accessible), atk_object_name_property_name);
591 * atk_object_set_description:
592 * @accessible: an #AtkObject
593 * @description : a character string to be set as the accessible description
595 * Sets the accessible description of the accessible.
597 void
598 atk_object_set_description (AtkObject *accessible,
599 const gchar *description)
601 AtkObjectClass *klass;
603 g_return_if_fail (accessible != NULL);
604 g_return_if_fail (ATK_IS_OBJECT (accessible));
605 g_return_if_fail (description != NULL);
607 klass = ATK_OBJECT_GET_CLASS (accessible);
608 if (klass->set_description)
610 (klass->set_description) (accessible, description);
611 g_object_notify (G_OBJECT (accessible), atk_object_name_property_description);
616 * atk_object_set_parent:
617 * @accessible: an #AtkObject
618 * @parent : an #AtkObject to be set as the accessible parent
620 * Sets the accessible parent of the accessible.
622 void
623 atk_object_set_parent (AtkObject *accessible,
624 AtkObject *parent)
626 AtkObjectClass *klass;
628 g_return_if_fail (accessible != NULL);
629 g_return_if_fail (ATK_IS_OBJECT (accessible));
631 klass = ATK_OBJECT_GET_CLASS (accessible);
632 if (klass->set_parent)
633 (klass->set_parent) (accessible, parent);
637 * atk_object_set_role:
638 * @accessible: an #AtkObject
639 * @role : an #AtkRole to be set as the role
641 * Sets the role of the accessible.
643 void
644 atk_object_set_role (AtkObject *accessible,
645 AtkRole role)
647 AtkObjectClass *klass;
649 g_return_if_fail (accessible != NULL);
650 g_return_if_fail (ATK_IS_OBJECT (accessible));
652 klass = ATK_OBJECT_GET_CLASS (accessible);
653 if (klass->set_role)
654 (klass->set_role) (accessible, role);
658 * atk_object_connect_property_change_handler:
659 * @accessible: an #AtkObject
660 * @handler : a function to be called when a property changes its value
662 * Specifies a function to be called when a property changes value.
664 * Returns: a #guint which is the handler id used in
665 * atk_object_remove_property_change_handler()
667 guint
668 atk_object_connect_property_change_handler (AtkObject *accessible,
669 AtkPropertyChangeHandler *handler)
671 AtkObjectClass *klass;
673 g_return_val_if_fail (accessible != NULL, 0);
674 g_return_val_if_fail (ATK_IS_OBJECT (accessible), 0);
675 g_return_val_if_fail ((handler != NULL), 0);
677 klass = ATK_OBJECT_GET_CLASS (accessible);
678 if (klass->connect_property_change_handler)
679 return (klass->connect_property_change_handler) (accessible, handler);
680 else
681 return 0;
685 * atk_object_remove_property_change_handler:
686 * @accessible: an #AtkObject
687 * @handler_id : a guint which identifies the handler to be removed.
689 * Removes a property change handler.
691 void
692 atk_object_remove_property_change_handler (AtkObject *accessible,
693 guint handler_id)
695 AtkObjectClass *klass;
697 g_return_if_fail (accessible != NULL);
698 g_return_if_fail (ATK_IS_OBJECT (accessible));
700 klass = ATK_OBJECT_GET_CLASS (accessible);
701 if (klass->remove_property_change_handler)
702 (klass->remove_property_change_handler) (accessible, handler_id);
706 * atk_implementor_ref_accessible:
707 * @implementor: The #GObject instance which should implement #AtkImplementorIface
708 * if a non-null return value is required.
710 * Gets a reference to an object's #AtkObject implementation, if
711 * the object implements #AtkObjectIface
713 * Returns: a reference to an object's #AtkObject implementation
715 AtkObject *
716 atk_implementor_ref_accessible (AtkImplementor *object)
718 AtkImplementorIface *iface;
719 AtkObject *accessible = NULL;
721 g_return_val_if_fail (object != NULL, NULL);
722 g_return_val_if_fail (ATK_IS_IMPLEMENTOR (object), NULL);
724 iface = ATK_IMPLEMENTOR_GET_IFACE (object);
726 if (iface != NULL)
727 accessible = iface->ref_accessible (object);
729 g_return_val_if_fail ((accessible != NULL), NULL);
731 return accessible;
734 static AtkRelationSet*
735 atk_object_real_ref_relation_set (AtkObject *accessible)
737 if (accessible->relation_set)
738 g_object_ref (accessible->relation_set);
740 return accessible->relation_set;
743 static void
744 atk_object_real_set_property (GObject *object,
745 guint prop_id,
746 const GValue *value,
747 GParamSpec *pspec)
749 AtkObject *accessible;
751 accessible = ATK_OBJECT (object);
753 switch (prop_id)
755 case PROP_NAME:
756 atk_object_set_name (accessible, g_value_get_string (value));
757 break;
758 case PROP_DESCRIPTION:
759 atk_object_set_description (accessible, g_value_get_string (value));
760 break;
761 case PROP_STATE:
762 g_print ("This interface does not support setting the state set of an accessible object\n");
763 break;
764 case PROP_VALUE:
765 if (ATK_IS_VALUE (accessible))
766 atk_value_set_current_value (ATK_VALUE (accessible), value);
767 break;
768 default:
769 break;
773 static void
774 atk_object_real_get_property (GObject *object,
775 guint prop_id,
776 GValue *value,
777 GParamSpec *pspec)
779 AtkObject *accessible;
781 accessible = ATK_OBJECT (object);
783 switch (prop_id)
785 case PROP_NAME:
786 g_value_set_string (value, atk_object_get_name (accessible));
787 break;
788 case PROP_DESCRIPTION:
789 g_value_set_string (value, atk_object_get_description (accessible));
790 break;
791 case PROP_VALUE:
792 if (ATK_IS_VALUE (accessible))
793 atk_value_get_current_value (ATK_VALUE (accessible), value);
794 break;
795 default:
796 break;
800 static void
801 atk_object_finalize (GObject *object)
803 AtkObject *accessible;
805 g_return_if_fail (ATK_IS_OBJECT (object));
807 accessible = ATK_OBJECT (object);
809 g_free (accessible->name);
810 g_free (accessible->description);
813 * Free memory allocated for relation set if it have been allocated.
815 if (accessible->relation_set)
817 g_object_unref (accessible->relation_set);
820 G_OBJECT_CLASS (parent_class)->finalize (object);
823 static void
824 atk_object_real_set_role (AtkObject *object,
825 AtkRole role)
827 object->role = role;