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 557689 - In 'select folder' action, filechooser doesn't work when you first create the window
In 'select folder' action, filechooser doesn't work when you first create the...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
: 582616 587039 (view as bug list)
Depends on:
Blocks: 398117
 
 
Reported: 2008-10-24 02:29 UTC by Cody Russell
Modified: 2010-08-11 18:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed fix (546 bytes, patch)
2008-10-24 02:30 UTC, Cody Russell
none Details | Review
Possible Fix (674 bytes, patch)
2009-11-21 19:15 UTC, Brett Mravec
none Details | Review
Another stab at a patch (599 bytes, patch)
2010-03-10 00:30 UTC, Cody Russell
none Details | Review
Fix a problem if the action is GTK_FILE_CHOOSER_ACTION_SAVE (738 bytes, patch)
2010-04-02 21:02 UTC, Cody Russell
committed Details | Review

Description Cody Russell 2008-10-24 02:29:05 UTC
Run 'testfilechooser -a select_folder'
Click 'Open' button
Confirm that it doesn't select the current folder

In order to get it to open the current folder, you have to go to the previous directory and then go back to the original directory by clicking the item in the listview (not the buttonbar at the top).
Comment 1 Cody Russell 2008-10-24 02:30:42 UTC
Created attachment 121233 [details] [review]
Proposed fix

This appears to fix it for me, but I'm not very familiar with filechooser code in gtk+ yet so I'm not sure if this is the correct fix and would appreciate a review.
Comment 2 Christian Dywan 2008-10-29 15:35:59 UTC
I cannot cofirm this, tried with 2.14.4 and trunk. The only thing that I notice is that unless I use arrow keys to move the current item in the tree view, there is no visible selection, but that would seem to be a different issue.
Comment 3 Cody Russell 2008-11-18 17:34:56 UTC
I'm still able to reproduce this in trunk.
Comment 4 Christian Dywan 2008-11-18 20:12:25 UTC
(In reply to comment #3)
> I'm still able to reproduce this in trunk.

I can reproduce it reliably with trunk now. Clicking 'Open' does nothing whatsoever unless I manually select a folder. Not sure why it worked for me the last time.

And the patch fixes it for me.
Comment 5 Federico Mena Quintero 2008-12-09 00:04:39 UTC
I think the patch fixes a symptom.

What is the purpose of the response_requested flag in GtkFileChooserDialog?

Alternatively, what if you turn on the response_requested flag before calling gtk_widget_activate() in gtkfilechooserdialog.c:file_chooser_widget_file_activated()?
Comment 6 Cody Russell 2008-12-21 22:23:10 UTC
Sorry I'm just now testing this.  But no, that did not appear to fix the problem.
Comment 7 Cody Russell 2008-12-21 22:30:35 UTC
Actually, it seems to never call file_chooser_widget_file_activated() when I hit the "Okay" button after the dialog is created.
Comment 8 Bastien Nocera 2009-08-10 11:31:10 UTC
Same bug as bug 587039?
Comment 9 Federico Mena Quintero 2009-08-10 19:06:51 UTC
*** Bug 587039 has been marked as a duplicate of this bug. ***
Comment 10 Brett Mravec 2009-11-21 19:15:49 UTC
Created attachment 148241 [details] [review]
Possible Fix

The problem actually occurs because of what widget has focus before you hit 'open'.  If the entry has focus and is empty, the chooser doesn't work correctly.  If the filelist has focus first, then it will work fine.

This seems to fix the problem but I have not tested it very much.
Comment 11 Steven Sheehy 2009-12-30 06:04:31 UTC
This issue only seems to occur when the location text entry box is visible. If it is hidden (Ctrl+L), then one is able to open the current folder upon creation. This may be related to what Brett said about the entry having focus and refusing to close the dialog if it is focused and empty. Is there a way to programmatically hide the location entry?
Comment 12 Cody Russell 2010-03-10 00:30:37 UTC
Created attachment 155696 [details] [review]
Another stab at a patch

Federico, could you take a peek at this one?  I think this makes more sense than my previous patch.
Comment 13 Cody Russell 2010-04-02 21:02:14 UTC
Created attachment 157773 [details] [review]
Fix a problem if the action is GTK_FILE_CHOOSER_ACTION_SAVE
Comment 14 Andrés G. Aragoneses (IRC: knocte) 2010-04-05 17:09:08 UTC
Just wanted to mention that this may be a dupe of bug 402349, who has 2 patches there as well waiting for review.

However, one of the patches of that bug focuses on the problem when impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, but one of the patches here GTK_FILE_CHOOSER_ACTION_SAVE; so that may be a clue of why they are not exactly duplicates? Hence I won't mark them as such yet.

Thoughs?
Comment 15 Federico Mena Quintero 2010-04-05 17:14:00 UTC
Review of attachment 157773 [details] [review]:

Excellent, this makes a lot of sense.  Please go ahead and push!

Would this be needed in the case of CREATE_FOLDER as well?
Comment 16 Federico Mena Quintero 2010-08-11 18:55:34 UTC
*** Bug 582616 has been marked as a duplicate of this bug. ***