21 static MapeFileIcon* mape_file_icon_new(GtkWidget* widget,
27 GdkPixbuf* scaled_pixbuf;
33 pixbuf = gtk_widget_render_icon(
41 pixbuf = gtk_widget_render_icon(
49 pixbuf = gdk_pixbuf_new_from_resource(
"/org/openclonk/mape/ocd.ico", &error);
52 pixbuf = gdk_pixbuf_new_from_resource(
"/org/openclonk/mape/ocf.ico", &error);
55 pixbuf = gdk_pixbuf_new_from_resource(
"/org/openclonk/mape/ocg.ico", &error);
58 pixbuf = gdk_pixbuf_new_from_resource(
"/org/openclonk/mape/ocs.ico", &error);
61 pixbuf = gdk_pixbuf_new_from_resource(
"/org/openclonk/mape/ocm.ico", &error);
64 g_assert_not_reached();
69 fprintf (stderr,
"Unable to create icon: %s\n", error->message);
76 gtk_icon_size_lookup(GTK_ICON_SIZE_BUTTON, &width, &height);
79 if(gdk_pixbuf_get_width(pixbuf) != width ||
80 gdk_pixbuf_get_height(pixbuf) != height)
82 scaled_pixbuf = gdk_pixbuf_scale_simple(
89 g_object_unref(pixbuf);
90 pixbuf = scaled_pixbuf;
105 g_object_unref(G_OBJECT(icon->
pixbuf) );
126 mape_file_icon_destroy(set->
icons[i]);
MapeFileIcon * mape_file_icon_set_lookup(MapeFileIconSet *set, MapeFileIconType type)
GdkPixbuf * mape_file_icon_get(MapeFileIcon *icon)
void mape_file_icon_set_destroy(MapeFileIconSet *set)
MapeFileIconSet * mape_file_icon_set_new(GtkWidget *widget)
@ MAPE_FILE_ICON_C4OBJECT
@ MAPE_FILE_ICON_C4SCENARIO
@ MAPE_FILE_ICON_C4MATERIAL
@ MAPE_FILE_ICON_C4FOLDER
enum MapeFileIconType_ MapeFileIconType
MapeFileIcon * icons[MAPE_FILE_ICON_COUNT]