]> Pileus Git - ~andy/gtk/blob - gtk/a11y/gtkspinneraccessible.c
filechooser: Show FUSE mounted locations in shortcuts
[~andy/gtk] / gtk / a11y / gtkspinneraccessible.c
1 /* GTK+ - accessibility implementations
2  * Copyright (C) 2007 John Stowers, Neil Jagdish Patel.
3  * Copyright (C) 2009 Bastien Nocera, David Zeuthen
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Code adapted from egg-spinner
19  * by Christian Hergert <christian.hergert@gmail.com>
20  */
21
22 #include "config.h"
23
24 #include <gtk/gtk.h>
25 #include "gtkintl.h"
26 #include "gtkspinneraccessible.h"
27
28 static void atk_image_interface_init (AtkImageIface *iface);
29
30 G_DEFINE_TYPE_WITH_CODE (GtkSpinnerAccessible, gtk_spinner_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
31                          G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init));
32
33 static void
34 gtk_spinner_accessible_initialize (AtkObject *accessible,
35                                    gpointer   widget)
36 {
37   ATK_OBJECT_CLASS (gtk_spinner_accessible_parent_class)->initialize (accessible, widget);
38
39   atk_object_set_name (accessible, C_("throbbing progress animation widget", "Spinner"));
40   atk_object_set_description (accessible, _("Provides visual indication of progress"));
41   atk_object_set_role (accessible, ATK_ROLE_ANIMATION);
42 }
43
44 static void
45 gtk_spinner_accessible_class_init (GtkSpinnerAccessibleClass *klass)
46 {
47   AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
48
49   atk_class->initialize = gtk_spinner_accessible_initialize;
50 }
51
52 static void
53 gtk_spinner_accessible_init (GtkSpinnerAccessible *self)
54 {
55 }
56
57 static void
58 gtk_spinner_accessible_image_get_size (AtkImage *image,
59                                        gint     *width,
60                                        gint     *height)
61 {
62   GtkWidget *widget;
63
64   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
65   if (widget == NULL)
66     {
67       *width = 0;
68       *height = 0;
69       return;
70     }
71
72   *width = gtk_widget_get_allocated_width (widget);
73   *height = gtk_widget_get_allocated_height (widget);
74 }
75
76 static void
77 atk_image_interface_init (AtkImageIface *iface)
78 {
79   iface->get_image_size = gtk_spinner_accessible_image_get_size;
80 }