1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
6 * Copyright (C) 2000 Eazel, Inc.
7 * Copyright (C) 2006 Christian Persch
9 * Nautilus is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * Nautilus is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * Author: Andy Hertzfeld <andy@eazel.com>
25 * This is the throbber (for busy feedback) for the location bar
31 #include "nautilus-throbber.h"
33 #include <eel/eel-debug.h>
34 #include <eel/eel-glib-extensions.h>
35 #include <eel/eel-gtk-extensions.h>
36 #include <eel/eel-accessibility.h>
37 #include <glib/gi18n.h>
39 static AtkObject
*nautilus_throbber_get_accessible (GtkWidget
*widget
);
41 G_DEFINE_TYPE (NautilusThrobber
, nautilus_throbber
, EPHY_TYPE_SPINNER
)
44 nautilus_throbber_init (NautilusThrobber
*throbber
)
49 nautilus_throbber_start (NautilusThrobber
*throbber
)
51 ephy_spinner_start (EPHY_SPINNER (throbber
));
55 nautilus_throbber_stop (NautilusThrobber
*throbber
)
57 ephy_spinner_stop (EPHY_SPINNER (throbber
));
61 nautilus_throbber_set_size (NautilusThrobber
*throbber
, GtkIconSize size
)
63 ephy_spinner_set_size (EPHY_SPINNER (throbber
), size
);
67 nautilus_throbber_class_init (NautilusThrobberClass
*class)
69 GtkWidgetClass
*widget_class
;
71 widget_class
= GTK_WIDGET_CLASS (class);
73 widget_class
->get_accessible
= nautilus_throbber_get_accessible
;
76 static AtkObjectClass
*a11y_parent_class
= NULL
;
79 nautilus_throbber_accessible_initialize (AtkObject
*accessible
,
82 atk_object_set_name (accessible
, _("throbber"));
83 atk_object_set_description (accessible
, _("provides visual status"));
85 a11y_parent_class
->initialize (accessible
, widget
);
89 nautilus_throbber_accessible_class_init (AtkObjectClass
*klass
)
91 a11y_parent_class
= g_type_class_peek_parent (klass
);
93 klass
->initialize
= nautilus_throbber_accessible_initialize
;
97 nautilus_throbber_accessible_image_get_size (AtkImage
*image
,
103 widget
= GTK_ACCESSIBLE (image
)->widget
;
105 *width
= *height
= 0;
107 *width
= widget
->allocation
.width
;
108 *height
= widget
->allocation
.height
;
113 nautilus_throbber_accessible_image_interface_init (AtkImageIface
*iface
)
115 iface
->get_image_size
= nautilus_throbber_accessible_image_get_size
;
119 nautilus_throbber_accessible_get_type (void)
121 static GType type
= 0;
125 if (G_UNLIKELY (type
== 0)) {
126 const GInterfaceInfo atk_image_info
= {
127 (GInterfaceInitFunc
) nautilus_throbber_accessible_image_interface_init
,
128 (GInterfaceFinalizeFunc
) NULL
,
132 type
= eel_accessibility_create_derived_type
133 ("NautilusThrobberAccessible",
135 nautilus_throbber_accessible_class_init
);
137 g_type_add_interface_static (type
, ATK_TYPE_IMAGE
,
145 nautilus_throbber_get_accessible (GtkWidget
*widget
)
147 AtkObject
*accessible
;
149 if ((accessible
= eel_accessibility_get_atk_object (widget
))) {
153 accessible
= g_object_new
154 (nautilus_throbber_accessible_get_type (), NULL
);
156 return eel_accessibility_set_atk_object_return (widget
, accessible
);
160 nautilus_throbber_new (void)
162 return g_object_new (NAUTILUS_TYPE_THROBBER
, NULL
);