public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme (); // foreach (string search_path in IconTheme.Default.SearchPath) // icon_theme.AppendSearchPath (search_path); // FIXME: Temporary workaround for a bug in IconTheme.SearchPath in Gtk# on 64-bit systems // https://github.com/mono/gtk-sharp/commit/9c54fd5ae77f63d11fdc6873a3cb90691990e37f icon_theme.AppendSearchPath ("/usr/share/icons"); icon_theme.AppendSearchPath ("/usr/local/share/icons"); icon_theme.AppendSearchPath ("/opt/local/share/icons"); icon_theme.AppendSearchPath (Path.Combine (SparkleUI.AssetsPath, "icons")); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); } catch { try { return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); } catch { return null; } } }
// Looks up an icon from the system's theme public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme (); icon_theme.AppendSearchPath (SparklePaths.SparkleIconPath); icon_theme.AppendSearchPath (SparklePaths.SparkleLocalIconPath); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); } catch { try { return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); } catch { return null; } } }
public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme (); icon_theme.AppendSearchPath (Path.Combine (UserInterface.AssetsPath, "icons")); foreach (string search_path in IconTheme.Default.SearchPath) icon_theme.AppendSearchPath (search_path); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); } catch { try { return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); } catch { return null; } } }
// Looks up an icon from the system's theme public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme (); icon_theme.AppendSearchPath (Path.Combine (SparkleUI.AssetsPath, "icons")); icon_theme.AppendSearchPath ( Path.Combine (Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), "icons")); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); } catch { try { return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback); } catch { return null; } } }
public static Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme(); icon_theme.AppendSearchPath(Path.Combine(UI.AssetsPath, "icons")); try { return icon_theme.LoadIcon(name, size, IconLookupFlags.GenericFallback); } catch { try { return icon_theme.LoadIcon("gtk-image-missing", size, IconLookupFlags.GenericFallback); } catch { return null; } } }
// Looks up an icon from the system's theme public Gdk.Pixbuf GetIcon(string name, int size) { IconTheme icon_theme = new IconTheme (); icon_theme.AppendSearchPath (System.IO.Path.Combine ("/usr/share/sparkleshare", "icons")); return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); }