aboutsummaryrefslogtreecommitdiff
path: root/src/application-service-appstore.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-05 16:54:12 -0500
committerTed Gould <ted@gould.cx>2010-08-05 16:54:12 -0500
commitc4045e9150fa79827d62d2ffb8c03d6d9b905a46 (patch)
treece9622c944e4ba9166f553d00ab25843c56be66f /src/application-service-appstore.c
parentc1aaada70bc0a55e99e1ef7e13e477ddf553f386 (diff)
parent9291697e3e6d4270a7f6200c0dc3d85743feb6d2 (diff)
downloadlibayatana-appindicator-c4045e9150fa79827d62d2ffb8c03d6d9b905a46.tar.gz
libayatana-appindicator-c4045e9150fa79827d62d2ffb8c03d6d9b905a46.tar.bz2
libayatana-appindicator-c4045e9150fa79827d62d2ffb8c03d6d9b905a46.zip
Syncing with trunk and resolving conflicts
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r--src/application-service-appstore.c92
1 files changed, 68 insertions, 24 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index 7f77a78..55906ff 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -38,20 +38,21 @@ 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_ICON_PATH "IconThemePath"
-#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_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_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 */
struct _ApplicationServiceAppstorePrivate {
@@ -80,7 +81,7 @@ struct _Application {
gchar * icon;
gchar * aicon;
gchar * menu;
- gchar * icon_path;
+ gchar * icon_theme_path;
gchar * label;
gchar * guide;
gboolean currently_free;
@@ -95,6 +96,7 @@ enum {
APPLICATION_REMOVED,
APPLICATION_ICON_CHANGED,
APPLICATION_LABEL_CHANGED,
+ APPLICATION_ICON_THEME_PATH_CHANGED,
LAST_SIGNAL
};
@@ -144,6 +146,13 @@ 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_ICON_THEME_PATH_CHANGED] = g_signal_new ("application-icon-theme-path-changed",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ApplicationServiceAppstoreClass, application_icon_theme_path_changed),
+ 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,
@@ -265,11 +274,11 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err
app->aicon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_AICON_NAME));
}
- gpointer icon_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_PATH);
- if (icon_path_data != NULL) {
- app->icon_path = g_value_dup_string((GValue *)icon_path_data);
+ gpointer icon_theme_path_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_THEME_PATH);
+ if (icon_theme_path_data != NULL) {
+ app->icon_theme_path = g_value_dup_string((GValue *)icon_theme_path_data);
} else {
- app->icon_path = g_strdup("");
+ app->icon_theme_path = g_strdup("");
}
gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL);
@@ -379,8 +388,8 @@ application_free (Application * app)
if (app->menu != NULL) {
g_free(app->menu);
}
- if (app->icon_path != NULL) {
- g_free(app->icon_path);
+ if (app->icon_theme_path != NULL) {
+ g_free(app->icon_theme_path);
}
if (app->label != NULL) {
g_free(app->label);
@@ -484,7 +493,7 @@ apply_status (Application * app, AppIndicatorStatus status)
g_list_index(priv->applications, app), /* Position */
app->dbus_name,
app->menu,
- app->icon_path,
+ app->icon_theme_path,
app->label,
app->guide,
TRUE);
@@ -628,6 +637,32 @@ new_status (DBusGProxy * proxy, const gchar * status, gpointer data)
}
/* Called when the Notification Item signals that it
+ has a new icon theme path. */
+static void
+new_icon_theme_path (DBusGProxy * proxy, const gchar * icon_theme_path, gpointer data)
+{
+ Application * app = (Application *)data;
+ if (!app->validated) return;
+
+ if (g_strcmp0(icon_theme_path, app->icon_theme_path)) {
+ /* If the new icon theme path is actually a new icon theme path */
+ if (app->icon_theme_path != NULL) g_free(app->icon_theme_path);
+ app->icon_theme_path = g_strdup(icon_theme_path);
+
+ if (app->status == APP_INDICATOR_STATUS_ACTIVE) {
+ gint position = get_position(app);
+ if (position == -1) return;
+
+ g_signal_emit(G_OBJECT(app->appstore),
+ signals[APPLICATION_ICON_THEME_PATH_CHANGED], 0,
+ position, app->icon_theme_path, TRUE);
+ }
+ }
+
+ 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)
@@ -695,7 +730,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
app->icon = NULL;
app->aicon = NULL;
app->menu = NULL;
- app->icon_path = NULL;
+ app->icon_theme_path = NULL;
app->label = NULL;
app->guide = NULL;
app->currently_free = FALSE;
@@ -744,6 +779,10 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
NOTIFICATION_ITEM_SIG_NEW_STATUS,
G_TYPE_STRING,
G_TYPE_INVALID);
+ dbus_g_proxy_add_signal(app->dbus_proxy,
+ 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,
@@ -765,6 +804,11 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst
G_CALLBACK(new_status),
app,
NULL);
+ dbus_g_proxy_connect_signal(app->dbus_proxy,
+ NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH,
+ 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),
@@ -860,7 +904,7 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst
/* Icon path */
g_value_init(&value, G_TYPE_STRING);
- g_value_set_string(&value, app->icon_path);
+ g_value_set_string(&value, app->icon_theme_path);
g_value_array_append(values, &value);
g_value_unset(&value);