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 505857 - filepath entered in location bar should be loaded after user press 'enter'
filepath entered in location bar should be loaded after user press 'enter'
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
unspecified
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks:
 
 
Reported: 2007-12-27 09:27 UTC by Chris Wang
Modified: 2008-03-07 08:57 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
gtk2-bgo505857-filechooser-dialog-ensure-default-response.diff (4.11 KB, patch)
2008-03-07 04:01 UTC, Federico Mena Quintero
committed Details | Review

Description Chris Wang 2007-12-27 09:27:59 UTC
Currently, when user enter a file path in the location bar in filechooser, the contents will not refresh after user pressing 'enter' key, although it can be workaround to clock on the 'Ok' button. 

Some gnome applications such as gedit implemented their own filechooser, which has this functionality. 

I don't know if there is any special reason why we don't implement this feature on filechooser as I think this is very useful. and only 4 lines of codes need to be added. 

Can some one provide some feedback on why we don't do this.

Other information:
This is a suggested fix for this bug

--- gtk/gtkfilechooserdialog.c.orig     2007-10-16 21:20:38.000000000 +0800
+++ gtk/gtkfilechooserdialog.c  2007-12-27 16:20:18.388325000 +0800
@@ -465,6 +465,12 @@
     {
       response_id = va_arg (varargs, gint);
       gtk_dialog_add_button (GTK_DIALOG (result), button_text, response_id);
+     
+      if ((response_id == GTK_RESPONSE_OK) ||
+         (response_id == GTK_RESPONSE_ACCEPT) ||
+         (response_id == GTK_RESPONSE_YES) ||
+         (response_id == GTK_RESPONSE_APPLY))
+              gtk_dialog_set_default_response (GTK_DIALOG (result), response_id);
       button_text = va_arg (varargs, const gchar *);
     }
Comment 1 Pacho Ramos 2008-02-24 14:47:00 UTC
Maybe related also with http://bugzilla.gnome.org/show_bug.cgi?id=482534

Comment 2 Pacho Ramos 2008-02-24 14:48:26 UTC
brasero and gnome-appearance-properties also suffer this problem, Should I open a separate bug report or wait for this?

Thanks for the info
Comment 3 Federico Mena Quintero 2008-03-07 03:37:07 UTC
Thanks for catching this!  Indeed, the problem happens with apps that don't call gtk_dialog_set_default_response() after creating the file chooser dialog.  I'll commit your patch with some small fixes.
Comment 4 Federico Mena Quintero 2008-03-07 04:01:44 UTC
Created attachment 106754 [details] [review]
gtk2-bgo505857-filechooser-dialog-ensure-default-response.diff

This is now in trunk and gtk-2-12.

Note that we ensure the default response in the ::map() handler, not in _new_valist(), so that people that use g_object_new() instead of gtk_file_chooser_dialog_new() will also get this functionality.

Thanks for the patch, Chris!

2008-03-06  Federico Mena Quintero  <federico@novell.com>

	Fix http://bugzilla.gnome.org/show_bug.cgi?id=505857 -
	GtkFileChooserDialog should set a default response button if the
	app doesn't set it.  Based on a patch by Chris Wang <chris.wang@sun.com>.

	* gtk/gtkfilechooserdialog.c (is_stock_accept_response_id): New
	function, refactor from where there was duplicated code.
	(gtk_file_chooser_dialog_new_valist): If the response ID for the
	button is one of the stock ones, make it the default response
	button.
Comment 5 Karl Lattimer 2008-03-07 08:57:01 UTC
Is this the same bug that when using deluge and the desktop is the default folder I still have to double click on it to be able to click open?