From ed4b69482684c7070c928af4966ba52c32bf041b Mon Sep 17 00:00:00 2001 From: Nick Dedekind Date: Tue, 30 Jul 2013 06:25:22 +0200 Subject: unitymenumodel: lookup themed icon before turning it into a uri --- libqmenumodel/src/unitymenumodel.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'libqmenumodel') diff --git a/libqmenumodel/src/unitymenumodel.cpp b/libqmenumodel/src/unitymenumodel.cpp index d40c813..58dd84b 100644 --- a/libqmenumodel/src/unitymenumodel.cpp +++ b/libqmenumodel/src/unitymenumodel.cpp @@ -19,6 +19,8 @@ #include "unitymenumodel.h" #include "converter.h" +#include + extern "C" { #include "gtk/gtkactionmuxer.h" #include "gtk/gtkmenutracker.h" @@ -304,11 +306,15 @@ static QString iconUri(GIcon *icon) QString uri; if (G_IS_THEMED_ICON (icon)) { - const gchar * const *names; - - names = g_themed_icon_get_names (G_THEMED_ICON (icon)); - if (names && names[0] && *names[0]) - uri = QString("image://theme/") + names[0]; + const gchar* const* iconNames = g_themed_icon_get_names (G_THEMED_ICON (icon)); + guint index = 0; + while(iconNames[index] != NULL) { + if (QIcon::hasThemeIcon(iconNames[index])) { + uri = QString("image://theme/") + iconNames[index]; + break; + } + index++; + } } else if (G_IS_FILE_ICON (icon)) { GFile *file; -- cgit v1.2.3