Author: jluke
Date: 2006-01-14 14:25:54 -0500 (Sat, 14 Jan 2006)
New Revision: 55577
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Utils/FileIconLoader.cs
Log:
2006-01-14 John Luke <[EMAIL PROTECTED]>
* MonoDevelop.Core.Gui.Utils/FileIconLoader.cs:
rewrite the way we lookup the "icon_name" from Gnome
to avoid relying on exceptions, and just always use
"gnome-fs-directory" for directories
Modified: trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog 2006-01-14
17:47:06 UTC (rev 55576)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/ChangeLog 2006-01-14
19:25:54 UTC (rev 55577)
@@ -1,3 +1,10 @@
+2006-01-14 John Luke <[EMAIL PROTECTED]>
+
+ * MonoDevelop.Core.Gui.Utils/FileIconLoader.cs:
+ rewrite the way we lookup the "icon_name" from Gnome
+ to avoid relying on exceptions, and just always use
+ "gnome-fs-directory" for directories
+
2006-01-10 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* MonoDevelop.Core.Gui/CommandService.cs: Added InsertOptions
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Utils/FileIconLoader.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Utils/FileIconLoader.cs
2006-01-14 17:47:06 UTC (rev 55576)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core.Gui/MonoDevelop.Core.Gui.Utils/FileIconLoader.cs
2006-01-14 19:25:54 UTC (rev 55577)
@@ -33,25 +33,26 @@
// FIXME: is there a GTK replacement for Gnome.Icon.LookupSync?
public static Gdk.Pixbuf GetPixbufForFile (string filename, int
size)
{
- Gnome.IconLookupResultFlags result;
- string icon;
- try {
- if (filename == "Documentation")
- icon = "gnome-fs-regular";
- else {
- if (File.Exists (filename) ||
Directory.Exists (filename)) {
- filename = filename.Replace
("%", "%25");
- filename = filename.Replace
("#", "%23");
- filename = filename.Replace
("?", "%3F");
- icon = Gnome.Icon.LookupSync
(IconTheme.Default, thumbnailFactory, filename, "", Gnome.IconLookupFlags.None,
out result);
- }
- else
- icon = "gnome-fs-regular";
- }
- } catch {
- icon = "gnome-fs-regular";
+ if (filename == "Documentation") {
+ return GetPixbufForType ("gnome-fs-regular",
size);
+ } else if (Directory.Exists (filename)) {
+ return GetPixbufForType ("gnome-fs-directory",
size);
+ } else if (File.Exists (filename)) {
+ filename = filename.Replace ("%", "%25");
+ filename = filename.Replace ("#", "%23");
+ filename = filename.Replace ("?", "%3F");
+ string icon = null;
+ try {
+ Gnome.IconLookupResultFlags result;
+ icon = Gnome.Icon.LookupSync
(IconTheme.Default, thumbnailFactory, filename, null,
Gnome.IconLookupFlags.None, out result);
+ } catch {}
+ if (icon == null || icon.Length == 0)
+ return GetPixbufForType
("gnome-fs-regular", size);
+ else
+ return GetPixbufForType (icon, size);
}
- return GetPixbufForType (icon, size);
+
+ return GetPixbufForType ("gnome-fs-regular", size);
}
public static Gdk.Pixbuf GetPixbufForType (string type, int
size)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches