aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/Makefile.in22
-rw-r--r--src/app-indicator.c218
-rw-r--r--src/app-indicator.h19
-rw-r--r--src/application-service-appstore.c144
-rw-r--r--src/application-service-appstore.h3
-rw-r--r--src/application-service-marshal.list4
-rw-r--r--src/application-service.xml10
-rw-r--r--src/indicator-application.c217
-rw-r--r--src/notification-item.xml6
10 files changed, 592 insertions, 54 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 68be1c0..b704b5e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -94,7 +94,8 @@ BUILT_SOURCES += \
libappindicator_la_SOURCES = \
$(libappindicator_headers) \
app-indicator-enum-types.c \
- app-indicator.c
+ app-indicator.c \
+ application-service-marshal.c
libappindicator_la_LDFLAGS = \
-version-info 0:0:0 \
diff --git a/src/Makefile.in b/src/Makefile.in
index 598f335..e7e06e3 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -80,8 +80,11 @@ libexec_PROGRAMS = indicator-application-service$(EXEEXT)
@HAVE_INTROSPECTION_TRUE@ $(vapi_DATA)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/gtk-doc.m4 \
+ $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -120,7 +123,8 @@ libappindicator_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am__objects_1 =
am_libappindicator_la_OBJECTS = $(am__objects_1) \
libappindicator_la-app-indicator-enum-types.lo \
- libappindicator_la-app-indicator.lo
+ libappindicator_la-app-indicator.lo \
+ libappindicator_la-application-service-marshal.lo
libappindicator_la_OBJECTS = $(am_libappindicator_la_OBJECTS)
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -440,7 +444,8 @@ libappindicatorinclude_HEADERS = \
libappindicator_la_SOURCES = \
$(libappindicator_headers) \
app-indicator-enum-types.c \
- app-indicator.c
+ app-indicator.c \
+ application-service-marshal.c
libappindicator_la_LDFLAGS = \
-version-info 0:0:0 \
@@ -657,6 +662,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/indicator_application_service-application-service.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libappindicator_la-app-indicator-enum-types.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libappindicator_la-app-indicator.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libappindicator_la-application-service-marshal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libapplication_la-application-service-marshal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libapplication_la-indicator-application.Plo@am__quote@
@@ -700,6 +706,14 @@ libappindicator_la-app-indicator.lo: app-indicator.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libappindicator_la_CFLAGS) $(CFLAGS) -c -o libappindicator_la-app-indicator.lo `test -f 'app-indicator.c' || echo '$(srcdir)/'`app-indicator.c
+libappindicator_la-application-service-marshal.lo: application-service-marshal.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libappindicator_la_CFLAGS) $(CFLAGS) -MT libappindicator_la-application-service-marshal.lo -MD -MP -MF $(DEPDIR)/libappindicator_la-application-service-marshal.Tpo -c -o libappindicator_la-application-service-marshal.lo `test -f 'application-service-marshal.c' || echo '$(srcdir)/'`application-service-marshal.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libappindicator_la-application-service-marshal.Tpo $(DEPDIR)/libappindicator_la-application-service-marshal.Plo
+@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='application-service-marshal.c' object='libappindicator_la-application-service-marshal.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libappindicator_la_CFLAGS) $(CFLAGS) -c -o libappindicator_la-application-service-marshal.lo `test -f 'application-service-marshal.c' || echo '$(srcdir)/'`application-service-marshal.c
+
libapplication_la-application-service-marshal.lo: application-service-marshal.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libapplication_la_CFLAGS) $(CFLAGS) -MT libapplication_la-application-service-marshal.lo -MD -MP -MF $(DEPDIR)/libapplication_la-application-service-marshal.Tpo -c -o libapplication_la-application-service-marshal.lo `test -f 'application-service-marshal.c' || echo '$(srcdir)/'`application-service-marshal.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libapplication_la-application-service-marshal.Tpo $(DEPDIR)/libapplication_la-application-service-marshal.Plo
diff --git a/src/app-indicator.c b/src/app-indicator.c
index fdfcc23..22b9c03 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -37,6 +37,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "app-indicator.h"
#include "app-indicator-enum-types.h"
+#include "application-service-marshal.h"
#include "notification-item-server.h"
#include "notification-watcher-client.h"
@@ -72,6 +73,9 @@ struct _AppIndicatorPrivate {
gchar *icon_theme_path;
DbusmenuServer *menuservice;
GtkWidget *menu;
+ gchar * label;
+ gchar * label_guide;
+ guint label_change_idle;
GtkStatusIcon * status_icon;
gint fallback_timer;
@@ -87,6 +91,7 @@ enum {
NEW_ICON,
NEW_ATTENTION_ICON,
NEW_STATUS,
+ NEW_LABEL,
CONNECTION_CHANGED,
NEW_ICON_THEME_PATH,
LAST_SIGNAL
@@ -105,7 +110,9 @@ enum {
PROP_ATTENTION_ICON_NAME,
PROP_ICON_THEME_PATH,
PROP_MENU,
- PROP_CONNECTED
+ PROP_CONNECTED,
+ PROP_LABEL,
+ PROP_LABEL_GUIDE
};
/* The strings so that they can be slowly looked up. */
@@ -117,6 +124,8 @@ enum {
#define PROP_ICON_THEME_PATH_S "icon-theme-path"
#define PROP_MENU_S "menu"
#define PROP_CONNECTED_S "connected"
+#define PROP_LABEL_S "label"
+#define PROP_LABEL_GUIDE_S "label-guide"
/* Private macro, shhhh! */
#define APP_INDICATOR_GET_PRIVATE(o) \
@@ -137,6 +146,7 @@ static void app_indicator_finalize (GObject *object);
static void app_indicator_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
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 check_connect (AppIndicator * self);
static void register_service_cb (DBusGProxy * proxy, GError * error, gpointer data);
static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout);
@@ -285,6 +295,41 @@ app_indicator_class_init (AppIndicatorClass *klass)
"Pretty simple, true if we have a reasonable expectation of being displayed through this object. You should hide your TrayIcon if so.",
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ /**
+ AppIndicator:label:
+
+ A label that can be shown next to the string in the application
+ indicator. The label will not be shown unless there is an icon
+ as well. The label is useful for numerical and other frequently
+ updated information. In general, it shouldn't be shown unless a
+ user requests it as it can take up a significant amount of space
+ on the user's panel. This may not be shown in all visualizations.
+ */
+ g_object_class_install_property(object_class,
+ PROP_LABEL,
+ g_param_spec_string (PROP_LABEL_S,
+ "A label next to the icon",
+ "A label to provide dynamic information.",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ AppIndicator:label-guide:
+
+ An optional string to provide guidance to the panel on how big
+ the #AppIndicator:label string could get. If this is set correctly
+ then the panel should never 'jiggle' as the string adjusts through
+ out the range of options. For instance, if you were providing a
+ percentage like "54% thrust" in #AppIndicator:label you'd want to
+ set this string to "100% thrust" to ensure space when Scotty can
+ get you enough power.
+ */
+ g_object_class_install_property(object_class,
+ PROP_LABEL_GUIDE,
+ g_param_spec_string (PROP_LABEL_GUIDE_S,
+ "A string to size the space available for the label.",
+ "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));
/* Signals */
@@ -334,6 +379,23 @@ app_indicator_class_init (AppIndicatorClass *klass)
G_TYPE_STRING);
/**
+ AppIndicator::new-label:
+ @arg0: The #AppIndicator object
+ @arg1: The string for the label
+ @arg1: The string for the guide
+
+ Emitted when either #AppIndicator:label or #AppIndicator:label-guide are
+ changed.
+ */
+ signals[NEW_LABEL] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_LABEL,
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (AppIndicatorClass, new_label),
+ NULL, NULL,
+ _application_service_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
+
+ /**
AppIndicator::connection-changed:
@arg0: The #AppIndicator object
@arg1: Whether we're connected or not
@@ -384,6 +446,9 @@ app_indicator_init (AppIndicator *self)
priv->icon_theme_path = NULL;
priv->menu = NULL;
priv->menuservice = NULL;
+ priv->label = NULL;
+ priv->label_guide = NULL;
+ priv->label_change_idle = 0;
priv->watcher_proxy = NULL;
priv->connection = NULL;
@@ -435,6 +500,11 @@ app_indicator_dispose (GObject *object)
priv->fallback_timer = 0;
}
+ if (priv->label_change_idle != 0) {
+ g_source_remove(priv->label_change_idle);
+ priv->label_change_idle = 0;
+ }
+
if (priv->menu != NULL) {
g_signal_handlers_disconnect_by_func (G_OBJECT (priv->menu),
client_menu_changed,
@@ -507,6 +577,16 @@ app_indicator_finalize (GObject *object)
g_free(priv->icon_theme_path);
priv->icon_theme_path = NULL;
}
+
+ if (priv->label != NULL) {
+ g_free(priv->label);
+ priv->label = NULL;
+ }
+
+ if (priv->label_guide != NULL) {
+ g_free(priv->label_guide);
+ priv->label_guide = NULL;
+ }
G_OBJECT_CLASS (app_indicator_parent_class)->finalize (object);
return;
@@ -578,6 +658,43 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu
check_connect (self);
break;
+ case PROP_LABEL: {
+ 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 (oldlabel != NULL) {
+ g_free(oldlabel);
+ }
+ break;
+ }
+ case PROP_LABEL_GUIDE: {
+ gchar * oldguide = priv->label_guide;
+ priv->label_guide = g_value_dup_string(value);
+
+ if (g_strcmp0(oldguide, priv->label_guide) != 0) {
+ signal_label_change(APP_INDICATOR(object));
+ }
+
+ if (priv->label_guide != NULL && priv->label_guide[0] == '\0') {
+ g_free(priv->label_guide);
+ priv->label_guide = NULL;
+ }
+
+ if (oldguide != NULL) {
+ g_free(oldguide);
+ }
+ break;
+ }
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -635,6 +752,14 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa
g_value_set_boolean (value, priv->watcher_proxy != NULL ? TRUE : FALSE);
break;
+ case PROP_LABEL:
+ g_value_set_string (value, priv->label);
+ break;
+
+ case PROP_LABEL_GUIDE:
+ g_value_set_string (value, priv->label_guide);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -643,6 +768,39 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa
return;
}
+/* Sends the label changed signal and resets the source ID */
+static gboolean
+signal_label_change_idle (gpointer user_data)
+{
+ AppIndicator * self = (AppIndicator *)user_data;
+ AppIndicatorPrivate *priv = self->priv;
+
+ g_signal_emit(G_OBJECT(self), signals[NEW_LABEL], 0,
+ priv->label != NULL ? priv->label : "",
+ priv->label_guide != NULL ? priv->label_guide : "",
+ TRUE);
+
+ priv->label_change_idle = 0;
+
+ return FALSE;
+}
+
+/* Sets up an idle function to send the label changed signal
+ so that we don't send it too many times. */
+static void
+signal_label_change (AppIndicator * self)
+{
+ AppIndicatorPrivate *priv = self->priv;
+
+ /* don't set it twice */
+ if (priv->label_change_idle != 0) {
+ return;
+ }
+
+ priv->label_change_idle = g_idle_add(signal_label_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. */
@@ -1150,6 +1308,31 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name)
}
/**
+ app_indicator_set_label:
+ @self: The #AppIndicator object to use
+ @label: The label to show next to the icon.
+ @guide: A guide to size the label correctly.
+
+ This is a wrapper function for the #AppIndicator:label and
+ #AppIndicator:guide properties. This function can take #NULL
+ as either @label or @guide and will clear the entries.
+*/
+void
+app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * guide)
+{
+ g_return_if_fail (IS_APP_INDICATOR (self));
+ /* Note: The label can be NULL, it's okay */
+ /* Note: The guide can be NULL, it's okay */
+
+ g_object_set(G_OBJECT(self),
+ PROP_LABEL_S, label == NULL ? "" : label,
+ PROP_LABEL_GUIDE_S, guide == NULL ? "" : guide,
+ NULL);
+
+ return;
+}
+
+/**
app_indicator_set_icon_theme_path:
@self: The #AppIndicator object to use
@icon_theme_path: The icon theme path to set.
@@ -1717,3 +1900,36 @@ app_indicator_get_menu (AppIndicator *self)
return GTK_MENU(priv->menu);
}
+
+/**
+ app_indicator_get_label:
+ @self: The #AppIndicator object to use
+
+ Wrapper function for property #AppIndicator:label.
+
+ Return value: The current label.
+*/
+const gchar *
+app_indicator_get_label (AppIndicator *self)
+{
+ g_return_val_if_fail (IS_APP_INDICATOR (self), NULL);
+
+ return self->priv->label;
+}
+
+/**
+ app_indicator_get_label_guide:
+ @self: The #AppIndicator object to use
+
+ Wrapper function for property #AppIndicator:label-guide.
+
+ Return value: The current label guide.
+*/
+const gchar *
+app_indicator_get_label_guide (AppIndicator *self)
+{
+ g_return_val_if_fail (IS_APP_INDICATOR (self), NULL);
+
+ return self->priv->label_guide;
+}
+
diff --git a/src/app-indicator.h b/src/app-indicator.h
index b17f023..8320a2f 100644
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -93,6 +93,11 @@ G_BEGIN_DECLS
String identifier for the #AppIndicator::new-status signal.
*/
/**
+ APP_INDICATOR_SIGNAL_NEW_LABEL:
+
+ String identifier for the #AppIndicator::new-label signal.
+*/
+/**
APP_INDICATOR_SIGNAL_CONNECTION_CHANGED:
String identifier for the #AppIndicator::connection-changed signal.
@@ -105,6 +110,7 @@ G_BEGIN_DECLS
#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"
@@ -160,7 +166,7 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate;
there is no Application Indicator area available.
@unfallback: The function that gets called if an Application
Indicator area appears after the fallback has been created.
- @app_indicator_reserved_2: Reserved for future use.
+ @new_label: Slot for #AppIndicator::new-label.
The signals and external functions that make up the #AppIndicator
class object.
@@ -188,12 +194,16 @@ struct _AppIndicatorClass {
void (*unfallback) (AppIndicator * indicator,
GtkStatusIcon * status_icon);
+ /* Another DBus Signal */
+ void (* new_label) (AppIndicator *indicator,
+ const gchar *label,
+ const gchar *guide,
+ gpointer user_data);
void (* new_icon_theme_path) (AppIndicator *indicator,
const gchar *icon_theme_path,
gpointer user_data);
/* Reserved */
- void (*app_indicator_reserved_2)(void);
};
/**
@@ -236,6 +246,9 @@ void app_indicator_set_menu (AppIndicator
GtkMenu *menu);
void app_indicator_set_icon (AppIndicator *self,
const gchar *icon_name);
+void app_indicator_set_label (AppIndicator *self,
+ const gchar *label,
+ const gchar *guide);
void app_indicator_set_icon_theme_path(AppIndicator *self,
const gchar *icon_theme_path);
@@ -247,6 +260,8 @@ const gchar * app_indicator_get_icon (AppIndicator *
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);
G_END_DECLS
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index f18a89e..55906ff 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -38,17 +38,20 @@ static gboolean _application_service_server_get_applications (ApplicationService
#include "application-service-server.h"
-#define NOTIFICATION_ITEM_PROP_ID "Id"
-#define NOTIFICATION_ITEM_PROP_CATEGORY "Category"
-#define NOTIFICATION_ITEM_PROP_STATUS "Status"
-#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName"
-#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName"
+#define NOTIFICATION_ITEM_PROP_ID "Id"
+#define NOTIFICATION_ITEM_PROP_CATEGORY "Category"
+#define NOTIFICATION_ITEM_PROP_STATUS "Status"
+#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName"
+#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName"
#define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath"
-#define NOTIFICATION_ITEM_PROP_MENU "Menu"
-
-#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon"
-#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon"
-#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus"
+#define NOTIFICATION_ITEM_PROP_MENU "Menu"
+#define NOTIFICATION_ITEM_PROP_LABEL "Label"
+#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "LabelGuide"
+
+#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon"
+#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon"
+#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus"
+#define NOTIFICATION_ITEM_SIG_NEW_LABEL "NewLabel"
#define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath"
/* Private Stuff */
@@ -79,6 +82,8 @@ struct _Application {
gchar * aicon;
gchar * menu;
gchar * icon_theme_path;
+ gchar * label;
+ gchar * guide;
gboolean currently_free;
};
@@ -90,6 +95,7 @@ enum {
APPLICATION_ADDED,
APPLICATION_REMOVED,
APPLICATION_ICON_CHANGED,
+ APPLICATION_LABEL_CHANGED,
APPLICATION_ICON_THEME_PATH_CHANGED,
LAST_SIGNAL
};
@@ -124,8 +130,8 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_added),
NULL, NULL,
- _application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING,
- G_TYPE_NONE, 5, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE);
+ _application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING_STRING_STRING,
+ G_TYPE_NONE, 7, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE);
signals[APPLICATION_REMOVED] = g_signal_new ("application-removed",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
@@ -147,6 +153,19 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass)
NULL, NULL,
_application_service_marshal_VOID__INT_STRING,
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING, G_TYPE_NONE);
+ signals[APPLICATION_LABEL_CHANGED] = g_signal_new ("application-label-changed",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_label_changed),
+ NULL, NULL,
+ _application_service_marshal_VOID__INT_STRING_STRING,
+ G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_NONE);
+
+ dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_STRING,
+ G_TYPE_NONE,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE,
&dbus_glib__application_service_server_object_info);
@@ -262,6 +281,20 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err
app->icon_theme_path = g_strdup("");
}
+ gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL);
+ if (label_data != NULL) {
+ app->label = g_value_dup_string((GValue *)label_data);
+ } else {
+ app->label = g_strdup("");
+ }
+
+ gpointer guide_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL_GUIDE);
+ if (guide_data != NULL) {
+ app->guide = g_value_dup_string((GValue *)guide_data);
+ } else {
+ app->guide = g_strdup("");
+ }
+
/* TODO: Calling approvers, but we're ignoring the results. So, eh. */
g_list_foreach(priv->approvers, check_with_old_approver, app);
@@ -358,6 +391,12 @@ application_free (Application * app)
if (app->icon_theme_path != NULL) {
g_free(app->icon_theme_path);
}
+ if (app->label != NULL) {
+ g_free(app->label);
+ }
+ if (app->guide != NULL) {
+ g_free(app->guide);
+ }
g_free(app);
return;
@@ -455,6 +494,8 @@ apply_status (Application * app, AppIndicatorStatus status)
app->dbus_name,
app->menu,
app->icon_theme_path,
+ app->label,
+ app->guide,
TRUE);
}
} else {
@@ -621,6 +662,48 @@ new_icon_theme_path (DBusGProxy * proxy, const gchar * icon_theme_path, gpointer
return;
}
+/* Called when the Notification Item signals that it
+ has a new label. */
+static void
+new_label (DBusGProxy * proxy, const gchar * label, const gchar * guide, gpointer data)
+{
+ Application * app = (Application *)data;
+ if (!app->validated) return;
+
+ gboolean changed = FALSE;
+
+ if (g_strcmp0(app->label, label) != 0) {
+ changed = TRUE;
+ if (app->label != NULL) {
+ g_free(app->label);
+ app->label = NULL;
+ }
+ app->label = g_strdup(label);
+ }
+
+ if (g_strcmp0(app->guide, guide) != 0) {
+ changed = TRUE;
+ if (app->guide != NULL) {
+ g_free(app->guide);
+ app->guide = NULL;
+ }
+ app->guide = g_strdup(guide);
+ }
+
+ if (changed) {
+ gint position = get_position(app);
+ if (position == -1) return;
+
+ g_signal_emit(app->appstore, signals[APPLICATION_LABEL_CHANGED], 0,
+ position,
+ app->label != NULL ? app->label : "",
+ app->guide != NULL ? app->guide : "",
+ TRUE);
+ }
+
+ return;
+}
+
/* Adding a new NotificationItem object from DBus in to the
appstore. First, we need to get the information on it
though. */
@@ -648,6 +731,8 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
app->aicon = NULL;
app->menu = NULL;
app->icon_theme_path = NULL;
+ app->label = NULL;
+ app->guide = NULL;
app->currently_free = FALSE;
/* Get the DBus proxy for the NotificationItem interface */
@@ -698,7 +783,12 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH,
G_TYPE_STRING,
G_TYPE_INVALID);
-
+ dbus_g_proxy_add_signal(app->dbus_proxy,
+ NOTIFICATION_ITEM_SIG_NEW_LABEL,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
+
dbus_g_proxy_connect_signal(app->dbus_proxy,
NOTIFICATION_ITEM_SIG_NEW_ICON,
G_CALLBACK(new_icon),
@@ -719,7 +809,12 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
G_CALLBACK(new_icon_theme_path),
app,
NULL);
-
+ dbus_g_proxy_connect_signal(app->dbus_proxy,
+ NOTIFICATION_ITEM_SIG_NEW_LABEL,
+ G_CALLBACK(new_label),
+ app,
+ NULL);
+
/* Get all the propertiees */
org_freedesktop_DBus_Properties_get_all_async(app->prop_proxy,
NOTIFICATION_ITEM_DBUS_IFACE,
@@ -778,13 +873,14 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst
gint position = 0;
for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) {
+ Application * app = (Application *)listpntr->data;
GValueArray * values = g_value_array_new(5);
GValue value = {0};
/* Icon name */
g_value_init(&value, G_TYPE_STRING);
- g_value_set_string(&value, ((Application *)listpntr->data)->icon);
+ g_value_set_string(&value, app->icon);
g_value_array_append(values, &value);
g_value_unset(&value);
@@ -796,19 +892,31 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst
/* DBus Address */
g_value_init(&value, G_TYPE_STRING);
- g_value_set_string(&value, ((Application *)listpntr->data)->dbus_name);
+ g_value_set_string(&value, app->dbus_name);
g_value_array_append(values, &value);
g_value_unset(&value);
/* DBus Object */
g_value_init(&value, DBUS_TYPE_G_OBJECT_PATH);
- g_value_set_static_boxed(&value, ((Application *)listpntr->data)->menu);
+ g_value_set_static_boxed(&value, app->menu);
g_value_array_append(values, &value);
g_value_unset(&value);
/* Icon path */
g_value_init(&value, G_TYPE_STRING);
- g_value_set_string(&value, ((Application *)listpntr->data)->icon_theme_path);
+ g_value_set_string(&value, app->icon_theme_path);
+ g_value_array_append(values, &value);
+ g_value_unset(&value);
+
+ /* Label */
+ g_value_init(&value, G_TYPE_STRING);
+ g_value_set_string(&value, app->label);
+ g_value_array_append(values, &value);
+ g_value_unset(&value);
+
+ /* Guide */
+ g_value_init(&value, G_TYPE_STRING);
+ g_value_set_string(&value, app->guide);
g_value_array_append(values, &value);
g_value_unset(&value);
diff --git a/src/application-service-appstore.h b/src/application-service-appstore.h
index 422b0fd..9ae2874 100644
--- a/src/application-service-appstore.h
+++ b/src/application-service-appstore.h
@@ -45,8 +45,9 @@ struct _ApplicationServiceAppstoreClass {
void (*application_added) (ApplicationServiceAppstore * appstore, gchar *, gint, gchar *, gchar *, gpointer);
void (*application_removed) (ApplicationServiceAppstore * appstore, gint, gpointer);
- void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
+ void (*application_icon_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
void (*application_icon_theme_path_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, gpointer);
+ void (*application_label_changed)(ApplicationServiceAppstore * appstore, gint, const gchar *, const gchar *, gpointer);
};
struct _ApplicationServiceAppstore {
diff --git a/src/application-service-marshal.list b/src/application-service-marshal.list
index 4ac8398..f432028 100644
--- a/src/application-service-marshal.list
+++ b/src/application-service-marshal.list
@@ -16,5 +16,7 @@
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
-VOID: STRING, INT, STRING, STRING, STRING
+VOID: STRING, INT, STRING, STRING, STRING, STRING, STRING
+VOID: INT, STRING, STRING
VOID: INT, STRING
+VOID: STRING, STRING
diff --git a/src/application-service.xml b/src/application-service.xml
index dcccfa4..031bf68 100644
--- a/src/application-service.xml
+++ b/src/application-service.xml
@@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
<!-- Methods -->
<method name="GetApplications">
- <arg type="a(sisos)" name="applications" direction="out" />
+ <arg type="a(sisosss)" name="applications" direction="out" />
</method>
<!-- Signals -->
@@ -36,6 +36,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
<arg type="s" name="dbusaddress" direction="out" />
<arg type="o" name="dbusobject" direction="out" />
<arg type="s" name="iconpath" direction="out" />
+ <arg type="s" name="label" direction="out" />
+ <arg type="s" name="labelguide" direction="out" />
</signal>
<signal name="ApplicationRemoved">
<arg type="i" name="position" direction="out" />
@@ -48,6 +50,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
<arg type="i" name="position" direction="out" />
<arg type="s" name="icon_theme_path" direction="out" />
</signal>
-
+ <signal name="ApplicationLabelChanged">
+ <arg type="i" name="position" direction="out" />
+ <arg type="s" name="label" direction="out" />
+ <arg type="s" name="guide" direction="out" />
+ </signal>
</interface>
</node>
diff --git a/src/indicator-application.c b/src/indicator-application.c
index 066ea63..36e1446 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -85,10 +85,11 @@ typedef struct _ApplicationEntry ApplicationEntry;
struct _ApplicationEntry {
IndicatorObjectEntry entry;
gchar * icon_theme_path;
- gchar * icon_name;
gboolean old_service;
gchar * dbusobject;
gchar * dbusaddress;
+ gchar * guide;
+ gchar * longname;
};
#define INDICATOR_APPLICATION_GET_PRIVATE(o) \
@@ -106,8 +107,9 @@ static void disconnected (IndicatorApplication * application);
static void disconnected_helper (gpointer data, gpointer user_data);
static gboolean disconnected_kill (gpointer user_data);
static void disconnected_kill_helper (gpointer data, gpointer user_data);
-static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application);
+static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, IndicatorApplication * application);
static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);
+static void application_label_changed (DBusGProxy * proxy, gint position, const gchar * label, const gchar * guide, IndicatorApplication * application);
static void application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconname, IndicatorApplication * application);
static void application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gchar * icon_theme_path, IndicatorApplication * application);
static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);
@@ -132,19 +134,27 @@ indicator_application_class_init (IndicatorApplicationClass *klass)
io_class->get_entries = get_entries;
io_class->get_location = get_location;
- dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING,
+ dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING_STRING_STRING,
G_TYPE_NONE,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
G_TYPE_INVALID);
dbus_g_object_register_marshaller(_application_service_marshal_VOID__INT_STRING,
G_TYPE_NONE,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_INVALID);
+ dbus_g_object_register_marshaller(_application_service_marshal_VOID__INT_STRING_STRING,
+ G_TYPE_NONE,
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
return;
}
@@ -272,6 +282,8 @@ connected (IndicatorApplication * application)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
G_TYPE_INVALID);
dbus_g_proxy_add_signal(priv->service_proxy,
"ApplicationRemoved",
@@ -287,6 +299,12 @@ connected (IndicatorApplication * application)
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_INVALID);
+ dbus_g_proxy_add_signal(priv->service_proxy,
+ "ApplicationLabelChanged",
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_INVALID);
/* Connect to them */
g_debug("Connect to them.");
@@ -310,6 +328,11 @@ connected (IndicatorApplication * application)
G_CALLBACK(application_icon_theme_path_changed),
application,
NULL /* Disconnection Signal */);
+ dbus_g_proxy_connect_signal(priv->service_proxy,
+ "ApplicationLabelChanged",
+ G_CALLBACK(application_label_changed),
+ application,
+ NULL /* Disconnection Signal */);
}
/* Query it for existing applications */
@@ -421,11 +444,51 @@ application_added_search (gconstpointer a, gconstpointer b)
return -1;
}
+/* Does a quick meausre of how big the string is in
+ pixels with a Pango layout */
+static gint
+measure_string (GtkStyle * style, PangoContext * context, const gchar * string)
+{
+ PangoLayout * layout = pango_layout_new(context);
+ pango_layout_set_text(layout, string, -1);
+ pango_layout_set_font_description(layout, style->font_desc);
+
+ gint width;
+ pango_layout_get_pixel_size(layout, &width, NULL);
+ g_object_unref(layout);
+ return width;
+}
+
+/* Try to get a good guess at what a maximum width of the entire
+ string would be. */
+static void
+guess_label_size (ApplicationEntry * app)
+{
+ /* This is during startup. */
+ if (app->entry.label == NULL) return;
+
+ GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(app->entry.label));
+ PangoContext * context = gtk_widget_get_pango_context(GTK_WIDGET(app->entry.label));
+
+ gint length = measure_string(style, context, gtk_label_get_text(app->entry.label));
+
+ if (app->guide != NULL) {
+ gint guidelen = measure_string(style, context, app->guide);
+ if (guidelen > length) {
+ length = guidelen;
+ }
+ }
+
+ gtk_widget_set_size_request(GTK_WIDGET(app->entry.label), length, -1);
+
+ return;
+}
+
/* Here we respond to new applications by building up the
ApplicationEntry and signaling the indicator host that
we've got a new indicator. */
static void
-application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, IndicatorApplication * application)
+application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, IndicatorApplication * application)
{
g_return_if_fail(IS_INDICATOR_APPLICATION(application));
g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname);
@@ -455,21 +518,38 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co
app->dbusaddress = g_strdup(dbusaddress);
app->dbusobject = g_strdup(dbusobject);
+ app->guide = NULL;
- app->icon_name = g_strdup(iconname);
/* We make a long name using the suffix, and if that
icon is available we want to use it. Otherwise we'll
just use the name we were given. */
- gchar * longname = NULL;
+ app->longname = NULL;
if (!g_str_has_suffix(iconname, PANEL_ICON_SUFFIX)) {
- longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
+ app->longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
} else {
- longname = g_strdup(iconname);
+ app->longname = g_strdup(iconname);
+ }
+ app->entry.image = indicator_image_helper(app->longname);
+
+ if (label == NULL || label[0] == '\0') {
+ app->entry.label = NULL;
+ } else {
+ app->entry.label = GTK_LABEL(gtk_label_new(label));
+ g_object_ref(G_OBJECT(app->entry.label));
+ gtk_widget_show(GTK_WIDGET(app->entry.label));
+
+ if (app->guide != NULL) {
+ g_free(app->guide);
+ app->guide = NULL;
+ }
+
+ if (guide != NULL) {
+ app->guide = g_strdup(guide);
+ }
+
+ guess_label_size(app);
}
- app->entry.image = indicator_image_helper(longname);
- g_free(longname);
- app->entry.label = NULL;
app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject));
/* Keep copies of these for ourself, just in case. */
@@ -480,7 +560,6 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co
priv->applications = g_list_insert(priv->applications, app, position);
- /* TODO: Need to deal with position here somehow */
g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
return;
}
@@ -512,14 +591,16 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a
if (app->dbusobject != NULL) {
g_free(app->dbusobject);
}
- if (app->icon_name != NULL) {
- g_free(app->icon_name);
- }
+ if (app->guide != NULL) {
+ g_free(app->guide);
+ }
+ if (app->longname != NULL) {
+ g_free(app->longname);
+ }
if (app->entry.image != NULL) {
g_object_unref(G_OBJECT(app->entry.image));
}
if (app->entry.label != NULL) {
- g_warning("Odd, an application indicator with a label?");
g_object_unref(G_OBJECT(app->entry.label));
}
if (app->entry.menu != NULL) {
@@ -530,6 +611,87 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a
return;
}
+/* The callback for the signal that the label for an application
+ has changed. */
+static void
+application_label_changed (DBusGProxy * proxy, gint position, const gchar * label, const gchar * guide, IndicatorApplication * application)
+{
+ IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
+ ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position);
+ gboolean signal_reload = FALSE;
+
+ if (app == NULL) {
+ g_warning("Unable to find application at position: %d", position);
+ return;
+ }
+
+ if (label == NULL || label[0] == '\0') {
+ /* No label, let's see if we need to delete the old one */
+ if (app->entry.label != NULL) {
+ g_object_unref(G_OBJECT(app->entry.label));
+ app->entry.label = NULL;
+
+ signal_reload = TRUE;
+ }
+ } else {
+ /* We've got a label, is this just an update or is
+ it a new thing. */
+ if (app->entry.label != NULL) {
+ gtk_label_set_text(app->entry.label, label);
+ } else {
+ app->entry.label = GTK_LABEL(gtk_label_new(label));
+ g_object_ref(G_OBJECT(app->entry.label));
+ gtk_widget_show(GTK_WIDGET(app->entry.label));
+
+ signal_reload = TRUE;
+ }
+ }
+
+ /* Copy the guide if we have one */
+ if (app->guide != NULL) {
+ g_free(app->guide);
+ app->guide = NULL;
+ }
+
+ if (guide != NULL && guide[0] != '\0') {
+ app->guide = g_strdup(guide);
+ }
+
+ /* Protected against not having a label */
+ guess_label_size(app);
+
+ if (signal_reload) {
+ /* Telling the listener that this has been removed, and then
+ readded to make it reparse the entry. */
+ if (app->entry.label != NULL) {
+ gtk_widget_hide(GTK_WIDGET(app->entry.label));
+ }
+
+ if (app->entry.image != NULL) {
+ gtk_widget_hide(GTK_WIDGET(app->entry.image));
+ }
+
+ if (app->entry.menu != NULL) {
+ gtk_menu_detach(app->entry.menu);
+ }
+
+ g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
+
+ if (app->entry.label != NULL) {
+ gtk_widget_show(GTK_WIDGET(app->entry.label));
+ }
+
+ if (app->entry.image != NULL) {
+ indicator_image_helper_update(app->entry.image, app->longname);
+ gtk_widget_show(GTK_WIDGET(app->entry.image));
+ }
+
+ g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, &(app->entry), TRUE);
+ }
+
+ return;
+}
+
/* The callback for the signal that the icon for an application
has changed. */
static void
@@ -546,11 +708,16 @@ application_icon_changed (DBusGProxy * proxy, gint position, const gchar * iconn
/* We make a long name using the suffix, and if that
icon is available we want to use it. Otherwise we'll
just use the name we were given. */
- gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
- indicator_image_helper_update(app->entry.image, longname);
- g_free(longname);
-
- app->icon_name = g_strdup(iconname);
+ if (app->longname != NULL) {
+ g_free(app->longname);
+ app->longname = NULL;
+ }
+ if (!g_str_has_suffix(iconname, PANEL_ICON_SUFFIX)) {
+ app->longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX);
+ } else {
+ app->longname = g_strdup(iconname);
+ }
+ indicator_image_helper_update(app->entry.image, app->longname);
return;
}
@@ -578,7 +745,7 @@ application_icon_theme_path_changed (DBusGProxy * proxy, gint position, const gc
app->icon_theme_path = g_strdup(icon_theme_path);
theme_dir_ref(application, app->icon_theme_path);
}
- indicator_image_helper_update(app->entry.image, app->icon_name);
+ indicator_image_helper_update(app->entry.image, app->longname);
}
return;
@@ -605,15 +772,17 @@ get_applications_helper (gpointer data, gpointer user_data)
{
GValueArray * array = (GValueArray *)data;
- g_return_if_fail(array->n_values == 5);
+ g_return_if_fail(array->n_values == 7);
const gchar * icon_name = g_value_get_string(g_value_array_get_nth(array, 0));
gint position = g_value_get_int(g_value_array_get_nth(array, 1));
const gchar * dbus_address = g_value_get_string(g_value_array_get_nth(array, 2));
const gchar * dbus_object = g_value_get_boxed(g_value_array_get_nth(array, 3));
const gchar * icon_theme_path = g_value_get_string(g_value_array_get_nth(array, 4));
+ const gchar * label = g_value_get_string(g_value_array_get_nth(array, 5));
+ const gchar * guide = g_value_get_string(g_value_array_get_nth(array, 6));
- return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_theme_path, user_data);
+ return application_added(NULL, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, user_data);
}
/* Unrefs a theme directory. This may involve removing it from
diff --git a/src/notification-item.xml b/src/notification-item.xml
index dc755c9..01261b5 100644
--- a/src/notification-item.xml
+++ b/src/notification-item.xml
@@ -12,6 +12,8 @@
to find the icons specified above. -->
<property name="IconThemePath" type="s" access="read" />
<property name="Menu" type="o" access="read" />
+ <property name="Label" type="s" access="read" />
+ <property name="LabelGuide" type="s" access="read" />
<!-- Methods -->
<!-- None currently -->
@@ -27,6 +29,10 @@
<signal name="NewStatus">
<arg type="s" name="status" direction="out" />
</signal>
+ <signal name="NewLabel">
+ <arg type="s" name="label" direction="out" />
+ <arg type="s" name="guide" direction="out" />
+ </signal>
</interface>
</node>