Bug 97776 - kde ignores icons folder in XDG_DATA_DIRS
Summary: kde ignores icons folder in XDG_DATA_DIRS
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-24 09:13 UTC by Tobias Powalowski
Modified: 2006-11-03 13:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Adds icon lookup in XDG_DATA_DIRS (1.48 KB, patch)
2005-09-11 13:39 UTC, Jan de Groot
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Powalowski 2005-01-24 09:13:36 UTC
Version:            (using KDE KDE 3.3.91)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.3 
OS:                Linux

if you don't install kde to /usr and you set the XDG_DATA_DIRS variable to /usr kde doesn't recognize the icons folder and so some apps don't show the icon that is defined in the .desktop files
here is my XDG setup:
XDG_DATA_DIRS="/usr/share:/usr/share:/opt/gnome/share:/opt/kde/share"

temporary workaround for that problem is to define an additional KDEDIR like that:
KDEDIR="/opt/kde"
KDEDIRS="/opt/kde:/usr"
Comment 1 Jan de Groot 2005-09-11 13:39:48 UTC
Created attachment 12524 [details]
Adds icon lookup in XDG_DATA_DIRS

This patch looks a bit hacky, but kdecore seems to be hacky anyways (when I
started doing it the "right" way, I got so many compiler warnings that I had to
C&P the compiler output in a text editor to find the error in it).

What this patch actually does is looking up icons in $KDEDIRS/icons and
$KDEDIRS/pixmaps as usual, and besides those standard dirs, it also looks at
$XDG_DATA_DIRS/icons and $XDG_DATA_DIRS/pixmaps.

According to the icon theme specifications at
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html,
looking in XDG_DATA_DIRS/icons and /usr/share/pixmaps is standard, but too many
applications store pixmaps in their own prefix, resulting in things like
/opt/gnome/share/pixmaps. GTK+ also looks for icons in XDG_DATA_DIRS/pixmaps,
so I do the same with KDE now.
Comment 2 Waldo Bastian 2006-06-12 20:06:45 UTC
Patch looks good.
Comment 3 Lubos Lunak 2006-08-24 15:38:06 UTC
SVN commit 576641 by lunakl:

Read icons also from $XDG_DATA_DIRS, modified patch from #97776.
FEATURE: 97776



 M  +2 -0      kiconloader.cpp  
 M  +2 -2      kicontheme.cpp  
 M  +3 -0      kstandarddirs.cpp  


--- branches/KDE/3.5/kdelibs/kdecore/kiconloader.cpp #576640:576641
@@ -260,6 +260,8 @@
     QStringList dirs;
     dirs += d->mpDirs->resourceDirs("icon");
     dirs += d->mpDirs->resourceDirs("pixmap");
+    dirs += d->mpDirs->resourceDirs("xdgdata-icon");
+    dirs += "/usr/share/pixmaps";
     for (QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it)
 	d->mpDirs->addResourceDir("appicon", *it);
 
--- branches/KDE/3.5/kdelibs/kdecore/kicontheme.cpp #576640:576641
@@ -105,7 +105,7 @@
     }
     // Find the theme description file. These are always global.
 
-    icnlibs = KGlobal::dirs()->resourceDirs("icon");
+    icnlibs = KGlobal::dirs()->resourceDirs("icon") + KGlobal::dirs()->resourceDirs("xdgdata-icon");
     for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
     {
         cDir = *it + name + "/";
@@ -466,7 +466,7 @@
         return *_theme_list;
 
     _theme_list = new QStringList();
-    QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon");
+    QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon") + KGlobal::dirs()->resourceDirs("xdgdata-icon");
     QStringList::ConstIterator it;
     for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
     {
--- branches/KDE/3.5/kdelibs/kdecore/kstandarddirs.cpp #576640:576641
@@ -100,6 +100,7 @@
 			      "wallpaper", "lib", "pixmap", "templates",
 			      "module", "qtplugins",
 			      "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu",
+			      "xdgdata-icon",
 			      "kcfg", "emoticons", 0 };
 
 static int tokenize( QStringList& token, const QString& str,
@@ -1055,6 +1056,8 @@
         return "lib" KDELIBSUFF "/kde3/plugins";
     if (!strcmp(type, "xdgdata-apps"))
         return "applications/";
+    if (!strcmp(type, "xdgdata-icon"))
+        return "icons/";
     if (!strcmp(type, "xdgdata-dirs"))
         return "desktop-directories/";
     if (!strcmp(type, "xdgconf-menu"))
Comment 4 Lubos Lunak 2006-11-03 13:51:19 UTC
SVN commit 601485 by lunakl:

Add $XDG_DATA_DIRS/pixmaps to the icon lookup paths as well,
even though it's not in the spec. E.g. some GNOME apps put
their icons there :-/
CCBUG: 97776



 M  +2 -0      kiconloader.cpp  
 M  +4 -0      kicontheme.cpp  
 M  +3 -1      kstandarddirs.cpp  


--- branches/KDE/3.5/kdelibs/kdecore/kiconloader.cpp #601484:601485
@@ -246,6 +246,8 @@
     dirs += d->mpDirs->resourceDirs("pixmap");
     dirs += d->mpDirs->resourceDirs("xdgdata-icon");
     dirs += "/usr/share/pixmaps";
+    // These are not in the icon spec, but e.g. GNOME puts some icons there anyway.
+    dirs += d->mpDirs->resourceDirs("xdgdata-pixmap");
     for (QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it)
 	d->mpDirs->addResourceDir("appicon", *it);
 
--- branches/KDE/3.5/kdelibs/kdecore/kicontheme.cpp #601484:601485
@@ -108,6 +108,8 @@
     icnlibs = KGlobal::dirs()->resourceDirs("icon");
     icnlibs += KGlobal::dirs()->resourceDirs("xdgdata-icon");
     icnlibs += "/usr/share/pixmaps";
+    // These are not in the icon spec, but e.g. GNOME puts some icons there anyway.
+    icnlibs += KGlobal::dirs()->resourceDirs("xdgdata-pixmap");
     for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
     {
         cDir = *it + name + "/";
@@ -471,6 +473,8 @@
     QStringList icnlibs = KGlobal::dirs()->resourceDirs("icon");
     icnlibs += (KGlobal::dirs()->resourceDirs("xdgdata-icon"));
     icnlibs += "/usr/share/pixmaps";
+    // These are not in the icon spec, but e.g. GNOME puts some icons there anyway.
+    icnlibs += KGlobal::dirs()->resourceDirs("xdgdata-pixmap");
     QStringList::ConstIterator it;
     for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
     {
--- branches/KDE/3.5/kdelibs/kdecore/kstandarddirs.cpp #601484:601485
@@ -100,7 +100,7 @@
 			      "wallpaper", "lib", "pixmap", "templates",
 			      "module", "qtplugins",
 			      "xdgdata-apps", "xdgdata-dirs", "xdgconf-menu",
-			      "xdgdata-icon",
+			      "xdgdata-icon", "xdgdata-pixmap",
 			      "kcfg", "emoticons", 0 };
 
 static int tokenize( QStringList& token, const QString& str,
@@ -1058,6 +1058,8 @@
         return "applications/";
     if (!strcmp(type, "xdgdata-icon"))
         return "icons/";
+    if (!strcmp(type, "xdgdata-pixmap"))
+        return "pixmaps/";
     if (!strcmp(type, "xdgdata-dirs"))
         return "desktop-directories/";
     if (!strcmp(type, "xdgconf-menu"))