+ string line = sr.ReadLine ();
+
+ while (line != null) {
+ if (line.IndexOf ("Inherits=") != -1) {
+ line = line.Trim ();
+ line = line.Replace ("Inherits=", "");
+
+ line = line.Trim ();
+
+ string[] split = line.Split (new char [] { ',' });
+
+ tmp_inherits.AddRange (split);
+ break;
+ }
+ line = sr.ReadLine ();
+ }
+
+ sr.Close ();
+ } catch (Exception) {
+
+ }
+
+ if (tmp_inherits.Count > 0) {
+ foreach (string icon_theme in tmp_inherits) {
+ foreach (string path in icon_paths) {
+ if (Directory.Exists (path + "/" + icon_theme)) {
+ if (!inherits_path_collection.Contains (path + "/" + icon_theme)) {
+ inherits_path_collection.Add (path + "/" + icon_theme);
+
+ if (File.Exists (path + "/" + icon_theme + "/" + "index.theme"))
+ GetIndexThemeInherits (path + "/" + icon_theme + "/" + "index.theme");
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ private void CreateUIIcons ()
+ {
+ string resolv_path = ResolvePath (main_icon_theme_path);
+ string default_gnome_path = "";
+
+ // get the default gnome icon theme path
+ foreach (string path in icon_paths)
+ if (Directory.Exists (path + "/gnome")) {
+ default_gnome_path = path + "/gnome/48x48/";
+ break;
+ }
+
+ // use default gnome icon theme if there isn't a "/48x48" or "/scalable" dir
+ // for the current theme
+ if (resolv_path == String.Empty)
+ resolv_path = default_gnome_path;
+
+ Hashtable name_mime_hash = new Hashtable ();
+
+ name_mime_hash ["gnome-fs-directory"] = "inode/directory";
+ name_mime_hash ["gnome-fs-regular"] = "unknown/unknown";
+ name_mime_hash ["gnome-fs-desktop"] = "desktop/desktop";
+ name_mime_hash ["gnome-fs-home"] = "directory/home";
+ name_mime_hash ["gnome-fs-network"] = "network/network";
+ name_mime_hash ["gnome-fs-directory-accept"] = "recently/recently";
+ name_mime_hash ["gnome-fs-client"] = "workplace/workplace";
+
+ name_mime_hash ["gnome-fs-nfs"] = "nfs/nfs";
+ name_mime_hash ["gnome-fs-smb"] = "smb/smb";
+
+ name_mime_hash ["gnome-dev-cdrom"] = "cdrom/cdrom";
+ name_mime_hash ["gnome-dev-harddisk"] = "harddisk/harddisk";
+ name_mime_hash ["gnome-dev-removable"] = "removable/removable";
+
+ int initial_name_mime_hash_count = name_mime_hash.Count;
+
+ // first check the current icon theme path
+ string[] dirs = Directory.GetDirectories (resolv_path);
+ ArrayList objects = CheckAndAddUIIcons (dirs, name_mime_hash);
+
+ if (objects.Count != name_mime_hash.Count) {
+ // remove found icons
+ foreach (object o in objects) {
+ name_mime_hash.Remove (o);
+ }
+
+ // check the default gnome path
+ dirs = Directory.GetDirectories (default_gnome_path);
+ objects = CheckAndAddUIIcons (dirs, name_mime_hash);
+
+ //could be a kde icon theme, so we check kde icon names too
+ if (objects.Count == initial_name_mime_hash_count) {
+ dirs = Directory.GetDirectories (resolv_path);
+
+ name_mime_hash.Clear ();
+ name_mime_hash ["folder"] = "inode/directory";
+ name_mime_hash ["unknown"] = "unknown/unknown";
+ name_mime_hash ["desktop"] = "desktop/desktop";
+ name_mime_hash ["folder_home"] = "directory/home";
+ name_mime_hash ["network"] = "network/network";
+ name_mime_hash ["folder_man"] = "recently/recently";
+ name_mime_hash ["system"] = "workplace/workplace";
+
+ name_mime_hash ["nfs_mount"] = "nfs/nfs";
+ name_mime_hash ["server"] = "smb/smb";
+
+ name_mime_hash ["cdrom_mount"] = "cdrom/cdrom";
+ name_mime_hash ["hdd_mount"] = "harddisk/harddisk";
+ name_mime_hash ["usbpendrive_mount"] = "removable/removable";
+
+ CheckAndAddUIIcons (dirs, name_mime_hash);
+ }
+ }
+ }
+
+ private ArrayList CheckAndAddUIIcons (string[] dirs, Hashtable name_mime_hash)
+ {
+ ArrayList al = new ArrayList (name_mime_hash.Count);
+
+ string extension = is_svg_icon_theme ? "svg" : "png";
+
+ for (int i = 0; i < dirs.Length; i++) {
+ foreach (DictionaryEntry entry in name_mime_hash) {
+ string key = (string)entry.Key;
+ if (File.Exists (dirs [i] + "/" + key + "." + extension)) {
+ string value = (string)entry.Value;
+
+ MimeIconEngine.AddMimeTypeAndIconName (value, key);
+
+ if (!is_svg_icon_theme)
+ MimeIconEngine.AddIcon (key, dirs [i] + "/" + key + "." + extension);
+ else
+ MimeIconEngine.AddSVGIcon (key, dirs [i] + "/" + key + "." + extension);
+
+ al.Add (entry.Key);
+ }
+ }
+ }
+
+ return al;
+ }
+
+ private void CreateMimeTypeIcons ()
+ {
+ foreach (string ip in inherits_path_collection) {
+ string path_to_use = ResolvePath (ip);
+
+ if (path_to_use == String.Empty)
+ continue;
+
+ if (!Directory.Exists (path_to_use + "mimetypes"))
+ continue;
+
+ string[] files = Directory.GetFiles (path_to_use + "mimetypes");
+
+ for (int z = 0; z < files.Length; z++) {
+ string extension = Path.GetExtension (files [z]);