User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:126.96.36.199) Gecko/20070725 Firefox/188.8.131.52 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:184.108.40.206) Gecko/20070725 Firefox/220.127.116.11 (sorry for my bad english ^^) When I open a file with File > Open or in a web page, I have this : http://www.casimages.com/img/png/07081609331939701024056.png But it would be well better if one could see the contents of the files, like this: http://www.gimp-fr.org/images/gimp22/dialogs-file-open.png It would seem that bad GTK widget is called, according to certain forums. Reproducible: Always Steps to Reproduce: 1. Open a file ! 2. 3.
If you want this feature added to the GTK file picker, you should probably contact the people who maintain the GTK file picker, not the people who maintain applications that use the GTK file picker.
According to some other people of ubuntu-fr.org, the problem would come from Firefox which calls the bad widget : this widget already exists.
It's up to the application to provide a preview in the gtk filechooser (see gtk_file_chooser_set_preview_widget docs).
Assigning to self as I have something that works reasonably well.
Created attachment 293466 [details] [diff] [review] Patch Uses a GtkImage to display a preview of any image that is selected. I think sites like Photobucket and Flickr have made the need for something like this much higher ;)
Created attachment 293467 [details] [diff] [review] Patch 1.1 Damn the tabs.
gtk_widget_destroy(file_chooser); + if (img_preview) + gtk_widget_destroy(img_preview); I don't think you need to do that, since gtk_file_chooser_set_preview_widget adds the widget to the filechooser and thus it's destroyed when the filechooser is destroyed. (And otherwise you'd need to initialise |GtkWidget *img_preview;| to NULL.)
Created attachment 293547 [details] [diff] [review] Patch 2
Comment on attachment 293547 [details] [diff] [review] Patch 2 This has a problem with images smaller than 160px. New patch soon.
Created attachment 293732 [details] [diff] [review] Patch 3 This patch will let GTK scale down images that are too small but keep images that are already smaller than the maximum preview size so that GTK doesn't scale them up. It will also calculate padding to make sure the preview pane is always the same size, with the image centered.
This looks good. I have one question related to Christian's comment #7 though. Since we call gtk_image_new, aren't we responsible for calling gtk_image_destroy? Won't gtk_file_chooser_set_preview_widget add its own reference to the image instead of stealing ours? I sure hope so...
Comment on attachment 293732 [details] [diff] [review] Patch 3 I guess not, let's go with this.
Comment on attachment 293732 [details] [diff] [review] Patch 3 Show preview of file in GTK file picker.
Checking in widget/src/gtk2/nsFilePicker.cpp; /cvsroot/mozilla/widget/src/gtk2/nsFilePicker.cpp,v <-- nsFilePicker.cpp new revision: 1.16; previous revision: 1.15 done