diff options
author | Ted Gould <ted@gould.cx> | 2012-01-28 21:10:32 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-01-28 21:10:32 -0600 |
commit | 3c1556cb30938195c6646d203f949912d7af5c4e (patch) | |
tree | d3a38e8b000bc57516a92e1d3b14f79181db93ff /src/app-indicator.c | |
parent | fb6509958adc6b571ea7c067507a2d269cbae539 (diff) | |
download | libayatana-appindicator-3c1556cb30938195c6646d203f949912d7af5c4e.tar.gz libayatana-appindicator-3c1556cb30938195c6646d203f949912d7af5c4e.tar.bz2 libayatana-appindicator-3c1556cb30938195c6646d203f949912d7af5c4e.zip |
Adding the title property
Diffstat (limited to 'src/app-indicator.c')
-rw-r--r-- | src/app-indicator.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c index f1caf82..f29d08e 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -128,7 +128,8 @@ enum { PROP_LABEL, PROP_LABEL_GUIDE, PROP_ORDERING_INDEX, - PROP_DBUS_MENU_SERVER + PROP_DBUS_MENU_SERVER, + PROP_TITLE }; /* The strings so that they can be slowly looked up. */ @@ -145,6 +146,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_TITLE_S "title" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -252,7 +254,7 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); /** - * AppIndicator: + * AppIndicator:status: * * Whether the indicator is shown or requests attention. Defaults to * 'Passive'. @@ -411,6 +413,21 @@ app_indicator_class_init (AppIndicatorClass *klass) "DBusmenu server which is available for testing the application indicators.", DBUSMENU_TYPE_SERVER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * AppIndicator:title: + * + * Provides a way to refer to this application indicator in a human + * readable form. This is used in the Unity desktop in the HUD as + * the first part of the menu entries to distinguish them from the + * focused application's entries. + */ + g_object_class_install_property(object_class, + PROP_TITLE, + g_param_spec_string (PROP_TITLE_S, + "Title of the application indicator", + "A human readable way to refer to this application indicator in the UI.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* Signals */ @@ -837,20 +854,38 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu gchar * oldlabel = priv->label; priv->label = g_value_dup_string(value); - if (g_strcmp0(oldlabel, priv->label) != 0) { - signal_label_change(APP_INDICATOR(object)); - } - if (priv->label != NULL && priv->label[0] == '\0') { g_free(priv->label); priv->label = NULL; } + if (g_strcmp0(oldlabel, priv->label) != 0) { + signal_label_change(APP_INDICATOR(object)); + } + if (oldlabel != NULL) { g_free(oldlabel); } break; } + case PROP_TITLE: { + gchar * oldtitle = priv->title; + priv->title = g_value_dup_string(value); + + if (priv->title != NULL && priv->title[0] == '\0') { + g_free(priv->title); + priv->title = NULL; + } + + if (g_strcmp0(oldtitle, priv->title) != 0) { + // signal_title_change(APP_INDICATOR(object)); + } + + if (oldtitle != NULL) { + g_free(oldtitle); + } + break; + } case PROP_LABEL_GUIDE: { gchar * oldguide = priv->label_guide; priv->label_guide = g_value_dup_string(value); |