1 /* GTK+ - accessibility implementations
2  * Copyright 2001, 2002, 2003 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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "config.h"
19 
20 #include "gtklockbuttonaccessibleprivate.h"
21 
22 #include "gtk/gtklockbuttonprivate.h"
23 #include "gtk/gtkwidgetprivate.h"
24 
G_DEFINE_TYPE(GtkLockButtonAccessible,gtk_lock_button_accessible,GTK_TYPE_BUTTON_ACCESSIBLE)25 G_DEFINE_TYPE (GtkLockButtonAccessible, gtk_lock_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE)
26 
27 static const gchar *
28 gtk_lock_button_accessible_get_name (AtkObject *obj)
29 {
30   GtkLockButton *lockbutton;
31 
32   lockbutton = GTK_LOCK_BUTTON (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)));
33   if (lockbutton == NULL)
34     return NULL;
35 
36   return _gtk_lock_button_get_current_text (lockbutton);
37 }
38 
39 static void
gtk_lock_button_accessible_class_init(GtkLockButtonAccessibleClass * klass)40 gtk_lock_button_accessible_class_init (GtkLockButtonAccessibleClass *klass)
41 {
42   AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
43 
44   atk_object_class->get_name = gtk_lock_button_accessible_get_name;
45 }
46 
47 static void
gtk_lock_button_accessible_init(GtkLockButtonAccessible * lockbutton)48 gtk_lock_button_accessible_init (GtkLockButtonAccessible *lockbutton)
49 {
50 }
51 
52 void
_gtk_lock_button_accessible_name_changed(GtkLockButton * lockbutton)53 _gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton)
54 {
55   AtkObject *obj;
56 
57   obj = _gtk_widget_peek_accessible (GTK_WIDGET (lockbutton));
58   if (obj == NULL)
59     return;
60 
61   g_object_notify (G_OBJECT (obj), "accessible-name");
62 }
63 
64