After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 553211 - GtkFileChooserButton unsets filter after first use of dialog
GtkFileChooserButton unsets filter after first use of dialog
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.18.x
Other Linux
: Normal major
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
: 559276 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-09-22 05:22 UTC by Danielle Madeley
Modified: 2010-05-02 19:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
testcase (1.16 KB, text/plain)
2008-09-22 05:22 UTC, Danielle Madeley
  Details
patch (566 bytes, patch)
2008-09-26 18:56 UTC, Matthias Clasen
committed Details | Review
patch (1.14 KB, patch)
2010-02-08 18:48 UTC, Bert Broekhuizen
none Details | Review
patch against gtk-2-18 branch (1.16 KB, patch)
2010-02-25 13:17 UTC, Bert Broekhuizen
committed Details | Review

Description Danielle Madeley 2008-09-22 05:22:01 UTC
It seems in GTK+ 2.14, that the currently selected filter of a GtkFileChooserButton is deselected after a file has been chosen.

The problem is as follows:
 - create a GtkFileChooserButton, add some filters
 - click on the button, open the dialog, first filter is selected as expected
 - select a file, click Open
 - click on the button again, open the dialog, no filter is selected anymore

This worked correctly in GTK+ 2.12.11.
Comment 1 Danielle Madeley 2008-09-22 05:22:39 UTC
Created attachment 119148 [details]
testcase
Comment 2 Danielle Madeley 2008-09-22 06:48:35 UTC
A bit more info on this...

I've just noticed on 2.14.2 this assertion is thrown:

(gtk-file-chooser-button-test:7708): GLib-GIO-CRITICAL **: g_content_type_get_mime_type: assertion `type != NULL' failed

Which I've traced here:
  • #0 IA__g_log
    at gmessages.c line 516
  • #1 IA__g_return_if_fail_warning
    at gmessages.c line 532
  • #2 IA__g_content_type_get_mime_type
    at gcontenttype.c line 732
  • #3 get_is_file_filtered
    at gtkfilechooserdefault.c line 5916
  • #4 show_and_select_files_finished_loading
    at gtkfilechooserdefault.c line 6393

show_and_select_files_finished_loading() is the function that calls set_current_filter(impl, NULL), unsetting the filter.
Comment 3 Matthias Clasen 2008-09-26 18:56:07 UTC
Created attachment 119442 [details] [review]
patch

Does this patch make things work as expected for you ?
Comment 4 Matthias Clasen 2008-09-27 00:22:09 UTC
        Bug 553211 – GtkFileChooserButton unsets filter after first use

        * gtk/gtkfilechooserdefault.c (show_and_select_files): Also
        get the content-type, since it is used later on.
        Pointed out by Davyd Madeley.
Comment 5 Danielle Madeley 2008-10-07 07:11:08 UTC
Just trying this patch now against 2.14.3. I'm still experiencing the problem, but the patch does seem to have suppressed the warning.
Comment 6 Matthias Clasen 2008-11-06 02:07:51 UTC
*** Bug 559276 has been marked as a duplicate of this bug. ***
Comment 7 Javier Jardón (IRC: jjardon) 2009-10-26 22:37:59 UTC
I can reproduce this bug in GTK+ 2.18.3 version
Comment 8 Bert Broekhuizen 2010-02-08 18:48:55 UTC
Created attachment 153282 [details] [review]
patch

Appears to fix the bug
Comment 9 Bert Broekhuizen 2010-02-08 18:58:43 UTC
More detailed description of the patch:

When any FileChooserWidget changes from hidden to shown with one or more files selected, this problem occurs.
Function show_and_select_files_finished_loading() tries to determine if any files are selected that are filtered out by the currently selected filter. If so, the filter is unset.
The determination is done by calling get_is_file_filtered() for all selected files.
get_is_file_filtered() uses the "standard::display-name" attribute, but that attribute hasn't been obtained in the show_and_select_file() function, causing show_and_select_files_finished_loading() to think that all selected files are filtered out and the filter always being unset.
Comment 10 Matthias Clasen 2010-02-09 05:52:16 UTC
What branch/release is this patch against ?
It doesn't apply to either master or 2.18
Comment 11 Bert Broekhuizen 2010-02-09 20:51:16 UTC
It's against 2.18.
I'm a newbie w.r.t. git, but have looked at
http://live.gnome.org/GnomeLove/SubmittingPatches and
http://live.gnome.org/Git/Developers
and tried to follow the instructions as closely as possible.
When I try to apply the patch to a newly checked out gtk-2-18 branch,
I get a "space before tab in indent." warning but the patch is accepted by git (and as far as I can tell I haven't made a change to the spacing).

Any idea what I'm doing wrong?
Comment 12 Bert Broekhuizen 2010-02-25 10:42:17 UTC
Looking at 2.19.6, I see that gtkfilechooserdefault.c has changed quite a bit compared to 2.18.
One of the changes also fixed this bug, so it's fixed for 2.19.
Comment 13 Bert Broekhuizen 2010-02-25 13:17:53 UTC
Created attachment 154683 [details] [review]
patch against gtk-2-18 branch

New patch with whitespace issue fixed.
This is for gtk-2-18 only, because the problem doesn't exist in master.
Comment 14 Javier Jardón (IRC: jjardon) 2010-05-02 19:23:14 UTC
Comment on attachment 154683 [details] [review]
patch against gtk-2-18 branch

committed in the gtk-2-18 branch after Benjamin Otte review

commit cac87b0a165fe1e92e38cc8f134a6e4657c7a837
Comment 15 Javier Jardón (IRC: jjardon) 2010-05-02 19:24:37 UTC
The previous commit solves the problem in GTK+ 2.18.

The bug doesn't exist in GTK+ 2.20 or master, so we can close this now.