diff options
author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2013-07-30 06:25:22 +0200 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-07-30 06:25:22 +0200 |
commit | ed4b69482684c7070c928af4966ba52c32bf041b (patch) | |
tree | b3f075994c05ed60dd4898e48ece7bb4437098e9 /libqmenumodel | |
parent | 16b480d00dd5c1fba5252e728cfc71aaa5cc916f (diff) | |
download | qmenumodel-ed4b69482684c7070c928af4966ba52c32bf041b.tar.gz qmenumodel-ed4b69482684c7070c928af4966ba52c32bf041b.tar.bz2 qmenumodel-ed4b69482684c7070c928af4966ba52c32bf041b.zip |
unitymenumodel: lookup themed icon before turning it into a uri
Diffstat (limited to 'libqmenumodel')
-rw-r--r-- | libqmenumodel/src/unitymenumodel.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
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 <QIcon> + 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; |