]> Pileus Git - ~andy/gtk/blobdiff - gtk/a11y/gtkbuttonaccessible.c
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / a11y / gtkbuttonaccessible.c
index 1be1137d160d60467d0a9247bc6b23199051f698..3ba94d30cf66e1e89dac0e984ad8001cdf888f61 100644 (file)
@@ -1,4 +1,4 @@
-/* GAIL - The GNOME Accessibility Implementation Library
+/* GTK+ - accessibility implementations
  * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
  *
  * This library is free software; you can redistribute it and/or
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
 
 #include <string.h>
 #include <gtk/gtk.h>
+#include <glib/gi18n-lib.h>
 #include "gtkbuttonaccessible.h"
-#include <libgail-util/gailmisc.h>
 
 
 static void atk_action_interface_init (AtkActionIface *iface);
@@ -216,10 +214,10 @@ gtk_button_accessible_notify_gtk (GObject    *obj,
       if (atk_obj->name == NULL)
         g_object_notify (G_OBJECT (atk_obj), "accessible-name");
 
-      g_signal_emit_by_name (atk_obj, "visible_data_changed");
+      g_signal_emit_by_name (atk_obj, "visible-data-changed");
     }
   else
-    GAIL_WIDGET_CLASS (gtk_button_accessible_parent_class)->notify_gtk (obj, pspec);
+    GTK_WIDGET_ACCESSIBLE_CLASS (gtk_button_accessible_parent_class)->notify_gtk (obj, pspec);
 }
 
 static void
@@ -227,7 +225,7 @@ gtk_button_accessible_class_init (GtkButtonAccessibleClass *klass)
 {
   AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
   GtkContainerAccessibleClass *container_class = (GtkContainerAccessibleClass*)klass;
-  GailWidgetClass *widget_class = (GailWidgetClass*)klass;
+  GtkWidgetAccessibleClass *widget_class = (GtkWidgetAccessibleClass*)klass;
 
   class->get_name = gtk_button_accessible_get_name;
   class->get_n_children = gtk_button_accessible_get_n_children;
@@ -276,7 +274,6 @@ static const gchar *
 gtk_button_accessible_get_keybinding (AtkAction *action,
                                       gint       i)
 {
-  GtkButtonAccessible *button;
   gchar *return_value = NULL;
   GtkWidget *widget;
   GtkWidget *label;
@@ -289,8 +286,6 @@ gtk_button_accessible_get_keybinding (AtkAction *action,
   if (i != 0)
     return NULL;
 
-  button = GTK_BUTTON_ACCESSIBLE (action);
-
   label = get_label_from_button (widget);
   if (GTK_IS_LABEL (label))
     {
@@ -333,10 +328,27 @@ static const gchar *
 gtk_button_accessible_action_get_name (AtkAction *action,
                                        gint       i)
 {
-  if (i != 0)
-    return NULL;
+  if (i == 0)
+    return "click";
+  return NULL;
+}
 
-  return "click";
+static const gchar *
+gtk_button_accessible_action_get_localized_name (AtkAction *action,
+                                                 gint       i)
+{
+  if (i == 0)
+    return C_("Action name", "Click");
+  return NULL;
+}
+
+static const gchar *
+gtk_button_accessible_action_get_description (AtkAction *action,
+                                              gint       i)
+{
+  if (i == 0)
+    return C_("Action description", "Clicks the button");
+  return NULL;
 }
 
 static void
@@ -346,6 +358,8 @@ atk_action_interface_init (AtkActionIface *iface)
   iface->get_n_actions = gtk_button_accessible_get_n_actions;
   iface->get_keybinding = gtk_button_accessible_get_keybinding;
   iface->get_name = gtk_button_accessible_action_get_name;
+  iface->get_localized_name = gtk_button_accessible_action_get_localized_name;
+  iface->get_description = gtk_button_accessible_action_get_description;
 }
 
 static const gchar *
@@ -376,7 +390,7 @@ gtk_button_accessible_get_image_position (AtkImage     *image,
                                           AtkCoordType  coord_type)
 {
   GtkWidget *widget;
-  GtkImage  *button_image;
+  GtkWidget *button_image;
   AtkObject *obj;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
@@ -388,10 +402,9 @@ gtk_button_accessible_get_image_position (AtkImage     *image,
     }
 
   button_image = get_image_from_button (widget);
-
   if (button_image != NULL)
     {
-      obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
+      obj = gtk_widget_get_accessible (button_image);
       atk_component_get_position (ATK_COMPONENT (obj), x, y, coord_type);
     }
   else
@@ -407,7 +420,7 @@ gtk_button_accessible_get_image_size (AtkImage *image,
                                       gint     *height)
 {
   GtkWidget *widget;
-  GtkImage  *button_image;
+  GtkWidget *button_image;
   AtkObject *obj;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
@@ -419,8 +432,7 @@ gtk_button_accessible_get_image_size (AtkImage *image,
     }
 
   button_image = get_image_from_button (widget);
-
-  if (button_image != NULL)
+  if (GTK_IS_IMAGE (button_image))
     {
       obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
       atk_image_get_image_size (ATK_IMAGE (obj), width, height);
@@ -437,7 +449,7 @@ gtk_button_accessible_set_image_description (AtkImage    *image,
                                              const gchar *description)
 {
   GtkWidget *widget;
-  GtkImage  *button_image;
+  GtkWidget *button_image;
   AtkObject *obj;
 
   widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
@@ -446,8 +458,7 @@ gtk_button_accessible_set_image_description (AtkImage    *image,
     return FALSE;
 
   button_image = get_image_from_button (widget);
-
-  if (button_image != NULL)
+  if (GTK_IMAGE (button_image))
     {
       obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
       return atk_image_set_image_description (ATK_IMAGE (obj), description);