[gnome-software] Show a more correct warning message if the icon type is not supported
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Show a more correct warning message if the icon type is not supported
- Date: Wed, 2 Oct 2013 08:54:36 +0000 (UTC)
commit c6e552487f68ab7e9d5b09dd978e137d0cb80bab
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 2 08:25:52 2013 +0100
Show a more correct warning message if the icon type is not supported
src/plugins/appstream-cache.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/appstream-cache.c b/src/plugins/appstream-cache.c
index c08301d..c512844 100644
--- a/src/plugins/appstream-cache.c
+++ b/src/plugins/appstream-cache.c
@@ -123,8 +123,10 @@ appstream_cache_start_element_cb (GMarkupParseContext *context,
gpointer user_data,
GError **error)
{
+ AppstreamAppIconKind icon_kind;
AppstreamCacheHelper *helper = (AppstreamCacheHelper *) user_data;
AppstreamTag section_new;
+ const gchar *tmp = NULL;
guint i;
/* process tag start */
@@ -158,16 +160,26 @@ appstream_cache_start_element_cb (GMarkupParseContext *context,
/* get the icon kind */
for (i = 0; attribute_names[i] != NULL; i++) {
if (g_strcmp0 (attribute_names[i], "type") == 0) {
- appstream_app_set_icon_kind (helper->item_temp,
- appstream_cache_icon_kind_from_string
(attribute_values[i]));
+ tmp = attribute_values[i];
break;
}
}
- if (appstream_app_get_icon_kind (helper->item_temp) == APPSTREAM_APP_ICON_KIND_UNKNOWN) {
+ if (tmp == NULL) {
g_set_error_literal (error,
APPSTREAM_CACHE_ERROR,
APPSTREAM_CACHE_ERROR_FAILED,
"icon type not set");
+ } else {
+ icon_kind = appstream_cache_icon_kind_from_string (tmp);
+ if (icon_kind == APPSTREAM_APP_ICON_KIND_UNKNOWN) {
+ g_set_error (error,
+ APPSTREAM_CACHE_ERROR,
+ APPSTREAM_CACHE_ERROR_FAILED,
+ "icon type '%s' not supported", tmp);
+ } else {
+ appstream_app_set_icon_kind (helper->item_temp,
+ icon_kind);
+ }
}
break;
case APPSTREAM_TAG_ID:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]