From 55682880fe194976e2ea9f74041b89846e97309e Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Mon, 7 Feb 2011 18:17:24 +1100 Subject: Include indicator-object.h to reference INDICATOR_OBJECT_SCROLL_UP --- src/application-service-appstore.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 52a510e..23047b4 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -24,6 +24,7 @@ with this program. If not, see . #include "config.h" #endif +#include #include "libappindicator/app-indicator.h" #include "app-indicator-enum-types.h" #include "application-service-appstore.h" -- cgit v1.2.3 From e6a59a7ef8e9f71ac89a1e84008e77f5ea71c905 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Mon, 7 Feb 2011 18:25:03 +1100 Subject: Add accessible name support --- src/application-service-appstore.c | 61 ++++++++++++++++++++++--- src/application-service.xml | 7 ++- src/indicator-application.c | 94 ++++++++++++++++++++++++++++++++++---- 3 files changed, 145 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 23047b4..fcd7f24 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -49,12 +49,14 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" #define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" #define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" +#define NOTIFICATION_ITEM_PROP_ACCESSIBLE_NAME "AccessibleName" #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 "XAyatanaNewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" +#define NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_NAME "NewAccessibleName" #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" #define OVERRIDE_FILE_NAME "ordering-override.keyfile" @@ -104,6 +106,7 @@ struct _Application { gchar * icon_theme_path; gchar * label; gchar * guide; + gchar * accessible_name; gboolean currently_free; guint ordering_index; GList * approved_by; @@ -431,7 +434,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, GVariant * menu = NULL, * id = NULL, * category = NULL, * status = NULL, * icon_name = NULL, * aicon_name = NULL, * icon_theme_path = NULL, * index = NULL, * label = NULL, - * guide = NULL; + * guide = NULL, * accessible_name = NULL; GVariant * properties = g_dbus_proxy_call_finish(app->props, res, &error); @@ -474,6 +477,8 @@ got_all_properties (GObject * source_object, GAsyncResult * res, label = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_LABEL_GUIDE) == 0) { guide = g_variant_ref(value); + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ACCESSIBLE_NAME) == 0) { + accessible_name = g_variant_ref(value); } /* else ignore */ } g_variant_iter_free (iter); @@ -528,6 +533,12 @@ got_all_properties (GObject * source_object, GAsyncResult * res, app->guide = g_strdup(""); } + if (accessible_name != NULL) { + app->accessible_name = g_variant_dup_string(accessible_name, NULL); + } else { + app->accessible_name = g_strdup(""); + } + g_list_foreach(priv->approvers, check_with_old_approver, app); apply_status(app); @@ -548,6 +559,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, if (index) g_variant_unref (index); if (label) g_variant_unref (label); if (guide) g_variant_unref (guide); + if (accessible_name) g_variant_unref (accessible_name); return; } @@ -725,6 +737,9 @@ application_free (Application * app) if (app->approved_by != NULL) { g_list_free(app->approved_by); } + if (app->accessible_name != NULL) { + g_free(app->accessible_name); + } g_free(app); return; @@ -833,11 +848,12 @@ apply_status (Application * app) if (app->visible_state == VISIBLE_STATE_HIDDEN) { /* Put on panel */ emit_signal (appstore, "ApplicationAdded", - g_variant_new ("(sisosss)", newicon, + g_variant_new ("(sisossss)", newicon, get_position(app), app->dbus_name, app->menu, app->icon_theme_path, - app->label, app->guide)); + app->label, app->guide, + app->accessible_name)); } else { /* Icon update */ gint position = get_position(app); @@ -926,6 +942,32 @@ new_label (Application * app, const gchar * label, const gchar * guide) return; } +static void +new_accessible_name (Application * app, const gchar * accessible_name) +{ + gboolean changed = FALSE; + + if (g_strcmp0(app->accessible_name, accessible_name) != 0) { + changed = TRUE; + if (app->accessible_name != NULL) { + g_free(app->accessible_name); + app->accessible_name = NULL; + } + app->accessible_name = g_strdup(accessible_name); + } + + if (changed) { + gint position = get_position(app); + if (position == -1) return; + + emit_signal (app->appstore, "ApplicationAccessibleNameChanged", + g_variant_new ("(is)", position, + app->accessible_name != NULL ? app->accessible_name : "")); + } + + return; +} + /* Adding a new NotificationItem object from DBus in to the appstore. First, we need to get the information on it though. */ @@ -1124,6 +1166,11 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name g_variant_get(parameters, "(&s&s)", &label, &guide); new_label(app, label, guide); } + else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_NAME) == 0) { + const gchar * accessible_name; + g_variant_get(parameters, "(&s)", &accessible_name); + new_accessible_name(app, accessible_name); + } return; } @@ -1212,18 +1259,18 @@ get_applications (ApplicationServiceAppstore * appstore) continue; } - g_variant_builder_add (&builder, "(sisosss)", app->icon, + g_variant_builder_add (&builder, "(sisossss)", app->icon, position++, app->dbus_name, app->menu, app->icon_theme_path, app->label, - app->guide); + app->guide, app->accessible_name); } out = g_variant_builder_end(&builder); } else { GError * error = NULL; - out = g_variant_parse(g_variant_type_new("a(sisosss)"), "[]", NULL, NULL, &error); + out = g_variant_parse(g_variant_type_new("a(sisossss)"), "[]", NULL, NULL, &error); if (error != NULL) { - g_warning("Unable to parse '[]' as a 'a(sisosss)': %s", error->message); + g_warning("Unable to parse '[]' as a 'a(sisossss)': %s", error->message); out = NULL; g_error_free(error); } diff --git a/src/application-service.xml b/src/application-service.xml index 1ad7030..8693c52 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -26,7 +26,7 @@ with this program. If not, see . - + @@ -44,6 +44,7 @@ with this program. If not, see . + @@ -61,5 +62,9 @@ with this program. If not, see . + + + + diff --git a/src/indicator-application.c b/src/indicator-application.c index cd83bdf..098644b 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -115,11 +115,12 @@ 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 (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide); +static void application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_name); static void application_removed (IndicatorApplication * application, gint position); static void application_label_changed (IndicatorApplication * application, gint position, const gchar * label, const gchar * guide); static void application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname); static void application_icon_theme_path_changed (IndicatorApplication * application, gint position, const gchar * icon_theme_path); +static void application_accessible_name_changed (IndicatorApplication * application, gint position, const gchar * accessible_name); static void get_applications (GObject * obj, GAsyncResult * res, gpointer user_data); static void get_applications_helper (IndicatorApplication * self, GVariant * variant); static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir); @@ -450,7 +451,7 @@ guess_label_size (ApplicationEntry * app) ApplicationEntry and signaling the indicator host that we've got a new indicator. */ static void -application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide) +application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_name) { g_return_if_fail(IS_INDICATOR_APPLICATION(application)); g_debug("Building new application entry: %s with icon: %s at position %i", dbusaddress, iconname, position); @@ -499,6 +500,12 @@ application_added (IndicatorApplication * application, const gchar * iconname, g guess_label_size(app); } + if (accessible_name == NULL || accessible_name[0] == '\0') { + app->entry.accessible_name = NULL; + } else { + app->entry.accessible_name = g_strdup(accessible_name); + } + app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); /* Keep copies of these for ourself, just in case. */ @@ -700,6 +707,65 @@ application_icon_theme_path_changed (IndicatorApplication * application, gint po return; } +/* The callback for the signal that the accessible name for an application + has changed. */ +static void +application_accessible_name_changed (IndicatorApplication * application, gint position, const gchar * accessible_name) +{ + 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 (accessible_name == NULL || accessible_name[0] == '\0') { + /* No accessible_name, let's see if we need to delete the old one */ + if (app->entry.accessible_name != NULL) { + app->entry.accessible_name = NULL; + signal_reload = TRUE; + } + } else { + app->entry.accessible_name = g_strdup(accessible_name); + + signal_reload = TRUE; + } + + 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; + +} + /* Receives all signals from the service, routed to the appropriate functions */ static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, @@ -715,11 +781,14 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, const gchar * icon_theme_path; const gchar * label; const gchar * guide; - g_variant_get (parameters, "(&si&s&o&s&s&s)", &iconname, + const gchar * accessible_name; + g_variant_get (parameters, "(&si&s&o&s&s&s&s)", &iconname, &position, &dbusaddress, &dbusobject, - &icon_theme_path, &label, &guide); + &icon_theme_path, &label, &guide, + &accessible_name); application_added(self, iconname, position, dbusaddress, - dbusobject, icon_theme_path, label, guide); + dbusobject, icon_theme_path, label, guide, + accessible_name); } else if (g_strcmp0(signal_name, "ApplicationRemoved") == 0) { gint position; @@ -745,6 +814,12 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, g_variant_get (parameters, "(i&s&s)", &position, &label, &guide); application_label_changed(self, position, label, guide); } + else if (g_strcmp0(signal_name, "ApplicationAccessibleNameChanged") == 0) { + gint position; + const gchar * accessible_name; + g_variant_get (parameters, "(i&s)", &position, &accessible_name); + application_accessible_name_changed(self, position, accessible_name); + } return; } @@ -768,7 +843,7 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) return; } - g_variant_get(result, "(a(sisosss))", &iter); + g_variant_get(result, "(a(sisossss))", &iter); while ((child = g_variant_iter_next_value (iter))) get_applications_helper(self, child); g_variant_iter_free (iter); @@ -788,11 +863,12 @@ get_applications_helper (IndicatorApplication * self, GVariant * variant) const gchar * icon_theme_path; const gchar * label; const gchar * guide; - g_variant_get(variant, "(sisosss)", &icon_name, &position, + const gchar * accessible_name; + g_variant_get(variant, "(sisossss)", &icon_name, &position, &dbus_address, &dbus_object, &icon_theme_path, &label, - &guide); + &guide, &accessible_name); - return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide); + return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_name); } /* Unrefs a theme directory. This may involve removing it from -- cgit v1.2.3 From a958e07de2cb9148a261187600b10598f60bbb69 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 8 Feb 2011 17:57:32 +1100 Subject: accessible_name -> accessible_desc --- src/application-service-appstore.c | 50 +++++++++++++++++++------------------- src/application-service.xml | 6 ++--- src/indicator-application.c | 48 ++++++++++++++++++------------------ 3 files changed, 52 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index fcd7f24..6c4ec02 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -49,14 +49,14 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" #define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" #define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" -#define NOTIFICATION_ITEM_PROP_ACCESSIBLE_NAME "AccessibleName" +#define NOTIFICATION_ITEM_PROP_ACCESSIBLE_DESC "AccessibleDesc" #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 "XAyatanaNewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" -#define NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_NAME "NewAccessibleName" +#define NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_DESC "NewAccessibleDesc" #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" #define OVERRIDE_FILE_NAME "ordering-override.keyfile" @@ -106,7 +106,7 @@ struct _Application { gchar * icon_theme_path; gchar * label; gchar * guide; - gchar * accessible_name; + gchar * accessible_desc; gboolean currently_free; guint ordering_index; GList * approved_by; @@ -434,7 +434,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, GVariant * menu = NULL, * id = NULL, * category = NULL, * status = NULL, * icon_name = NULL, * aicon_name = NULL, * icon_theme_path = NULL, * index = NULL, * label = NULL, - * guide = NULL, * accessible_name = NULL; + * guide = NULL, * accessible_desc = NULL; GVariant * properties = g_dbus_proxy_call_finish(app->props, res, &error); @@ -477,8 +477,8 @@ got_all_properties (GObject * source_object, GAsyncResult * res, label = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_LABEL_GUIDE) == 0) { guide = g_variant_ref(value); - } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ACCESSIBLE_NAME) == 0) { - accessible_name = g_variant_ref(value); + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ACCESSIBLE_DESC) == 0) { + accessible_desc = g_variant_ref(value); } /* else ignore */ } g_variant_iter_free (iter); @@ -533,10 +533,10 @@ got_all_properties (GObject * source_object, GAsyncResult * res, app->guide = g_strdup(""); } - if (accessible_name != NULL) { - app->accessible_name = g_variant_dup_string(accessible_name, NULL); + if (accessible_desc != NULL) { + app->accessible_desc = g_variant_dup_string(accessible_desc, NULL); } else { - app->accessible_name = g_strdup(""); + app->accessible_desc = g_strdup(""); } g_list_foreach(priv->approvers, check_with_old_approver, app); @@ -559,7 +559,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, if (index) g_variant_unref (index); if (label) g_variant_unref (label); if (guide) g_variant_unref (guide); - if (accessible_name) g_variant_unref (accessible_name); + if (accessible_desc) g_variant_unref (accessible_desc); return; } @@ -737,8 +737,8 @@ application_free (Application * app) if (app->approved_by != NULL) { g_list_free(app->approved_by); } - if (app->accessible_name != NULL) { - g_free(app->accessible_name); + if (app->accessible_desc != NULL) { + g_free(app->accessible_desc); } g_free(app); @@ -853,7 +853,7 @@ apply_status (Application * app) app->dbus_name, app->menu, app->icon_theme_path, app->label, app->guide, - app->accessible_name)); + app->accessible_desc)); } else { /* Icon update */ gint position = get_position(app); @@ -943,17 +943,17 @@ new_label (Application * app, const gchar * label, const gchar * guide) } static void -new_accessible_name (Application * app, const gchar * accessible_name) +new_accessible_desc (Application * app, const gchar * accessible_desc) { gboolean changed = FALSE; - if (g_strcmp0(app->accessible_name, accessible_name) != 0) { + if (g_strcmp0(app->accessible_desc, accessible_desc) != 0) { changed = TRUE; - if (app->accessible_name != NULL) { - g_free(app->accessible_name); - app->accessible_name = NULL; + if (app->accessible_desc != NULL) { + g_free(app->accessible_desc); + app->accessible_desc = NULL; } - app->accessible_name = g_strdup(accessible_name); + app->accessible_desc = g_strdup(accessible_desc); } if (changed) { @@ -962,7 +962,7 @@ new_accessible_name (Application * app, const gchar * accessible_name) emit_signal (app->appstore, "ApplicationAccessibleNameChanged", g_variant_new ("(is)", position, - app->accessible_name != NULL ? app->accessible_name : "")); + app->accessible_desc != NULL ? app->accessible_desc : "")); } return; @@ -1166,10 +1166,10 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name g_variant_get(parameters, "(&s&s)", &label, &guide); new_label(app, label, guide); } - else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_NAME) == 0) { - const gchar * accessible_name; - g_variant_get(parameters, "(&s)", &accessible_name); - new_accessible_name(app, accessible_name); + else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_DESC) == 0) { + const gchar * accessible_desc; + g_variant_get(parameters, "(&s)", &accessible_desc); + new_accessible_desc(app, accessible_desc); } return; @@ -1262,7 +1262,7 @@ get_applications (ApplicationServiceAppstore * appstore) g_variant_builder_add (&builder, "(sisossss)", app->icon, position++, app->dbus_name, app->menu, app->icon_theme_path, app->label, - app->guide, app->accessible_name); + app->guide, app->accessible_desc); } out = g_variant_builder_end(&builder); diff --git a/src/application-service.xml b/src/application-service.xml index 8693c52..fc65c40 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -44,7 +44,7 @@ with this program. If not, see . - + @@ -62,9 +62,9 @@ with this program. If not, see . - + - + diff --git a/src/indicator-application.c b/src/indicator-application.c index 098644b..785f0b6 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -115,12 +115,12 @@ 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 (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_name); +static void application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_desc); static void application_removed (IndicatorApplication * application, gint position); static void application_label_changed (IndicatorApplication * application, gint position, const gchar * label, const gchar * guide); static void application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname); static void application_icon_theme_path_changed (IndicatorApplication * application, gint position, const gchar * icon_theme_path); -static void application_accessible_name_changed (IndicatorApplication * application, gint position, const gchar * accessible_name); +static void application_accessible_desc_changed (IndicatorApplication * application, gint position, const gchar * accessible_desc); static void get_applications (GObject * obj, GAsyncResult * res, gpointer user_data); static void get_applications_helper (IndicatorApplication * self, GVariant * variant); static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir); @@ -451,7 +451,7 @@ guess_label_size (ApplicationEntry * app) ApplicationEntry and signaling the indicator host that we've got a new indicator. */ static void -application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_name) +application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_desc) { g_return_if_fail(IS_INDICATOR_APPLICATION(application)); g_debug("Building new application entry: %s with icon: %s at position %i", dbusaddress, iconname, position); @@ -500,10 +500,10 @@ application_added (IndicatorApplication * application, const gchar * iconname, g guess_label_size(app); } - if (accessible_name == NULL || accessible_name[0] == '\0') { - app->entry.accessible_name = NULL; + if (accessible_desc == NULL || accessible_desc[0] == '\0') { + app->entry.accessible_desc = NULL; } else { - app->entry.accessible_name = g_strdup(accessible_name); + app->entry.accessible_desc = g_strdup(accessible_desc); } app->entry.menu = GTK_MENU(dbusmenu_gtkmenu_new((gchar *)dbusaddress, (gchar *)dbusobject)); @@ -707,10 +707,10 @@ application_icon_theme_path_changed (IndicatorApplication * application, gint po return; } -/* The callback for the signal that the accessible name for an application - has changed. */ +/* The callback for the signal that the accessible description for + an application has changed. */ static void -application_accessible_name_changed (IndicatorApplication * application, gint position, const gchar * accessible_name) +application_accessible_desc_changed (IndicatorApplication * application, gint position, const gchar * accessible_desc) { IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position); @@ -721,14 +721,14 @@ application_accessible_name_changed (IndicatorApplication * application, gint po return; } - if (accessible_name == NULL || accessible_name[0] == '\0') { - /* No accessible_name, let's see if we need to delete the old one */ - if (app->entry.accessible_name != NULL) { - app->entry.accessible_name = NULL; + if (accessible_desc == NULL || accessible_desc[0] == '\0') { + /* No accessible_desc, let's see if we need to delete the old one */ + if (app->entry.accessible_desc != NULL) { + app->entry.accessible_desc = NULL; signal_reload = TRUE; } } else { - app->entry.accessible_name = g_strdup(accessible_name); + app->entry.accessible_desc = g_strdup(accessible_desc); signal_reload = TRUE; } @@ -781,14 +781,14 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, const gchar * icon_theme_path; const gchar * label; const gchar * guide; - const gchar * accessible_name; + const gchar * accessible_desc; g_variant_get (parameters, "(&si&s&o&s&s&s&s)", &iconname, &position, &dbusaddress, &dbusobject, &icon_theme_path, &label, &guide, - &accessible_name); + &accessible_desc); application_added(self, iconname, position, dbusaddress, dbusobject, icon_theme_path, label, guide, - accessible_name); + accessible_desc); } else if (g_strcmp0(signal_name, "ApplicationRemoved") == 0) { gint position; @@ -814,11 +814,11 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, g_variant_get (parameters, "(i&s&s)", &position, &label, &guide); application_label_changed(self, position, label, guide); } - else if (g_strcmp0(signal_name, "ApplicationAccessibleNameChanged") == 0) { + else if (g_strcmp0(signal_name, "ApplicationAccessibleDescChanged") == 0) { gint position; - const gchar * accessible_name; - g_variant_get (parameters, "(i&s)", &position, &accessible_name); - application_accessible_name_changed(self, position, accessible_name); + const gchar * accessible_desc; + g_variant_get (parameters, "(i&s)", &position, &accessible_desc); + application_accessible_desc_changed(self, position, accessible_desc); } return; @@ -863,12 +863,12 @@ get_applications_helper (IndicatorApplication * self, GVariant * variant) const gchar * icon_theme_path; const gchar * label; const gchar * guide; - const gchar * accessible_name; + const gchar * accessible_desc; g_variant_get(variant, "(sisossss)", &icon_name, &position, &dbus_address, &dbus_object, &icon_theme_path, &label, - &guide, &accessible_name); + &guide, &accessible_desc); - return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_name); + return application_added(self, icon_name, position, dbus_address, dbus_object, icon_theme_path, label, guide, accessible_desc); } /* Unrefs a theme directory. This may involve removing it from -- cgit v1.2.3 From 70d0a4d38b318a28abe7d6397c83c5b7ecb55c57 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Fri, 11 Feb 2011 07:53:12 +1100 Subject: Use the ACCESSIBLE_DESC_UPDATE signal to refresh the accessible description. --- src/indicator-application.c | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index 785f0b6..086692e 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -734,33 +734,9 @@ application_accessible_desc_changed (IndicatorApplication * application, gint po } 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); - } + /* Unlike the label change, we don't need to remove and re-add + the indicator to update the accessible description. */ + g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &(app->entry), TRUE); return; -- cgit v1.2.3 From d2a8021a93f72378985d87de5cd80f2d0ef93006 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Fri, 11 Feb 2011 10:07:18 -0500 Subject: update label too in update_status --- src/application-service-appstore.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 23047b4..3d9e49d 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -845,6 +845,10 @@ apply_status (Application * app) emit_signal (appstore, "ApplicationIconChanged", g_variant_new ("(is)", position, newicon)); + emit_signal (appstore, "ApplicationLabelChanged", + g_variant_new ("(iss)", position, + app->label != NULL ? app->label : "", + app->guide != NULL ? app->guide : "")); } } -- cgit v1.2.3 From fb64a7a187bd7878528b76ebf8fc86159c9ed443 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Fri, 11 Feb 2011 10:25:25 -0500 Subject: don't abort on various unexpected situations; just spit out critical warning --- src/application-service-appstore.c | 18 +++++++++--------- src/indicator-application.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 23047b4..04becf7 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -163,7 +163,7 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass) node_info = g_dbus_node_info_new_for_xml(_application_service, &error); if (error != NULL) { - g_error("Unable to parse Application Service Interface description: %s", error->message); + g_critical("Unable to parse Application Service Interface description: %s", error->message); g_error_free(error); } } @@ -172,7 +172,7 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass) interface_info = g_dbus_node_info_lookup_interface(node_info, INDICATOR_APPLICATION_DBUS_IFACE); if (interface_info == NULL) { - g_error("Unable to find interface '" INDICATOR_APPLICATION_DBUS_IFACE "'"); + g_critical("Unable to find interface '" INDICATOR_APPLICATION_DBUS_IFACE "'"); } } @@ -215,7 +215,7 @@ bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data) GDBusConnection * connection = g_bus_get_finish(res, &error); if (error != NULL) { - g_error("OMG! Unable to get a connection to DBus: %s", error->message); + g_critical("OMG! Unable to get a connection to DBus: %s", error->message); g_error_free(error); return; } @@ -240,7 +240,7 @@ bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data) &error); if (error != NULL) { - g_error("Unable to register the object to DBus: %s", error->message); + g_critical("Unable to register the object to DBus: %s", error->message); g_error_free(error); return; } @@ -441,7 +441,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, } if (error != NULL) { - g_error("Could not grab DBus properties for %s: %s", app->dbus_name, error->message); + g_critical("Could not grab DBus properties for %s: %s", app->dbus_name, error->message); g_error_free(error); if (!app->validated) application_free(app); @@ -773,7 +773,7 @@ emit_signal (ApplicationServiceAppstore * appstore, const gchar * name, &error); if (error != NULL) { - g_error("Unable to send %s signal: %s", name, error->message); + g_critical("Unable to send %s signal: %s", name, error->message); g_error_free(error); return; } @@ -1021,7 +1021,7 @@ dbus_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) } if (error != NULL) { - g_error("Could not grab DBus proxy for %s: %s", app->dbus_name, error->message); + g_critical("Could not grab DBus proxy for %s: %s", app->dbus_name, error->message); g_error_free(error); application_free(app); return; @@ -1077,7 +1077,7 @@ props_cb (GObject * object, GAsyncResult * res, gpointer user_data) } if (error != NULL) { - g_error("Could not grab Properties DBus proxy for %s: %s", app->dbus_name, error->message); + g_critical("Could not grab Properties DBus proxy for %s: %s", app->dbus_name, error->message); g_error_free(error); application_free(app); return; @@ -1416,7 +1416,7 @@ approver_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) } if (error != NULL) { - g_error("Could not grab DBus proxy for approver: %s", error->message); + g_critical("Could not grab DBus proxy for approver: %s", error->message); g_error_free(error); return; } diff --git a/src/indicator-application.c b/src/indicator-application.c index cd83bdf..2fbdb13 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -279,7 +279,7 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) } if (error != NULL) { - g_error("Could not grab DBus proxy for %s: %s", INDICATOR_APPLICATION_DBUS_ADDR, error->message); + g_critical("Could not grab DBus proxy for %s: %s", INDICATOR_APPLICATION_DBUS_ADDR, error->message); g_error_free(error); return; } -- cgit v1.2.3 From f614bf09906d0bc9230fbf35522ae2f10a026b41 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 18 Feb 2011 23:32:53 -0600 Subject: Ensures the accessible description is NULL --- src/indicator-application.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index 2fbdb13..c18c2b0 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -456,7 +456,7 @@ application_added (IndicatorApplication * application, const gchar * iconname, g g_debug("Building new application entry: %s with icon: %s at position %i", dbusaddress, iconname, position); IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); - ApplicationEntry * app = g_new(ApplicationEntry, 1); + ApplicationEntry * app = g_new0(ApplicationEntry, 1); app->old_service = FALSE; app->icon_theme_path = NULL; -- cgit v1.2.3 From ab57d4162744d35bb08280d5922ce4044dec2042 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Feb 2011 20:48:03 -0600 Subject: Adding a missing brace --- src/indicator-application.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/indicator-application.c b/src/indicator-application.c index 086692e..84864b8 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -737,6 +737,7 @@ application_accessible_desc_changed (IndicatorApplication * application, gint po /* Unlike the label change, we don't need to remove and re-add the indicator to update the accessible description. */ g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &(app->entry), TRUE); + } return; -- cgit v1.2.3 From 1cfc978dbf1df5ed02adc9a57f22d67d04621d06 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 21:50:05 -0600 Subject: Switching things around so the icon switches with the description all the way up the stack --- src/application-service-appstore.c | 74 ++++++++++++-------------------------- src/application-service.xml | 5 +-- src/indicator-application.c | 70 ++++++++++++------------------------ 3 files changed, 46 insertions(+), 103 deletions(-) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 6c4ec02..da49b4c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -43,20 +43,20 @@ static void props_cb (GObject * object, GAsyncResult * res, gpointer user_data); #define NOTIFICATION_ITEM_PROP_CATEGORY "Category" #define NOTIFICATION_ITEM_PROP_STATUS "Status" #define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName" +#define NOTIFICATION_ITEM_PROP_ICON_DESC "IconAccessibleDesc" #define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" +#define NOTIFICATION_ITEM_PROP_AICON_DESC "AttentionAccessibleDesc" #define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath" #define NOTIFICATION_ITEM_PROP_MENU "Menu" #define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" #define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" #define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" -#define NOTIFICATION_ITEM_PROP_ACCESSIBLE_DESC "AccessibleDesc" #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 "XAyatanaNewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" -#define NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_DESC "NewAccessibleDesc" #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" #define OVERRIDE_FILE_NAME "ordering-override.keyfile" @@ -101,12 +101,13 @@ struct _Application { gboolean validated; /* Whether we've gotten all the parameters and they look good. */ AppIndicatorStatus status; gchar * icon; + gchar * icon_desc; gchar * aicon; + gchar * aicon_desc; gchar * menu; gchar * icon_theme_path; gchar * label; gchar * guide; - gchar * accessible_desc; gboolean currently_free; guint ordering_index; GList * approved_by; @@ -433,8 +434,9 @@ got_all_properties (GObject * source_object, GAsyncResult * res, ApplicationServiceAppstorePrivate * priv = app->appstore->priv; GVariant * menu = NULL, * id = NULL, * category = NULL, * status = NULL, * icon_name = NULL, * aicon_name = NULL, + * icon_desc = NULL, * aicon_desc = NULL, * icon_theme_path = NULL, * index = NULL, * label = NULL, - * guide = NULL, * accessible_desc = NULL; + * guide = NULL; GVariant * properties = g_dbus_proxy_call_finish(app->props, res, &error); @@ -467,8 +469,12 @@ got_all_properties (GObject * source_object, GAsyncResult * res, status = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ICON_NAME) == 0) { icon_name = g_variant_ref(value); + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ICON_DESC) == 0) { + icon_desc = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_AICON_NAME) == 0) { aicon_name = g_variant_ref(value); + } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_AICON_DESC) == 0) { + aicon_desc = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ICON_THEME_PATH) == 0) { icon_theme_path = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ORDERING_INDEX) == 0) { @@ -477,8 +483,6 @@ got_all_properties (GObject * source_object, GAsyncResult * res, label = g_variant_ref(value); } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_LABEL_GUIDE) == 0) { guide = g_variant_ref(value); - } else if (g_strcmp0(name, NOTIFICATION_ITEM_PROP_ACCESSIBLE_DESC) == 0) { - accessible_desc = g_variant_ref(value); } /* else ignore */ } g_variant_iter_free (iter); @@ -533,12 +537,6 @@ got_all_properties (GObject * source_object, GAsyncResult * res, app->guide = g_strdup(""); } - if (accessible_desc != NULL) { - app->accessible_desc = g_variant_dup_string(accessible_desc, NULL); - } else { - app->accessible_desc = g_strdup(""); - } - g_list_foreach(priv->approvers, check_with_old_approver, app); apply_status(app); @@ -554,12 +552,13 @@ got_all_properties (GObject * source_object, GAsyncResult * res, if (category) g_variant_unref (category); if (status) g_variant_unref (status); if (icon_name) g_variant_unref (icon_name); + if (icon_desc) g_variant_unref (icon_desc); if (aicon_name) g_variant_unref (aicon_name); + if (aicon_desc) g_variant_unref (aicon_desc); if (icon_theme_path) g_variant_unref (icon_theme_path); if (index) g_variant_unref (index); if (label) g_variant_unref (label); if (guide) g_variant_unref (guide); - if (accessible_desc) g_variant_unref (accessible_desc); return; } @@ -719,8 +718,11 @@ application_free (Application * app) if (app->icon != NULL) { g_free(app->icon); } - if (app->aicon != NULL) { - g_free(app->aicon); + if (app->icon_desc != NULL) { + g_free(app->icon_desc); + } + if (app->aicon_desc != NULL) { + g_free(app->aicon_desc); } if (app->menu != NULL) { g_free(app->menu); @@ -737,9 +739,6 @@ application_free (Application * app) if (app->approved_by != NULL) { g_list_free(app->approved_by); } - if (app->accessible_desc != NULL) { - g_free(app->accessible_desc); - } g_free(app); return; @@ -840,8 +839,10 @@ apply_status (Application * app) } else { /* Figure out which icon we should be using */ gchar * newicon = app->icon; + gchar * newdesc = app->icon_desc; if (app->status == APP_INDICATOR_STATUS_ATTENTION && app->aicon != NULL && app->aicon[0] != '\0') { newicon = app->aicon; + newdesc = app->aicon_desc; } /* Determine whether we're already shown or not */ @@ -853,14 +854,14 @@ apply_status (Application * app) app->dbus_name, app->menu, app->icon_theme_path, app->label, app->guide, - app->accessible_desc)); + newdesc)); } else { /* Icon update */ gint position = get_position(app); if (position == -1) return; emit_signal (appstore, "ApplicationIconChanged", - g_variant_new ("(is)", position, newicon)); + g_variant_new ("(iss)", position, newicon, newdesc)); } } @@ -942,32 +943,6 @@ new_label (Application * app, const gchar * label, const gchar * guide) return; } -static void -new_accessible_desc (Application * app, const gchar * accessible_desc) -{ - gboolean changed = FALSE; - - if (g_strcmp0(app->accessible_desc, accessible_desc) != 0) { - changed = TRUE; - if (app->accessible_desc != NULL) { - g_free(app->accessible_desc); - app->accessible_desc = NULL; - } - app->accessible_desc = g_strdup(accessible_desc); - } - - if (changed) { - gint position = get_position(app); - if (position == -1) return; - - emit_signal (app->appstore, "ApplicationAccessibleNameChanged", - g_variant_new ("(is)", position, - app->accessible_desc != NULL ? app->accessible_desc : "")); - } - - return; -} - /* Adding a new NotificationItem object from DBus in to the appstore. First, we need to get the information on it though. */ @@ -1166,11 +1141,6 @@ app_receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name g_variant_get(parameters, "(&s&s)", &label, &guide); new_label(app, label, guide); } - else if (g_strcmp0(signal_name, NOTIFICATION_ITEM_SIG_NEW_ACCESSIBLE_DESC) == 0) { - const gchar * accessible_desc; - g_variant_get(parameters, "(&s)", &accessible_desc); - new_accessible_desc(app, accessible_desc); - } return; } @@ -1262,7 +1232,7 @@ get_applications (ApplicationServiceAppstore * appstore) g_variant_builder_add (&builder, "(sisossss)", app->icon, position++, app->dbus_name, app->menu, app->icon_theme_path, app->label, - app->guide, app->accessible_desc); + app->guide, app->icon_desc); } out = g_variant_builder_end(&builder); diff --git a/src/application-service.xml b/src/application-service.xml index fc65c40..f3164ef 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -52,6 +52,7 @@ with this program. If not, see . + @@ -62,9 +63,5 @@ with this program. If not, see . - - - - diff --git a/src/indicator-application.c b/src/indicator-application.c index 84864b8..455abcb 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -118,9 +118,8 @@ static void disconnected_kill_helper (gpointer data, gpointer user_data); static void application_added (IndicatorApplication * application, const gchar * iconname, gint position, const gchar * dbusaddress, const gchar * dbusobject, const gchar * icon_theme_path, const gchar * label, const gchar * guide, const gchar * accessible_desc); static void application_removed (IndicatorApplication * application, gint position); static void application_label_changed (IndicatorApplication * application, gint position, const gchar * label, const gchar * guide); -static void application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname); +static void application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname, const gchar * icondesc); static void application_icon_theme_path_changed (IndicatorApplication * application, gint position, const gchar * icon_theme_path); -static void application_accessible_desc_changed (IndicatorApplication * application, gint position, const gchar * accessible_desc); static void get_applications (GObject * obj, GAsyncResult * res, gpointer user_data); static void get_applications_helper (IndicatorApplication * self, GVariant * variant); static void theme_dir_unref(IndicatorApplication * ia, const gchar * dir); @@ -651,7 +650,7 @@ application_label_changed (IndicatorApplication * application, gint position, co /* The callback for the signal that the icon for an application has changed. */ static void -application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname) +application_icon_changed (IndicatorApplication * application, gint position, const gchar * iconname, const gchar * icondesc) { IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(application); ApplicationEntry * app = (ApplicationEntry *)g_list_nth_data(priv->applications, position); @@ -661,6 +660,11 @@ application_icon_changed (IndicatorApplication * application, gint position, con return; } + if (iconname == NULL) { + g_warning("We can't have a NULL icon name on %d", position); + return; + } + /* 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. */ @@ -675,6 +679,19 @@ application_icon_changed (IndicatorApplication * application, gint position, con } indicator_image_helper_update(app->entry.image, app->longname); + if (g_strcmp0(app->entry.accessible_desc, icondesc) != 0) { + if (app->entry.accessible_desc != NULL) { + g_free((gchar *)app->entry.accessible_desc); + app->entry.accessible_desc = NULL; + } + + if (icondesc != NULL && icondesc[0] != '\0') { + app->entry.accessible_desc = g_strdup(icondesc); + } + + g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &(app->entry), TRUE); + } + return; } @@ -707,42 +724,6 @@ application_icon_theme_path_changed (IndicatorApplication * application, gint po return; } -/* The callback for the signal that the accessible description for - an application has changed. */ -static void -application_accessible_desc_changed (IndicatorApplication * application, gint position, const gchar * accessible_desc) -{ - 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 (accessible_desc == NULL || accessible_desc[0] == '\0') { - /* No accessible_desc, let's see if we need to delete the old one */ - if (app->entry.accessible_desc != NULL) { - app->entry.accessible_desc = NULL; - signal_reload = TRUE; - } - } else { - app->entry.accessible_desc = g_strdup(accessible_desc); - - signal_reload = TRUE; - } - - if (signal_reload) { - /* Unlike the label change, we don't need to remove and re-add - the indicator to update the accessible description. */ - g_signal_emit(G_OBJECT(application), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &(app->entry), TRUE); - } - - return; - -} - /* Receives all signals from the service, routed to the appropriate functions */ static void receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, @@ -775,8 +756,9 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, else if (g_strcmp0(signal_name, "ApplicationIconChanged") == 0) { gint position; const gchar * iconname; - g_variant_get (parameters, "(i&s)", &position, &iconname); - application_icon_changed(self, position, iconname); + const gchar * icondesc; + g_variant_get (parameters, "(i&s&s)", &position, &iconname, &icondesc); + application_icon_changed(self, position, iconname, icondesc); } else if (g_strcmp0(signal_name, "ApplicationIconThemePathChanged") == 0) { gint position; @@ -791,12 +773,6 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, g_variant_get (parameters, "(i&s&s)", &position, &label, &guide); application_label_changed(self, position, label, guide); } - else if (g_strcmp0(signal_name, "ApplicationAccessibleDescChanged") == 0) { - gint position; - const gchar * accessible_desc; - g_variant_get (parameters, "(i&s)", &position, &accessible_desc); - application_accessible_desc_changed(self, position, accessible_desc); - } return; } -- cgit v1.2.3 From 419c9a428454f5ce887c0ae8a89871e7b43b65b5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 24 Feb 2011 22:02:15 -0600 Subject: Making sure we have a description for the variant world --- src/application-service-appstore.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 18dac5e..10feef5 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -845,6 +845,10 @@ apply_status (Application * app) newdesc = app->aicon_desc; } + if (newdesc == NULL) { + newdesc = ""; + } + /* Determine whether we're already shown or not */ if (app->visible_state == VISIBLE_STATE_HIDDEN) { /* Put on panel */ -- cgit v1.2.3