Closed Bug 396876 Opened 17 years ago Closed 17 years ago

GTK file picker doesn't show preview of file

Categories

(Core :: Widget: Gtk, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9beta3

People

(Reporter: versgui, Assigned: ventnor.bugzilla)

Details

Attachments

(1 file, 3 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

(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.
Component: Disability Access → Widget: Gtk
Product: Firefox → Core
QA Contact: disability.access → gtk
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.
Summary: outline when opening of a file → GTK file picker doesn't show preview of file
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.
Assignee: nobody → ventnor.bugzilla
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch Patch (obsolete) — Splinter Review
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 ;)
Attachment #293466 - Flags: superreview?(roc)
Attachment #293466 - Flags: review?(roc)
Attached patch Patch 1.1 (obsolete) — Splinter Review
Damn the tabs.
Attachment #293466 - Attachment is obsolete: true
Attachment #293467 - Flags: superreview?(roc)
Attachment #293467 - Flags: review?(roc)
Attachment #293466 - Flags: superreview?(roc)
Attachment #293466 - Flags: review?(roc)
Version: unspecified → Trunk
   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.)
Attached patch Patch 2 (obsolete) — Splinter Review
Attachment #293467 - Attachment is obsolete: true
Attachment #293547 - Flags: superreview?(roc)
Attachment #293547 - Flags: review?(roc)
Attachment #293467 - Flags: superreview?(roc)
Attachment #293467 - Flags: review?(roc)
Comment on attachment 293547 [details] [diff] [review]
Patch 2

This has a problem with images smaller than 160px. New patch soon.
Attachment #293547 - Attachment is obsolete: true
Attachment #293547 - Flags: superreview?(roc)
Attachment #293547 - Flags: review?(roc)
Attached patch Patch 3Splinter Review
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.
Attachment #293732 - Flags: superreview?(roc)
Attachment #293732 - Flags: review?(roc)
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.
Attachment #293732 - Flags: superreview?(roc)
Attachment #293732 - Flags: superreview+
Attachment #293732 - Flags: review?(roc)
Attachment #293732 - Flags: review+
Comment on attachment 293732 [details] [diff] [review]
Patch 3

Show preview of file in GTK file picker.
Attachment #293732 - Flags: approval1.9?
Attachment #293732 - Flags: approval1.9? → approval1.9+
Keywords: checkin-needed
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
Status: NEW → RESOLVED
Closed: 17 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M11
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: