mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-16 21:50:34 +00:00
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
This commit is contained in:
parent
fb1b025cbf
commit
58cf6dfaaf
@ -481,6 +481,7 @@ gtk_private_h_sources = \
|
||||
gtkimcontextsimpleseqs.h \
|
||||
gtkintl.h \
|
||||
gtkkeyhash.h \
|
||||
gtklockbuttonprivate.h \
|
||||
gtkmenubuttonprivate.h \
|
||||
gtkmenuprivate.h \
|
||||
gtkmenuitemprivate.h \
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
30
gtk/gtklockbuttonprivate.h
Normal file
30
gtk/gtklockbuttonprivate.h
Normal file
@ -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__ */
|
Loading…
Reference in New Issue
Block a user