2 extern string? g_win32_get_package_installation_directory_of_module (void *module);
5 public Gdk.Pixbuf? find_icon_sized (string name, Gtk.IconSize icon_size)
8 Gtk.icon_size_lookup (icon_size, out width, out height);
9 return find_icon (name, width);
12 /* Portability hack: making Gtk icon themes work on Windows is
13 * difficult; let's just bundle the icons that are necessary and
17 public Gdk.Pixbuf? find_icon (string name, int size)
22 string? base_path = g_win32_get_package_installation_directory_of_module (null);
24 // Hack to allow running within the source tree
25 int last_dir_index = base_path.last_index_of_char ('\\');
26 if (base_path.substring (last_dir_index) == "\\src")
27 base_path = base_path.slice(0, last_dir_index);
29 string? filename = Path.build_filename (base_path, "share", "icons", "%s.png".printf (name));
30 return new Gdk.Pixbuf.from_file_at_size (filename, size, size);
32 var icon_theme = Gtk.IconTheme.get_default ();
33 return icon_theme.load_icon (name, icon_size, Gtk.IconLookupFlags.FORCE_SIZE);
38 stdout.printf("Error loading icon '%s': %s\n", name, e.message);