diff options
Diffstat (limited to 'src/plugins/fs/meta.c')
-rw-r--r-- | src/plugins/fs/meta.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/plugins/fs/meta.c b/src/plugins/fs/meta.c index 6cbab5f5..e7b28b68 100644 --- a/src/plugins/fs/meta.c +++ b/src/plugins/fs/meta.c | |||
@@ -333,6 +333,9 @@ void handleListRemove(GladeXML * xml, | |||
333 | NULL); | 333 | NULL); |
334 | } | 334 | } |
335 | 335 | ||
336 | #define THUMBSIZE 128 | ||
337 | |||
338 | |||
336 | struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, | 339 | struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, |
337 | const char * name, | 340 | const char * name, |
338 | const char * previewName) { | 341 | const char * previewName) { |
@@ -343,9 +346,13 @@ struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, | |||
343 | struct ECRS_MetaData * meta; | 346 | struct ECRS_MetaData * meta; |
344 | EXTRACTOR_KeywordType type; | 347 | EXTRACTOR_KeywordType type; |
345 | GdkPixbuf * pixbuf; | 348 | GdkPixbuf * pixbuf; |
349 | GdkPixbuf * out; | ||
346 | char * mvalue; | 350 | char * mvalue; |
351 | size_t length; | ||
352 | unsigned long width; | ||
353 | unsigned long height; | ||
354 | char * thumb; | ||
347 | 355 | ||
348 | DEBUG_BEGIN(); | ||
349 | metaList = glade_xml_get_widget(xml, | 356 | metaList = glade_xml_get_widget(xml, |
350 | name); | 357 | name); |
351 | metamodel = gtk_tree_view_get_model(GTK_TREE_VIEW(metaList)); | 358 | metamodel = gtk_tree_view_get_model(GTK_TREE_VIEW(metaList)); |
@@ -373,10 +380,28 @@ struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, | |||
373 | 380 | ||
374 | if (GTK_IMAGE_PIXBUF == | 381 | if (GTK_IMAGE_PIXBUF == |
375 | gtk_image_get_storage_type(GTK_IMAGE(preview))) { | 382 | gtk_image_get_storage_type(GTK_IMAGE(preview))) { |
376 | size_t length; | ||
377 | char * thumb; | ||
378 | |||
379 | pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(preview)); | 383 | pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(preview)); |
384 | if (pixbuf == NULL) | ||
385 | return meta; | ||
386 | height = gdk_pixbuf_get_height(pixbuf); | ||
387 | width = gdk_pixbuf_get_width(pixbuf); | ||
388 | if ( (height > THUMBSIZE) || | ||
389 | (width > THUMBSIZE) ) { | ||
390 | if (height > THUMBSIZE) { | ||
391 | width = width * THUMBSIZE / height; | ||
392 | height = THUMBSIZE; | ||
393 | } | ||
394 | if (width > THUMBSIZE) { | ||
395 | height = height * THUMBSIZE / width; | ||
396 | width = THUMBSIZE; | ||
397 | } | ||
398 | out = gdk_pixbuf_scale_simple(pixbuf, | ||
399 | width, | ||
400 | height, | ||
401 | GDK_INTERP_BILINEAR); | ||
402 | g_object_unref(pixbuf); | ||
403 | pixbuf = out; | ||
404 | } | ||
380 | if (pixbuf != NULL) { | 405 | if (pixbuf != NULL) { |
381 | thumb = NULL; | 406 | thumb = NULL; |
382 | if (gdk_pixbuf_save_to_buffer(pixbuf, | 407 | if (gdk_pixbuf_save_to_buffer(pixbuf, |
@@ -397,7 +422,6 @@ struct ECRS_MetaData * getMetaDataFromList(GladeXML * xml, | |||
397 | } | 422 | } |
398 | } | 423 | } |
399 | } | 424 | } |
400 | DEBUG_END(); | ||
401 | return meta; | 425 | return meta; |
402 | } | 426 | } |
403 | 427 | ||