aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-02-24 22:15:21 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-02-24 22:15:21 -0500
commit5f97e91d0017b93369d3ddc7e7354a8f285bf336 (patch)
tree0a340347ff7d0532e0e5862d5391eaaa7a92575e /src
parent3c0119b757b0c9f449d944e4423ff7d8ec723eaf (diff)
parent22fbdf6340b9b4e233c033e20009d2c65d18c804 (diff)
downloadlibayatana-appindicator-5f97e91d0017b93369d3ddc7e7354a8f285bf336.tar.gz
libayatana-appindicator-5f97e91d0017b93369d3ddc7e7354a8f285bf336.tar.bz2
libayatana-appindicator-5f97e91d0017b93369d3ddc7e7354a8f285bf336.zip
releasing version 0.2.96-0ubuntu10.2.96-0ubuntu1
Diffstat (limited to 'src')
-rw-r--r--src/app-indicator.c205
-rw-r--r--src/app-indicator.h28
-rw-r--r--src/gen-notification-item.xml.c3
-rw-r--r--src/notification-item.xml3
4 files changed, 208 insertions, 31 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c
index f4e9173..167e17f 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -80,6 +80,8 @@ struct _AppIndicatorPrivate {
guint32 ordering_index;
gchar * label;
gchar * label_guide;
+ gchar * accessible_desc;
+ gchar * att_accessible_desc;
guint label_change_idle;
GtkStatusIcon * status_icon;
@@ -117,7 +119,9 @@ 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,
@@ -131,7 +135,9 @@ 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"
@@ -263,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:
@@ -284,6 +302,19 @@ app_indicator_class_init (AppIndicatorClass *klass)
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:
An additional place to look for icon names that may be installed by the
@@ -442,7 +473,6 @@ app_indicator_class_init (AppIndicatorClass *klass)
_application_service_marshal_VOID__STRING_STRING,
G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
-
/**
AppIndicator::connection-changed:
@arg0: The #AppIndicator object
@@ -579,11 +609,6 @@ app_indicator_dispose (GObject *object)
AppIndicator *self = APP_INDICATOR (object);
AppIndicatorPrivate *priv = self->priv;
- if (priv->dbus_registration != 0) {
- g_dbus_connection_unregister_object(priv->connection, priv->dbus_registration);
- priv->dbus_registration = 0;
- }
-
if (priv->shorties != NULL) {
g_object_unref(G_OBJECT(priv->shorties));
priv->shorties = NULL;
@@ -632,6 +657,11 @@ app_indicator_dispose (GObject *object)
g_signal_emit (self, signals[CONNECTION_CHANGED], 0, FALSE);
}
+ if (priv->dbus_registration != 0) {
+ g_dbus_connection_unregister_object(priv->connection, priv->dbus_registration);
+ priv->dbus_registration = 0;
+ }
+
if (priv->connection != NULL) {
g_object_unref(G_OBJECT(priv->connection));
priv->connection = NULL;
@@ -688,6 +718,16 @@ app_indicator_finalize (GObject *object)
priv->label_guide = NULL;
}
+ if (priv->accessible_desc != NULL) {
+ g_free(priv->accessible_desc);
+ 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;
@@ -747,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:
@@ -846,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;
@@ -999,6 +1062,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, "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);
@@ -1613,20 +1680,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) {
@@ -1655,23 +1753,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) {
@@ -1930,6 +2061,22 @@ app_indicator_get_icon (AppIndicator *self)
}
/**
+ 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
@@ -1962,13 +2109,29 @@ app_indicator_get_attention_icon (AppIndicator *self)
}
/**
+ 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
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)
diff --git a/src/app-indicator.h b/src/app-indicator.h
index 3fdee86..f96212d 100644
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -267,10 +267,16 @@ 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_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_desc);
void app_indicator_set_label (AppIndicator *self,
const gchar *label,
const gchar *guide);
@@ -280,16 +286,18 @@ void app_indicator_set_ordering_index (AppIndicator
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);
-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,
diff --git a/src/gen-notification-item.xml.c b/src/gen-notification-item.xml.c
index b80567e..aa2ee0d 100644
--- a/src/gen-notification-item.xml.c
+++ b/src/gen-notification-item.xml.c
@@ -8,7 +8,9 @@ const char * _notification_item =
" <property name=\"Category\" type=\"s\" access=\"read\" />\n"
" <property name=\"Status\" type=\"s\" access=\"read\" />\n"
" <property name=\"IconName\" type=\"s\" access=\"read\" />\n"
+" <property name=\"IconAccessibleDesc\" type=\"s\" access=\"read\" />\n"
" <property name=\"AttentionIconName\" type=\"s\" access=\"read\" />\n"
+" <property name=\"AttentionAccessibleDesc\" type=\"s\" access=\"read\" />\n"
" <!-- An additional path to add to the theme search path\n"
" to find the icons specified above. -->\n"
" <property name=\"IconThemePath\" type=\"s\" access=\"read\" />\n"
@@ -38,6 +40,7 @@ const char * _notification_item =
" <arg type=\"s\" name=\"label\" direction=\"out\" />\n"
" <arg type=\"s\" name=\"guide\" direction=\"out\" />\n"
" </signal>\n"
+"\n"
" </interface>\n"
"</node>\n"
;
diff --git a/src/notification-item.xml b/src/notification-item.xml
index 127eb3a..bbf77c5 100644
--- a/src/notification-item.xml
+++ b/src/notification-item.xml
@@ -7,7 +7,9 @@
<property name="Category" type="s" access="read" />
<property name="Status" type="s" access="read" />
<property name="IconName" type="s" access="read" />
+ <property name="IconAccessibleDesc" type="s" access="read" />
<property name="AttentionIconName" type="s" access="read" />
+ <property name="AttentionAccessibleDesc" type="s" access="read" />
<!-- An additional path to add to the theme search path
to find the icons specified above. -->
<property name="IconThemePath" type="s" access="read" />
@@ -37,5 +39,6 @@
<arg type="s" name="label" direction="out" />
<arg type="s" name="guide" direction="out" />
</signal>
+
</interface>
</node>