From b92250455a186d00a5719548bf336b3491257a5d Mon Sep 17 00:00:00 2001 From: Scoopta Date: Tue, 12 May 2020 13:58:18 -0700 Subject: [PATCH] Added img-noscale --- src/wofi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/wofi.c b/src/wofi.c index a4a2736..29b82b9 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -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);