diff options
author | Luke Yelavich <luke.yelavich@canonical.com> | 2011-02-14 18:10:24 +1100 |
---|---|---|
committer | Luke Yelavich <luke.yelavich@canonical.com> | 2011-02-14 18:10:24 +1100 |
commit | 5b018bfff889c44eef34cc8aed95c36dbce25543 (patch) | |
tree | 488991f6fffe2ea97579b0185f2ef7475b94a279 | |
parent | d0e0e20ee786e3d109306fdf31856cc5f5da925e (diff) | |
download | ayatana-indicator-datetime-5b018bfff889c44eef34cc8aed95c36dbce25543.tar.gz ayatana-indicator-datetime-5b018bfff889c44eef34cc8aed95c36dbce25543.tar.bz2 ayatana-indicator-datetime-5b018bfff889c44eef34cc8aed95c36dbce25543.zip |
Add accessible description support.
-rw-r--r-- | src/indicator-datetime.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 1f61864..0d76a48 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, @@ -621,6 +623,11 @@ update_label (IndicatorDatetime * io) if (ltime == NULL) { g_debug("Error getting local time"); gtk_label_set_label(self->priv->label, _("Error getting time")); + g_signal_emit(G_OBJECT(self), + INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, + 0, + (IndicatorObjectEntry *)indicator_object_get_entries(INDICATOR_OBJECT(self))->data, + TRUE); return NULL; } @@ -642,6 +649,12 @@ update_label (IndicatorDatetime * io) self->priv->idle_measure = g_idle_add(idle_measure, io); } + g_signal_emit(G_OBJECT(self), + INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, + 0, + (IndicatorObjectEntry *)indicator_object_get_entries(INDICATOR_OBJECT(self))->data, + TRUE); + return ltime; } @@ -1313,3 +1326,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; +} |