Note: There are a few cases of duplicates in user autocompletion which are being worked on.

GTK file picker doesn't show preview of file

RESOLVED FIXED in mozilla1.9beta3

Status

()

Core
Widget: Gtk
--
enhancement
RESOLVED FIXED
10 years ago
10 years ago

People

(Reporter: versgui, Assigned: Michael Ventnor)

Tracking

Trunk
mozilla1.9beta3
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Reporter)

Description

10 years ago
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.

Updated

10 years ago
Component: Disability Access → Widget: Gtk
Product: Firefox → Core
QA Contact: disability.access → gtk

Comment 1

10 years ago
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
(Reporter)

Comment 2

10 years ago
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).
(Assignee)

Comment 4

10 years ago
Assigning to self as I have something that works reasonably well.
Assignee: nobody → ventnor.bugzilla
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 5

10 years ago
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 ;)
Attachment #293466 - Flags: superreview?(roc)
Attachment #293466 - Flags: review?(roc)
(Assignee)

Comment 6

10 years ago
Created attachment 293467 [details] [diff] [review]
Patch 1.1

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.)
(Assignee)

Comment 8

10 years ago
Created attachment 293547 [details] [diff] [review]
Patch 2
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)
(Assignee)

Comment 9

10 years ago
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)
(Assignee)

Comment 10

10 years ago
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.
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?

Updated

10 years ago
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
Last Resolved: 10 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.