From 9215e19e801f59a2abd4dd92563cfe50f366f635 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 18 Jan 2011 16:50:37 +1100 Subject: Add accessible_name variable in indicator entry structure --- libindicator/indicator-object.c | 10 ++++++++++ libindicator/indicator-object.h | 5 +++++ tests/dummy-indicator-null.c | 6 ++++++ tests/dummy-indicator-signaler.c | 7 +++++++ tests/dummy-indicator-simple.c | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 988a8ae..c190cd7 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -90,6 +90,7 @@ indicator_object_class_init (IndicatorObjectClass *klass) klass->get_label = NULL; klass->get_menu = NULL; klass->get_image = NULL; + klass->get_accessible_name = NULL; klass->get_entries = get_entries_default; klass->get_location = NULL; @@ -215,6 +216,7 @@ indicator_object_init (IndicatorObject *self) self->priv->entry.menu = NULL; self->priv->entry.label = NULL; self->priv->entry.image = NULL; + self->priv->entry.accessible_name = NULL; self->priv->gotten_entries = FALSE; @@ -395,6 +397,14 @@ get_entries_default (IndicatorObject * io) return NULL; } + if (class->get_accessible_name) { + priv->entry.accessible_name = class->get_accessible_name(io); + } + + if (priv->entry.accessible_name == NULL) { + g_warning("IndicatorObject class does not have an accessible name."); + } + priv->gotten_entries = TRUE; } diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 9ad1366..a2736d3 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -73,6 +73,7 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; @get_menu: Gets the image for this object. Should be set to #NULL if @get_entries is set. Should NOT ref the object. + @get_accessible_name: Gets the accessible name for this object. @get_entries: Gets all of the entires for this object returning a #GList of #IndicatorObjectEntries. The list should be under the ownership of the caller but the entires will @@ -99,6 +100,7 @@ struct _IndicatorObjectClass { GtkLabel * (*get_label) (IndicatorObject * io); GtkImage * (*get_image) (IndicatorObject * io); GtkMenu * (*get_menu) (IndicatorObject * io); + gchar * (*get_accessible_name) (IndicatorObject * io); GList * (*get_entries) (IndicatorObject * io); guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry); @@ -140,11 +142,14 @@ struct _IndicatorObject { @label: The label to be shown on the panel @image: The image to be shown on the panel @menu: The menu to be added to the menubar + @accessible_name: The accessible name of the + indicator */ struct _IndicatorObjectEntry { GtkLabel * label; GtkImage * image; GtkMenu * menu; + gchar * accessible_name; }; GType indicator_object_get_type (void); diff --git a/tests/dummy-indicator-null.c b/tests/dummy-indicator-null.c index 767067d..acebdb8 100644 --- a/tests/dummy-indicator-null.c +++ b/tests/dummy-indicator-null.c @@ -46,6 +46,11 @@ get_menu (IndicatorObject * io) { return NULL; } +gchar * +get_accessible_name (IndicatorObject * io) +{ + return NULL; +} static void dummy_indicator_null_class_init (DummyIndicatorNullClass *klass); static void dummy_indicator_null_init (DummyIndicatorNull *self); @@ -67,6 +72,7 @@ dummy_indicator_null_class_init (DummyIndicatorNullClass *klass) io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; + io_class->get_accessible_name = get_accessible_name; return; } diff --git a/tests/dummy-indicator-signaler.c b/tests/dummy-indicator-signaler.c index 9bd01bf..7dbe704 100644 --- a/tests/dummy-indicator-signaler.c +++ b/tests/dummy-indicator-signaler.c @@ -50,6 +50,12 @@ get_menu (IndicatorObject * io) return main_menu; } +gchar * +get_accessible_name (IndicatorObject * io) +{ + return "Signaler Item"; +} + static void dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass); static void dummy_indicator_signaler_init (DummyIndicatorSignaler *self); static void dummy_indicator_signaler_dispose (GObject *object); @@ -70,6 +76,7 @@ dummy_indicator_signaler_class_init (DummyIndicatorSignalerClass *klass) io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; + io_class->get_accessible_name = get_accessible_name; return; } diff --git a/tests/dummy-indicator-simple.c b/tests/dummy-indicator-simple.c index 654650f..0bbcde6 100644 --- a/tests/dummy-indicator-simple.c +++ b/tests/dummy-indicator-simple.c @@ -50,6 +50,12 @@ get_menu (IndicatorObject * io) return main_menu; } +gchar * +get_accessible_name (IndicatorObject * io) +{ + return "Simple Item"; +} + static void dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass); static void dummy_indicator_simple_init (DummyIndicatorSimple *self); static void dummy_indicator_simple_dispose (GObject *object); @@ -70,6 +76,7 @@ dummy_indicator_simple_class_init (DummyIndicatorSimpleClass *klass) io_class->get_label = get_label; io_class->get_image = get_icon; io_class->get_menu = get_menu; + io_class->get_accessible_name = get_accessible_name; return; } -- cgit v1.2.3