summaryrefslogtreecommitdiff
path: root/gtk/gtkfontsel.c
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2004-07-22 05:27:18 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-07-22 05:27:18 +0000
commit50243e65c11bd4204f467030817b751cfadc08c0 (patch)
tree6be0e8aeeba6830bbd87f06ad9ed03515dc5bc8e /gtk/gtkfontsel.c
parent8912c654ef8005b8a57ba9f02e63253359bd8d83 (diff)
downloadgtk+-50243e65c11bd4204f467030817b751cfadc08c0.tar.gz
Add additional accessability relations. (#141804, Padraig O'Briain)
Thu Jul 22 01:21:28 2004 Matthias Clasen <maclas@gmx.de> * gtk/gtkfontsel.c (gtk_font_selection_init): Add additional accessability relations. (#141804, Padraig O'Briain)
Diffstat (limited to 'gtk/gtkfontsel.c')
-rw-r--r--gtk/gtkfontsel.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c
index 64c7b312d0..06890deb32 100644
--- a/gtk/gtkfontsel.c
+++ b/gtk/gtkfontsel.c
@@ -34,6 +34,8 @@
#include <glib/gprintf.h>
#include <string.h>
+#include <atk/atk.h>
+
#include "gdk/gdk.h"
#include "gdk/gdkkeysyms.h"
@@ -55,6 +57,7 @@
#include "gtkvbox.h"
#include "gtkscrolledwindow.h"
#include "gtkintl.h"
+#include "gtkaccessible.h"
/* We don't enable the font and style entries because they don't add
* much in terms of visible effect and have a weird effect on keynav.
@@ -313,6 +316,7 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
GtkListStore *model;
GtkTreeViewColumn *column;
GList *focus_chain = NULL;
+ AtkObject *atk_obj;
gtk_widget_push_composite_child ();
@@ -494,6 +498,50 @@ gtk_font_selection_init (GtkFontSelection *fontsel)
g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (fontsel->size_list)), "changed",
G_CALLBACK (gtk_font_selection_select_size), fontsel);
+ atk_obj = gtk_widget_get_accessible (fontsel->size_list);
+ if (GTK_IS_ACCESSIBLE (atk_obj))
+ {
+ /* Accessibility support is enabled.
+ * Make the label ATK_RELATON_LABEL_FOR for the size list as well.
+ */
+ AtkObject *atk_label;
+ AtkRelationSet *relation_set;
+ AtkRelation *relation;
+ AtkObject *obj_array[1];
+ GPtrArray *array;
+
+ atk_label = gtk_widget_get_accessible (label);
+ relation_set = atk_object_ref_relation_set (atk_obj);
+ relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABELLED_BY);
+ if (relation)
+ {
+ array = atk_relation_get_target (relation);
+ g_ptr_array_add (array, atk_label);
+ }
+ else
+ {
+ obj_array[0] = atk_label;
+ relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABELLED_BY);
+ atk_relation_set_add (relation_set, relation);
+ }
+ g_object_unref (relation_set);
+
+ relation_set = atk_object_ref_relation_set (atk_label);
+ relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_LABEL_FOR);
+ if (relation)
+ {
+ array = atk_relation_get_target (relation);
+ g_ptr_array_add (array, atk_obj);
+ }
+ else
+ {
+ obj_array[0] = atk_obj;
+ relation = atk_relation_new (obj_array, 1, ATK_RELATION_LABEL_FOR);
+ atk_relation_set_add (relation_set, relation);
+ }
+ g_object_unref (relation_set);
+ }
+
/* create the text entry widget */
label = gtk_label_new_with_mnemonic (_("_Preview:"));