aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-16 15:10:23 -0600
committerTed Gould <ted@gould.cx>2011-02-16 15:10:23 -0600
commit01fe1bccaab200186bd403cca1f199af0e016ce1 (patch)
tree08fef8cdde91060a99878224b38a0996b75b121b
parent2b78c2fe68593532f69ce18a6898058dfa67e10c (diff)
parenta51274553b1a95227abefc80a65e2cc74364c7b2 (diff)
downloadlibayatana-indicator-01fe1bccaab200186bd403cca1f199af0e016ce1.tar.gz
libayatana-indicator-01fe1bccaab200186bd403cca1f199af0e016ce1.tar.bz2
libayatana-indicator-01fe1bccaab200186bd403cca1f199af0e016ce1.zip
Merging support for having an accessible description
-rw-r--r--libindicator/indicator-object.c29
-rw-r--r--libindicator/indicator-object.h10
-rw-r--r--tests/dummy-indicator-null.c6
-rw-r--r--tests/dummy-indicator-signaler.c7
-rw-r--r--tests/dummy-indicator-simple.c7
5 files changed, 59 insertions, 0 deletions
diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c
index 95ab08a..73c1ca7 100644
--- a/libindicator/indicator-object.c
+++ b/libindicator/indicator-object.c
@@ -61,6 +61,7 @@ enum {
SCROLL_ENTRY,
MENU_SHOW,
SHOW_NOW_CHANGED,
+ ACCESSIBLE_DESC_UPDATE,
LAST_SIGNAL
};
@@ -91,6 +92,7 @@ indicator_object_class_init (IndicatorObjectClass *klass)
klass->get_label = NULL;
klass->get_menu = NULL;
klass->get_image = NULL;
+ klass->get_accessible_desc = NULL;
klass->get_entries = get_entries_default;
klass->get_location = NULL;
@@ -221,6 +223,24 @@ indicator_object_class_init (IndicatorObjectClass *klass)
_indicator_object_marshal_VOID__POINTER_BOOLEAN,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_BOOLEAN);
+ /**
+ IndicatorObject::accessible-desc-update::
+ @arg0: The #IndicatorObject object
+ @arg1: A pointer to the #IndicatorObjectEntry whos
+ accessible description has been updated.
+
+ Signaled when an indicator's accessible description
+ has been updated, so that the displayer of the
+ indicator can fetch the new description.
+ */
+ signals[ACCESSIBLE_DESC_UPDATE] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (IndicatorObjectClass, accessible_desc_update),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE);
+
return;
}
@@ -236,6 +256,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_desc = NULL;
self->priv->gotten_entries = FALSE;
@@ -416,6 +437,14 @@ get_entries_default (IndicatorObject * io)
return NULL;
}
+ if (class->get_accessible_desc) {
+ priv->entry.accessible_desc = class->get_accessible_desc(io);
+ }
+
+ if (priv->entry.accessible_desc == NULL) {
+ g_warning("IndicatorObject class does not have an accessible description.");
+ }
+
priv->gotten_entries = TRUE;
}
diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h
index 4b3ce0b..4123119 100644
--- a/libindicator/indicator-object.h
+++ b/libindicator/indicator-object.h
@@ -57,6 +57,8 @@ typedef enum
#define INDICATOR_OBJECT_SIGNAL_MENU_SHOW_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_MENU_SHOW, INDICATOR_OBJECT_TYPE))
#define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED "show-now-changed"
#define INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_SHOW_NOW_CHANGED, INDICATOR_OBJECT_TYPE))
+#define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE "accessible-desc-update"
+#define INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, INDICATOR_OBJECT_TYPE))
typedef struct _IndicatorObject IndicatorObject;
typedef struct _IndicatorObjectClass IndicatorObjectClass;
@@ -75,6 +77,8 @@ 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_desc: Gets the accessible descriptionfor 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
@@ -93,6 +97,7 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry;
@entry_moved: Slot for #IndicatorObject::entry-moved
@menu_show: Slot for #IndicatorObject::menu-show
@show_now_changed: Slot for #IndicatorObject::show-now-changed
+ @accessible_desc_update: Slot for #IndicatorObject::accessible-desc-update
*/
struct _IndicatorObjectClass {
GObjectClass parent_class;
@@ -101,6 +106,7 @@ struct _IndicatorObjectClass {
GtkLabel * (*get_label) (IndicatorObject * io);
GtkImage * (*get_image) (IndicatorObject * io);
GtkMenu * (*get_menu) (IndicatorObject * io);
+ const gchar * (*get_accessible_desc) (IndicatorObject * io);
GList * (*get_entries) (IndicatorObject * io);
guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
@@ -117,6 +123,7 @@ struct _IndicatorObjectClass {
void (*menu_show) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data);
void (*show_now_changed) (IndicatorObject * io, IndicatorObjectEntry * entry, gboolean show_now_state, gpointer user_data);
void (*scroll_entry) (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction);
+ void (*accessible_desc_update) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
/* Reserved */
void (*reserved1) (void);
@@ -142,11 +149,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_desc: The accessible description
+ of the indicator
*/
struct _IndicatorObjectEntry {
GtkLabel * label;
GtkImage * image;
GtkMenu * menu;
+ const gchar * accessible_desc;
};
GType indicator_object_get_type (void);
diff --git a/tests/dummy-indicator-null.c b/tests/dummy-indicator-null.c
index 767067d..169196c 100644
--- a/tests/dummy-indicator-null.c
+++ b/tests/dummy-indicator-null.c
@@ -46,6 +46,11 @@ get_menu (IndicatorObject * io)
{
return NULL;
}
+const gchar *
+get_accessible_desc (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_desc = get_accessible_desc;
return;
}
diff --git a/tests/dummy-indicator-signaler.c b/tests/dummy-indicator-signaler.c
index 9bd01bf..dcb2560 100644
--- a/tests/dummy-indicator-signaler.c
+++ b/tests/dummy-indicator-signaler.c
@@ -50,6 +50,12 @@ get_menu (IndicatorObject * io)
return main_menu;
}
+const gchar *
+get_accessible_desc (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_desc = get_accessible_desc;
return;
}
diff --git a/tests/dummy-indicator-simple.c b/tests/dummy-indicator-simple.c
index 654650f..70937ba 100644
--- a/tests/dummy-indicator-simple.c
+++ b/tests/dummy-indicator-simple.c
@@ -50,6 +50,12 @@ get_menu (IndicatorObject * io)
return main_menu;
}
+const gchar *
+get_accessible_desc (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_desc = get_accessible_desc;
return;
}