Don't crash when the requested icon doesn't exist in theme
This commit is contained in:
parent
c4ab98a6b7
commit
63ab8a084d
|
@ -96,13 +96,30 @@ namespace SparkleShare {
|
|||
|
||||
|
||||
// Looks up an icon from the system's theme
|
||||
public static Gdk.Pixbuf GetIcon (string Name, int Size)
|
||||
public static Gdk.Pixbuf GetIcon (string name, int size)
|
||||
{
|
||||
|
||||
IconTheme IconTheme = new IconTheme ();
|
||||
IconTheme.AppendSearchPath (SparklePaths.SparkleIconPath);
|
||||
IconTheme.AppendSearchPath (SparklePaths.SparkleLocalIconPath);
|
||||
return IconTheme.LoadIcon (Name, Size, IconLookupFlags.GenericFallback);
|
||||
|
||||
try {
|
||||
|
||||
return IconTheme.LoadIcon (name, size, IconLookupFlags.GenericFallback);
|
||||
|
||||
} catch {
|
||||
|
||||
try {
|
||||
|
||||
return IconTheme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback);
|
||||
|
||||
} catch {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue