aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-09-16 03:18:33 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-09-16 03:18:33 +0800
commit0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9 (patch)
treef87bfb8639543469f5b77d6866c92915c9f61b95
parenta9538c3f466c7e5db9d2fd24ecf30db5e014e65f (diff)
downloadgsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.tar
gsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.tar.gz
gsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.tar.bz2
gsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.tar.lz
gsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.tar.xz
gsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.tar.zst
gsoc2013-evolution-0a6ebcf09b23bfc9d4ca42112a4f4ddb8d6c9df9.zip
If built with gtkfilechooser support, we need to add a checkbox in the
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. svn path=/trunk/; revision=27271
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/mail-account-gui.c54
2 files changed, 62 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e38a3df684..7df4b67ba6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -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
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 168a75ea7c..5de9dc8211 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -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 @@ smime_encrypt_key_clear(GtkWidget *w, MailAccountGui *gui)
}
#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);
@@ -1765,6 +1810,15 @@ mail_account_gui_new (EAccount *account, EMAccountPrefs *dialog)
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"));
gui->default_account = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "management_default"));