diff options
author | Jagadeesh B. G <jagadeesh.bana@wipro.com> | 2002-03-20 17:05:25 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2002-03-20 17:05:25 +0000 |
commit | 2e8a32ebdbfd216bfd1a0ebd3f50a4a6bd880214 (patch) | |
tree | 7902b154372490b20e6d3e6a5cb0cd3c13b9f29f | |
parent | a40594860631c2cb19d0a2a472d76cdaab91b989 (diff) | |
download | yelp-2e8a32ebdbfd216bfd1a0ebd3f50a4a6bd880214.tar.gz |
Set atk relation for search entry and label as part of accessibility
2002-03-20 Jagadeesh B. G <jagadeesh.bana@wipro.com>
* src/yelp-view-index.c: Set atk relation for search entry and
label as part of accessibility changes
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/yelp-view-index.c | 40 |
2 files changed, 45 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2002-03-20 Jagadeesh B. G <jagadeesh.bana@wipro.com> + + * src/yelp-view-index.c: Set atk relation for search entry and + label as part of accessibility changes + 2002-03-20 Padraig O'Briain <padraig.obriain@sun.com> * src/yelp-window.c (yw_handle_url): Call yelp_view-content)show_uri() diff --git a/src/yelp-view-index.c b/src/yelp-view-index.c index 727b69c4..ab46812c 100644 --- a/src/yelp-view-index.c +++ b/src/yelp-view-index.c @@ -54,6 +54,8 @@ static void yvi_entry_text_inserted_cb (GtkEntry *entry, static gboolean yvi_complete_idle (YelpViewIndex *view); static gboolean yvi_filter_idle (YelpViewIndex *view); static gchar * yvi_complete_func (YelpSection *section); +static void set_relation (GtkWidget *widget, + GtkLabel *label); struct _YelpViewIndexPriv { /* List of keywords */ @@ -328,6 +330,8 @@ yelp_view_index_new (GList *index) priv->entry = gtk_entry_new (); + set_relation (priv->entry, GTK_LABEL (label)); + g_signal_connect (priv->entry, "changed", G_CALLBACK (yvi_entry_changed_cb), view); @@ -408,3 +412,39 @@ yelp_view_index_show_uri (YelpViewIndex *view, const gchar *uri) yelp_html_open_uri (YELP_HTML (priv->html_view), real_uri, NULL); } + +/** + * set_relation + * @widget : The Gtk widget which is labelled by @label + * @label : The label for the @widget. + * Description : This function establishes atk relation + * between a gtk widget and a label. + */ + +static void +set_relation (GtkWidget *widget, GtkLabel *label) +{ + AtkObject *aobject; + AtkRelationSet *relation_set; + AtkRelation *relation; + AtkObject *targets[1]; + + g_return_if_fail (GTK_IS_WIDGET (widget)); + g_return_if_fail (GTK_IS_LABEL (label)); + + aobject = gtk_widget_get_accessible (widget); + + /* Return if GAIL is not loaded */ + if (! GTK_IS_ACCESSIBLE (aobject)) + return; + /* Set the ATK_RELATION_LABEL_FOR relation */ + gtk_label_set_mnemonic_widget (label, widget); + + targets[0] = gtk_widget_get_accessible (GTK_WIDGET (label)); + + relation_set = atk_object_ref_relation_set (aobject); + + relation = atk_relation_new (targets, 1, ATK_RELATION_LABELLED_BY); + atk_relation_set_add (relation_set, relation); + g_object_unref (G_OBJECT (relation)); +} |