Index: src/Fl_File_Icon2.cxx
===================================================================
--- src/Fl_File_Icon2.cxx	(Revision 12532)
+++ src/Fl_File_Icon2.cxx	(Arbeitskopie)
@@ -561,22 +561,11 @@
   return 0;
 }
 
-
-/**
-  Loads all system-defined icons. This call is useful when using the
-  FileChooser widget and should be used when the application starts:
-
-  \code
-  Fl_File_Icon::load_system_icons();
-  \endcode
-*/
-void
-Fl_File_Icon::load_system_icons(void) {
+static bool try_load_system_icons() {
   int		i;		// Looping var
   Fl_File_Icon	*icon;		// New icons
   char		filename[FL_PATH_MAX];	// Filename
   char		icondir[FL_PATH_MAX];	// Icon directory
-  static int	init = 0;	// Have the icons been initialized?
   const char * const icondirs[] = {
 		  "Bluecurve",	// Icon directories to look for, in order
 		  "crystalsvg",
@@ -584,74 +573,6 @@
 		  "hicolor",
 		  NULL
 		};
-  static short	plain[] = {	// Plain file icon
-		  COLOR, -1, -1, OUTLINEPOLYGON, 0, FL_GRAY,
-		  VERTEX, 2000, 1000, VERTEX, 2000, 9000,
-		  VERTEX, 6000, 9000, VERTEX, 8000, 7000,
-		  VERTEX, 8000, 1000, END, OUTLINEPOLYGON, 0, FL_GRAY,
-		  VERTEX, 6000, 9000, VERTEX, 6000, 7000,
-		  VERTEX, 8000, 7000, END,
-		  COLOR, 0, FL_BLACK, LINE, VERTEX, 6000, 7000,
-		  VERTEX, 8000, 7000, VERTEX, 8000, 1000,
-		  VERTEX, 2000, 1000, END, LINE, VERTEX, 3000, 7000,
-		  VERTEX, 5000, 7000, END, LINE, VERTEX, 3000, 6000,
-		  VERTEX, 5000, 6000, END, LINE, VERTEX, 3000, 5000,
-		  VERTEX, 7000, 5000, END, LINE, VERTEX, 3000, 4000,
-		  VERTEX, 7000, 4000, END, LINE, VERTEX, 3000, 3000,
-		  VERTEX, 7000, 3000, END, LINE, VERTEX, 3000, 2000,
-		  VERTEX, 7000, 2000, END,
-		  END
-		};
-  static short	image[] = {	// Image file icon
-		  COLOR, -1, -1, OUTLINEPOLYGON, 0, FL_GRAY,
-		  VERTEX, 2000, 1000, VERTEX, 2000, 9000,
-		  VERTEX, 6000, 9000, VERTEX, 8000, 7000,
-		  VERTEX, 8000, 1000, END, OUTLINEPOLYGON, 0, FL_GRAY,
-		  VERTEX, 6000, 9000, VERTEX, 6000, 7000,
-		  VERTEX, 8000, 7000, END,
-		  COLOR, 0, FL_BLACK, LINE, VERTEX, 6000, 7000,
-		  VERTEX, 8000, 7000, VERTEX, 8000, 1000,
-		  VERTEX, 2000, 1000, END,
-		  COLOR, 0, FL_RED, POLYGON, VERTEX, 3500, 2500,
-		  VERTEX, 3000, 3000, VERTEX, 3000, 4000,
-		  VERTEX, 3500, 4500, VERTEX, 4500, 4500,
-		  VERTEX, 5000, 4000, VERTEX, 5000, 3000,
-		  VERTEX, 4500, 2500, END,
-		  COLOR, 0, FL_GREEN, POLYGON, VERTEX, 5500, 2500,
-		  VERTEX, 5000, 3000, VERTEX, 5000, 4000,
-		  VERTEX, 5500, 4500, VERTEX, 6500, 4500,
-		  VERTEX, 7000, 4000, VERTEX, 7000, 3000,
-		  VERTEX, 6500, 2500, END,
-		  COLOR, 0, FL_BLUE, POLYGON, VERTEX, 4500, 3500,
-		  VERTEX, 4000, 4000, VERTEX, 4000, 5000,
-		  VERTEX, 4500, 5500, VERTEX, 5500, 5500,
-		  VERTEX, 6000, 5000, VERTEX, 6000, 4000,
-		  VERTEX, 5500, 3500, END,
-		  END
-		};
-  static short	dir[] = {	// Directory icon
-		  COLOR, -1, -1, POLYGON, VERTEX, 1000, 1000,
-		  VERTEX, 1000, 7500,  VERTEX, 9000, 7500,
-		  VERTEX, 9000, 1000, END,
-		  POLYGON, VERTEX, 1000, 7500, VERTEX, 2500, 9000,
-		  VERTEX, 5000, 9000, VERTEX, 6500, 7500, END,
-		  COLOR, 0, FL_WHITE, LINE, VERTEX, 1500, 1500,
-		  VERTEX, 1500, 7000, VERTEX, 9000, 7000, END,
-		  COLOR, 0, FL_BLACK, LINE, VERTEX, 9000, 7500,
-		  VERTEX, 9000, 1000, VERTEX, 1000, 1000, END,
-		  COLOR, 0, FL_GRAY, LINE, VERTEX, 1000, 1000,
-		  VERTEX, 1000, 7500, VERTEX, 2500, 9000,
-		  VERTEX, 5000, 9000, VERTEX, 6500, 7500,
-		  VERTEX, 9000, 7500, END,
-		  END
-		};
-
-
-  // Add symbols if they haven't been added already...
-  if (!init) {
-    // This method requires the images library...
-    fl_register_images();
-
     if (!kdedir) {
       // Figure out where KDE is installed...
       if ((kdedir = fl_getenv("KDEDIR")) == NULL) {
@@ -665,7 +586,6 @@
 
     if (!fl_access(filename, F_OK)) {
       // Load KDE icons...
-      icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
 
       for (i = 0; icondirs[i]; i ++) {
 	snprintf(icondir, sizeof(icondir), "%s/share/icons/%s", kdedir,
@@ -682,8 +602,11 @@
 	         kdedir);
       }
 
-      if (!fl_access(filename, F_OK)) icon->load_image(filename);
+      icon = new Fl_File_Icon("*", Fl_File_Icon::PLAIN);
+      if (fl_access(filename, F_OK)) return false;
 
+      icon->load_image(filename);
+
       icon = new Fl_File_Icon("*", Fl_File_Icon::LINK);
 
       snprintf(filename, sizeof(filename), "%s/16x16/filesystems/link.png",
@@ -754,10 +677,100 @@
 	icon = new Fl_File_Icon("*.ppd", Fl_File_Icon::PLAIN);
 	icon->load_fti("/usr/lib/filetype/install/iconlib/color.ps.idle.fti");
       }
-    } else {
+  }
+  return true;
+}
+
+/**
+  Loads all system-defined icons. This call is useful when using the
+  FileChooser widget and should be used when the application starts:
+
+  \code
+  Fl_File_Icon::load_system_icons();
+  \endcode
+*/
+void
+Fl_File_Icon::load_system_icons(void) {
+  static int	init = 0;	// Have the icons been initialized?
+  static short	plain[] = {	// Plain file icon
+		  COLOR, -1, -1, OUTLINEPOLYGON, 0, FL_GRAY,
+		  VERTEX, 2000, 1000, VERTEX, 2000, 9000,
+		  VERTEX, 6000, 9000, VERTEX, 8000, 7000,
+		  VERTEX, 8000, 1000, END, OUTLINEPOLYGON, 0, FL_GRAY,
+		  VERTEX, 6000, 9000, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, END,
+		  COLOR, 0, FL_BLACK, LINE, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, VERTEX, 8000, 1000,
+		  VERTEX, 2000, 1000, END, LINE, VERTEX, 3000, 7000,
+		  VERTEX, 5000, 7000, END, LINE, VERTEX, 3000, 6000,
+		  VERTEX, 5000, 6000, END, LINE, VERTEX, 3000, 5000,
+		  VERTEX, 7000, 5000, END, LINE, VERTEX, 3000, 4000,
+		  VERTEX, 7000, 4000, END, LINE, VERTEX, 3000, 3000,
+		  VERTEX, 7000, 3000, END, LINE, VERTEX, 3000, 2000,
+		  VERTEX, 7000, 2000, END,
+		  END
+		};
+  static short	image[] = {	// Image file icon
+		  COLOR, -1, -1, OUTLINEPOLYGON, 0, FL_GRAY,
+		  VERTEX, 2000, 1000, VERTEX, 2000, 9000,
+		  VERTEX, 6000, 9000, VERTEX, 8000, 7000,
+		  VERTEX, 8000, 1000, END, OUTLINEPOLYGON, 0, FL_GRAY,
+		  VERTEX, 6000, 9000, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, END,
+		  COLOR, 0, FL_BLACK, LINE, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, VERTEX, 8000, 1000,
+		  VERTEX, 2000, 1000, END,
+		  COLOR, 0, FL_RED, POLYGON, VERTEX, 3500, 2500,
+		  VERTEX, 3000, 3000, VERTEX, 3000, 4000,
+		  VERTEX, 3500, 4500, VERTEX, 4500, 4500,
+		  VERTEX, 5000, 4000, VERTEX, 5000, 3000,
+		  VERTEX, 4500, 2500, END,
+		  COLOR, 0, FL_GREEN, POLYGON, VERTEX, 5500, 2500,
+		  VERTEX, 5000, 3000, VERTEX, 5000, 4000,
+		  VERTEX, 5500, 4500, VERTEX, 6500, 4500,
+		  VERTEX, 7000, 4000, VERTEX, 7000, 3000,
+		  VERTEX, 6500, 2500, END,
+		  COLOR, 0, FL_BLUE, POLYGON, VERTEX, 4500, 3500,
+		  VERTEX, 4000, 4000, VERTEX, 4000, 5000,
+		  VERTEX, 4500, 5500, VERTEX, 5500, 5500,
+		  VERTEX, 6000, 5000, VERTEX, 6000, 4000,
+		  VERTEX, 5500, 3500, END,
+		  END
+		};
+  static short	dir[] = {	// Directory icon
+		  COLOR, -1, -1, POLYGON, VERTEX, 1000, 1000,
+		  VERTEX, 1000, 7500,  VERTEX, 9000, 7500,
+		  VERTEX, 9000, 1000, END,
+		  POLYGON, VERTEX, 1000, 7500, VERTEX, 2500, 9000,
+		  VERTEX, 5000, 9000, VERTEX, 6500, 7500, END,
+		  COLOR, 0, FL_WHITE, LINE, VERTEX, 1500, 1500,
+		  VERTEX, 1500, 7000, VERTEX, 9000, 7000, END,
+		  COLOR, 0, FL_BLACK, LINE, VERTEX, 9000, 7500,
+		  VERTEX, 9000, 1000, VERTEX, 1000, 1000, END,
+		  COLOR, 0, FL_GRAY, LINE, VERTEX, 1000, 1000,
+		  VERTEX, 1000, 7500, VERTEX, 2500, 9000,
+		  VERTEX, 5000, 9000, VERTEX, 6500, 7500,
+		  VERTEX, 9000, 7500, END,
+		  END
+		};
+
+
+  // Add symbols if they haven't been added already...
+  if (!init) {
+    // This method requires the images library...
+    fl_register_images();
+    if (!try_load_system_icons())
+
       // Create the default icons...
       new Fl_File_Icon("*", Fl_File_Icon::PLAIN, sizeof(plain) / sizeof(plain[0]), plain);
-      new Fl_File_Icon("*.{bm|bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm}", Fl_File_Icon::PLAIN,
+      new Fl_File_Icon("*.{bm|bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm"
+#ifdef FLTK_USE_NANOSVG
+                                      "|svg"
+#ifdef HAVE_LIBZ
+                                      "|svgz"
+#endif
+#endif
+                   "}", Fl_File_Icon::PLAIN,
                    sizeof(image) / sizeof(image[0]), image);
       new Fl_File_Icon("*", Fl_File_Icon::DIRECTORY, sizeof(dir) / sizeof(dir[0]), dir);
     }
@@ -771,7 +784,6 @@
     for (count = 0, temp = first_; temp; temp = temp->next_, count ++);
     printf("count of Fl_File_Icon's is %d...\n", count);
 #endif // DEBUG
-  }
 }
 
 
