aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-17 12:36:00 -0600
committerTed Gould <ted@gould.cx>2011-02-17 12:36:00 -0600
commit799a8c9f665757826690818089a72a4539ce8306 (patch)
treec337f8f884cae25d5d51f3eb250a418aac139960 /src
parent4c31081c5a9c854fa5b037c32a9e0100b4243043 (diff)
parent8cb18a5036248b0f1fd9f35c437e7f2f11fb3d1a (diff)
downloadayatana-indicator-datetime-799a8c9f665757826690818089a72a4539ce8306.tar.gz
ayatana-indicator-datetime-799a8c9f665757826690818089a72a4539ce8306.tar.bz2
ayatana-indicator-datetime-799a8c9f665757826690818089a72a4539ce8306.zip
Adding in accessible description support
Diffstat (limited to 'src')
-rw-r--r--src/indicator-datetime.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 1f61864..c7eb9d5 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -166,6 +166,7 @@ static void indicator_datetime_dispose (GObject *object);
static void indicator_datetime_finalize (GObject *object);
static GtkLabel * get_label (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
+static const gchar * get_accessible_desc (IndicatorObject * io);
static GVariant * bind_enum_set (const GValue * value, const GVariantType * type, gpointer user_data);
static gboolean bind_enum_get (GValue * value, GVariant * variant, gpointer user_data);
static gchar * generate_format_string (IndicatorDatetime * self);
@@ -203,6 +204,7 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
io_class->get_label = get_label;
io_class->get_menu = get_menu;
+ io_class->get_accessible_desc = get_accessible_desc;
g_object_class_install_property (object_class,
PROP_TIME_FORMAT,
@@ -603,6 +605,26 @@ idle_measure (gpointer data)
return FALSE;
}
+/* Updates the accessible description */
+static void
+update_accessible_description (IndicatorDatetime * io)
+{
+ GList * entries = indicator_object_get_entries(INDICATOR_OBJECT(io));
+ IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
+
+ entry->accessible_desc = get_accessible_desc(INDICATOR_OBJECT(io));
+
+ g_signal_emit(G_OBJECT(io),
+ INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID,
+ 0,
+ entry,
+ TRUE);
+
+ g_list_free(entries);
+
+ return;
+}
+
/* Updates the label to be the current time. */
static struct tm *
update_label (IndicatorDatetime * io)
@@ -621,6 +643,9 @@ update_label (IndicatorDatetime * io)
if (ltime == NULL) {
g_debug("Error getting local time");
gtk_label_set_label(self->priv->label, _("Error getting time"));
+
+ update_accessible_description(io);
+
return NULL;
}
@@ -642,6 +667,8 @@ update_label (IndicatorDatetime * io)
self->priv->idle_measure = g_idle_add(idle_measure, io);
}
+ update_accessible_description(io);
+
return ltime;
}
@@ -1313,3 +1340,16 @@ get_menu (IndicatorObject * io)
return GTK_MENU(self->priv->menu);
}
+
+static const gchar *
+get_accessible_desc (IndicatorObject * io)
+{
+ IndicatorDatetime * self = INDICATOR_DATETIME(io);
+ const gchar * name;
+
+ if (self->priv->label != NULL) {
+ name = gtk_label_get_text(self->priv->label);
+ return name;
+ }
+ return NULL;
+}