[gtk+/composite-templates] a11y: Get lockbutton text directly
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] a11y: Get lockbutton text directly
- Date: Tue, 10 Jul 2012 21:05:11 +0000 (UTC)
commit ed28f9ca9d5627206e52737378f4592fee1d83db
Author: Benjamin Otte <otte redhat com>
Date: Mon Jul 9 02:58:22 2012 +0200
a11y: Get lockbutton text directly
Instead of letting the generic button code attempt to find the currently
displayed text, just return the text directly.
https://bugzilla.gnome.org/show_bug.cgi?id=677347
gtk/Makefile.am | 1 +
gtk/a11y/gtklockbuttonaccessible.c | 18 ++++++++++++++++--
gtk/gtklockbutton.c | 18 +++++++++++++++++-
gtk/gtklockbuttonprivate.h | 30 ++++++++++++++++++++++++++++++
4 files changed, 64 insertions(+), 3 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 8f9ef2e..e382011 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -481,6 +481,7 @@ gtk_private_h_sources = \
gtkimcontextsimpleseqs.h \
gtkintl.h \
gtkkeyhash.h \
+ gtklockbuttonprivate.h \
gtkmenubuttonprivate.h \
gtkmenuprivate.h \
gtkmenuitemprivate.h \
diff --git a/gtk/a11y/gtklockbuttonaccessible.c b/gtk/a11y/gtklockbuttonaccessible.c
index ee1cccd..a24e310 100644
--- a/gtk/a11y/gtklockbuttonaccessible.c
+++ b/gtk/a11y/gtklockbuttonaccessible.c
@@ -17,15 +17,29 @@
#include "config.h"
-#include <string.h>
-#include <gtk/gtk.h>
+#include "gtk/gtklockbuttonprivate.h"
#include "gtklockbuttonaccessible.h"
G_DEFINE_TYPE (GtkLockButtonAccessible, _gtk_lock_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE)
+static const gchar *
+gtk_lock_button_accessible_get_name (AtkObject *obj)
+{
+ GtkLockButton *lockbutton;
+
+ lockbutton = GTK_LOCK_BUTTON (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)));
+ if (lockbutton == NULL)
+ return NULL;
+
+ return _gtk_lock_button_get_current_text (lockbutton);
+}
+
static void
_gtk_lock_button_accessible_class_init (GtkLockButtonAccessibleClass *klass)
{
+ AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
+
+ atk_object_class->get_name = gtk_lock_button_accessible_get_name;
}
static void
diff --git a/gtk/gtklockbutton.c b/gtk/gtklockbutton.c
index 6fc4536..9cb828b 100644
--- a/gtk/gtklockbutton.c
+++ b/gtk/gtklockbutton.c
@@ -18,7 +18,7 @@
#include "config.h"
-#include "gtklockbutton.h"
+#include "gtklockbuttonprivate.h"
#include "gtkbox.h"
#include "gtkimage.h"
#include "gtklabel.h"
@@ -564,3 +564,19 @@ gtk_lock_button_set_permission (GtkLockButton *button,
g_object_notify (G_OBJECT (button), "permission");
}
}
+
+const char *
+_gtk_lock_button_get_current_text (GtkLockButton *button)
+{
+ GtkLockButtonPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_LOCK_BUTTON (button), NULL);
+
+ priv = button->priv;
+
+ if (gtk_widget_get_visible (priv->label_lock))
+ return gtk_label_get_text (GTK_LABEL (priv->label_lock));
+ else
+ return gtk_label_get_text (GTK_LABEL (priv->label_unlock));
+}
+
diff --git a/gtk/gtklockbuttonprivate.h b/gtk/gtklockbuttonprivate.h
new file mode 100644
index 0000000..f029bf8
--- /dev/null
+++ b/gtk/gtklockbuttonprivate.h
@@ -0,0 +1,30 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Red Hat, Inc.
+ * Author: Matthias Clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_LOCK_BUTTON_PRIVATE_H__
+#define __GTK_LOCK_BUTTON_PRIVATE_H__
+
+#include "gtklockbutton.h"
+
+G_BEGIN_DECLS
+
+const char * _gtk_lock_button_get_current_text (GtkLockButton *button);
+
+G_END_DECLS
+
+#endif /* __GTK_LOCK_BUTTON_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]