ah, good catch. here's a new patch which addresses that issue. Jeff On Sun, 2004-09-12 at 08:09 +0800, Not Zed wrote: > > There's an issue with this if you hit the browse button on an existing > 'local delivery' account, or when configuring a new one. If you just > click browse then 'open', it removes the filename from the path. > > > On Thu, 2004-09-09 at 12:58 -0400, Jeffrey Stedfast wrote: > > Because of the limitations of GtkFileChooser, we had to add a checkbox > > allowing the user to toggle between file vs folder selection > > > > http://bugzilla.ximian.com/show_bug.cgi?id=64974 > > > > I'd attach the patch here, but I can't be bothered to spend 10 minutes > > to navigate to my cvs repository using this beast - it's just too damn > > annoying to use. > > > > I've attached it to bugzilla instead > > > > Jeff > > > -- > > Michael Zucchi <notzed ximian com> > "born to die, live to work, it's > all downhill from here" > Novell's Evolution and Free > Software Developer -- Jeffrey Stedfast Evolution Hacker - Novell, Inc. fejj ximian com - www.novell.com
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/mail/ChangeLog,v retrieving revision 1.3454 diff -u -r1.3454 ChangeLog --- ChangeLog 13 Sep 2004 16:00:16 -0000 1.3454 +++ ChangeLog 13 Sep 2004 16:36:35 -0000 @@ -1,3 +1,11 @@ +2004-09-09 Jeffrey Stedfast <fejj novell com> + + * mail-account-gui.c (mail_account_gui_new): If built with + gtkfilechooser support, we need to add a checkbox in the chooser + so that the user can select files or folders (allowing him to + choose - otherwise they won't be able to setup certain types of + accounts). Fixes bug #64974. + 2004-09-12 JP Rosevear <jpr novell com> Fixes #65703 Index: mail-account-gui.c =================================================================== RCS file: /cvs/gnome/evolution/mail/mail-account-gui.c,v retrieving revision 1.172 diff -u -r1.172 mail-account-gui.c --- mail-account-gui.c 10 Sep 2004 03:14:41 -0000 1.172 +++ mail-account-gui.c 13 Sep 2004 16:36:35 -0000 @@ -30,6 +30,7 @@ #include <string.h> #include <stdarg.h> +#include <sys/stat.h> #include <gconf/gconf-client.h> @@ -44,6 +45,11 @@ #include <gtk/gtknotebook.h> #include <gtk/gtkhbox.h> #include <gtk/gtkdialog.h> +#ifdef USE_GTKFILECHOOSER +#include <gtk/gtkfilechooser.h> +#include <gtk/gtkradiobutton.h> +#include <libgnomeui/gnome-file-entry.h> +#endif #include <e-util/e-account-list.h> #include <e-util/e-signature-list.h> @@ -1753,10 +1759,49 @@ } #endif +#ifdef USE_GTKFILECHOOSER +static void +select_file_toggled (GtkToggleButton *toggle, GtkFileChooser *chooser) +{ + GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; + + if (gtk_toggle_button_get_active (toggle)) + action = GTK_FILE_CHOOSER_ACTION_OPEN; + + gtk_file_chooser_set_action (chooser, action); +} + +static void +browse_clicked (GnomeFileEntry *fentry, MailAccountGui *gui) +{ + GtkWidget *check; + struct stat st; + char *path; + + if (GTK_IS_FILE_CHOOSER (fentry->fsw)) { + check = gtk_check_button_new_with_label (_("Select individual file")); + g_signal_connect (check, "toggled", G_CALLBACK (select_file_toggled), fentry->fsw); + gtk_widget_show (check); + gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (fentry->fsw), check); + + path = gnome_file_entry_get_full_path (fentry, TRUE); + if (path && stat (path, &st) == 0 && S_ISREG (st.st_mode)) + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); + else + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE); + gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (check)); + g_free (path); + } + + g_signal_handlers_disconnect_by_func (fentry, G_CALLBACK (fentry), gui); +} +#endif /* USE_GTKFILECHOOSER */ + MailAccountGui * mail_account_gui_new (EAccount *account, EMAccountPrefs *dialog) { MailAccountGui *gui; + GtkWidget *fileentry; g_object_ref (account); @@ -1764,6 +1809,15 @@ gui->account = account; gui->dialog = dialog; gui->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL, NULL); + +#ifdef USE_GTKFILECHOOSER + /* KLUDGE: If this Evolution was built with GtkFileChooser support, the user + * won't be able to create some types of local accounts because GtkFileChooser + * must be set to allow selection of one or the other of file vs folder. + * However, some providers allow the selection of files *or* folders. */ + fileentry = glade_xml_get_widget (gui->xml, "source_path_entry"); + g_signal_connect_after (fileentry, "browse-clicked", G_CALLBACK (browse_clicked), gui); +#endif /* Management */ gui->account_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "management_name"));
Attachment:
smime.p7s
Description: S/MIME cryptographic signature