]> Pileus Git - ~andy/gtk/blob - gtk/gtkaccessible.c
Patch from Matthias Clasen to remove remove all instances of
[~andy/gtk] / gtk / gtkaccessible.c
1 /* GTK - The GIMP Toolkit
2  * Copyright 2001 Sun Microsystems Inc.
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include <string.h>
21 #include <gtk/gtkwidget.h>
22 #include <gtk/gtksignal.h>
23 #include <gtk/gtkaccessible.h>
24
25 static void gtk_accessible_class_init (GtkAccessibleClass *klass);
26
27 static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible);
28
29 GtkType
30 gtk_accessible_get_type (void)
31 {
32   static GtkType accessible_type = 0;
33
34   if (!accessible_type)
35     {
36       static const GTypeInfo accessible_info =
37       {
38         sizeof (GtkAccessibleClass),
39         NULL,           /* base_init */
40         NULL,           /* base_finalize */
41         (GClassInitFunc) gtk_accessible_class_init,
42         NULL,           /* class_finalize */
43         NULL,           /* class_data */
44         sizeof (GtkAccessible),
45         16,             /* n_preallocs */
46         (GInstanceInitFunc) NULL,
47       };
48
49       accessible_type = g_type_register_static (ATK_TYPE_OBJECT, "GtkAccessible", &accessible_info, 0);
50     }
51
52   return accessible_type;
53 }
54
55 static void
56 gtk_accessible_class_init (GtkAccessibleClass *klass)
57 {
58   klass->connect_widget_destroyed = gtk_accessible_real_connect_widget_destroyed;
59
60 }
61
62 /**
63  * gtk_accessible_connect_widget_destroyed
64  * @accessible: a #GtkAccessible
65  *
66  * This function specifies the callback function to be called when the widget
67  * corresponding to a GtkAccessible is destroyed.
68  */
69 void
70 gtk_accessible_connect_widget_destroyed (GtkAccessible *accessible)
71 {
72   GtkAccessibleClass *class;
73
74   g_return_if_fail (GTK_IS_ACCESSIBLE (accessible));
75
76   class = GTK_ACCESSIBLE_GET_CLASS (accessible);
77
78   if (class->connect_widget_destroyed)
79     class->connect_widget_destroyed (accessible);
80 }
81
82 static void
83 gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
84 {
85   if (accessible->widget)
86   {
87     gtk_signal_connect (GTK_OBJECT (accessible->widget),
88                         "destroy",
89                         GTK_SIGNAL_FUNC (gtk_widget_destroyed),
90                         &accessible->widget);
91   }
92 }