aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-account-gui.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-29 01:48:07 +0800
committerDan Winship <danw@src.gnome.org>2001-03-29 01:48:07 +0800
commitb38a35a5187475b13210474cea7140025793b502 (patch)
tree3508123310f89e26c0d4f93e6d764fd6ccf7a6ac /mail/mail-account-gui.c
parent34ea3020395002ea43ddad071db305b4a35c51cc (diff)
downloadgsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.gz
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.tar.zst
gsoc2013-evolution-b38a35a5187475b13210474cea7140025793b502.zip
Set up the sent/drafts folder buttons. (folder_picker_clicked): Pop up the
* mail-account-gui.c (mail_account_gui_new): Set up the sent/drafts folder buttons. (folder_picker_clicked): Pop up the folder selector when sent or drafts is clicked. (mail_account_gui_save): Save the sent/drafts folders. * mail-config.c (account_copy): copy sent/drafts info (config_read): read sent/drafts info (mail_config_write): write sent/drafts info * mail-callbacks.c (composer_send_cb, composer_postpone_cb): split out some common code here (and fix inconsistencies). Always set headers on the message giving the account name, transport, and sent folder to use. * mail-ops.c (mail_send_message): If the message has an X-Evolution-Account header, use the transport/sent folder info for that account (assuming it still exists). Otherwise, if it has X-Evolution-Transport and/or X-Evolution-Fcc, use those. If not, use the default transport and sent folder. FIXME: Falls back silently to the default sent folder if it can't open the account-specific one... (send_queue_send): remove the X-Evolution-Transport, etc processing here, as it gets done by mail_send_message now. FIXME: We only sync the default sent folder. * component-factory.c (owner_set_cb): While setting up the standard folders, also record their URIs. svn path=/trunk/; revision=8991
Diffstat (limited to 'mail/mail-account-gui.c')
-rw-r--r--mail/mail-account-gui.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 198db8c11d..5ea67558df 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -28,9 +28,12 @@
#include <gal/widgets/e-unicode.h>
+#include "shell/evolution-shell-client.h"
#include "mail-account-gui.h"
#include "mail-session.h"
+extern char *default_drafts_folder_uri, *default_sent_folder_uri;
+
static void save_service (MailAccountGuiService *gsvc, GHashTable *extra_conf, MailConfigService *service);
static gboolean
@@ -646,6 +649,44 @@ extract_values (MailAccountGuiService *source, GHashTable *extra_config, CamelUR
}
+extern EvolutionShellClient *global_shell_client;
+
+static void
+set_folder_picker_label (GtkButton *button, const char *name)
+{
+ char *string;
+
+ string = e_utf8_to_gtk_string (GTK_WIDGET (button), name);
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), string);
+ g_free (string);
+}
+
+static void
+folder_picker_clicked (GtkButton *button, gpointer user_data)
+{
+ MailAccountGuiFolder *folder = user_data;
+ const char *allowed_types[] = { "mail", NULL };
+ char *physical_uri, *evolution_uri;
+
+ physical_uri = evolution_uri = NULL;
+ evolution_shell_client_user_select_folder (
+ global_shell_client, _("Select Folder"), folder->uri,
+ allowed_types, &evolution_uri, &physical_uri);
+ if (!physical_uri || !*physical_uri) {
+ g_free (physical_uri);
+ g_free (evolution_uri);
+ return;
+ }
+
+ g_free (folder->uri);
+ folder->uri = physical_uri;
+ g_free (folder->name);
+ folder->name = g_strdup (g_basename (evolution_uri));
+ g_free (evolution_uri);
+ set_folder_picker_label (button, folder->name);
+}
+
+
static gboolean
setup_service (MailAccountGuiService *gsvc, MailConfigService *service)
{
@@ -781,6 +822,27 @@ mail_account_gui_new (MailConfigAccount *account)
gui->transport.check_supported = GTK_BUTTON (glade_xml_get_widget (gui->xml, "transport_check_supported"));
gtk_signal_connect (GTK_OBJECT (gui->transport.check_supported), "clicked", GTK_SIGNAL_FUNC (service_check_supported), &gui->transport);
+ gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button"));
+ gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "clicked", GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->drafts_folder);
+ if (account->drafts_folder_uri) {
+ gui->drafts_folder.uri = g_strdup (account->drafts_folder_uri);
+ gui->drafts_folder.name = g_strdup (account->drafts_folder_name);
+ } else {
+ gui->drafts_folder.uri = g_strdup (default_drafts_folder_uri);
+ gui->drafts_folder.name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1);
+ }
+ set_folder_picker_label (gui->drafts_folder_button, gui->drafts_folder.name);
+ gui->sent_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "sent_button"));
+ gtk_signal_connect (GTK_OBJECT (gui->sent_folder_button), "clicked", GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->sent_folder);
+ if (account->sent_folder_uri) {
+ gui->sent_folder.uri = g_strdup (account->sent_folder_uri);
+ gui->sent_folder.name = g_strdup (account->sent_folder_name);
+ } else {
+ gui->sent_folder.uri = g_strdup (default_sent_folder_uri);
+ gui->sent_folder.name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1);
+ }
+ set_folder_picker_label (gui->sent_folder_button, gui->sent_folder.name);
+
return gui;
}
@@ -1082,6 +1144,15 @@ mail_account_gui_save (MailAccountGui *gui)
account->transport = g_new0 (MailConfigService, 1);
save_service (&gui->transport, NULL, account->transport);
+ g_free (account->drafts_folder_name);
+ account->drafts_folder_name = g_strdup (gui->drafts_folder.name);
+ g_free (account->drafts_folder_uri);
+ account->drafts_folder_uri = g_strdup (gui->drafts_folder.uri);
+ g_free (account->sent_folder_name);
+ account->sent_folder_name = g_strdup (gui->sent_folder.name);
+ g_free (account->sent_folder_uri);
+ account->sent_folder_uri = g_strdup (gui->sent_folder.uri);
+
return TRUE;
}