aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-10-08 19:22:48 +0800
committerMilan Crha <mcrha@redhat.com>2013-10-08 19:22:48 +0800
commitb5023d32bdffdeb6cb626e74d0f3e464e66cec1b (patch)
tree3257d3e4755641f99a10b9ba58779f32c82fe428
parent8099b68e96a85857e41784d6e128d4ff69e2e702 (diff)
downloadgsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.tar
gsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.tar.gz
gsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.tar.bz2
gsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.tar.lz
gsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.tar.xz
gsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.tar.zst
gsoc2013-evolution-b5023d32bdffdeb6cb626e74d0f3e464e66cec1b.zip
Bug #215115 - Per-folder From: email address
The change also allows setting accounts for certain recipients (based on a part of the recipient address). The option can be found in Folder Properties and in Edit->Preferences->Composer Preferences->Send Account.
-rw-r--r--e-util/e-mail-identity-combo-box.c73
-rw-r--r--e-util/e-mail-identity-combo-box.h5
-rw-r--r--mail/Makefile.am2
-rw-r--r--mail/e-mail-backend.c34
-rw-r--r--mail/e-mail-backend.h4
-rw-r--r--mail/e-mail-send-account-override.c718
-rw-r--r--mail/e-mail-send-account-override.h108
-rw-r--r--mail/em-composer-utils.c176
-rw-r--r--mail/em-composer-utils.h8
-rw-r--r--mail/em-folder-properties.c73
-rw-r--r--mail/mail-config.ui1417
-rw-r--r--modules/mail/em-composer-prefs.c747
-rw-r--r--po/POTFILES.in1
13 files changed, 2841 insertions, 525 deletions
diff --git a/e-util/e-mail-identity-combo-box.c b/e-util/e-mail-identity-combo-box.c
index 9561ba7f98..5cb7b0da34 100644
--- a/e-util/e-mail-identity-combo-box.c
+++ b/e-util/e-mail-identity-combo-box.c
@@ -16,6 +16,12 @@
*
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
#include "e-mail-identity-combo-box.h"
#define E_MAIL_IDENTITY_COMBO_BOX_GET_PRIVATE(obj) \
@@ -28,11 +34,13 @@
struct _EMailIdentityComboBoxPrivate {
ESourceRegistry *registry;
guint refresh_idle_id;
+ gboolean allow_none;
};
enum {
PROP_0,
- PROP_REGISTRY
+ PROP_REGISTRY,
+ PROP_ALLOW_NONE
};
enum {
@@ -129,6 +137,12 @@ mail_identity_combo_box_set_property (GObject *object,
E_MAIL_IDENTITY_COMBO_BOX (object),
g_value_get_object (value));
return;
+
+ case PROP_ALLOW_NONE:
+ e_mail_identity_combo_box_set_allow_none (
+ E_MAIL_IDENTITY_COMBO_BOX (object),
+ g_value_get_boolean (value));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -147,6 +161,13 @@ mail_identity_combo_box_get_property (GObject *object,
e_mail_identity_combo_box_get_registry (
E_MAIL_IDENTITY_COMBO_BOX (object)));
return;
+
+ case PROP_ALLOW_NONE:
+ g_value_set_boolean (
+ value,
+ e_mail_identity_combo_box_get_allow_none (
+ E_MAIL_IDENTITY_COMBO_BOX (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -230,12 +251,24 @@ e_mail_identity_combo_box_class_init (EMailIdentityComboBoxClass *class)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_ALLOW_NONE,
+ g_param_spec_boolean (
+ "allow-none",
+ "Allow None Item",
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
static void
e_mail_identity_combo_box_init (EMailIdentityComboBox *combo_box)
{
combo_box->priv = E_MAIL_IDENTITY_COMBO_BOX_GET_PRIVATE (combo_box);
+ combo_box->priv->allow_none = FALSE;
}
GtkWidget *
@@ -359,6 +392,17 @@ e_mail_identity_combo_box_refresh (EMailIdentityComboBox *combo_box)
g_list_free_full (list, (GDestroyNotify) g_object_unref);
+ if (combo_box->priv->allow_none) {
+ GtkTreeIter iter;
+
+ gtk_list_store_insert (GTK_LIST_STORE (tree_model), &iter, 0);
+
+ gtk_list_store_set (
+ GTK_LIST_STORE (tree_model), &iter,
+ COLUMN_DISPLAY_NAME, _("None"),
+ COLUMN_UID, "", -1);
+ }
+
/* Try and restore the previous selected source, or else pick
* the default identity of the default mail account. If even
* that fails, just pick the first item. */
@@ -366,7 +410,8 @@ e_mail_identity_combo_box_refresh (EMailIdentityComboBox *combo_box)
if (saved_uid != NULL)
gtk_combo_box_set_active_id (gtk_combo_box, saved_uid);
- if (gtk_combo_box_get_active_id (gtk_combo_box) == NULL)
+ if (!combo_box->priv->allow_none &&
+ gtk_combo_box_get_active_id (gtk_combo_box) == NULL)
mail_identity_combo_box_activate_default (combo_box);
if (gtk_combo_box_get_active_id (gtk_combo_box) == NULL)
@@ -380,3 +425,27 @@ e_mail_identity_combo_box_get_registry (EMailIdentityComboBox *combo_box)
return combo_box->priv->registry;
}
+
+void
+e_mail_identity_combo_box_set_allow_none (EMailIdentityComboBox *combo_box,
+ gboolean allow_none)
+{
+ g_return_if_fail (E_IS_MAIL_IDENTITY_COMBO_BOX (combo_box));
+
+ if ((combo_box->priv->allow_none ? 1 : 0) == (allow_none ? 1 : 0))
+ return;
+
+ combo_box->priv->allow_none = allow_none;
+
+ g_object_notify (G_OBJECT (combo_box), "allow-none");
+
+ e_mail_identity_combo_box_refresh (combo_box);
+}
+
+gboolean
+e_mail_identity_combo_box_get_allow_none (EMailIdentityComboBox *combo_box)
+{
+ g_return_val_if_fail (E_IS_MAIL_IDENTITY_COMBO_BOX (combo_box), FALSE);
+
+ return combo_box->priv->allow_none;
+}
diff --git a/e-util/e-mail-identity-combo-box.h b/e-util/e-mail-identity-combo-box.h
index 8c395b362f..07336a435d 100644
--- a/e-util/e-mail-identity-combo-box.h
+++ b/e-util/e-mail-identity-combo-box.h
@@ -69,6 +69,11 @@ void e_mail_identity_combo_box_refresh
ESourceRegistry *
e_mail_identity_combo_box_get_registry
(EMailIdentityComboBox *combo_box);
+void e_mail_identity_combo_box_set_allow_none
+ (EMailIdentityComboBox *combo_box,
+ gboolean allow_none);
+gboolean e_mail_identity_combo_box_get_allow_none
+ (EMailIdentityComboBox *combo_box);
G_END_DECLS
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 61dc4c3379..b5a9caa3ea 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -80,6 +80,7 @@ mailinclude_HEADERS = \
e-mail-reader-utils.h \
e-mail-reader.h \
e-mail-request.h \
+ e-mail-send-account-override.h \
e-mail-sidebar.h \
e-mail-tag-editor.h \
e-mail-ui-session.h \
@@ -154,6 +155,7 @@ libevolution_mail_la_SOURCES = \
e-mail-reader-utils.c \
e-mail-reader.c \
e-mail-request.c \
+ e-mail-send-account-override.c \
e-mail-sidebar.c \
e-mail-tag-editor.c \
e-mail-ui-session.c \
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index b7fb84735e..f15e7f8efb 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -63,11 +63,13 @@
struct _EMailBackendPrivate {
EMailSession *session;
GHashTable *jobs;
+ EMailSendAccountOverride *send_account_override;
};
enum {
PROP_0,
- PROP_SESSION
+ PROP_SESSION,
+ PROP_SEND_ACCOUNT_OVERRIDE
};
/* FIXME Kill this thing. It's a horrible hack. */
@@ -825,6 +827,13 @@ mail_backend_get_property (GObject *object,
e_mail_backend_get_session (
E_MAIL_BACKEND (object)));
return;
+
+ case PROP_SEND_ACCOUNT_OVERRIDE:
+ g_value_set_object (
+ value,
+ e_mail_backend_get_send_account_override (
+ E_MAIL_BACKEND (object)));
+ return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -862,6 +871,7 @@ mail_backend_finalize (GObject *object)
priv = E_MAIL_BACKEND_GET_PRIVATE (object);
g_hash_table_destroy (priv->jobs);
+ g_clear_object (&priv->send_account_override);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_mail_backend_parent_class)->finalize (object);
@@ -1016,6 +1026,7 @@ mail_backend_constructed (GObject *object)
EShellBackend *shell_backend;
MailFolderCache *folder_cache;
ESourceRegistry *registry;
+ gchar *send_overrides_ini;
priv = E_MAIL_BACKEND_GET_PRIVATE (object);
@@ -1108,6 +1119,10 @@ mail_backend_constructed (GObject *object)
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_backend_parent_class)->constructed (object);
+
+ send_overrides_ini = g_build_filename (e_shell_backend_get_config_dir (shell_backend), "send-overrides.ini", NULL);
+ priv->send_account_override = e_mail_send_account_override_new (send_overrides_ini);
+ g_free (send_overrides_ini);
}
static void
@@ -1138,6 +1153,16 @@ e_mail_backend_class_init (EMailBackendClass *class)
NULL,
E_TYPE_MAIL_SESSION,
G_PARAM_READABLE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SEND_ACCOUNT_OVERRIDE,
+ g_param_spec_object (
+ "send-account-override",
+ NULL,
+ NULL,
+ E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE,
+ G_PARAM_READABLE));
}
static void
@@ -1229,3 +1254,10 @@ e_mail_backend_empty_trash_policy_decision (EMailBackend *backend)
return class->empty_trash_policy_decision (backend);
}
+EMailSendAccountOverride *
+e_mail_backend_get_send_account_override (EMailBackend *backend)
+{
+ g_return_val_if_fail (E_IS_MAIL_BACKEND (backend), NULL);
+
+ return backend->priv->send_account_override;
+}
diff --git a/mail/e-mail-backend.h b/mail/e-mail-backend.h
index b44b330a9f..0bc94f1318 100644
--- a/mail/e-mail-backend.h
+++ b/mail/e-mail-backend.h
@@ -28,6 +28,7 @@
#include <shell/e-shell-backend.h>
#include <libemail-engine/e-mail-session.h>
+#include <mail/e-mail-send-account-override.h>
/* Standard GObject macros */
#define E_TYPE_MAIL_BACKEND \
@@ -76,6 +77,9 @@ gboolean e_mail_backend_delete_junk_policy_decision
(EMailBackend *backend);
gboolean e_mail_backend_empty_trash_policy_decision
(EMailBackend *backend);
+EMailSendAccountOverride *
+ e_mail_backend_get_send_account_override
+ (EMailBackend *backend);
G_END_DECLS
diff --git a/mail/e-mail-send-account-override.c b/mail/e-mail-send-account-override.c
new file mode 100644
index 0000000000..8af7227439
--- /dev/null
+++ b/mail/e-mail-send-account-override.c
@@ -0,0 +1,718 @@
+/*
+ * e-mail-send-account-override.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2013 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <libedataserver/libedataserver.h>
+
+#include "e-mail-send-account-override.h"
+
+#define FOLDERS_SECTION "Folders"
+#define RECIPIENTS_SECTION "Recipients"
+#define OPTIONS_SECTION "Options"
+
+#define OPTION_PREFER_FOLDER "PreferFolder"
+
+struct _EMailSendAccountOverridePrivate
+{
+ GKeyFile *key_file;
+ gchar *config_filename;
+ gboolean prefer_folder;
+
+ gboolean need_save;
+ guint save_frozen;
+
+ GMutex property_lock;
+};
+
+enum {
+ PROP_0,
+ PROP_PREFER_FOLDER
+};
+
+enum {
+ CHANGED,
+ LAST_SIGNAL
+};
+
+static gint signals[LAST_SIGNAL];
+
+G_DEFINE_TYPE (EMailSendAccountOverride, e_mail_send_account_override, G_TYPE_OBJECT)
+
+static void
+e_mail_send_account_override_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EMailSendAccountOverride *account_override = E_MAIL_SEND_ACCOUNT_OVERRIDE (object);
+
+ g_return_if_fail (account_override != NULL);
+
+ switch (property_id) {
+ case PROP_PREFER_FOLDER:
+ g_value_set_boolean (value,
+ e_mail_send_account_override_get_prefer_folder (account_override));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_mail_send_account_override_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EMailSendAccountOverride *account_override = E_MAIL_SEND_ACCOUNT_OVERRIDE (object);
+
+ g_return_if_fail (account_override != NULL);
+
+ switch (property_id) {
+ case PROP_PREFER_FOLDER:
+ e_mail_send_account_override_set_prefer_folder (account_override,
+ g_value_get_boolean (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+e_mail_send_account_override_finalize (GObject *object)
+{
+ EMailSendAccountOverride *account_override = E_MAIL_SEND_ACCOUNT_OVERRIDE (object);
+
+ g_return_if_fail (account_override != NULL);
+
+ if (account_override->priv->key_file) {
+ g_key_file_free (account_override->priv->key_file);
+ account_override->priv->key_file = NULL;
+ }
+
+ if (account_override->priv->config_filename) {
+ g_free (account_override->priv->config_filename);
+ account_override->priv->config_filename = NULL;
+ }
+
+ g_mutex_clear (&account_override->priv->property_lock);
+
+ G_OBJECT_CLASS (e_mail_send_account_override_parent_class)->finalize (object);
+}
+
+static void
+e_mail_send_account_override_class_init (EMailSendAccountOverrideClass *klass)
+{
+ GObjectClass *object_class;
+
+ g_type_class_add_private (klass, sizeof (EMailSendAccountOverridePrivate));
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->get_property = e_mail_send_account_override_get_property;
+ object_class->set_property = e_mail_send_account_override_set_property;
+ object_class->finalize = e_mail_send_account_override_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_PREFER_FOLDER,
+ g_param_spec_boolean (
+ "prefer-folder",
+ "Prefer Folder",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ signals[CHANGED] = g_signal_new (
+ "changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMailSendAccountOverrideClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
+
+static void
+e_mail_send_account_override_init (EMailSendAccountOverride *account_override)
+{
+ account_override->priv = G_TYPE_INSTANCE_GET_PRIVATE (account_override,
+ E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE, EMailSendAccountOverridePrivate);
+
+ g_mutex_init (&account_override->priv->property_lock);
+ account_override->priv->key_file = g_key_file_new ();
+ account_override->priv->config_filename = NULL;
+ account_override->priv->prefer_folder = TRUE;
+ account_override->priv->need_save = FALSE;
+ account_override->priv->save_frozen = 0;
+}
+
+static gboolean
+e_mail_send_account_override_save_locked (EMailSendAccountOverride *account_override)
+{
+ gchar *contents;
+ GError *error = NULL;
+
+ g_return_val_if_fail (account_override->priv->key_file != NULL, FALSE);
+
+ account_override->priv->need_save = FALSE;
+
+ if (!account_override->priv->config_filename)
+ return FALSE;
+
+ contents = g_key_file_to_data (account_override->priv->key_file, NULL, NULL);
+ if (!contents)
+ return FALSE;
+
+ g_file_set_contents (account_override->priv->config_filename, contents, -1, &error);
+
+ if (error) {
+ g_warning ("%s: %s", G_STRFUNC, error->message);
+ g_clear_error (&error);
+ }
+
+ g_free (contents);
+
+ return TRUE;
+}
+
+static gboolean
+e_mail_send_account_override_maybe_save_locked (EMailSendAccountOverride *account_override)
+{
+ if (account_override->priv->save_frozen)
+ account_override->priv->need_save = TRUE;
+ else
+ return e_mail_send_account_override_save_locked (account_override);
+
+ return FALSE;
+}
+
+static gchar *
+get_override_for_folder_uri_locked (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri)
+{
+ gchar *account_uid;
+
+ if (!folder_uri || !*folder_uri)
+ return NULL;
+
+ account_uid = g_key_file_get_string (account_override->priv->key_file, FOLDERS_SECTION, folder_uri, NULL);
+
+ if (account_uid)
+ g_strchomp (account_uid);
+
+ if (account_uid && !*account_uid) {
+ g_free (account_uid);
+ account_uid = NULL;
+ }
+
+ return account_uid;
+}
+
+static gchar *
+test_one_recipient (/* const */ gchar **keys,
+ /* const */ GPtrArray *values,
+ const gchar *name,
+ const gchar *address)
+{
+ gint ii;
+
+ g_return_val_if_fail (keys != NULL, NULL);
+ g_return_val_if_fail (values != NULL, NULL);
+
+ if ((!name || !*name) && (!address || !*address))
+ return NULL;
+
+ for (ii = 0; keys[ii] && ii < values->len; ii++) {
+ if (name && *name && e_util_utf8_strstrcase (name, keys[ii]) != NULL) {
+ return g_strdup (values->pdata[ii]);
+ }
+
+ if (address && *address && e_util_utf8_strstrcase (address, keys[ii]) != NULL) {
+ return g_strdup (values->pdata[ii]);
+ }
+ }
+
+ return NULL;
+}
+
+static gchar *
+get_override_for_recipients_locked (EMailSendAccountOverride *account_override,
+ CamelAddress *recipients)
+{
+ CamelInternetAddress *iaddress;
+ gchar *account_uid = NULL;
+ GPtrArray *values;
+ gchar **keys;
+ gint ii, len;
+
+ if (!recipients || !CAMEL_IS_INTERNET_ADDRESS (recipients))
+ return NULL;
+
+ keys = g_key_file_get_keys (account_override->priv->key_file, RECIPIENTS_SECTION, NULL, NULL);
+ if (!keys)
+ return NULL;
+
+ values = g_ptr_array_new_full (g_strv_length (keys), g_free);
+ for (ii = 0; keys[ii]; ii++) {
+ g_ptr_array_add (values, g_key_file_get_string (account_override->priv->key_file,
+ RECIPIENTS_SECTION, keys[ii], NULL));
+ }
+
+ iaddress = CAMEL_INTERNET_ADDRESS (recipients);
+ len = camel_address_length (recipients);
+ for (ii = 0; ii < len; ii++) {
+ const gchar *name, *address;
+
+ if (camel_internet_address_get (iaddress, ii, &name, &address)) {
+ account_uid = test_one_recipient (keys, values, name, address);
+
+ if (account_uid)
+ g_strchomp (account_uid);
+
+ if (account_uid && !*account_uid) {
+ g_free (account_uid);
+ account_uid = NULL;
+ }
+
+ if (account_uid)
+ break;
+ }
+ }
+
+ g_ptr_array_free (values, TRUE);
+ g_strfreev (keys);
+
+ return account_uid;
+}
+
+static void
+list_overrides_section_for_account_locked (EMailSendAccountOverride *account_override,
+ const gchar *account_uid,
+ const gchar *section,
+ GSList **overrides)
+{
+ gchar **keys;
+
+ g_return_if_fail (account_uid != NULL);
+ g_return_if_fail (section != NULL);
+
+ if (!overrides)
+ return;
+
+ *overrides = NULL;
+
+ keys = g_key_file_get_keys (account_override->priv->key_file, section, NULL, NULL);
+ if (keys) {
+ gint ii;
+
+ for (ii = 0; keys[ii]; ii++) {
+ const gchar *key = keys[ii];
+ gchar *value;
+
+ value = g_key_file_get_string (account_override->priv->key_file, section, key, NULL);
+ if (g_strcmp0 (value, account_uid) == 0)
+ *overrides = g_slist_prepend (*overrides, g_strdup (key));
+ g_free (value);
+ }
+ }
+
+ g_strfreev (keys);
+
+ *overrides = g_slist_reverse (*overrides);
+}
+
+static void
+list_overrides_for_account_locked (EMailSendAccountOverride *account_override,
+ const gchar *account_uid,
+ GSList **folder_overrides,
+ GSList **recipient_overrides)
+{
+ if (!account_uid)
+ return;
+
+ list_overrides_section_for_account_locked (account_override, account_uid, FOLDERS_SECTION, folder_overrides);
+ list_overrides_section_for_account_locked (account_override, account_uid, RECIPIENTS_SECTION, recipient_overrides);
+}
+
+EMailSendAccountOverride *
+e_mail_send_account_override_new (const gchar *config_filename)
+{
+ EMailSendAccountOverride *account_override;
+
+ account_override = g_object_new (E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE, NULL);
+
+ if (config_filename)
+ e_mail_send_account_override_set_config_filename (account_override, config_filename);
+
+ return account_override;
+}
+
+void
+e_mail_send_account_override_set_config_filename (EMailSendAccountOverride *account_override,
+ const gchar *config_filename)
+{
+ GError *error = NULL;
+ gboolean old_prefer_folder, prefer_folder_changed;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (config_filename != NULL);
+ g_return_if_fail (*config_filename);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+ if (g_strcmp0 (config_filename, account_override->priv->config_filename) == 0) {
+ g_mutex_unlock (&account_override->priv->property_lock);
+ return;
+ }
+
+ g_free (account_override->priv->config_filename);
+ account_override->priv->config_filename = g_strdup (config_filename);
+
+ g_key_file_load_from_file (account_override->priv->key_file,
+ account_override->priv->config_filename, G_KEY_FILE_NONE, NULL);
+
+ old_prefer_folder = account_override->priv->prefer_folder;
+ account_override->priv->prefer_folder = g_key_file_get_boolean (account_override->priv->key_file,
+ OPTIONS_SECTION, OPTION_PREFER_FOLDER, &error);
+
+ if (error) {
+ /* default value is to prefer the folder override over the recipients */
+ account_override->priv->prefer_folder = TRUE;
+ g_clear_error (&error);
+ }
+
+ prefer_folder_changed = (account_override->priv->prefer_folder ? 1 : 0) != (old_prefer_folder ? 1 : 0);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (prefer_folder_changed)
+ g_object_notify (G_OBJECT (account_override), "prefer-folder");
+}
+
+gchar *
+e_mail_send_account_override_dup_config_filename (EMailSendAccountOverride *account_override)
+{
+ gchar *config_filename;
+
+ g_return_val_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override), NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+ config_filename = g_strdup (account_override->priv->config_filename);
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ return config_filename;
+}
+
+void
+e_mail_send_account_override_set_prefer_folder (EMailSendAccountOverride *account_override,
+ gboolean prefer_folder)
+{
+ gboolean changed, saved = FALSE;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ changed = (account_override->priv->prefer_folder ? 1 : 0) != (prefer_folder ? 1 : 0);
+ if (changed) {
+ account_override->priv->prefer_folder = prefer_folder;
+
+ g_key_file_set_boolean (account_override->priv->key_file,
+ OPTIONS_SECTION, OPTION_PREFER_FOLDER, prefer_folder);
+
+ saved = e_mail_send_account_override_maybe_save_locked (account_override);
+ }
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (changed)
+ g_object_notify (G_OBJECT (account_override), "prefer-folder");
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
+
+gboolean
+e_mail_send_account_override_get_prefer_folder (EMailSendAccountOverride *account_override)
+{
+ gboolean prefer_folder;
+
+ g_return_val_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override), FALSE);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+ prefer_folder = account_override->priv->prefer_folder;
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ return prefer_folder;
+}
+
+/* free returned pointer with g_free() */
+gchar *
+e_mail_send_account_override_get_account_uid (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri,
+ const CamelInternetAddress *recipients_to,
+ const CamelInternetAddress *recipients_cc,
+ const CamelInternetAddress *recipients_bcc)
+{
+ gchar *account_uid = NULL;
+
+ g_return_val_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override), NULL);
+ g_return_val_if_fail (account_override->priv->config_filename != NULL, NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ if (account_override->priv->prefer_folder)
+ account_uid = get_override_for_folder_uri_locked (account_override, folder_uri);
+
+ if (!account_uid)
+ account_uid = get_override_for_recipients_locked (account_override, (CamelAddress *) recipients_to);
+
+ if (!account_uid)
+ account_uid = get_override_for_recipients_locked (account_override, (CamelAddress *) recipients_cc);
+
+ if (!account_uid)
+ account_uid = get_override_for_recipients_locked (account_override, (CamelAddress *) recipients_bcc);
+
+ if (!account_uid && !account_override->priv->prefer_folder)
+ account_uid = get_override_for_folder_uri_locked (account_override, folder_uri);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ return account_uid;
+}
+
+void
+e_mail_send_account_override_remove_for_account_uid (EMailSendAccountOverride *account_override,
+ const gchar *account_uid)
+{
+ GSList *folders = NULL, *recipients = NULL, *iter;
+ gboolean saved = FALSE;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (account_uid != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ list_overrides_for_account_locked (account_override, account_uid, &folders, &recipients);
+
+ if (folders || recipients) {
+ for (iter = folders; iter; iter = g_slist_next (iter)) {
+ const gchar *key = iter->data;
+
+ g_key_file_remove_key (account_override->priv->key_file, FOLDERS_SECTION, key, NULL);
+ }
+
+ for (iter = recipients; iter; iter = g_slist_next (iter)) {
+ const gchar *key = iter->data;
+
+ g_key_file_remove_key (account_override->priv->key_file, RECIPIENTS_SECTION, key, NULL);
+ }
+
+ saved = e_mail_send_account_override_maybe_save_locked (account_override);
+ }
+
+ g_slist_free_full (folders, g_free);
+ g_slist_free_full (recipients, g_free);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
+
+gchar *
+e_mail_send_account_override_get_for_folder (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri)
+{
+ gchar *account_uid = NULL;
+
+ g_return_val_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override), NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ account_uid = get_override_for_folder_uri_locked (account_override, folder_uri);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ return account_uid;
+}
+
+void
+e_mail_send_account_override_set_for_folder (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri,
+ const gchar *account_uid)
+{
+ gboolean saved;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (folder_uri != NULL);
+ g_return_if_fail (account_uid != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ g_key_file_set_string (account_override->priv->key_file, FOLDERS_SECTION, folder_uri, account_uid);
+ saved = e_mail_send_account_override_maybe_save_locked (account_override);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
+
+void
+e_mail_send_account_override_remove_for_folder (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri)
+{
+ gboolean saved;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (folder_uri != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ g_key_file_remove_key (account_override->priv->key_file, FOLDERS_SECTION, folder_uri, NULL);
+ saved = e_mail_send_account_override_maybe_save_locked (account_override);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
+
+gchar *
+e_mail_send_account_override_get_for_recipient (EMailSendAccountOverride *account_override,
+ const CamelInternetAddress *recipients)
+{
+ gchar *account_uid;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (recipients != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+ account_uid = get_override_for_recipients_locked (account_override, (CamelAddress *) recipients);
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ return account_uid;
+}
+
+void
+e_mail_send_account_override_set_for_recipient (EMailSendAccountOverride *account_override,
+ const gchar *recipient,
+ const gchar *account_uid)
+{
+ gboolean saved;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (recipient != NULL);
+ g_return_if_fail (account_uid != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ g_key_file_set_string (account_override->priv->key_file, RECIPIENTS_SECTION, recipient, account_uid);
+ saved = e_mail_send_account_override_maybe_save_locked (account_override);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
+
+void
+e_mail_send_account_override_remove_for_recipient (EMailSendAccountOverride *account_override,
+ const gchar *recipient)
+{
+ gboolean saved;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (recipient != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ g_key_file_remove_key (account_override->priv->key_file, RECIPIENTS_SECTION, recipient, NULL);
+ saved = e_mail_send_account_override_maybe_save_locked (account_override);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
+
+void
+e_mail_send_account_override_list_for_account (EMailSendAccountOverride *account_override,
+ const gchar *account_uid,
+ GSList **folder_overrides,
+ GSList **recipient_overrides)
+{
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+ g_return_if_fail (account_uid != NULL);
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ list_overrides_for_account_locked (account_override, account_uid, folder_overrides, recipient_overrides);
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+}
+
+void
+e_mail_send_account_override_freeze_save (EMailSendAccountOverride *account_override)
+{
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ account_override->priv->save_frozen++;
+ if (!account_override->priv->save_frozen) {
+ g_warn_if_reached ();
+ }
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+}
+
+void
+e_mail_send_account_override_thaw_save (EMailSendAccountOverride *account_override)
+{
+ gboolean saved = FALSE;
+
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+
+ g_mutex_lock (&account_override->priv->property_lock);
+
+ if (!account_override->priv->save_frozen) {
+ g_warn_if_reached ();
+ } else {
+ account_override->priv->save_frozen--;
+ if (!account_override->priv->save_frozen &&
+ account_override->priv->need_save)
+ saved = e_mail_send_account_override_save_locked (account_override);
+ }
+
+ g_mutex_unlock (&account_override->priv->property_lock);
+
+ if (saved)
+ g_signal_emit (account_override, signals[CHANGED], 0);
+}
diff --git a/mail/e-mail-send-account-override.h b/mail/e-mail-send-account-override.h
new file mode 100644
index 0000000000..e89d7b657c
--- /dev/null
+++ b/mail/e-mail-send-account-override.h
@@ -0,0 +1,108 @@
+/*
+ * e-mail-send-account-override.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2013 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#ifndef E_MAIL_SEND_ACCOUNT_OVERRIDE_H
+#define E_MAIL_SEND_ACCOUNT_OVERRIDE_H
+
+#include <glib-object.h>
+#include <camel/camel.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE \
+ (e_mail_send_account_override_get_type ())
+#define E_MAIL_SEND_ACCOUNT_OVERRIDE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE, EMailSendAccountOverride))
+#define E_MAIL_SEND_ACCOUNT_OVERRIDE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE, EMailSendAccountOverrideClass))
+#define E_IS_MAIL_SEND_ACCOUNT_OVERRIDE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE))
+#define E_IS_MAIL_SEND_ACCOUNT_OVERRIDE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE))
+#define E_MAIL_SEND_ACCOUNT_OVERRIDE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MAIL_SEND_ACCOUNT_OVERRIDE, EMailSendAccountOverrideClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMailSendAccountOverride EMailSendAccountOverride;
+typedef struct _EMailSendAccountOverrideClass EMailSendAccountOverrideClass;
+typedef struct _EMailSendAccountOverridePrivate EMailSendAccountOverridePrivate;
+
+struct _EMailSendAccountOverride {
+ GObject parent;
+ EMailSendAccountOverridePrivate *priv;
+};
+
+struct _EMailSendAccountOverrideClass {
+ GObjectClass parent;
+
+ /* Signals */
+ void (* changed) (EMailSendAccountOverride *account_override);
+};
+
+GType e_mail_send_account_override_get_type (void);
+EMailSendAccountOverride *
+ e_mail_send_account_override_new (const gchar *config_filename);
+void e_mail_send_account_override_set_config_filename
+ (EMailSendAccountOverride *account_override,
+ const gchar *config_filename);
+gchar * e_mail_send_account_override_dup_config_filename
+ (EMailSendAccountOverride *account_override);
+void e_mail_send_account_override_set_prefer_folder (EMailSendAccountOverride *account_override,
+ gboolean prefer_folder);
+gboolean e_mail_send_account_override_get_prefer_folder (EMailSendAccountOverride *account_override);
+gchar * e_mail_send_account_override_get_account_uid (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri,
+ const CamelInternetAddress *recipients_to,
+ const CamelInternetAddress *recipients_cc,
+ const CamelInternetAddress *recipients_bcc);
+void e_mail_send_account_override_remove_for_account_uid
+ (EMailSendAccountOverride *account_override,
+ const gchar *account_uid);
+gchar * e_mail_send_account_override_get_for_folder (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri);
+void e_mail_send_account_override_set_for_folder (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri,
+ const gchar *account_uid);
+void e_mail_send_account_override_remove_for_folder (EMailSendAccountOverride *account_override,
+ const gchar *folder_uri);
+gchar * e_mail_send_account_override_get_for_recipient (EMailSendAccountOverride *account_override,
+ const CamelInternetAddress *recipients);
+void e_mail_send_account_override_set_for_recipient (EMailSendAccountOverride *account_override,
+ const gchar *recipient,
+ const gchar *account_uid);
+void e_mail_send_account_override_remove_for_recipient
+ (EMailSendAccountOverride *account_override,
+ const gchar *recipient);
+void e_mail_send_account_override_list_for_account (EMailSendAccountOverride *account_override,
+ const gchar *account_uid,
+ GSList **folder_overrides,
+ GSList **recipient_overrides);
+void e_mail_send_account_override_freeze_save (EMailSendAccountOverride *account_override);
+void e_mail_send_account_override_thaw_save (EMailSendAccountOverride *account_override);
+
+G_END_DECLS
+
+#endif /* E_MAIL_SEND_ACCOUNT_OVERRIDE_H */
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 630fe0f77a..44e8619e5d 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1103,6 +1103,8 @@ create_new_composer (EShell *shell,
e_composer_header_table_set_subject (table, subject);
e_composer_header_table_set_identity_uid (table, identity);
+ em_utils_apply_send_account_override_to_composer (composer, shell, folder);
+
g_free (identity);
g_object_unref (client_cache);
@@ -1140,6 +1142,83 @@ em_utils_compose_new_message (EShell *shell,
return composer;
}
+static CamelMimeMessage *
+em_utils_get_composer_recipients_as_message (EMsgComposer *composer)
+{
+ CamelMimeMessage *message;
+ EComposerHeaderTable *table;
+ EComposerHeader *header;
+ EDestination **destv;
+ CamelInternetAddress *to_addr, *cc_addr, *bcc_addr, *dest_addr;
+ const gchar *text_addr;
+ gint ii;
+
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
+
+ table = e_msg_composer_get_header_table (composer);
+ header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_TO);
+
+ if (!e_composer_header_get_visible (header))
+ return NULL;
+
+ message = camel_mime_message_new ();
+
+ to_addr = camel_internet_address_new ();
+ cc_addr = camel_internet_address_new ();
+ bcc_addr = camel_internet_address_new ();
+
+ /* To */
+ dest_addr = to_addr;
+ destv = e_composer_header_table_get_destinations_to (table);
+ for (ii = 0; destv != NULL && destv[ii] != NULL; ii++) {
+ text_addr = e_destination_get_address (destv[ii]);
+ if (text_addr && *text_addr) {
+ if (camel_address_decode (CAMEL_ADDRESS (dest_addr), text_addr) <= 0)
+ camel_internet_address_add (dest_addr, "", text_addr);
+ }
+ }
+ e_destination_freev (destv);
+
+ /* CC */
+ dest_addr = cc_addr;
+ destv = e_composer_header_table_get_destinations_cc (table);
+ for (ii = 0; destv != NULL && destv[ii] != NULL; ii++) {
+ text_addr = e_destination_get_address (destv[ii]);
+ if (text_addr && *text_addr) {
+ if (camel_address_decode (CAMEL_ADDRESS (dest_addr), text_addr) <= 0)
+ camel_internet_address_add (dest_addr, "", text_addr);
+ }
+ }
+ e_destination_freev (destv);
+
+ /* Bcc */
+ dest_addr = bcc_addr;
+ destv = e_composer_header_table_get_destinations_bcc (table);
+ for (ii = 0; destv != NULL && destv[ii] != NULL; ii++) {
+ text_addr = e_destination_get_address (destv[ii]);
+ if (text_addr && *text_addr) {
+ if (camel_address_decode (CAMEL_ADDRESS (dest_addr), text_addr) <= 0)
+ camel_internet_address_add (dest_addr, "", text_addr);
+ }
+ }
+ e_destination_freev (destv);
+
+ if (camel_address_length (CAMEL_ADDRESS (to_addr)) > 0)
+ camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_TO, to_addr);
+
+ if (camel_address_length (CAMEL_ADDRESS (cc_addr)) > 0)
+ camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_CC, cc_addr);
+
+ if (camel_address_length (CAMEL_ADDRESS (bcc_addr)) > 0)
+ camel_mime_message_set_recipients (message, CAMEL_RECIPIENT_TYPE_BCC, bcc_addr);
+
+ g_object_unref (to_addr);
+ g_object_unref (cc_addr);
+ g_object_unref (bcc_addr);
+
+ return message;
+}
+
/**
* em_utils_compose_new_message_with_mailto:
* @shell: an #EShell
@@ -1170,6 +1249,8 @@ em_utils_compose_new_message_with_mailto (EShell *shell,
else
composer = e_msg_composer_new (shell);
+ em_utils_apply_send_account_override_to_composer (composer, shell, folder);
+
table = e_msg_composer_get_header_table (composer);
client_cache = e_composer_header_table_ref_client_cache (table);
@@ -1459,6 +1540,9 @@ em_utils_edit_message (EShell *shell,
}
composer = e_msg_composer_new_with_message (shell, message, keep_signature, NULL);
+
+ em_utils_apply_send_account_override_to_composer (composer, shell, folder);
+
if (!folder_is_templates) {
EComposerHeaderTable *table;
ESource *source;
@@ -1907,8 +1991,10 @@ redirect_get_composer (EShell *shell,
registry = e_shell_get_registry (shell);
/* This returns a new ESource reference. */
- source = em_utils_guess_mail_identity_with_recipients_and_sort (
- registry, message, NULL, NULL, sort_sources_by_ui, shell);
+ source = em_utils_check_send_account_override (shell, message, NULL);
+ if (!source)
+ source = em_utils_guess_mail_identity_with_recipients_and_sort (
+ registry, message, NULL, NULL, sort_sources_by_ui, shell);
if (source != NULL) {
identity_uid = e_source_dup_uid (source);
@@ -2851,8 +2937,10 @@ em_utils_reply_to_message (EShell *shell,
registry = e_shell_get_registry (shell);
/* This returns a new ESource reference. */
- source = em_utils_guess_mail_identity_with_recipients_and_sort (
- registry, message, folder, message_uid, sort_sources_by_ui, shell);
+ source = em_utils_check_send_account_override (shell, message, folder);
+ if (!source)
+ source = em_utils_guess_mail_identity_with_recipients_and_sort (
+ registry, message, folder, message_uid, sort_sources_by_ui, shell);
if (source != NULL) {
identity_uid = e_source_dup_uid (source);
g_object_unref (source);
@@ -2920,6 +3008,9 @@ em_utils_reply_to_message (EShell *shell,
g_free (tmp_message_uid);
}
+ /* because some reply types can change recipients after the composer is populated */
+ em_utils_apply_send_account_override_to_composer (composer, shell, folder);
+
composer_set_no_change (composer);
gtk_widget_show (GTK_WIDGET (composer));
@@ -3058,3 +3149,80 @@ em_configure_new_composer (EMsgComposer *composer,
header, "clicked",
G_CALLBACK (post_header_clicked_cb), session);
}
+
+/* free returned pointer with g_object_unref(), if not NULL */
+ESource *
+em_utils_check_send_account_override (EShell *shell,
+ CamelMimeMessage *message,
+ CamelFolder *folder)
+{
+ EMailBackend *mail_backend;
+ EMailSendAccountOverride *account_override;
+ CamelInternetAddress *to = NULL, *cc = NULL, *bcc = NULL;
+ gchar *folder_uri = NULL, *account_uid;
+ ESource *account_source = NULL;
+ ESourceRegistry *source_registry;
+
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
+
+ if (!message && !folder)
+ return NULL;
+
+ if (message) {
+ to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
+ cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
+ bcc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC);
+ }
+
+ mail_backend = E_MAIL_BACKEND (e_shell_get_backend_by_name (shell, "mail"));
+ g_return_val_if_fail (mail_backend != NULL, NULL);
+
+ if (folder)
+ folder_uri = e_mail_folder_uri_from_folder (folder);
+
+ source_registry = e_shell_get_registry (shell);
+ account_override = e_mail_backend_get_send_account_override (mail_backend);
+ account_uid = e_mail_send_account_override_get_account_uid (account_override, folder_uri, to, cc, bcc);
+
+ while (account_uid) {
+ account_source = e_source_registry_ref_source (source_registry, account_uid);
+ if (account_source)
+ break;
+
+ /* stored send account override settings contain a reference
+ to a dropped account, thus cleanup it now */
+ e_mail_send_account_override_remove_for_account_uid (account_override, account_uid);
+
+ g_free (account_uid);
+ account_uid = e_mail_send_account_override_get_account_uid (account_override, folder_uri, to, cc, bcc);
+ }
+
+ g_free (folder_uri);
+ g_free (account_uid);
+
+ return account_source;
+}
+
+void
+em_utils_apply_send_account_override_to_composer (EMsgComposer *composer,
+ EShell *shell,
+ CamelFolder *folder)
+{
+ CamelMimeMessage *message;
+ EComposerHeaderTable *header_table;
+ ESource *source;
+
+ g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+ message = em_utils_get_composer_recipients_as_message (composer);
+ source = em_utils_check_send_account_override (shell, message, folder);
+ g_object_unref (message);
+
+ if (!source)
+ return;
+
+ header_table = e_msg_composer_get_header_table (composer);
+ e_composer_header_table_set_identity_uid (header_table, e_source_get_uid (source));
+
+ g_object_unref (source);
+}
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index a99c3c8af2..db7a0c29b3 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -85,6 +85,14 @@ void em_utils_get_real_folder_uri_and_message_uid
const gchar *uid,
gchar **folder_uri,
gchar **message_uid);
+ESource * em_utils_check_send_account_override
+ (EShell *shell,
+ CamelMimeMessage *message,
+ CamelFolder *folder);
+void em_utils_apply_send_account_override_to_composer
+ (EMsgComposer *composer,
+ EShell *shell,
+ CamelFolder *folder);
G_END_DECLS
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index d50888fea9..b56dffb4bf 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -31,10 +31,14 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <shell/e-shell.h>
+
#include <libemail-engine/e-mail-folder-utils.h>
#include <libemail-engine/mail-mt.h>
#include <libemail-engine/mail-ops.h>
+#include <e-util/e-util.h>
+
#include "e-mail-backend.h"
#include "e-mail-ui-session.h"
#include "em-config.h"
@@ -77,6 +81,25 @@ emfp_free (EConfig *ec,
g_slist_free (items);
}
+static void
+mail_identity_combo_box_changed_cb (GtkComboBox *combo_box,
+ EMailSendAccountOverride *account_override)
+{
+ const gchar *active_id, *folder_uri;
+
+ g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
+ g_return_if_fail (E_IS_MAIL_SEND_ACCOUNT_OVERRIDE (account_override));
+
+ folder_uri = g_object_get_data (G_OBJECT (combo_box), "sao-folder-uri");
+ g_return_if_fail (folder_uri != NULL);
+
+ active_id = gtk_combo_box_get_active_id (combo_box);
+ if (!active_id || !*active_id)
+ e_mail_send_account_override_remove_for_folder (account_override, folder_uri);
+ else
+ e_mail_send_account_override_set_for_folder (account_override, folder_uri, active_id);
+}
+
static gint
add_numbered_row (GtkTable *table,
gint row,
@@ -255,6 +278,56 @@ emfp_get_folder_item (EConfig *ec,
g_free (properties);
+ /* add send-account-override setting widgets */
+ if (context->folder != NULL) {
+ ESourceRegistry *registry;
+ EShell *shell;
+ EMailBackend *mail_backend;
+ EMailSendAccountOverride *account_override;
+ gchar *folder_uri, *account_uid;
+ GtkWidget *label;
+
+ registry = e_shell_get_registry (e_shell_get_default ());
+
+ label = gtk_label_new_with_mnemonic (_("_Send Account Override:"));
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_show (label);
+ gtk_table_attach (
+ GTK_TABLE (table), label,
+ 0, 2, row, row + 1,
+ GTK_FILL, 0, 0, 0);
+ row++;
+
+ widget = g_object_new (E_TYPE_MAIL_IDENTITY_COMBO_BOX,
+ "registry", registry,
+ "allow-none", TRUE,
+ NULL);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
+ gtk_widget_set_margin_left (widget, 12);
+ gtk_widget_show (widget);
+ gtk_table_attach (
+ GTK_TABLE (table), widget,
+ 0, 2, row, row + 1,
+ GTK_FILL | GTK_EXPAND, 0, 0, 0);
+ row++;
+
+ shell = e_shell_get_default ();
+ mail_backend = E_MAIL_BACKEND (e_shell_get_backend_by_name (shell, "mail"));
+ g_return_val_if_fail (mail_backend != NULL, table);
+
+ account_override = e_mail_backend_get_send_account_override (mail_backend);
+ folder_uri = e_mail_folder_uri_from_folder (context->folder);
+ account_uid = e_mail_send_account_override_get_for_folder (account_override, folder_uri);
+
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), account_uid ? account_uid : "");
+ g_object_set_data_full (G_OBJECT (widget), "sao-folder-uri", folder_uri, g_free);
+
+ g_signal_connect (widget, "changed",
+ G_CALLBACK (mail_identity_combo_box_changed_cb), account_override);
+
+ g_free (account_uid);
+ }
+
return table;
}
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index a614467150..943945815e 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -25,7 +25,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
@@ -41,7 +40,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
</object>
@@ -221,8 +219,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -237,8 +235,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -253,8 +251,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -269,8 +267,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -370,7 +368,7 @@
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -386,7 +384,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -395,15 +393,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -412,15 +410,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -429,15 +427,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -446,15 +444,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -463,15 +461,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -483,11 +481,12 @@
<child>
<object class="GtkComboBoxText" id="comboboxReplyStyle">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<items>
- <item translatable="yes" context="ReplyForward" id="attach">Attachment</item>
- <item translatable="yes" context="ReplyForward" id="outlook">Inline (Outlook style)</item>
- <item translatable="yes" context="ReplyForward" id="quoted">Quoted</item>
- <item translatable="yes" context="ReplyForward" id="do-not-quote">Do Not Quote</item>
+ <item translatable="yes" context="ReplyForward">Attachment</item>
+ <item translatable="yes" context="ReplyForward">Inline (Outlook style)</item>
+ <item translatable="yes" context="ReplyForward">Quoted</item>
+ <item translatable="yes" context="ReplyForward">Do Not Quote</item>
</items>
</object>
</child>
@@ -506,10 +505,11 @@
<child>
<object class="GtkComboBoxText" id="comboboxForwardStyle">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<items>
- <item translatable="yes" context="ReplyForward" id="attached">Attachment</item>
- <item translatable="yes" context="ReplyForward" id="inline">Inline</item>
- <item translatable="yes" context="ReplyForward" id="quoted">Quoted</item>
+ <item translatable="yes" context="ReplyForward">Attachment</item>
+ <item translatable="yes" context="ReplyForward">Inline</item>
+ <item translatable="yes" context="ReplyForward">Quoted</item>
</items>
</object>
</child>
@@ -771,8 +771,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -806,7 +806,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="color">#000000000000</property>
</object>
@@ -893,8 +892,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -909,8 +908,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -925,8 +924,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -941,8 +940,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -957,8 +956,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -973,8 +972,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -1008,529 +1007,431 @@
<property name="tab_fill">False</property>
</packing>
</child>
- </object>
- <object class="GtkListStore" id="hash_algo_model">
- <columns>
- <!-- column-name Hash -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Default</col>
- </row>
- <row>
- <col id="0" translatable="yes">SHA1</col>
- </row>
- <row>
- <col id="0" translatable="yes">SHA256</col>
- </row>
- <row>
- <col id="0" translatable="yes">SHA384</col>
- </row>
- <row>
- <col id="0" translatable="yes">SHA512</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model1">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">a</col>
- </row>
- <row>
- <col id="0" translatable="yes">b</col>
- </row>
- </data>
- </object>
- <object class="GtkListStore" id="model2">
- <columns>
- <!-- column-name gchararray -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">a</col>
- </row>
- <row>
- <col id="0" translatable="yes">b</col>
- </row>
- </data>
- </object>
- <object class="GtkNotebook" id="network_preferences_toplevel">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<child>
- <object class="GtkVBox" id="vboxNetworkGeneral">
+ <object class="GtkGrid" id="send-account-override-grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="spacing">12</property>
<child>
- <object class="GtkVBox" id="proxy-section">
+ <object class="GtkFrame" id="sao-folders-frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">etched-out</property>
<child>
- <object class="GtkLabel" id="proxy-header">
+ <object class="GtkAlignment" id="sao-folders-alignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Proxy Settings</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="proxy-alignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">12</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">6</property>
+ <property name="right_padding">6</property>
<child>
- <object class="GtkVBox" id="proxy-vbox">
+ <object class="GtkGrid" id="sao-folders-grid">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkRadioButton" id="rdoSysSettings">
- <property name="label" translatable="yes">_Use system defaults</property>
+ <object class="GtkButtonBox" id="sao-folders-bbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">30</property>
+ <property name="margin_right">30</property>
+ <property name="spacing">2</property>
+ <property name="layout_style">center</property>
+ <child>
+ <object class="GtkButton" id="sao-folders-add-button">
+ <property name="label" translatable="yes">Add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="sao-folders-remove-button">
+ <property name="label" translatable="yes">Remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="rdoNoProxy">
- <property name="label" translatable="yes">_Direct connection to the Internet</property>
+ <object class="GtkScrolledWindow" id="soa-folders-scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">rdoSysSettings</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkTreeView" id="sao-folders-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection8">
+ <property name="mode">multiple</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="sao-folders-frame-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> Use for Folders </property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="sao-recipients-frame">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">6</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">etched-out</property>
+ <child>
+ <object class="GtkAlignment" id="sao-recipients-alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">6</property>
+ <property name="right_padding">6</property>
+ <child>
+ <object class="GtkGrid" id="sao-recipients-grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
- <object class="GtkRadioButton" id="rdoManualProxy">
- <property name="label" translatable="yes">_Manual proxy configuration:</property>
+ <object class="GtkButtonBox" id="sao-recipients-bbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">rdoSysSettings</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <property name="layout_style">center</property>
+ <child>
+ <object class="GtkButton" id="sao-recipients-add-button">
+ <property name="label" translatable="yes">Add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="sao-recipients-edit-button">
+ <property name="label" translatable="yes">Edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="sao-recipients-remove-button">
+ <property name="label" translatable="yes">Remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="alignment27">
+ <object class="GtkScrolledWindow" id="soa-recipients-scrolledwindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">24</property>
+ <property name="can_focus">True</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
<child>
- <object class="GtkVBox" id="vbox18">
+ <object class="GtkTreeView" id="sao-recipients-treeview">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkTable" id="table9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">4</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="lblHttpHost">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">H_TTP Proxy:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">txtHttpHost</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblHttpsHost">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Secure HTTP Proxy:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">txtHttpsHost</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblSocksHost">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">SOC_KS Proxy:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">txtSocksHost</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblIgnoreHosts">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">No _Proxy for:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">txtIgnoreHosts</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="txtHttpHost">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="txtHttpsHost">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="txtSocksHost">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblHttpPort">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Port:</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblHttpsPort">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Port:</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblSocksPort">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Port:</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spnHttpPort">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment4</property>
- <property name="climb_rate">1</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spnHttpsPort">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment5</property>
- <property name="climb_rate">1</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spnSocksPort">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment6</property>
- <property name="climb_rate">1</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="txtIgnoreHosts">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="chkUseAuth">
- <property name="label" translatable="yes">Use Authe_ntication</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment26">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="left_padding">24</property>
- <child>
- <object class="GtkTable" id="table11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">3</property>
- <child>
- <object class="GtkLabel" id="lblAuthUser">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Us_ername:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">txtAuthUser</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="lblAuthPwd">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Pass_word:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">txtAuthPwd</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="txtAuthUser">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="txtAuthPwd">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="visibility">False</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection9">
+ <property name="mode">multiple</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="sao-recipients-frame-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> Use for Recipients </property>
+ <property name="use_markup">True</property>
+ </object>
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkAlignment" id="proxy-padding">
+ <object class="GtkFrame" id="sao-account-frame">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="label_xalign">0</property>
<child>
- <placeholder/>
+ <object class="GtkAlignment" id="sao-account-alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">6</property>
+ <property name="right_padding">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="soa-account-scrolledwindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkTreeView" id="sao-account-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection7"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="sao-account-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> Account </property>
+ <property name="use_markup">True</property>
+ </object>
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sao-header-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_bottom">6</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Send account overrides</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sao-info-label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">12</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ <property name="margin_bottom">6</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Assign which account should be used as a send account for respective folders or recipients, an override for usual send account detection. List of recipients can contain partial addresses or names. The name and the address parts are compared separately.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="sao-prefer-folder-check">
+ <property name="label" translatable="yes">Folder override has precedence over Recipient override</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="margin_left">12</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
</child>
<child type="tab">
- <object class="GtkLabel" id="lblNetworkGeneral">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">General</property>
+ <property name="label" translatable="yes">Send Account</property>
</object>
<packing>
+ <property name="position">4</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
+ <object class="GtkListStore" id="hash_algo_model">
+ <columns>
+ <!-- column-name Hash -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Default</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">SHA1</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">SHA256</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">SHA384</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">SHA512</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model1">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">a</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">b</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkListStore" id="model2">
+ <columns>
+ <!-- column-name gchararray -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">a</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">b</col>
+ </row>
+ </data>
+ </object>
<object class="GtkNotebook" id="preferences_toplevel">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -1583,8 +1484,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -1611,8 +1512,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -1681,8 +1582,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -1716,7 +1617,7 @@
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -1724,7 +1625,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="title" translatable="yes">Select HTML fixed width font</property>
<signal name="font-set" handler="changed" swapped="no"/>
</object>
@@ -1734,7 +1634,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -1742,7 +1642,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="title" translatable="yes">Select HTML variable width font</property>
<signal name="font-set" handler="changed" swapped="no"/>
</object>
@@ -1750,7 +1649,7 @@
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
<child>
@@ -1767,7 +1666,7 @@
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
</packing>
</child>
</object>
@@ -1782,6 +1681,7 @@
<child>
<object class="GtkHBox" id="hboxReadTimeout">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="chkMarkTimeout">
@@ -1790,6 +1690,7 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -1817,6 +1718,7 @@
<child>
<object class="GtkLabel" id="lblSeconds">
<property name="visible">True</property>
+ <property name="can_focus">False</property>
<property name="label" translatable="yes">seconds</property>
<property name="justify">center</property>
</object>
@@ -1844,8 +1746,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -1860,7 +1762,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="title" translatable="yes">Pick a color</property>
<property name="color">#000000000000</property>
</object>
@@ -1925,8 +1826,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -1941,8 +1842,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -2009,8 +1910,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -2050,8 +1951,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -2136,8 +2037,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -2152,8 +2053,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -2215,8 +2116,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
@@ -2232,8 +2133,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radImagesNever</property>
@@ -2250,8 +2151,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radImagesNever</property>
@@ -2395,8 +2296,8 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -2517,7 +2418,6 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -2532,7 +2432,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -2606,6 +2505,24 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
</object>
@@ -2690,14 +2607,13 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">4</property>
</packing>
</child>
@@ -2712,7 +2628,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
@@ -2755,7 +2670,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
@@ -2764,7 +2678,7 @@
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">4</property>
</packing>
</child>
@@ -2807,7 +2721,6 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -2823,7 +2736,6 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -2852,7 +2764,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
@@ -2861,7 +2772,7 @@
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">4</property>
</packing>
</child>
@@ -2871,7 +2782,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
@@ -2880,7 +2790,7 @@
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
+ <property name="y_options"/>
<property name="x_padding">25</property>
</packing>
</child>
@@ -2984,6 +2894,477 @@
</packing>
</child>
</object>
+ <object class="GtkNotebook" id="network_preferences_toplevel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkVBox" id="vboxNetworkGeneral">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkVBox" id="proxy-section">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="proxy-header">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Proxy Settings</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="proxy-alignment">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="proxy-vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="rdoSysSettings">
+ <property name="label" translatable="yes">_Use system defaults</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="rdoNoProxy">
+ <property name="label" translatable="yes">_Direct connection to the Internet</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rdoSysSettings</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="rdoManualProxy">
+ <property name="label" translatable="yes">_Manual proxy configuration:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">rdoSysSettings</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment27">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">24</property>
+ <child>
+ <object class="GtkVBox" id="vbox18">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkTable" id="table9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">4</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="lblHttpHost">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">H_TTP Proxy:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtHttpHost</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblHttpsHost">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Secure HTTP Proxy:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtHttpsHost</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblSocksHost">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">SOC_KS Proxy:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtSocksHost</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblIgnoreHosts">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">No _Proxy for:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtIgnoreHosts</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="txtHttpHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="txtHttpsHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="txtSocksHost">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblHttpPort">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblHttpsPort">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblSocksPort">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Port:</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="spnHttpPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">adjustment4</property>
+ <property name="climb_rate">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="spnHttpsPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">adjustment5</property>
+ <property name="climb_rate">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="spnSocksPort">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">adjustment6</property>
+ <property name="climb_rate">1</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="txtIgnoreHosts">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="chkUseAuth">
+ <property name="label" translatable="yes">Use Authe_ntication</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0.5</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment26">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">24</property>
+ <child>
+ <object class="GtkTable" id="table11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="lblAuthUser">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Us_ername:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtAuthUser</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lblAuthPwd">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Pass_word:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">txtAuthPwd</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="txtAuthUser">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="txtAuthPwd">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="proxy-padding">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="lblNetworkGeneral">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">General</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
<object class="GtkSizeGroup" id="composer-combo-box-size-group">
<widgets>
<widget name="comboboxReplyStyle"/>
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 57de8ab8f6..03b8523b7e 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -37,14 +37,22 @@
#include <gtkhtml/gtkhtml.h>
#include <editor/gtkhtml-spell-language.h>
+#include <libedataserver/libedataserver.h>
#include <composer/e-msg-composer.h>
#include <shell/e-shell-utils.h>
+#include <libemail-engine/e-mail-folder-utils.h>
+
#include <mail/em-config.h>
#include <mail/em-folder-selection-button.h>
+#include <mail/em-folder-selector.h>
+#include <mail/em-folder-tree.h>
+#include <mail/em-folder-tree-model.h>
+#include <mail/e-mail-backend.h>
#include <mail/e-mail-junk-options.h>
+#include <mail/e-mail-ui-session.h>
G_DEFINE_TYPE (
EMComposerPrefs,
@@ -218,6 +226,722 @@ spell_setup (EMComposerPrefs *prefs)
g_list_free (active_languages);
}
+#define MAIL_SEND_ACCOUNT_OVERRIDE_KEY "sao-mail-send-account-override"
+#define MAIL_CAMEL_SESSION_KEY "sao-mail-camel-session"
+
+static gchar *
+sao_dup_account_uid (GtkBuilder *builder)
+{
+ GtkWidget *widget;
+ GtkTreeView *tree_view;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *account_uid = NULL;
+
+ widget = e_builder_get_widget (builder, "sao-account-treeview");
+ g_return_val_if_fail (GTK_IS_TREE_VIEW (widget), NULL);
+
+ tree_view = GTK_TREE_VIEW (widget);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return NULL;
+
+ gtk_tree_model_get (model, &iter, 1, &account_uid, -1);
+
+ return account_uid;
+}
+
+static void
+sao_fill_overrides (GtkBuilder *builder,
+ const gchar *tree_view_name,
+ GSList *overrides,
+ gboolean is_folder)
+{
+ CamelSession *session = NULL;
+ GtkWidget *widget;
+ GtkListStore *list_store;
+ GtkTreeIter titer;
+ GSList *oiter;
+
+ widget = e_builder_get_widget (builder, tree_view_name);
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
+ g_return_if_fail (list_store != NULL);
+
+ gtk_list_store_clear (list_store);
+
+ if (is_folder)
+ session = g_object_get_data (G_OBJECT (builder), MAIL_CAMEL_SESSION_KEY);
+
+ for (oiter = overrides; oiter; oiter = g_slist_next (oiter)) {
+ const gchar *value = oiter->data;
+ gchar *markup = NULL;
+
+ if (!value || !*value)
+ continue;
+
+ if (is_folder) {
+ markup = e_mail_folder_uri_to_markup (session, value, NULL);
+ if (!markup)
+ continue;
+ }
+
+ gtk_list_store_append (list_store, &titer);
+
+ if (is_folder) {
+ gtk_list_store_set (list_store, &titer, 0, markup, 1, value, -1);
+ } else {
+ gtk_list_store_set (list_store, &titer, 0, value, -1);
+ }
+
+ g_free (markup);
+ }
+}
+
+static void
+sao_account_treeview_selection_changed_cb (GtkTreeSelection *selection,
+ GtkBuilder *builder)
+{
+ GtkTreeModel *model = NULL;
+ GtkWidget *widget;
+ gboolean enable = FALSE;
+
+ g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-folders-treeview");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+
+ if (gtk_tree_selection_get_selected (selection, NULL, NULL)) {
+ gchar *account_uid;
+
+ account_uid = sao_dup_account_uid (builder);
+ if (account_uid) {
+ GSList *folder_overrides = NULL, *recipient_overrides = NULL;
+
+ enable = TRUE;
+
+ e_mail_send_account_override_list_for_account (
+ g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY),
+ account_uid, &folder_overrides, &recipient_overrides);
+
+ sao_fill_overrides (builder, "sao-folders-treeview", folder_overrides, TRUE);
+ sao_fill_overrides (builder, "sao-recipients-treeview", recipient_overrides, FALSE);
+
+ g_slist_free_full (folder_overrides, g_free);
+ g_slist_free_full (recipient_overrides, g_free);
+ g_free (account_uid);
+ }
+ }
+
+ widget = e_builder_get_widget (builder, "sao-folders-frame");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ gtk_widget_set_sensitive (widget, enable);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-frame");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ gtk_widget_set_sensitive (widget, enable);
+}
+
+static void
+sao_overrides_changed_cb (EMailSendAccountOverride *account_override,
+ GtkBuilder *builder)
+{
+ GtkWidget *widget;
+ GtkTreeSelection *selection;
+
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-account-treeview");
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+
+ sao_account_treeview_selection_changed_cb (selection, builder);
+}
+
+static void
+sao_block_changed_handler (GtkBuilder *builder)
+{
+ GObject *account_override;
+
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ account_override = g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY),
+ g_signal_handlers_block_by_func (account_override, sao_overrides_changed_cb, builder);
+}
+
+static void
+sao_unblock_changed_handler (GtkBuilder *builder)
+{
+ GObject *account_override;
+
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ account_override = g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY),
+ g_signal_handlers_unblock_by_func (account_override, sao_overrides_changed_cb, builder);
+}
+
+static void
+sao_folders_treeview_selection_changed_cb (GtkTreeSelection *selection,
+ GtkBuilder *builder)
+{
+ GtkWidget *widget;
+ gint nselected;
+
+ g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ nselected = gtk_tree_selection_count_selected_rows (selection);
+
+ widget = e_builder_get_widget (builder, "sao-folders-remove-button");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ gtk_widget_set_sensitive (widget, nselected > 0);
+}
+
+static void
+sao_folders_add_button_clicked_cb (GtkButton *button,
+ GtkBuilder *builder)
+{
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+ EMFolderSelector *selector;
+ EMFolderTree *folder_tree;
+ GtkWidget *dialog;
+ GtkWindow *window;
+ gchar *account_uid = NULL;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ account_uid = sao_dup_account_uid (builder);
+ g_return_if_fail (account_uid != NULL);
+
+ widget = e_builder_get_widget (builder, "sao-folders-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+ tree_view = GTK_TREE_VIEW (widget);
+
+ window = GTK_WINDOW (gtk_widget_get_toplevel (widget));
+
+ dialog = em_folder_selector_new (
+ window, em_folder_tree_model_get_default (),
+ 0, _("Select Folder to Add"), NULL, _("_Add"));
+
+ selector = EM_FOLDER_SELECTOR (dialog);
+ folder_tree = em_folder_selector_get_folder_tree (selector);
+
+ em_folder_tree_set_excluded (folder_tree, EMFT_EXCLUDE_NOSELECT);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+ const gchar *uri;
+
+ uri = em_folder_selector_get_selected_uri (selector);
+ if (uri && *uri) {
+ gboolean found = FALSE;
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ model = gtk_tree_view_get_model (tree_view);
+
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ do {
+ gchar *old_uri = NULL;
+
+ gtk_tree_model_get (model, &iter, 1, &old_uri, -1);
+
+ found = g_strcmp0 (uri, old_uri) == 0;
+
+ g_free (old_uri);
+ } while (!found && gtk_tree_model_iter_next (model, &iter));
+ }
+
+ if (!found) {
+ EMailSendAccountOverride *account_override;
+ GtkListStore *list_store;
+ CamelSession *session;
+ gchar *markup;
+
+ list_store = GTK_LIST_STORE (model);
+ session = g_object_get_data (G_OBJECT (builder), MAIL_CAMEL_SESSION_KEY);
+ markup = e_mail_folder_uri_to_markup (session, uri, NULL);
+
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, 0, markup, 1, uri, -1);
+
+ g_free (markup);
+
+ sao_block_changed_handler (builder);
+
+ account_override = g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY);
+ e_mail_send_account_override_set_for_folder (account_override, uri, account_uid);
+
+ sao_unblock_changed_handler (builder);
+ }
+
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+ }
+
+ gtk_widget_destroy (dialog);
+ g_free (account_uid);
+}
+
+static void
+sao_folders_remove_button_clicked_cb (GtkButton *button,
+ GtkBuilder *builder)
+{
+ EMailSendAccountOverride *account_override;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+ GList *selected, *siter;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-folders-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+ tree_view = GTK_TREE_VIEW (widget);
+ selection = gtk_tree_view_get_selection (tree_view);
+ model = gtk_tree_view_get_model (tree_view);
+
+ sao_block_changed_handler (builder);
+
+ account_override = g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY);
+ e_mail_send_account_override_freeze_save (account_override);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, &model);
+ selected = g_list_reverse (selected);
+
+ for (siter = selected; siter; siter = g_list_next (siter)) {
+ gchar *uri = NULL;
+
+ if (!gtk_tree_model_get_iter (model, &iter, siter->data))
+ continue;
+
+ gtk_tree_model_get (model, &iter, 1, &uri, -1);
+
+ if (uri && *uri)
+ e_mail_send_account_override_remove_for_folder (account_override, uri);
+
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ g_free (uri);
+ }
+
+ e_mail_send_account_override_thaw_save (account_override);
+ sao_unblock_changed_handler (builder);
+
+ g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
+}
+
+static void
+sao_recipients_treeview_selection_changed_cb (GtkTreeSelection *selection,
+ GtkBuilder *builder)
+{
+ GtkWidget *widget;
+ gint nselected;
+
+ g_return_if_fail (GTK_IS_TREE_SELECTION (selection));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ nselected = gtk_tree_selection_count_selected_rows (selection);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-edit-button");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ gtk_widget_set_sensitive (widget, nselected == 1);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-remove-button");
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ gtk_widget_set_sensitive (widget, nselected > 0);
+}
+
+static void
+sao_recipient_edited_cb (GtkCellRendererText *renderer,
+ const gchar *path_str,
+ const gchar *new_text,
+ GtkBuilder *builder)
+{
+ EMailSendAccountOverride *account_override;
+ GtkTreePath *path;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *text, *old_text = NULL, *account_uid;
+ GtkWidget *widget;
+
+ g_return_if_fail (path_str != NULL);
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ path = gtk_tree_path_new_from_string (path_str);
+ g_return_if_fail (path != NULL);
+
+ account_uid = sao_dup_account_uid (builder);
+ g_return_if_fail (account_uid != NULL);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+ g_return_if_fail (gtk_tree_model_get_iter (model, &iter, path));
+ gtk_tree_path_free (path);
+
+ gtk_tree_model_get (model, &iter, 0, &old_text, -1);
+
+ sao_block_changed_handler (builder);
+
+ account_override = g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY);
+
+ text = g_strdup (new_text);
+ if (text)
+ g_strchomp (text);
+
+ if (old_text && *old_text)
+ e_mail_send_account_override_remove_for_recipient (account_override, old_text);
+
+ if (!text || !*text) {
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ } else {
+ GtkTreeIter new_iter = iter;
+ gboolean is_new = TRUE;
+
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ do {
+ gchar *old_recipient = NULL;
+
+ gtk_tree_model_get (model, &iter, 0, &old_recipient, -1);
+
+ is_new = !old_recipient || e_util_utf8_strcasecmp (text, old_recipient) != 0;
+
+ g_free (old_recipient);
+ } while (is_new && gtk_tree_model_iter_next (model, &iter));
+ }
+
+ if (is_new) {
+ gtk_list_store_set (GTK_LIST_STORE (model), &new_iter, 0, text, -1);
+ e_mail_send_account_override_set_for_recipient (account_override, text, account_uid);
+ } else {
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+
+ gtk_list_store_remove (GTK_LIST_STORE (model), &new_iter);
+
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+ }
+
+ sao_unblock_changed_handler (builder);
+
+ g_free (account_uid);
+ g_free (old_text);
+ g_free (text);
+}
+
+static void
+sao_recipient_editing_canceled_cb (GtkCellRenderer *renderer,
+ GtkBuilder *builder)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
+
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ do {
+ gchar *old_recipient = NULL;
+
+ gtk_tree_model_get (model, &iter, 0, &old_recipient, -1);
+
+ if (!old_recipient || !*old_recipient) {
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ g_free (old_recipient);
+ break;
+ }
+
+ g_free (old_recipient);
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+}
+
+static void
+sao_recipients_add_button_clicked_cb (GtkButton *button,
+ GtkBuilder *builder)
+{
+ GtkTreeView *tree_view;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+ GList *cells;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ tree_view = GTK_TREE_VIEW (widget);
+ model = gtk_tree_view_get_model (tree_view);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+
+ gtk_tree_selection_unselect_all (selection);
+ gtk_tree_selection_select_iter (selection, &iter);
+
+ column = gtk_tree_view_get_column (tree_view, 0);
+ g_return_if_fail (column != NULL);
+
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
+ g_return_if_fail (cells != NULL);
+
+ path = gtk_tree_model_get_path (model, &iter);
+ if (path == NULL) {
+ g_list_free (cells);
+ return;
+ }
+
+ g_object_set (cells->data, "editable", TRUE, NULL);
+ gtk_tree_view_set_cursor_on_cell (
+ tree_view, path, column, cells->data, TRUE);
+ g_object_set (cells->data, "editable", FALSE, NULL);
+
+ gtk_tree_path_free (path);
+ g_list_free (cells);
+}
+
+static void
+sao_recipients_edit_button_clicked_cb (GtkButton *button,
+ GtkBuilder *builder)
+{
+ GtkTreeView *tree_view;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+ GtkWidget *widget;
+ GList *cells, *selected;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ tree_view = GTK_TREE_VIEW (widget);
+ selection = gtk_tree_view_get_selection (tree_view);
+
+ g_return_if_fail (gtk_tree_selection_count_selected_rows (selection) == 1);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, NULL);
+ g_return_if_fail (selected && selected->next == NULL);
+
+ path = selected->data;
+ /* 'path' is freed later in the function */
+ g_list_free (selected);
+
+ column = gtk_tree_view_get_column (tree_view, 0);
+ g_return_if_fail (column != NULL);
+
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
+ g_return_if_fail (cells != NULL);
+
+ g_object_set (cells->data, "editable", TRUE, NULL);
+ gtk_tree_view_set_cursor_on_cell (
+ tree_view, path, column, cells->data, TRUE);
+ g_object_set (cells->data, "editable", FALSE, NULL);
+
+ gtk_tree_path_free (path);
+ g_list_free (cells);
+}
+
+static void
+sao_recipients_remove_button_clicked_cb (GtkButton *button,
+ GtkBuilder *builder)
+{
+ EMailSendAccountOverride *account_override;
+ GtkTreeSelection *selection;
+ GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkWidget *widget;
+ GList *selected, *siter;
+
+ g_return_if_fail (GTK_IS_BUTTON (button));
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+ tree_view = GTK_TREE_VIEW (widget);
+ selection = gtk_tree_view_get_selection (tree_view);
+ model = gtk_tree_view_get_model (tree_view);
+
+ sao_block_changed_handler (builder);
+
+ account_override = g_object_get_data (G_OBJECT (builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY);
+ e_mail_send_account_override_freeze_save (account_override);
+
+ selected = gtk_tree_selection_get_selected_rows (selection, &model);
+ selected = g_list_reverse (selected);
+
+ for (siter = selected; siter; siter = g_list_next (siter)) {
+ gchar *recipient = NULL;
+
+ if (!gtk_tree_model_get_iter (model, &iter, siter->data))
+ continue;
+
+ gtk_tree_model_get (model, &iter, 0, &recipient, -1);
+
+ if (recipient && *recipient)
+ e_mail_send_account_override_remove_for_recipient (account_override, recipient);
+
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ g_free (recipient);
+ }
+
+ e_mail_send_account_override_thaw_save (account_override);
+ sao_unblock_changed_handler (builder);
+
+ g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
+}
+
+static void
+send_account_override_setup (GtkBuilder *builder,
+ EMailBackend *mail_backend,
+ ESourceRegistry *registry)
+{
+ EMailIdentityComboBox *identity_combo_box;
+ EMailSendAccountOverride *account_override;
+ GtkTreeView *tree_view;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkListStore *list_store;
+ GtkCellRenderer *renderer;
+ GtkWidget *widget;
+
+ g_return_if_fail (GTK_IS_BUILDER (builder));
+ g_return_if_fail (E_IS_MAIL_BACKEND (mail_backend));
+ g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
+
+ /* use its model to avoid code duplication */
+ widget = e_mail_identity_combo_box_new (registry);
+ identity_combo_box = g_object_ref_sink (widget);
+
+ widget = e_builder_get_widget (builder, "sao-account-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ tree_view = GTK_TREE_VIEW (widget);
+
+ g_object_set_data_full (G_OBJECT (tree_view), "identity-combo-box",
+ identity_combo_box, (GDestroyNotify) gtk_widget_destroy);
+ g_object_set_data_full (G_OBJECT (builder), MAIL_CAMEL_SESSION_KEY,
+ g_object_ref (e_mail_backend_get_session (mail_backend)), g_object_unref);
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (identity_combo_box));
+
+ gtk_tree_view_set_model (tree_view, model);
+ gtk_tree_view_insert_column_with_attributes (tree_view, -1, _("Account"),
+ gtk_cell_renderer_text_new (),
+ "text", 0, NULL);
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (sao_account_treeview_selection_changed_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-folders-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ tree_view = GTK_TREE_VIEW (widget);
+
+ /* markup, folder-uri */
+ list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
+ gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
+ gtk_tree_view_insert_column_with_attributes (tree_view, -1, _("Folder"),
+ gtk_cell_renderer_text_new (),
+ "markup", 0, NULL);
+ g_object_unref (list_store);
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (sao_folders_treeview_selection_changed_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-folders-add-button");
+ g_return_if_fail (GTK_IS_BUTTON (widget));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (sao_folders_add_button_clicked_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-folders-remove-button");
+ g_return_if_fail (GTK_IS_BUTTON (widget));
+ gtk_widget_set_sensitive (widget, FALSE);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (sao_folders_remove_button_clicked_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-treeview");
+ g_return_if_fail (GTK_IS_TREE_VIEW (widget));
+
+ tree_view = GTK_TREE_VIEW (widget);
+
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (G_OBJECT (renderer), "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL);
+ g_signal_connect (renderer, "edited", G_CALLBACK (sao_recipient_edited_cb), builder);
+ g_signal_connect (renderer, "editing-canceled", G_CALLBACK (sao_recipient_editing_canceled_cb), builder);
+
+ list_store = gtk_list_store_new (1, G_TYPE_STRING);
+ gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
+ gtk_tree_view_insert_column_with_attributes (tree_view, -1, _("Recipient"),
+ renderer, "text", 0, NULL);
+ g_object_unref (list_store);
+
+ selection = gtk_tree_view_get_selection (tree_view);
+ g_signal_connect (selection, "changed",
+ G_CALLBACK (sao_recipients_treeview_selection_changed_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-add-button");
+ g_return_if_fail (GTK_IS_BUTTON (widget));
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (sao_recipients_add_button_clicked_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-edit-button");
+ g_return_if_fail (GTK_IS_BUTTON (widget));
+ gtk_widget_set_sensitive (widget, FALSE);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (sao_recipients_edit_button_clicked_cb), builder);
+
+ widget = e_builder_get_widget (builder, "sao-recipients-remove-button");
+ g_return_if_fail (GTK_IS_BUTTON (widget));
+ gtk_widget_set_sensitive (widget, FALSE);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (sao_recipients_remove_button_clicked_cb), builder);
+
+ /* init view */
+ widget = e_builder_get_widget (builder, "sao-account-treeview");
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ sao_account_treeview_selection_changed_cb (selection, builder);
+
+ account_override = e_mail_backend_get_send_account_override (mail_backend);
+ g_signal_connect_object (account_override, "changed", G_CALLBACK (sao_overrides_changed_cb), builder, 0);
+}
+
static GtkWidget *
emcp_widget_glade (EConfig *ec,
EConfigItem *item,
@@ -259,6 +983,11 @@ static EMConfigItem emcp_items[] = {
{ E_CONFIG_PAGE,
(gchar *) "20.spellcheck",
(gchar *) "vboxSpellChecking",
+ emcp_widget_glade },
+
+ { E_CONFIG_PAGE,
+ (gchar *) "90.accountoverride",
+ (gchar *) "send-account-override-grid",
emcp_widget_glade }
};
@@ -285,6 +1014,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
GtkCellRenderer *renderer;
EMConfig *ec;
EMConfigTargetPrefs *target;
+ EMailBackend *mail_backend;
+ EMailSendAccountOverride *send_override;
GSList *l;
gint i;
@@ -496,6 +1227,22 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
widget, "prefer-html",
G_SETTINGS_BIND_GET);
+ /* Send Account override */
+ mail_backend = E_MAIL_BACKEND (e_shell_get_backend_by_name (shell, "mail"));
+ g_return_if_fail (mail_backend != NULL);
+
+ send_override = e_mail_backend_get_send_account_override (mail_backend);
+ g_object_set_data_full (G_OBJECT (prefs->builder), MAIL_SEND_ACCOUNT_OVERRIDE_KEY,
+ g_object_ref (send_override), g_object_unref);
+
+ send_account_override_setup (prefs->builder, mail_backend, registry);
+
+ widget = e_builder_get_widget (prefs->builder, "sao-prefer-folder-check");
+ g_object_bind_property (
+ send_override, "prefer-folder",
+ widget, "active",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
/* get our toplevel widget */
target = em_config_target_new_prefs (ec);
e_config_set_target ((EConfig *) ec, (EConfigTarget *) target);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7cab584520..bdee4c9e1f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -226,6 +226,7 @@ e-util/e-focus-tracker.c
e-util/e-image-chooser.c
e-util/e-import-assistant.c
e-util/e-interval-chooser.c
+e-util/e-mail-identity-combo-box.c
e-util/e-mail-signature-combo-box.c
e-util/e-mail-signature-editor.c
e-util/e-mail-signature-manager.c