mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
Image loading fallback
This commit is contained in:
parent
9228a5508b
commit
d1ace58ceb
1 changed files with 6 additions and 5 deletions
|
@ -660,15 +660,16 @@ GtkWidget* new_image_icon( const char* filename ) {
|
||||||
str += filename;
|
str += filename;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_file( str.GetBuffer(), &gerror );
|
pixbuf = gdk_pixbuf_new_from_file( str.GetBuffer(), &gerror );
|
||||||
if( pixbuf == NULL ) {
|
if( pixbuf != NULL ) {
|
||||||
|
icon = gtk_image_new_from_pixbuf( pixbuf );
|
||||||
|
g_object_unref( pixbuf );
|
||||||
|
} else {
|
||||||
Sys_FPrintf( SYS_ERR, "ERROR: Failed to load bitmap: %s, %s\n", str.GetBuffer(), gerror->message );
|
Sys_FPrintf( SYS_ERR, "ERROR: Failed to load bitmap: %s, %s\n", str.GetBuffer(), gerror->message );
|
||||||
g_error_free( gerror );
|
g_error_free( gerror );
|
||||||
|
icon = gtk_image_new_from_file( filename );
|
||||||
}
|
}
|
||||||
icon = gtk_image_new_from_pixbuf( pixbuf );
|
|
||||||
gtk_widget_show( icon );
|
gtk_widget_show( icon );
|
||||||
if( pixbuf ) {
|
|
||||||
g_object_unref( pixbuf );
|
|
||||||
}
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue