Added img-noscale

This commit is contained in:
Scoopta 2020-05-12 13:58:18 -07:00
parent 6019f46199
commit b92250455a

View File

@ -222,6 +222,7 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi
char* ret = strdup("");
struct map* mode_map = map_init();
map_put(mode_map, "img", "true");
map_put(mode_map, "img-noscale", "true");
map_put(mode_map, "text", "true");
char* tmp = strdup(text);
@ -308,6 +309,15 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi
GtkWidget* img = gtk_image_new_from_pixbuf(buf);
gtk_widget_set_name(img, "img");
gtk_container_add(GTK_CONTAINER(box), img);
} else if(strcmp(mode, "img-noscale") == 0 && create_widgets) {
GdkPixbuf* buf = gdk_pixbuf_new_from_file(str, NULL);
if(buf == NULL) {
fprintf(stderr, "Image %s cannot be loaded\n", str);
goto done;
}
GtkWidget* img = gtk_image_new_from_pixbuf(buf);
gtk_widget_set_name(img, "img");
gtk_container_add(GTK_CONTAINER(box), img);
} else if(strcmp(mode, "text") == 0) {
if(create_widgets) {
GtkWidget* label = gtk_label_new(str);