diff options
author | Christian Grothoff <christian@grothoff.org> | 2006-12-11 05:16:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2006-12-11 05:16:35 +0000 |
commit | 8b77ccc1561bc51e59b9441314c9ea672f7640be (patch) | |
tree | 300b329d71b50306dda602253092f232d1e20071 | |
parent | 2f8dc413a8e1a214d1217bff0b1628464051f323 (diff) | |
download | gnunet-gtk-8b77ccc1561bc51e59b9441314c9ea672f7640be.tar.gz gnunet-gtk-8b77ccc1561bc51e59b9441314c9ea672f7640be.zip |
scale
-rw-r--r-- | src/plugins/fs/meta.c | 34 | ||||
-rw-r--r-- | src/plugins/fs/upload.c | 7 |
2 files changed, 29 insertions, 12 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 | ||
diff --git a/src/plugins/fs/upload.c b/src/plugins/fs/upload.c index f5b922f6..d25e7d94 100644 --- a/src/plugins/fs/upload.c +++ b/src/plugins/fs/upload.c | |||
@@ -348,7 +348,6 @@ static void * start_upload_helper(void * cls) { | |||
348 | return NULL; | 348 | return NULL; |
349 | } | 349 | } |
350 | 350 | ||
351 | |||
352 | void on_fsinsertuploadbutton_clicked_fs(gpointer dummy, | 351 | void on_fsinsertuploadbutton_clicked_fs(gpointer dummy, |
353 | GtkWidget * uploadButton) { | 352 | GtkWidget * uploadButton) { |
354 | FSUC fsuc; | 353 | FSUC fsuc; |
@@ -406,8 +405,6 @@ void on_fsinsertuploadbutton_clicked_fs(gpointer dummy, | |||
406 | ECRS_freeUri(keywordURI); | 405 | ECRS_freeUri(keywordURI); |
407 | createMetaTypeComboBox(metaXML, | 406 | createMetaTypeComboBox(metaXML, |
408 | "metaDataDialogMetaTypeComboBox"); | 407 | "metaDataDialogMetaTypeComboBox"); |
409 | |||
410 | |||
411 | g_signal_connect_data(gtk_tree_view_get_selection(GTK_TREE_VIEW(glade_xml_get_widget(metaXML, | 408 | g_signal_connect_data(gtk_tree_view_get_selection(GTK_TREE_VIEW(glade_xml_get_widget(metaXML, |
412 | "metaDataDialogKeywordList"))), | 409 | "metaDataDialogKeywordList"))), |
413 | "changed", | 410 | "changed", |
@@ -422,10 +419,6 @@ void on_fsinsertuploadbutton_clicked_fs(gpointer dummy, | |||
422 | NULL, | 419 | NULL, |
423 | NULL, | 420 | NULL, |
424 | 0); | 421 | 0); |
425 | |||
426 | |||
427 | |||
428 | |||
429 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), | 422 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), |
430 | GTK_RESPONSE_OK); | 423 | GTK_RESPONSE_OK); |
431 | if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) { | 424 | if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) { |