aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-application.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-01-08 10:18:57 -0600
committerTed Gould <ted@gould.cx>2010-01-08 10:18:57 -0600
commita5753822cc80f3f579aa61801b54134b3baa8076 (patch)
tree1420a809e796c5af35fd2f4656f11b60eec12c4d /src/indicator-application.c
parent1c834b9b1e97a7a2ef552a5cdff726f3d4e6194a (diff)
parent8226d6c8f8870be9d2902fcd2137b242f2559da8 (diff)
downloadayatana-indicator-application-a5753822cc80f3f579aa61801b54134b3baa8076.tar.gz
ayatana-indicator-application-a5753822cc80f3f579aa61801b54134b3baa8076.tar.bz2
ayatana-indicator-application-a5753822cc80f3f579aa61801b54134b3baa8076.zip
Adding in the ability for applications to specify a directory path to get added to the icon theme search path.
Diffstat (limited to 'src/indicator-application.c')
-rw-r--r--src/indicator-application.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/indicator-application.c b/src/indicator-application.c
index f3566e4..fbfbd40 100644
--- a/src/indicator-application.c
+++ b/src/indicator-application.c
@@ -80,6 +80,7 @@ struct _IndicatorApplicationPrivate {
typedef struct _ApplicationEntry ApplicationEntry;
struct _ApplicationEntry {
IndicatorObjectEntry entry;
+ gchar * icon_path;
};
#define INDICATOR_APPLICATION_GET_PRIVATE(o) \
@@ -91,7 +92,7 @@ static void indicator_application_dispose (GObject *object);
static void indicator_application_finalize (GObject *object);
static GList * get_entries (IndicatorObject * io);
static void connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplication * application);
-static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, IndicatorApplication * application);
+static void application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application);
static void application_removed (DBusGProxy * proxy, gint position , IndicatorApplication * application);
static void get_applications (DBusGProxy *proxy, GPtrArray *OUT_applications, GError *error, gpointer userdata);
@@ -111,12 +112,13 @@ indicator_application_class_init (IndicatorApplicationClass *klass)
io_class->get_entries = get_entries;
- dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING,
+ dbus_g_object_register_marshaller(_application_service_marshal_VOID__STRING_INT_STRING_STRING_STRING,
G_TYPE_NONE,
G_TYPE_STRING,
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING,
G_TYPE_INVALID);
return;
@@ -211,6 +213,7 @@ connected (IndicatorServiceManager * sm, gboolean connected, IndicatorApplicatio
G_TYPE_INT,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING,
G_TYPE_INVALID);
dbus_g_proxy_add_signal(priv->service_proxy,
"ApplicationRemoved",
@@ -267,12 +270,19 @@ get_entries (IndicatorObject * io)
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, IndicatorApplication * application)
+application_added (DBusGProxy * proxy, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_path, IndicatorApplication * application)
{
g_debug("Building new application entry: %s with icon: %s", dbusaddress, iconname);
IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application);
ApplicationEntry * app = g_new(ApplicationEntry, 1);
+ app->icon_path = NULL;
+ if (icon_path != NULL && icon_path[0] != '\0') {
+ app->icon_path = g_strdup(icon_path);
+ g_debug("\tAppending search path: %s", app->icon_path);
+ gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), app->icon_path);
+ }
+
app->entry.image = GTK_IMAGE(gtk_image_new_from_icon_name(iconname, GTK_ICON_SIZE_MENU));
app->entry.label = NULL;
app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject));
@@ -302,6 +312,9 @@ application_removed (DBusGProxy * proxy, gint position, IndicatorApplication * a
priv->applications = g_list_remove(priv->applications, app);
g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, &(app->entry), TRUE);
+ if (app->icon_path != NULL) {
+ g_free(app->icon_path);
+ }
if (app->entry.image != NULL) {
g_object_unref(G_OBJECT(app->entry.image));
}