summaryrefslogtreecommitdiffstats
path: root/src/gui/styles
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-09 18:49:56 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-09 21:05:49 (GMT)
commite361321e156bf1123e0d670c052307dc00f6d3f4 (patch)
treedf95e7f04608f89f91cb567de013cb3c9c3d92cc /src/gui/styles
parent995de3e31aef578b87cdb7a1762d6bc465d21651 (diff)
downloadQt-e361321e156bf1123e0d670c052307dc00f6d3f4.zip
Qt-e361321e156bf1123e0d670c052307dc00f6d3f4.tar.gz
Qt-e361321e156bf1123e0d670c052307dc00f6d3f4.tar.bz2
Fixed getting an icon for a file on the filesystem with gnome.
According to the documentation gnome_icon_lookup_sync() can return an absolute file path for the icon, so we check if the returned string starts like a path, then we load the icon from the file. This also fixes compilation warnings. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/gui/styles')
-rw-r--r--src/gui/styles/gtksymbols.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/styles/gtksymbols.cpp b/src/gui/styles/gtksymbols.cpp
index d62f717..6ec5796 100644
--- a/src/gui/styles/gtksymbols.cpp
+++ b/src/gui/styles/gtksymbols.cpp
@@ -984,15 +984,18 @@ QIcon QGtk::getFilesystemIcon(const QFileInfo &info)
if (QGtk::gnome_vfs_init && QGtk::gnome_icon_lookup_sync) {
QGtk::gnome_vfs_init();
GtkIconTheme *theme = QGtk::gtk_icon_theme_get_default();
- QString fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded();
+ QByteArray fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded();
char * icon_name = QGtk::gnome_icon_lookup_sync(theme,
NULL,
- qPrintable(fileurl),
+ fileurl.data(),
NULL,
GNOME_ICON_LOOKUP_FLAGS_NONE,
NULL);
- return QIcon::fromTheme(icon_name);
+ QString iconName = QString::fromUtf8(icon_name);
g_free(icon_name);
+ if (iconName.startsWith(QLatin1Char('/')))
+ return QIcon(iconName);
+ return QIcon::fromTheme(iconName);
}
return icon;
}