From 7b66244b517d5d6cba73e41e37c10f09ab2e506b Mon Sep 17 00:00:00 2001
From: Li Yuan
Date: Mon, 5 Jun 2006 09:40:25 +0000
Subject: add labelled by relationship between label and e-timezone-entry. add
2006-06-05 Li Yuan
* gui/dialogs/cal-prefs-dialog.glade:
add labelled by relationship between label and e-timezone-entry.
* gui/e-timezone-entry.c: (add_relation),
(e_timezone_entry_set_timezone):
add relationship between label and entry.
svn path=/trunk/; revision=32078
---
calendar/gui/dialogs/cal-prefs-dialog.glade | 5 +++-
calendar/gui/e-timezone-entry.c | 44 +++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
(limited to 'calendar/gui')
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade
index 068c157087..86333965bd 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -103,7 +103,7 @@
6
-
+
True
Time _zone:
True
@@ -165,6 +165,9 @@
0
0
Thu, 13 Jan 2005 04:18:03 GMT
+
+
+
1
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index fe57453540..e708a03618 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -71,6 +71,8 @@ static void on_entry_changed (GtkEntry *entry,
ETimezoneEntry *tentry);
static void on_button_clicked (GtkWidget *widget,
ETimezoneEntry *tentry);
+static void add_relation (ETimezoneEntry *tentry,
+ GtkWidget *widget);
static void e_timezone_entry_set_entry (ETimezoneEntry *tentry);
@@ -224,6 +226,46 @@ e_timezone_entry_get_timezone (ETimezoneEntry *tentry)
return priv->zone;
}
+static void
+add_relation (ETimezoneEntry *tentry,
+ GtkWidget *widget)
+{
+ AtkObject *a11ytentry, *a11yWidget;
+ AtkRelationSet *set;
+ AtkRelation *relation;
+ GPtrArray *target;
+ gpointer target_object;
+
+ /* add a labelled_by relation for widget for accessibility */
+
+ a11ytentry = gtk_widget_get_accessible (GTK_WIDGET (tentry));
+ a11yWidget = gtk_widget_get_accessible (widget);
+
+ set = atk_object_ref_relation_set (a11yWidget);
+ if (set != NULL) {
+ relation = atk_relation_set_get_relation_by_type (set,
+ ATK_RELATION_LABELLED_BY);
+ /* check whether has a labelled_by relation already */
+ if (relation != NULL)
+ return;
+ }
+
+ set = atk_object_ref_relation_set (a11ytentry);
+ if (!set)
+ return;
+
+ relation = atk_relation_set_get_relation_by_type (set,
+ ATK_RELATION_LABELLED_BY);
+ if (relation != NULL) {
+ target = atk_relation_get_target (relation);
+ target_object = g_ptr_array_index (target, 0);
+ if (ATK_IS_OBJECT (target_object)) {
+ atk_object_add_relationship (a11yWidget,
+ ATK_RELATION_LABELLED_BY,
+ ATK_OBJECT (target_object));
+ }
+ }
+}
void
e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
@@ -238,6 +280,8 @@ e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
priv->zone = zone;
e_timezone_entry_set_entry (tentry);
+
+ add_relation (tentry, priv->entry);
}
--
cgit