From b13fa490fb368b779a99543d18d5c68c01f8eb31 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Fri, 4 Feb 2011 13:57:23 +1100 Subject: Add accessible_name support --- src/app-indicator.c | 161 +++++++++++++++++++++++++++++++++++++++++++++- src/app-indicator.h | 13 ++++ src/notification-item.xml | 4 ++ 3 files changed, 177 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index 039b980..f815fac 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -80,7 +80,9 @@ struct _AppIndicatorPrivate { guint32 ordering_index; gchar * label; gchar * label_guide; + gchar * accessible_name; guint label_change_idle; + guint accessible_name_change_idle; GtkStatusIcon * status_icon; gint fallback_timer; @@ -103,6 +105,7 @@ enum { NEW_LABEL, CONNECTION_CHANGED, NEW_ICON_THEME_PATH, + NEW_ACCESSIBLE_NAME, LAST_SIGNAL }; @@ -122,7 +125,8 @@ enum { PROP_LABEL, PROP_LABEL_GUIDE, PROP_ORDERING_INDEX, - PROP_DBUS_MENU_SERVER + PROP_DBUS_MENU_SERVER, + PROP_ACCESSIBLE_NAME }; /* The strings so that they can be slowly looked up. */ @@ -137,6 +141,7 @@ enum { #define PROP_LABEL_GUIDE_S "label-guide" #define PROP_ORDERING_INDEX_S "ordering-index" #define PROP_DBUS_MENU_SERVER_S "dbus-menu-server" +#define PROP_ACCESSIBLE_NAME_S "accessible-name" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -164,6 +169,7 @@ static void app_indicator_set_property (GObject * object, guint prop_id, const G static void app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); /* Other stuff */ static void signal_label_change (AppIndicator * self); +static void signal_accessible_name_change (AppIndicator * self); static void check_connect (AppIndicator * self); static void register_service_cb (GObject * obj, GAsyncResult * res, gpointer user_data); static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout); @@ -341,6 +347,22 @@ app_indicator_class_init (AppIndicatorClass *klass) "To ensure that the label does not cause the panel to 'jiggle' this string should provide information on how much space it could take.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:accessible-name: + + A string that describes the indicator in text form. This string is + used to identify the indicator to users of assistive technologies, such + as screen readers. If the indicator has a label, then duplicating the + contents of the label is fine, if the label alone conveys enough + information about the state of the indicator to the user. + */ + g_object_class_install_property(object_class, + PROP_ACCESSIBLE_NAME, + g_param_spec_string (PROP_ACCESSIBLE_NAME_S, + "A string that describes the indicator in text form.", + "This string shoudl convey a description of the indicator's current status, for users who use assistive technologies.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** AppIndicator:ordering-index: @@ -438,6 +460,21 @@ app_indicator_class_init (AppIndicatorClass *klass) _application_service_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + /** + AppIndicator::new-accessible-name: + @arg0: The #AppIndicator object + @arg1: The string for the accessible name + + Emitted when #AppIndicator:accessible_name changes. + */ + signals[NEW_ACCESSIBLE_NAME] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_NAME, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AppIndicatorClass, new_accessible_name), + NULL, NULL, + _application_service_marshal_VOID__STRING_STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); + /** AppIndicator::connection-changed: @@ -527,6 +564,7 @@ app_indicator_init (AppIndicator *self) priv->label = NULL; priv->label_guide = NULL; priv->label_change_idle = 0; + priv->accessible_name_change_idle = 0; priv->watcher_proxy = NULL; priv->connection = NULL; @@ -590,6 +628,11 @@ app_indicator_dispose (GObject *object) priv->label_change_idle = 0; } + if (priv->accessible_name_change_idle != 0) { + g_source_remove(priv->accessible_name_change_idle); + priv->accessible_name_change_idle = 0; + } + if (priv->menu != NULL) { g_signal_handlers_disconnect_by_func (G_OBJECT (priv->menu), client_menu_changed, @@ -667,6 +710,11 @@ app_indicator_finalize (GObject *object) priv->label_guide = NULL; } + if (priv->accessible_name != NULL) { + g_free(priv->accessible_name); + priv->accessible_name = NULL; + } + if (priv->path != NULL) { g_free(priv->path); priv->path = NULL; @@ -778,6 +826,24 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } + case PROP_ACCESSIBLE_NAME: { + gchar * olda11yname = priv->accessible_name; + priv->accessible_name = g_value_dup_string(value); + + if (g_strcmp0(olda11yname, priv->accessible_name) != 0) { + signal_accessible_name_change(APP_INDICATOR(object)); + } + + if (priv->accessible_name != NULL && priv->accessible_name[0] == '\0') { + g_free(priv->accessible_name); + priv->accessible_name = NULL; + } + + if (olda11yname != NULL) { + g_free(olda11yname); + } + break; + } case PROP_ORDERING_INDEX: priv->ordering_index = g_value_get_uint(value); break; @@ -856,6 +922,10 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->label_guide); break; + case PROP_ACCESSIBLE_NAME: + g_value_set_string (value, priv->accessible_name); + break; + case PROP_ORDERING_INDEX: g_value_set_uint(value, priv->ordering_index); break; @@ -941,6 +1011,8 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * return g_variant_new_string(priv->label_guide ? priv->label_guide : ""); } else if (g_strcmp0(property, "XAyatanaOrderingIndex") == 0) { return g_variant_new_uint32(priv->ordering_index); + } else if (g_strcmp0(property, "AccessibleName") == 0) { + return g_variant_new_string(priv->accessible_name ? priv->accessible_name : ""); } *error = g_error_new(0, 0, "Unknown property: %s", property); @@ -997,6 +1069,55 @@ signal_label_change (AppIndicator * self) return; } +/* Sends the accessible name changed signal and resets the source ID */ +static gboolean +signal_accessible_name_change_idle (gpointer user_data) +{ + AppIndicator * self = (AppIndicator *)user_data; + AppIndicatorPrivate *priv = self->priv; + + gchar * accessible_name = priv->accessible_name != NULL ? priv->accessible_name : ""; + + g_signal_emit(G_OBJECT(self), signals[NEW_ACCESSIBLE_NAME], 0, + accessible_name, TRUE); + if (priv->dbus_registration != 0 && priv->connection != NULL) { + GError * error = NULL; + + g_dbus_connection_emit_signal(priv->connection, + NULL, + priv->path, + NOTIFICATION_ITEM_DBUS_IFACE, + "NewAccessibleName", + g_variant_new("(s)", accessible_name), + &error); + + if (error != NULL) { + g_warning("Unable to send signal for NewIcon: %s", error->message); + g_error_free(error); + } + } + + priv->accessible_name_change_idle = 0; + + return FALSE; +} + +/* Sets up an idle function to send the accessible name changed + signal so that we don't send it too many times. */ +static void +signal_accessible_name_change (AppIndicator * self) +{ + AppIndicatorPrivate *priv = self->priv; + + /* don't set it twice */ + if (priv->accessible_name_change_idle != 0) { + return; + } + + priv->accessible_name_change_idle = g_idle_add(signal_accessible_name_change_idle, self); + return; +} + /* This function is used to see if we have enough information to connect to things. If we do, and we're not connected, it connects for us. */ @@ -1638,6 +1759,28 @@ app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * return; } +/** + app_indicator_set_accessible_name: + @self: The #AppIndicator object to use + @accessible_name: The accessible name used by assistive technologies. + + This is a wrapper function for the #AppIndicator:accessible_name + property. This function can take #NULL as @accessible_name and + will clear the entry. +*/ +void +app_indicator_set_accessible_name (AppIndicator *self, const gchar * accessible_name) +{ + g_return_if_fail (IS_APP_INDICATOR (self)); + /* Note: The accessible name can be NULL, it's okay */ + + g_object_set(G_OBJECT(self), + PROP_ACCESSIBLE_NAME_S, accessible_name == NULL ? "" : accessible_name, + NULL); + + return; +} + /** app_indicator_set_icon_theme_path: @self: The #AppIndicator object to use @@ -1932,6 +2075,22 @@ app_indicator_get_label_guide (AppIndicator *self) return self->priv->label_guide; } +/** + app_indicator_get_accessible_name: + @self: The #AppIndicator object to use + + Wrapper function for property #AppIndicator:accessible_name. + + Return value: The current accessible name. +*/ +const gchar * +app_indicator_get_accessible_name (AppIndicator *self) +{ + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + + return self->priv->accessible_name; +} + /** app_indicator_get_ordering_index: @self: The #AppIndicator object to use diff --git a/src/app-indicator.h b/src/app-indicator.h index 3e159db..dac87ec 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -107,12 +107,18 @@ G_BEGIN_DECLS String identifier for the #AppIndicator::new-icon-theme-path signal. */ +/** + APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_NAME: + + String identifier for the #AppIndicator::new-accessible-name signal. +*/ #define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon" #define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" #define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status" #define APP_INDICATOR_SIGNAL_NEW_LABEL "new-label" #define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed" #define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path" +#define APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_NAME "new-accessible-name" /** AppIndicatorCategory: @@ -162,6 +168,7 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate; @new_status: Slot for #AppIndicator::new-status. @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path @new_label: Slot for #AppIndicator::new-label. + @new_accessible_name: Slot for #AppIndicator::new-accessible-name. @connection_changed: Slot for #AppIndicator::connection-changed. @app_indicator_reserved_sw: Reserved for future use. @app_indicator_reserved_ats: Reserved for future use. @@ -198,6 +205,9 @@ struct _AppIndicatorClass { const gchar *label, const gchar *guide, gpointer user_data); + void (* new_accessible_name) (AppIndicator *indicator, + const gchar *accessible_name); + /* Local Signals */ void (* connection_changed) (AppIndicator * indicator, @@ -263,6 +273,8 @@ void app_indicator_set_icon (AppIndicator void app_indicator_set_label (AppIndicator *self, const gchar *label, const gchar *guide); +void app_indicator_set_accessible_name(AppIndicator *self, + const gchar *accessible_name); void app_indicator_set_icon_theme_path(AppIndicator *self, const gchar *icon_theme_path); void app_indicator_set_ordering_index (AppIndicator *self, @@ -278,6 +290,7 @@ const gchar * app_indicator_get_attention_icon (AppIndicator * GtkMenu * app_indicator_get_menu (AppIndicator *self); const gchar * app_indicator_get_label (AppIndicator *self); const gchar * app_indicator_get_label_guide (AppIndicator *self); +const gchar * app_indicator_get_accessible_name(AppIndicator *self); guint32 app_indicator_get_ordering_index (AppIndicator *self); /* Helpers */ diff --git a/src/notification-item.xml b/src/notification-item.xml index 05afd83..63f9374 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -15,6 +15,7 @@ + @@ -34,6 +35,9 @@ + + + -- cgit v1.2.3 From fffab2e1e8d991a41cc591ceaca77c8a40f31f33 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 8 Feb 2011 17:55:35 +1100 Subject: accessible_name -> accessible_desc --- src/app-indicator.c | 124 +++++++++++++++++++++++----------------------- src/app-indicator.h | 18 +++---- src/notification-item.xml | 6 +-- 3 files changed, 74 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index de9dd39..a5045e3 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -80,9 +80,9 @@ struct _AppIndicatorPrivate { guint32 ordering_index; gchar * label; gchar * label_guide; - gchar * accessible_name; + gchar * accessible_desc; guint label_change_idle; - guint accessible_name_change_idle; + guint accessible_desc_change_idle; GtkStatusIcon * status_icon; gint fallback_timer; @@ -106,7 +106,7 @@ enum { CONNECTION_CHANGED, NEW_ICON_THEME_PATH, SCROLL_EVENT, - NEW_ACCESSIBLE_NAME, + NEW_ACCESSIBLE_DESC, LAST_SIGNAL }; @@ -127,7 +127,7 @@ enum { PROP_LABEL_GUIDE, PROP_ORDERING_INDEX, PROP_DBUS_MENU_SERVER, - PROP_ACCESSIBLE_NAME + PROP_ACCESSIBLE_DESC }; /* The strings so that they can be slowly looked up. */ @@ -142,7 +142,7 @@ enum { #define PROP_LABEL_GUIDE_S "label-guide" #define PROP_ORDERING_INDEX_S "ordering-index" #define PROP_DBUS_MENU_SERVER_S "dbus-menu-server" -#define PROP_ACCESSIBLE_NAME_S "accessible-name" +#define PROP_ACCESSIBLE_DESC_S "accessible-desc" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -170,7 +170,7 @@ static void app_indicator_set_property (GObject * object, guint prop_id, const G static void app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); /* Other stuff */ static void signal_label_change (AppIndicator * self); -static void signal_accessible_name_change (AppIndicator * self); +static void signal_accessible_desc_change (AppIndicator * self); static void check_connect (AppIndicator * self); static void register_service_cb (GObject * obj, GAsyncResult * res, gpointer user_data); static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout); @@ -352,7 +352,7 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:accessible-name: + AppIndicator:accessible-desc: A string that describes the indicator in text form. This string is used to identify the indicator to users of assistive technologies, such @@ -361,10 +361,10 @@ app_indicator_class_init (AppIndicatorClass *klass) information about the state of the indicator to the user. */ g_object_class_install_property(object_class, - PROP_ACCESSIBLE_NAME, - g_param_spec_string (PROP_ACCESSIBLE_NAME_S, + PROP_ACCESSIBLE_DESC, + g_param_spec_string (PROP_ACCESSIBLE_DESC_S, "A string that describes the indicator in text form.", - "This string shoudl convey a description of the indicator's current status, for users who use assistive technologies.", + "This string should convey a description of the indicator's current status, for users who use assistive technologies.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** @@ -465,16 +465,16 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); /** - AppIndicator::new-accessible-name: + AppIndicator::new-accessible-desc: @arg0: The #AppIndicator object - @arg1: The string for the accessible name + @arg1: The string for the accessible description - Emitted when #AppIndicator:accessible_name changes. + Emitted when #AppIndicator:accessible_desc changes. */ - signals[NEW_ACCESSIBLE_NAME] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_NAME, + signals[NEW_ACCESSIBLE_DESC] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_DESC, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_accessible_name), + G_STRUCT_OFFSET (AppIndicatorClass, new_accessible_desc), NULL, NULL, _application_service_marshal_VOID__STRING_STRING, G_TYPE_NONE, 1, G_TYPE_STRING); @@ -583,7 +583,7 @@ app_indicator_init (AppIndicator *self) priv->label = NULL; priv->label_guide = NULL; priv->label_change_idle = 0; - priv->accessible_name_change_idle = 0; + priv->accessible_desc_change_idle = 0; priv->watcher_proxy = NULL; priv->connection = NULL; @@ -647,9 +647,9 @@ app_indicator_dispose (GObject *object) priv->label_change_idle = 0; } - if (priv->accessible_name_change_idle != 0) { - g_source_remove(priv->accessible_name_change_idle); - priv->accessible_name_change_idle = 0; + if (priv->accessible_desc_change_idle != 0) { + g_source_remove(priv->accessible_desc_change_idle); + priv->accessible_desc_change_idle = 0; } if (priv->menu != NULL) { @@ -729,9 +729,9 @@ app_indicator_finalize (GObject *object) priv->label_guide = NULL; } - if (priv->accessible_name != NULL) { - g_free(priv->accessible_name); - priv->accessible_name = NULL; + if (priv->accessible_desc != NULL) { + g_free(priv->accessible_desc); + priv->accessible_desc = NULL; } if (priv->path != NULL) { @@ -845,21 +845,21 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } - case PROP_ACCESSIBLE_NAME: { - gchar * olda11yname = priv->accessible_name; - priv->accessible_name = g_value_dup_string(value); + case PROP_ACCESSIBLE_DESC: { + gchar * olda11ydesc = priv->accessible_desc; + priv->accessible_desc = g_value_dup_string(value); - if (g_strcmp0(olda11yname, priv->accessible_name) != 0) { - signal_accessible_name_change(APP_INDICATOR(object)); + if (g_strcmp0(olda11ydesc, priv->accessible_desc) != 0) { + signal_accessible_desc_change(APP_INDICATOR(object)); } - if (priv->accessible_name != NULL && priv->accessible_name[0] == '\0') { - g_free(priv->accessible_name); - priv->accessible_name = NULL; + if (priv->accessible_desc != NULL && priv->accessible_desc[0] == '\0') { + g_free(priv->accessible_desc); + priv->accessible_desc = NULL; } - if (olda11yname != NULL) { - g_free(olda11yname); + if (olda11ydesc != NULL) { + g_free(olda11ydesc); } break; } @@ -941,8 +941,8 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->label_guide); break; - case PROP_ACCESSIBLE_NAME: - g_value_set_string (value, priv->accessible_name); + case PROP_ACCESSIBLE_DESC: + g_value_set_string (value, priv->accessible_desc); break; case PROP_ORDERING_INDEX: @@ -1067,8 +1067,8 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * return g_variant_new_string(priv->label_guide ? priv->label_guide : ""); } else if (g_strcmp0(property, "XAyatanaOrderingIndex") == 0) { return g_variant_new_uint32(priv->ordering_index); - } else if (g_strcmp0(property, "AccessibleName") == 0) { - return g_variant_new_string(priv->accessible_name ? priv->accessible_name : ""); + } else if (g_strcmp0(property, "AccessibleDesc") == 0) { + return g_variant_new_string(priv->accessible_desc ? priv->accessible_desc : ""); } *error = g_error_new(0, 0, "Unknown property: %s", property); @@ -1125,17 +1125,17 @@ signal_label_change (AppIndicator * self) return; } -/* Sends the accessible name changed signal and resets the source ID */ +/* Sends the accessible description changed signal and resets the source ID */ static gboolean -signal_accessible_name_change_idle (gpointer user_data) +signal_accessible_desc_change_idle (gpointer user_data) { AppIndicator * self = (AppIndicator *)user_data; AppIndicatorPrivate *priv = self->priv; - gchar * accessible_name = priv->accessible_name != NULL ? priv->accessible_name : ""; + gchar * accessible_desc = priv->accessible_desc != NULL ? priv->accessible_desc : ""; - g_signal_emit(G_OBJECT(self), signals[NEW_ACCESSIBLE_NAME], 0, - accessible_name, TRUE); + g_signal_emit(G_OBJECT(self), signals[NEW_ACCESSIBLE_DESC], 0, + accessible_desc, TRUE); if (priv->dbus_registration != 0 && priv->connection != NULL) { GError * error = NULL; @@ -1143,34 +1143,34 @@ signal_accessible_name_change_idle (gpointer user_data) NULL, priv->path, NOTIFICATION_ITEM_DBUS_IFACE, - "NewAccessibleName", - g_variant_new("(s)", accessible_name), + "NewAccessibleDesc", + g_variant_new("(s)", accessible_desc), &error); if (error != NULL) { - g_warning("Unable to send signal for NewIcon: %s", error->message); + g_warning("Unable to send signal for NewAccessibleDesc: %s", error->message); g_error_free(error); } } - priv->accessible_name_change_idle = 0; + priv->accessible_desc_change_idle = 0; return FALSE; } -/* Sets up an idle function to send the accessible name changed - signal so that we don't send it too many times. */ +/* Sets up an idle function to send the accessible description + changed signal so that we don't send it too many times. */ static void -signal_accessible_name_change (AppIndicator * self) +signal_accessible_desc_change (AppIndicator * self) { AppIndicatorPrivate *priv = self->priv; /* don't set it twice */ - if (priv->accessible_name_change_idle != 0) { + if (priv->accessible_desc_change_idle != 0) { return; } - priv->accessible_name_change_idle = g_idle_add(signal_accessible_name_change_idle, self); + priv->accessible_desc_change_idle = g_idle_add(signal_accessible_desc_change_idle, self); return; } @@ -1840,22 +1840,22 @@ app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * } /** - app_indicator_set_accessible_name: + app_indicator_set_accessible_desc: @self: The #AppIndicator object to use - @accessible_name: The accessible name used by assistive technologies. + @accessible_desc: The accessible description used by assistive technologies. - This is a wrapper function for the #AppIndicator:accessible_name - property. This function can take #NULL as @accessible_name and + This is a wrapper function for the #AppIndicator:accessible_desc + property. This function can take #NULL as @accessible_desc and will clear the entry. */ void -app_indicator_set_accessible_name (AppIndicator *self, const gchar * accessible_name) +app_indicator_set_accessible_desc (AppIndicator *self, const gchar * accessible_desc) { g_return_if_fail (IS_APP_INDICATOR (self)); - /* Note: The accessible name can be NULL, it's okay */ + /* Note: The accessible description can be NULL, it's okay */ g_object_set(G_OBJECT(self), - PROP_ACCESSIBLE_NAME_S, accessible_name == NULL ? "" : accessible_name, + PROP_ACCESSIBLE_DESC_S, accessible_desc == NULL ? "" : accessible_desc, NULL); return; @@ -2156,19 +2156,19 @@ app_indicator_get_label_guide (AppIndicator *self) } /** - app_indicator_get_accessible_name: + app_indicator_get_accessible_desc: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator:accessible_name. + Wrapper function for property #AppIndicator:accessible_desc. - Return value: The current accessible name. + Return value: The current accessible description. */ const gchar * -app_indicator_get_accessible_name (AppIndicator *self) +app_indicator_get_accessible_desc (AppIndicator *self) { g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - return self->priv->accessible_name; + return self->priv->accessible_desc; } /** diff --git a/src/app-indicator.h b/src/app-indicator.h index 0d4473d..0807eee 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -113,9 +113,9 @@ G_BEGIN_DECLS String identifier for the #AppIndicator::scroll-event signal. */ /** - APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_NAME: + APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_DESC: - String identifier for the #AppIndicator::new-accessible-name signal. + String identifier for the #AppIndicator::new-accessible-desc signal. */ #define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon" #define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" @@ -124,7 +124,7 @@ G_BEGIN_DECLS #define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed" #define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path" #define APP_INDICATOR_SIGNAL_SCROLL_EVENT "scroll-event" -#define APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_NAME "new-accessible-name" +#define APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_DESC "new-accessible-desc" /** AppIndicatorCategory: @@ -174,7 +174,7 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate; @new_status: Slot for #AppIndicator::new-status. @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path @new_label: Slot for #AppIndicator::new-label. - @new_accessible_name: Slot for #AppIndicator::new-accessible-name. + @new_accessible_desc: Slot for #AppIndicator::new-accessible-desc. @connection_changed: Slot for #AppIndicator::connection-changed. @scroll-event: Slot for #AppIndicator::scroll-event @app_indicator_reserved_ats: Reserved for future use. @@ -211,8 +211,8 @@ struct _AppIndicatorClass { const gchar *label, const gchar *guide, gpointer user_data); - void (* new_accessible_name) (AppIndicator *indicator, - const gchar *accessible_name); + void (* new_accessible_desc) (AppIndicator *indicator, + const gchar *accessible_desc); /* Local Signals */ @@ -284,8 +284,8 @@ void app_indicator_set_icon (AppIndicator void app_indicator_set_label (AppIndicator *self, const gchar *label, const gchar *guide); -void app_indicator_set_accessible_name(AppIndicator *self, - const gchar *accessible_name); +void app_indicator_set_accessible_desc(AppIndicator *self, + const gchar *accessible_desc); void app_indicator_set_icon_theme_path(AppIndicator *self, const gchar *icon_theme_path); void app_indicator_set_ordering_index (AppIndicator *self, @@ -301,7 +301,7 @@ const gchar * app_indicator_get_attention_icon (AppIndicator * GtkMenu * app_indicator_get_menu (AppIndicator *self); const gchar * app_indicator_get_label (AppIndicator *self); const gchar * app_indicator_get_label_guide (AppIndicator *self); -const gchar * app_indicator_get_accessible_name(AppIndicator *self); +const gchar * app_indicator_get_accessible_desc(AppIndicator *self); guint32 app_indicator_get_ordering_index (AppIndicator *self); /* Helpers */ diff --git a/src/notification-item.xml b/src/notification-item.xml index 737ecb3..3e5b3ff 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -15,7 +15,7 @@ - + @@ -38,8 +38,8 @@ - - + + -- cgit v1.2.3 From d63e2d04123cb7e37fa5f9a3cb8239364d81e629 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 20:51:06 -0600 Subject: Changing the signal to match what was discussed with the KDE folks --- src/notification-item.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/notification-item.xml b/src/notification-item.xml index 3e5b3ff..bbf77c5 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -7,7 +7,9 @@ + + @@ -15,7 +17,6 @@ - @@ -38,9 +39,6 @@ - - - -- cgit v1.2.3 From 5de3ea9982cb396feceab453ce9c83032bc00074 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 21:10:58 -0600 Subject: Change the name of the accessible description and add the attention one. --- src/app-indicator.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index c3da8ed..7d849dd 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -81,6 +81,7 @@ struct _AppIndicatorPrivate { gchar * label; gchar * label_guide; gchar * accessible_desc; + gchar * att_accessible_desc; guint label_change_idle; guint accessible_desc_change_idle; @@ -736,6 +737,11 @@ app_indicator_finalize (GObject *object) priv->accessible_desc = NULL; } + if (priv->att_accessible_desc != NULL) { + g_free(priv->att_accessible_desc); + priv->att_accessible_desc = NULL; + } + if (priv->path != NULL) { g_free(priv->path); priv->path = NULL; @@ -1069,8 +1075,10 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * return g_variant_new_string(priv->label_guide ? priv->label_guide : ""); } else if (g_strcmp0(property, "XAyatanaOrderingIndex") == 0) { return g_variant_new_uint32(priv->ordering_index); - } else if (g_strcmp0(property, "AccessibleDesc") == 0) { + } else if (g_strcmp0(property, "IconAccessibleDesc") == 0) { return g_variant_new_string(priv->accessible_desc ? priv->accessible_desc : ""); + } else if (g_strcmp0(property, "AttentionAccessibleDesc") == 0) { + return g_variant_new_string(priv->att_accessible_desc ? priv->att_accessible_desc : ""); } *error = g_error_new(0, 0, "Unknown property: %s", property); -- cgit v1.2.3 From 6335283b2e1551066fd12ef89c4916122ea27ffe Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 21:14:24 -0600 Subject: Drop signaling the accessible description changed on it's own. --- src/app-indicator.c | 63 +---------------------------------------------------- 1 file changed, 1 insertion(+), 62 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index 7d849dd..858f424 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -83,7 +83,6 @@ struct _AppIndicatorPrivate { gchar * accessible_desc; gchar * att_accessible_desc; guint label_change_idle; - guint accessible_desc_change_idle; GtkStatusIcon * status_icon; gint fallback_timer; @@ -171,7 +170,6 @@ static void app_indicator_set_property (GObject * object, guint prop_id, const G static void app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); /* Other stuff */ static void signal_label_change (AppIndicator * self); -static void signal_accessible_desc_change (AppIndicator * self); static void check_connect (AppIndicator * self); static void register_service_cb (GObject * obj, GAsyncResult * res, gpointer user_data); static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout); @@ -586,7 +584,6 @@ app_indicator_init (AppIndicator *self) priv->label = NULL; priv->label_guide = NULL; priv->label_change_idle = 0; - priv->accessible_desc_change_idle = 0; priv->watcher_proxy = NULL; priv->connection = NULL; @@ -650,11 +647,6 @@ app_indicator_dispose (GObject *object) priv->label_change_idle = 0; } - if (priv->accessible_desc_change_idle != 0) { - g_source_remove(priv->accessible_desc_change_idle); - priv->accessible_desc_change_idle = 0; - } - if (priv->menu != NULL) { g_signal_handlers_disconnect_by_func (G_OBJECT (priv->menu), client_menu_changed, @@ -857,10 +849,6 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu gchar * olda11ydesc = priv->accessible_desc; priv->accessible_desc = g_value_dup_string(value); - if (g_strcmp0(olda11ydesc, priv->accessible_desc) != 0) { - signal_accessible_desc_change(APP_INDICATOR(object)); - } - if (priv->accessible_desc != NULL && priv->accessible_desc[0] == '\0') { g_free(priv->accessible_desc); priv->accessible_desc = NULL; @@ -870,7 +858,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu g_free(olda11ydesc); } break; - } + } case PROP_ORDERING_INDEX: priv->ordering_index = g_value_get_uint(value); break; @@ -1135,55 +1123,6 @@ signal_label_change (AppIndicator * self) return; } -/* Sends the accessible description changed signal and resets the source ID */ -static gboolean -signal_accessible_desc_change_idle (gpointer user_data) -{ - AppIndicator * self = (AppIndicator *)user_data; - AppIndicatorPrivate *priv = self->priv; - - gchar * accessible_desc = priv->accessible_desc != NULL ? priv->accessible_desc : ""; - - g_signal_emit(G_OBJECT(self), signals[NEW_ACCESSIBLE_DESC], 0, - accessible_desc, TRUE); - if (priv->dbus_registration != 0 && priv->connection != NULL) { - GError * error = NULL; - - g_dbus_connection_emit_signal(priv->connection, - NULL, - priv->path, - NOTIFICATION_ITEM_DBUS_IFACE, - "NewAccessibleDesc", - g_variant_new("(s)", accessible_desc), - &error); - - if (error != NULL) { - g_warning("Unable to send signal for NewAccessibleDesc: %s", error->message); - g_error_free(error); - } - } - - priv->accessible_desc_change_idle = 0; - - return FALSE; -} - -/* Sets up an idle function to send the accessible description - changed signal so that we don't send it too many times. */ -static void -signal_accessible_desc_change (AppIndicator * self) -{ - AppIndicatorPrivate *priv = self->priv; - - /* don't set it twice */ - if (priv->accessible_desc_change_idle != 0) { - return; - } - - priv->accessible_desc_change_idle = g_idle_add(signal_accessible_desc_change_idle, self); - return; -} - /* This function is used to see if we have enough information to connect to things. If we do, and we're not connected, it connects for us. */ -- cgit v1.2.3 From 021dd71e638567f708d86f0805e01b055888083d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 21:18:37 -0600 Subject: Dropping the new accessible description signal --- src/app-indicator.c | 17 ----------------- src/app-indicator.h | 10 ---------- 2 files changed, 27 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index 858f424..814a8f1 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -106,7 +106,6 @@ enum { CONNECTION_CHANGED, NEW_ICON_THEME_PATH, SCROLL_EVENT, - NEW_ACCESSIBLE_DESC, LAST_SIGNAL }; @@ -463,22 +462,6 @@ app_indicator_class_init (AppIndicatorClass *klass) _application_service_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); - /** - AppIndicator::new-accessible-desc: - @arg0: The #AppIndicator object - @arg1: The string for the accessible description - - Emitted when #AppIndicator:accessible_desc changes. - */ - signals[NEW_ACCESSIBLE_DESC] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_DESC, - G_TYPE_FROM_CLASS(klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (AppIndicatorClass, new_accessible_desc), - NULL, NULL, - _application_service_marshal_VOID__STRING_STRING, - G_TYPE_NONE, 1, G_TYPE_STRING); - - /** AppIndicator::connection-changed: @arg0: The #AppIndicator object diff --git a/src/app-indicator.h b/src/app-indicator.h index 9e53447..cce6b9e 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -112,11 +112,6 @@ G_BEGIN_DECLS String identifier for the #AppIndicator::scroll-event signal. */ -/** - APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_DESC: - - String identifier for the #AppIndicator::new-accessible-desc signal. -*/ #define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon" #define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" #define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status" @@ -124,7 +119,6 @@ G_BEGIN_DECLS #define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed" #define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path" #define APP_INDICATOR_SIGNAL_SCROLL_EVENT "scroll-event" -#define APP_INDICATOR_SIGNAL_NEW_ACCESSIBLE_DESC "new-accessible-desc" /** AppIndicatorCategory: @@ -174,7 +168,6 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate; @new_status: Slot for #AppIndicator::new-status. @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path @new_label: Slot for #AppIndicator::new-label. - @new_accessible_desc: Slot for #AppIndicator::new-accessible-desc. @connection_changed: Slot for #AppIndicator::connection-changed. @scroll_event: Slot for #AppIndicator::scroll-event @app_indicator_reserved_ats: Reserved for future use. @@ -211,9 +204,6 @@ struct _AppIndicatorClass { const gchar *label, const gchar *guide, gpointer user_data); - void (* new_accessible_desc) (AppIndicator *indicator, - const gchar *accessible_desc); - /* Local Signals */ void (* connection_changed) (AppIndicator * indicator, -- cgit v1.2.3 From 4716fe0deefcd3e4ccbe777093427157ed6c99c6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 21:43:21 -0600 Subject: Switch around API so it makes sense for what we want to do. --- src/app-indicator.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/app-indicator.h b/src/app-indicator.h index cce6b9e..562de56 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -267,32 +267,37 @@ void app_indicator_set_status (AppIndicator AppIndicatorStatus status); void app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name); +void app_indicator_set_attention_icon_full (AppIndicator *self, + const gchar *icon_name, + const gchar *icon_description); void app_indicator_set_menu (AppIndicator *self, GtkMenu *menu); void app_indicator_set_icon (AppIndicator *self, const gchar *icon_name); +void app_indicator_set_icon_full (AppIndicator *self, + const gchar *icon_name, + const gchar *icon_description); void app_indicator_set_label (AppIndicator *self, const gchar *label, const gchar *guide); -void app_indicator_set_accessible_desc(AppIndicator *self, - const gchar *accessible_desc); void app_indicator_set_icon_theme_path(AppIndicator *self, const gchar *icon_theme_path); void app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index); /* Get properties */ -const gchar * app_indicator_get_id (AppIndicator *self); -AppIndicatorCategory app_indicator_get_category (AppIndicator *self); -AppIndicatorStatus app_indicator_get_status (AppIndicator *self); -const gchar * app_indicator_get_icon (AppIndicator *self); -const gchar * app_indicator_get_icon_theme_path(AppIndicator *self); -const gchar * app_indicator_get_attention_icon (AppIndicator *self); -GtkMenu * app_indicator_get_menu (AppIndicator *self); -const gchar * app_indicator_get_label (AppIndicator *self); -const gchar * app_indicator_get_label_guide (AppIndicator *self); -const gchar * app_indicator_get_accessible_desc(AppIndicator *self); -guint32 app_indicator_get_ordering_index (AppIndicator *self); +const gchar * app_indicator_get_id (AppIndicator *self); +AppIndicatorCategory app_indicator_get_category (AppIndicator *self); +AppIndicatorStatus app_indicator_get_status (AppIndicator *self); +const gchar * app_indicator_get_icon (AppIndicator *self); +const gchar * app_indicator_get_icon_desc (AppIndicator *self); +const gchar * app_indicator_get_icon_theme_path (AppIndicator *self); +const gchar * app_indicator_get_attention_icon (AppIndicator *self); +const gchar * app_indicator_get_attention_icon_desc (AppIndicator *self); +GtkMenu * app_indicator_get_menu (AppIndicator *self); +const gchar * app_indicator_get_label (AppIndicator *self); +const gchar * app_indicator_get_label_guide (AppIndicator *self); +guint32 app_indicator_get_ordering_index (AppIndicator *self); /* Helpers */ void app_indicator_build_menu_from_desktop (AppIndicator * self, -- cgit v1.2.3 From 7e03eadb90bf137ff4737d796edd0b8bf61ad6f1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 21:57:03 -0600 Subject: Fixing up the set functions so we get some descriptions. --- src/app-indicator.c | 96 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 69 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index 814a8f1..d75fce0 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1664,20 +1664,51 @@ app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) @self: The #AppIndicator object to use @icon_name: The name of the attention icon to set for this indicator - Wrapper function for property #AppIndicator:attention-icon-name. + Wrapper for app_indicator_set_attention_icon_full() with a NULL + description. + + Deprecated: Use app_indicator_set_attention_icon_full() instead. */ void app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) +{ + return app_indicator_set_attention_icon_full(self, icon_name, NULL); +} + +/** + app_indicator_set_attention_icon_full: + @self: The #AppIndicator object to use + @icon_name: The name of the attention icon to set for this indicator + @icon_desc: A textual description of the icon + + Wrapper function for property #AppIndicator:attention-icon-name. +*/ +void +app_indicator_set_attention_icon_full (AppIndicator *self, const gchar *icon_name, const gchar * icon_desc) { g_return_if_fail (IS_APP_INDICATOR (self)); g_return_if_fail (icon_name != NULL); + gboolean changed = FALSE; if (g_strcmp0 (self->priv->attention_icon_name, icon_name) != 0) { - if (self->priv->attention_icon_name) + if (self->priv->attention_icon_name) { g_free (self->priv->attention_icon_name); + } self->priv->attention_icon_name = g_strdup(icon_name); + changed = TRUE; + } + + if (g_strcmp0(self->priv->att_accessible_desc, icon_desc) != 0) { + if (self->priv->att_accessible_desc) { + g_free (self->priv->att_accessible_desc); + } + self->priv->att_accessible_desc = g_strdup(icon_name); + changed = TRUE; + } + + if (changed) { g_signal_emit (self, signals[NEW_ATTENTION_ICON], 0, TRUE); if (self->priv->dbus_registration != 0 && self->priv->connection != NULL) { @@ -1706,23 +1737,56 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) @self: The #AppIndicator object to use @icon_name: The icon name to set. + Wrapper function for app_indicator_set_icon_full() with a NULL + description. + + Deprecated: Use app_indicator_set_icon_full() +**/ +void +app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) +{ + return app_indicator_set_icon_full(self, icon_name, NULL); +} + +/** + app_indicator_set_icon_full: + @self: The #AppIndicator object to use + @icon_name: The icon name to set. + @icon_desc: A textual description of the icon for accessibility + Sets the default icon to use when the status is active but not set to attention. In most cases, this should be the application icon for the program. - Wrapper function for property #AppIndicator:icon-name. + + Wrapper function for property #AppIndicator:icon-name and + #AppIndicator::icon-description. **/ void -app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) +app_indicator_set_icon_full (AppIndicator *self, const gchar *icon_name, const gchar * icon_desc) { g_return_if_fail (IS_APP_INDICATOR (self)); g_return_if_fail (icon_name != NULL); + gboolean changed = FALSE; if (g_strcmp0 (self->priv->icon_name, icon_name) != 0) { - if (self->priv->icon_name) + if (self->priv->icon_name) { g_free (self->priv->icon_name); + } self->priv->icon_name = g_strdup(icon_name); + changed = TRUE; + } + if (g_strcmp0(self->priv->accessible_desc, icon_desc) != 0) { + if (self->priv->accessible_desc != NULL) { + g_free(self->priv->accessible_desc); + } + + self->priv->accessible_desc = g_strdup(icon_desc); + changed = TRUE; + } + + if (changed) { g_signal_emit (self, signals[NEW_ICON], 0, TRUE); if (self->priv->dbus_registration != 0 && self->priv->connection != NULL) { @@ -1771,28 +1835,6 @@ app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * return; } -/** - app_indicator_set_accessible_desc: - @self: The #AppIndicator object to use - @accessible_desc: The accessible description used by assistive technologies. - - This is a wrapper function for the #AppIndicator:accessible_desc - property. This function can take #NULL as @accessible_desc and - will clear the entry. -*/ -void -app_indicator_set_accessible_desc (AppIndicator *self, const gchar * accessible_desc) -{ - g_return_if_fail (IS_APP_INDICATOR (self)); - /* Note: The accessible description can be NULL, it's okay */ - - g_object_set(G_OBJECT(self), - PROP_ACCESSIBLE_DESC_S, accessible_desc == NULL ? "" : accessible_desc, - NULL); - - return; -} - /** app_indicator_set_icon_theme_path: @self: The #AppIndicator object to use -- cgit v1.2.3 From e5b4e41bb3b71899ecc2e22fd3d8ce4badfd02ae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 22:03:23 -0600 Subject: Fixing up the get functions --- src/app-indicator.c | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index d75fce0..4f09e60 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -2044,6 +2044,22 @@ app_indicator_get_icon (AppIndicator *self) return self->priv->icon_name; } +/** + app_indicator_get_icon_desc: + @self: The #AppIndicator object to use + + Wrapper function for property #AppIndicator:icon-desc. + + Return value: The current icon description. +*/ +const gchar * +app_indicator_get_icon_desc (AppIndicator *self) +{ + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + + return self->priv->accessible_desc; +} + /** app_indicator_get_icon_theme_path: @self: The #AppIndicator object to use @@ -2076,6 +2092,22 @@ app_indicator_get_attention_icon (AppIndicator *self) return self->priv->attention_icon_name; } +/** + app_indicator_get_attention_icon_desc: + @self: The #AppIndicator object to use + + Wrapper function for property #AppIndicator:attention-icon-desc. + + Return value: The current attention icon description. +*/ +const gchar * +app_indicator_get_attention_icon_desc (AppIndicator *self) +{ + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + + return self->priv->att_accessible_desc; +} + /** app_indicator_get_menu: @self: The #AppIndicator object to use @@ -2083,7 +2115,7 @@ app_indicator_get_attention_icon (AppIndicator *self) Gets the menu being used for this application indicator. Wrapper function for property #AppIndicator:menu. - Return value: A #GtkMenu object or %NULL if one hasn't been set. + Return value: (transfer none): A #GtkMenu object or %NULL if one hasn't been set. */ GtkMenu * app_indicator_get_menu (AppIndicator *self) @@ -2129,22 +2161,6 @@ app_indicator_get_label_guide (AppIndicator *self) return self->priv->label_guide; } -/** - app_indicator_get_accessible_desc: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:accessible_desc. - - Return value: The current accessible description. -*/ -const gchar * -app_indicator_get_accessible_desc (AppIndicator *self) -{ - g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); - - return self->priv->accessible_desc; -} - /** app_indicator_get_ordering_index: @self: The #AppIndicator object to use -- cgit v1.2.3 From e3ccf5fa098bbc85cb1b1085683d2c748f1ca85b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 22:13:44 -0600 Subject: Reconfigure properties to match. --- src/app-indicator.c | 108 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/app-indicator.c b/src/app-indicator.c index 4f09e60..7742d30 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -119,14 +119,15 @@ enum { PROP_CATEGORY, PROP_STATUS, PROP_ICON_NAME, + PROP_ICON_DESC, PROP_ATTENTION_ICON_NAME, + PROP_ATTENTION_ICON_DESC, PROP_ICON_THEME_PATH, PROP_CONNECTED, PROP_LABEL, PROP_LABEL_GUIDE, PROP_ORDERING_INDEX, - PROP_DBUS_MENU_SERVER, - PROP_ACCESSIBLE_DESC + PROP_DBUS_MENU_SERVER }; /* The strings so that they can be slowly looked up. */ @@ -134,14 +135,15 @@ enum { #define PROP_CATEGORY_S "category" #define PROP_STATUS_S "status" #define PROP_ICON_NAME_S "icon-name" +#define PROP_ICON_DESC_S "icon-desc" #define PROP_ATTENTION_ICON_NAME_S "attention-icon-name" +#define PROP_ATTENTION_ICON_DESC_S "attention-icon-desc" #define PROP_ICON_THEME_PATH_S "icon-theme-path" #define PROP_CONNECTED_S "connected" #define PROP_LABEL_S "label" #define PROP_LABEL_GUIDE_S "label-guide" #define PROP_ORDERING_INDEX_S "ordering-index" #define PROP_DBUS_MENU_SERVER_S "dbus-menu-server" -#define PROP_ACCESSIBLE_DESC_S "accessible-desc" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -267,12 +269,24 @@ app_indicator_class_init (AppIndicatorClass *klass) The name of the regular icon that is shown for the indicator. */ g_object_class_install_property(object_class, - PROP_ICON_NAME, + PROP_ICON_NAME, g_param_spec_string (PROP_ICON_NAME_S, - "An icon for the indicator", - "The default icon that is shown for the indicator.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); + "An icon for the indicator", + "The default icon that is shown for the indicator.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:icon-desc: + + The description of the regular icon that is shown for the indicator. + */ + g_object_class_install_property(object_class, + PROP_ICON_DESC, + g_param_spec_string (PROP_ICON_DESC_S, + "A description of the icon for the indicator", + "A description of the default icon that is shown for the indicator.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** AppIndicator:attention-icon-name: @@ -287,6 +301,19 @@ app_indicator_class_init (AppIndicatorClass *klass) "If the indicator sets it's status to 'attention' then this icon is shown.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:attention-icon-desc: + + If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION + then this textual description of the icon shown. + */ + g_object_class_install_property (object_class, + PROP_ATTENTION_ICON_DESC, + g_param_spec_string (PROP_ATTENTION_ICON_DESC_S, + "A description of the icon to show when the indicator request attention.", + "When the indicator is an attention mode this should describe the icon shown", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** AppIndicator:icon-theme-path: @@ -349,22 +376,6 @@ app_indicator_class_init (AppIndicatorClass *klass) "To ensure that the label does not cause the panel to 'jiggle' this string should provide information on how much space it could take.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - /** - AppIndicator:accessible-desc: - - A string that describes the indicator in text form. This string is - used to identify the indicator to users of assistive technologies, such - as screen readers. If the indicator has a label, then duplicating the - contents of the label is fine, if the label alone conveys enough - information about the state of the indicator to the user. - */ - g_object_class_install_property(object_class, - PROP_ACCESSIBLE_DESC, - g_param_spec_string (PROP_ACCESSIBLE_DESC_S, - "A string that describes the indicator in text form.", - "This string should convey a description of the indicator's current status, for users who use assistive technologies.", - NULL, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** AppIndicator:ordering-index: @@ -776,14 +787,29 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu break; case PROP_ICON_NAME: - app_indicator_set_icon (APP_INDICATOR (object), - g_value_get_string (value)); + app_indicator_set_icon_full (APP_INDICATOR (object), + g_value_get_string (value), + priv->accessible_desc); + check_connect (self); + break; + + case PROP_ICON_DESC: + app_indicator_set_icon_full (APP_INDICATOR (object), + priv->icon_name, + g_value_get_string (value)); check_connect (self); break; case PROP_ATTENTION_ICON_NAME: - app_indicator_set_attention_icon (APP_INDICATOR (object), - g_value_get_string (value)); + app_indicator_set_attention_icon_full (APP_INDICATOR (object), + g_value_get_string (value), + priv->att_accessible_desc); + break; + + case PROP_ATTENTION_ICON_DESC: + app_indicator_set_attention_icon_full (APP_INDICATOR (object), + priv->attention_icon_name, + g_value_get_string (value)); break; case PROP_ICON_THEME_PATH: @@ -828,20 +854,6 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } - case PROP_ACCESSIBLE_DESC: { - gchar * olda11ydesc = priv->accessible_desc; - priv->accessible_desc = g_value_dup_string(value); - - if (priv->accessible_desc != NULL && priv->accessible_desc[0] == '\0') { - g_free(priv->accessible_desc); - priv->accessible_desc = NULL; - } - - if (olda11ydesc != NULL) { - g_free(olda11ydesc); - } - break; - } case PROP_ORDERING_INDEX: priv->ordering_index = g_value_get_uint(value); break; @@ -889,10 +901,18 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->icon_name); break; + case PROP_ICON_DESC: + g_value_set_string (value, priv->accessible_desc); + break; + case PROP_ATTENTION_ICON_NAME: g_value_set_string (value, priv->attention_icon_name); break; + case PROP_ATTENTION_ICON_DESC: + g_value_set_string (value, priv->att_accessible_desc); + break; + case PROP_ICON_THEME_PATH: g_value_set_string (value, priv->icon_theme_path); break; @@ -920,10 +940,6 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->label_guide); break; - case PROP_ACCESSIBLE_DESC: - g_value_set_string (value, priv->accessible_desc); - break; - case PROP_ORDERING_INDEX: g_value_set_uint(value, priv->ordering_index); break; -- cgit v1.2.3 From ccad277faafa2d6a6b5f63e87aa57c58d0aee222 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 22:27:08 -0600 Subject: Matching prototypes to C file --- src/app-indicator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/app-indicator.h b/src/app-indicator.h index 562de56..f96212d 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -269,14 +269,14 @@ void app_indicator_set_attention_icon (AppIndicator const gchar *icon_name); void app_indicator_set_attention_icon_full (AppIndicator *self, const gchar *icon_name, - const gchar *icon_description); + const gchar *icon_desc); void app_indicator_set_menu (AppIndicator *self, GtkMenu *menu); void app_indicator_set_icon (AppIndicator *self, const gchar *icon_name); void app_indicator_set_icon_full (AppIndicator *self, const gchar *icon_name, - const gchar *icon_description); + const gchar *icon_desc); void app_indicator_set_label (AppIndicator *self, const gchar *label, const gchar *guide); -- cgit v1.2.3