ui/gtk/image.c

branch
newapi
changeset 381
b47bda6666ce
parent 340
2dd42bd4fe5d
equal deleted inserted replaced
380:aad99285865c 381:b47bda6666ce
91 g->value = value; 91 g->value = value;
92 g->type = type; 92 g->type = type;
93 GdkPixbuf *pixbuf = value; 93 GdkPixbuf *pixbuf = value;
94 94
95 if(pixbuf) { 95 if(pixbuf) {
96 int width, height; 96 int width = gdk_pixbuf_get_width(pixbuf);
97 #if GTK_CHECK_VERSION(4, 12, 0) 97 int height = gdk_pixbuf_get_height(pixbuf);
98
99 #if GTK_CHECK_VERSION(4, 0, 0)
98 GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf); 100 GdkTexture *texture = gdk_texture_new_for_pixbuf(pixbuf);
99 gtk_picture_set_paintable(GTK_PICTURE(g->obj), GDK_PAINTABLE(texture)); 101 gtk_picture_set_paintable(GTK_PICTURE(g->obj), GDK_PAINTABLE(texture));
100 width = gdk_texture_get_width(texture);
101 height = gdk_texture_get_height(texture);
102 #else 102 #else
103 gtk_image_set_from_pixbuf(GTK_IMAGE(g->obj), pixbuf); 103 gtk_image_set_from_pixbuf(GTK_IMAGE(g->obj), pixbuf);
104 #endif 104 #endif
105 gtk_widget_set_size_request(g->obj, width, height); 105 gtk_widget_set_size_request(g->obj, width, height);
106 } 106 }

mercurial