aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-mailer-prefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-mailer-prefs.c')
-rw-r--r--mail/em-mailer-prefs.c388
1 files changed, 194 insertions, 194 deletions
diff --git a/mail/em-mailer-prefs.c b/mail/em-mailer-prefs.c
index a47f274e5b..9746e620bb 100644
--- a/mail/em-mailer-prefs.c
+++ b/mail/em-mailer-prefs.c
@@ -72,7 +72,7 @@ enum {
HEADER_LIST_ENABLED_COLUMN, /* is the header enabled? */
HEADER_LIST_IS_DEFAULT_COLUMN, /* is this header a default header, eg From: */
HEADER_LIST_HEADER_COLUMN, /* the real name of this header */
- HEADER_LIST_N_COLUMNS,
+ HEADER_LIST_N_COLUMNS,
};
static GType col_types[] = {
@@ -91,7 +91,7 @@ static const char *default_headers[] = {
N_("Bcc"),
N_("Subject"),
N_("Date"),
- N_("Newsgroups"),
+ N_("Newsgroups"),
"x-evolution-mailer", /* DO NOT translate */
};
@@ -112,7 +112,7 @@ GtkType
em_mailer_prefs_get_type (void)
{
static GType type = 0;
-
+
if (!type) {
GTypeInfo type_info = {
sizeof (EMMailerPrefsClass),
@@ -123,10 +123,10 @@ em_mailer_prefs_get_type (void)
0,
(GInstanceInitFunc) em_mailer_prefs_init,
};
-
+
type = g_type_register_static (gtk_vbox_get_type (), "EMMailerPrefs", &type_info, 0);
}
-
+
return type;
}
@@ -134,10 +134,10 @@ static void
em_mailer_prefs_class_init (EMMailerPrefsClass *klass)
{
GObjectClass *object_class;
-
+
object_class = (GObjectClass *) klass;
parent_class = g_type_class_ref (gtk_vbox_get_type ());
-
+
object_class->finalize = em_mailer_prefs_finalise;
}
@@ -151,9 +151,9 @@ static void
em_mailer_prefs_finalise (GObject *obj)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) obj;
-
+
g_object_unref (prefs->gui);
-
+
((GObjectClass *)(parent_class))->finalize (obj);
}
@@ -189,7 +189,7 @@ labels_changed (EMMailerPrefs *prefs)
const char *cstring;
char *string;
int i;
-
+
for (i = 4; i >= 0; i--) {
GdkColor color;
@@ -199,9 +199,9 @@ labels_changed (EMMailerPrefs *prefs)
color.red, color.green, color.blue);
list = g_slist_prepend (list, string);
}
-
+
gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, list, NULL);
-
+
l = list;
while (l != NULL) {
n = l->next;
@@ -228,7 +228,7 @@ restore_labels_clicked (GtkWidget *widget, gpointer user_data)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
int i;
-
+
for (i = 0; i < 5; i++) {
gtk_entry_set_text (prefs->labels[i].name, _(label_defaults[i].name));
color_button_set_color (prefs->labels[i].color, label_defaults[i].colour);
@@ -243,13 +243,13 @@ emmp_header_remove_sensitivity (EMMailerPrefs *prefs)
GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->header_list);
gboolean is_default;
- /* remove button should be sensitive if the currenlty selected entry in the list view
- is not a default header. if there are no entries, or none is selected, it should be
+ /* remove button should be sensitive if the currenlty selected entry in the list view
+ is not a default header. if there are no entries, or none is selected, it should be
disabled
*/
if (gtk_tree_selection_get_selected (selection, NULL, &iter)) {
- gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter,
- HEADER_LIST_IS_DEFAULT_COLUMN, &is_default,
+ gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter,
+ HEADER_LIST_IS_DEFAULT_COLUMN, &is_default,
-1);
if (is_default)
gtk_widget_set_sensitive (GTK_WIDGET (prefs->remove_header), FALSE);
@@ -264,16 +264,16 @@ static gboolean
emmp_header_is_valid (const char *header)
{
const char *p = header;
-
+
if (header[0] == 0)
return FALSE;
-
+
while (*p) {
if ((*p == ':') || (*p == ' '))
return FALSE;
p++;
}
-
+
return TRUE;
}
@@ -283,9 +283,9 @@ emmp_header_add_sensitivity (EMMailerPrefs *prefs)
const char *entry_contents;
GtkTreeIter iter;
gboolean valid;
-
- /* the add header button should be sensitive if the text box contains
- a valid header string, that is not a duplicate with something already
+
+ /* the add header button should be sensitive if the text box contains
+ a valid header string, that is not a duplicate with something already
in the list view
*/
entry_contents = gtk_entry_get_text (GTK_ENTRY (prefs->entry_header));
@@ -293,23 +293,23 @@ emmp_header_add_sensitivity (EMMailerPrefs *prefs)
gtk_widget_set_sensitive (GTK_WIDGET (prefs->add_header), FALSE);
return;
}
-
+
/* check if this is a duplicate */
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (prefs->header_list_store), &iter);
while (valid) {
char *header_name;
-
- gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter,
- HEADER_LIST_HEADER_COLUMN, &header_name,
+
+ gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter,
+ HEADER_LIST_HEADER_COLUMN, &header_name,
-1);
if (g_ascii_strcasecmp (header_name, entry_contents) == 0) {
gtk_widget_set_sensitive (GTK_WIDGET (prefs->add_header), FALSE);
return;
}
-
+
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (prefs->header_list_store), &iter);
}
-
+
gtk_widget_set_sensitive (GTK_WIDGET (prefs->add_header), TRUE);
}
@@ -319,7 +319,7 @@ emmp_save_headers (EMMailerPrefs *prefs)
GSList *header_list;
GtkTreeIter iter;
gboolean valid;
-
+
/* Headers */
header_list = NULL;
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (prefs->header_list_store), &iter);
@@ -327,19 +327,19 @@ emmp_save_headers (EMMailerPrefs *prefs)
struct _EMMailerPrefsHeader h;
gboolean enabled;
char *xml;
-
- gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter,
- HEADER_LIST_HEADER_COLUMN, &h.name,
- HEADER_LIST_ENABLED_COLUMN, &enabled,
+
+ gtk_tree_model_get (GTK_TREE_MODEL (prefs->header_list_store), &iter,
+ HEADER_LIST_HEADER_COLUMN, &h.name,
+ HEADER_LIST_ENABLED_COLUMN, &enabled,
-1);
h.enabled = enabled;
-
+
if ((xml = em_mailer_prefs_header_to_xml (&h)))
header_list = g_slist_append (header_list, xml);
-
+
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (prefs->header_list_store), &iter);
}
-
+
gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, header_list, NULL);
g_slist_foreach (header_list, (GFunc) g_free, NULL);
g_slist_free (header_list);
@@ -352,14 +352,14 @@ emmp_header_list_enabled_toggled (GtkCellRendererToggle *cell, const char *path_
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter;
int enabled;
-
+
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, HEADER_LIST_ENABLED_COLUMN, &enabled, -1);
enabled = !enabled;
gtk_list_store_set (GTK_LIST_STORE (model), &iter, HEADER_LIST_ENABLED_COLUMN,
enabled, -1);
gtk_tree_path_free (path);
-
+
emmp_save_headers (prefs);
}
@@ -369,16 +369,16 @@ emmp_header_add_header (GtkWidget *widget, EMMailerPrefs *prefs)
GtkTreeModel *model = GTK_TREE_MODEL (prefs->header_list_store);
GtkTreeIter iter;
const gchar *text = gtk_entry_get_text (prefs->entry_header);
-
+
g_strstrip ((gchar *)text);
if (text && (strlen (text)>0)) {
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- HEADER_LIST_NAME_COLUMN, text,
- HEADER_LIST_ENABLED_COLUMN, TRUE,
- HEADER_LIST_HEADER_COLUMN, text,
- HEADER_LIST_IS_DEFAULT_COLUMN, FALSE,
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ HEADER_LIST_NAME_COLUMN, text,
+ HEADER_LIST_ENABLED_COLUMN, TRUE,
+ HEADER_LIST_HEADER_COLUMN, text,
+ HEADER_LIST_IS_DEFAULT_COLUMN, FALSE,
-1);
gtk_entry_set_text (prefs->entry_header, "");
emmp_header_remove_sensitivity (prefs);
@@ -395,21 +395,21 @@ emmp_header_remove_header (GtkWidget *button, gpointer user_data)
GtkTreeModel *model = GTK_TREE_MODEL (prefs->header_list_store);
GtkTreeSelection *selection = gtk_tree_view_get_selection (prefs->header_list);
GtkTreeIter iter;
-
+
if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
return;
-
+
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
emmp_header_remove_sensitivity (prefs);
-
+
emmp_save_headers (prefs);
}
-static void
+static void
emmp_header_list_row_selected (GtkTreeSelection *selection, gpointer user_data)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
-
+
emmp_header_remove_sensitivity (prefs);
}
@@ -417,7 +417,7 @@ static void
emmp_header_entry_changed (GtkWidget *entry, gpointer user_data)
{
EMMailerPrefs *prefs = (EMMailerPrefs *) user_data;
-
+
emmp_header_add_sensitivity (prefs);
}
@@ -425,7 +425,7 @@ static void
mark_seen_timeout_changed (GtkSpinButton *spin, EMMailerPrefs *prefs)
{
int timeout;
-
+
timeout = (int) (gtk_spin_button_get_value (prefs->timeout) * 1000.0);
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/mark_seen_timeout", timeout, NULL);
}
@@ -434,9 +434,9 @@ static void
address_compress_count_changed (GtkSpinButton *spin, EMMailerPrefs *prefs)
{
int count;
-
+
count = (int) gtk_spin_button_get_value (prefs->address_count);
-
+
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/address_count", count, NULL);
}
@@ -444,9 +444,9 @@ static void
mlimit_count_changed (GtkSpinButton *spin, EMMailerPrefs *prefs)
{
int count;
-
+
count = (int) gtk_spin_button_get_value (prefs->mlimit_count);
-
+
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/message_text_part_limit", count, NULL);
}
@@ -457,13 +457,13 @@ spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, fl
double min, max;
char *mkey, *p;
int val;
-
+
gtk_spin_button_get_range (spin, &min, &max);
-
+
mkey = g_alloca (strlen (key) + 5);
p = g_stpcpy (mkey, key);
*p++ = '_';
-
+
/* see if the admin locked down the min value */
strcpy (p, "min");
val = gconf_client_get_int (prefs->gconf, mkey, &err);
@@ -471,7 +471,7 @@ spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, fl
g_clear_error (&err);
else
min = (1.0 * val) / div;
-
+
/* see if the admin locked down the max value */
strcpy (p, "max");
val = gconf_client_get_int (prefs->gconf, mkey, &err);
@@ -479,18 +479,18 @@ spin_button_init (EMMailerPrefs *prefs, GtkSpinButton *spin, const char *key, fl
g_clear_error (&err);
else
max = (1.0 * val) / div;
-
+
gtk_spin_button_set_range (spin, min, max);
-
+
/* get the value */
val = gconf_client_get_int (prefs->gconf, key, NULL);
gtk_spin_button_set_value (spin, (1.0 * val) / div);
-
+
if (value_changed) {
g_object_set_data ((GObject *) spin, "key", (void *) key);
g_signal_connect (spin, "value-changed", value_changed, prefs);
}
-
+
if (!gconf_client_key_is_writable (prefs->gconf, key, NULL))
gtk_widget_set_sensitive ((GtkWidget *) spin, FALSE);
}
@@ -499,7 +499,7 @@ static void
toggle_button_toggled (GtkToggleButton *toggle, EMMailerPrefs *prefs)
{
const char *key;
-
+
key = g_object_get_data ((GObject *) toggle, "key");
gconf_client_set_bool (prefs->gconf, key, gtk_toggle_button_get_active (toggle), NULL);
}
@@ -520,7 +520,7 @@ static void
toggle_button_toggled_not (GtkToggleButton *toggle, EMMailerPrefs *prefs)
{
const char *key;
-
+
key = g_object_get_data ((GObject *) toggle, "key");
gconf_client_set_bool (prefs->gconf, key, !gtk_toggle_button_get_active (toggle), NULL);
}
@@ -530,12 +530,12 @@ static void
custom_font_changed (GtkToggleButton *toggle, EMMailerPrefs *prefs)
{
gboolean use_custom;
-
+
use_custom = !gtk_toggle_button_get_active (toggle);
-
+
gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_fixed), use_custom);
gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_variable), use_custom);
-
+
gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/fonts/use_custom", use_custom, NULL);
}
@@ -544,7 +544,7 @@ font_changed (GtkFontButton *font_button, EMMailerPrefs *prefs)
{
const gchar *key;
const gchar *font_name;
-
+
key = g_object_get_data (G_OBJECT (font_button), "key");
font_name = gtk_font_button_get_font_name (font_button);
gconf_client_set_string (prefs->gconf, key, font_name, NULL);
@@ -554,7 +554,7 @@ static void
toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, int not, const char *key, GCallback toggled)
{
gboolean bool;
-
+
bool = gconf_client_get_bool (prefs->gconf, key, NULL);
gtk_toggle_button_set_active (toggle, not ? !bool : bool);
@@ -562,7 +562,7 @@ toggle_button_init (EMMailerPrefs *prefs, GtkToggleButton *toggle, int not, cons
g_object_set_data ((GObject *) toggle, "key", (void *) key);
g_signal_connect (toggle, "toggled", toggled, prefs);
}
-
+
if (!gconf_client_key_is_writable (prefs->gconf, key, NULL))
gtk_widget_set_sensitive ((GtkWidget *) toggle, FALSE);
}
@@ -572,11 +572,11 @@ charset_activate (GtkWidget *item, EMMailerPrefs *prefs)
{
GtkWidget *menu;
char *string;
-
+
menu = gtk_option_menu_get_menu (prefs->charset);
if (!(string = e_charset_picker_get_charset (menu)))
string = g_strdup (e_iconv_locale_charset ());
-
+
gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/charset", string, NULL);
g_free (string);
}
@@ -587,19 +587,19 @@ charset_menu_init (EMMailerPrefs *prefs)
GtkWidget *menu, *item;
GList *items;
char *buf;
-
+
buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/charset", NULL);
menu = e_charset_picker_new (buf && *buf ? buf : e_iconv_locale_charset ());
gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu));
g_free (buf);
-
+
items = GTK_MENU_SHELL (menu)->children;
while (items) {
item = items->data;
g_signal_connect (item, "activate", G_CALLBACK (charset_activate), prefs);
items = items->next;
}
-
+
if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/charset", NULL))
gtk_widget_set_sensitive ((GtkWidget *) prefs->charset, FALSE);
}
@@ -608,7 +608,7 @@ static void
trash_days_activate (GtkWidget *item, EMMailerPrefs *prefs)
{
int days;
-
+
days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days"));
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", days, NULL);
}
@@ -618,29 +618,29 @@ emmp_empty_trash_init (EMMailerPrefs *prefs)
{
int locked, days, hist = 0, i;
GtkWidget *menu, *item;
-
+
toggle_button_init (prefs, prefs->empty_trash, FALSE,
"/apps/evolution/mail/trash/empty_on_exit",
G_CALLBACK (toggle_button_toggled));
-
+
days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL);
menu = gtk_menu_new();
for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) {
if (days >= empty_trash_frequency[i].days)
hist = i;
-
+
item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label));
g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days));
g_signal_connect (item, "activate", G_CALLBACK (trash_days_activate), prefs);
-
+
gtk_widget_show (item);
gtk_menu_shell_append((GtkMenuShell *)menu, item);
}
-
+
gtk_widget_show(menu);
gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_trash_days, menu);
gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_trash_days, hist);
-
+
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit_days", NULL);
gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_trash_days, !locked);
}
@@ -649,7 +649,7 @@ static void
junk_days_activate (GtkWidget *item, EMMailerPrefs *prefs)
{
int days;
-
+
days = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "days"));
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", days, NULL);
}
@@ -659,29 +659,29 @@ emmp_empty_junk_init (EMMailerPrefs *prefs)
{
int locked, days, hist = 0, i;
GtkWidget *menu, *item;
-
+
toggle_button_init (prefs, prefs->empty_junk, FALSE,
"/apps/evolution/mail/junk/empty_on_exit",
G_CALLBACK (toggle_button_toggled));
-
+
days = gconf_client_get_int(prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL);
menu = gtk_menu_new();
for (i = 0; i < G_N_ELEMENTS (empty_trash_frequency); i++) {
if (days >= empty_trash_frequency[i].days)
hist = i;
-
+
item = gtk_menu_item_new_with_label (_(empty_trash_frequency[i].label));
g_object_set_data ((GObject *) item, "days", GINT_TO_POINTER (empty_trash_frequency[i].days));
g_signal_connect (item, "activate", G_CALLBACK (junk_days_activate), prefs);
-
+
gtk_widget_show (item);
gtk_menu_shell_append((GtkMenuShell *)menu, item);
}
-
+
gtk_widget_show(menu);
gtk_option_menu_set_menu((GtkOptionMenu *)prefs->empty_junk_days, menu);
gtk_option_menu_set_history((GtkOptionMenu *)prefs->empty_junk_days, hist);
-
+
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/junk/empty_on_exit_days", NULL);
gtk_widget_set_sensitive ((GtkWidget *) prefs->empty_junk_days, !locked);
}
@@ -690,14 +690,14 @@ static void
http_images_changed (GtkWidget *widget, EMMailerPrefs *prefs)
{
int when;
-
+
if (gtk_toggle_button_get_active (prefs->images_always))
when = MAIL_CONFIG_HTTP_ALWAYS;
else if (gtk_toggle_button_get_active (prefs->images_sometimes))
when = MAIL_CONFIG_HTTP_SOMETIMES;
else
when = MAIL_CONFIG_HTTP_NEVER;
-
+
gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", when, NULL);
}
@@ -706,7 +706,7 @@ static void
notify_type_changed (GtkWidget *widget, EMMailerPrefs *prefs)
{
int type;
-
+
if (gtk_toggle_button_get_active (prefs->notify_not))
type = MAIL_CONFIG_NOTIFY_NOT;
else if (gtk_toggle_button_get_active (prefs->notify_beep))
@@ -773,7 +773,7 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
{
char *def_plugin = gtk_combo_box_get_active_text(GTK_COMBO_BOX (combo));
const GList *plugins = mail_session_get_junk_plugins();
-
+
gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/junk/default_plugin", def_plugin, NULL);
while (plugins) {
struct _EMJunkHookItem *item = plugins->data;;
@@ -798,8 +798,8 @@ junk_plugin_changed (GtkWidget *combo, EMMailerPrefs *prefs)
html = g_strdup_printf ("<i>%s</i>", text);
gtk_label_set_markup (prefs->plugin_status, html);
g_free (html);
- g_free (text);
- }
+ g_free (text);
+ }
break;
}
plugins = plugins->next;
@@ -816,30 +816,30 @@ junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs)
if (!plugins || !g_list_length ((GList *)plugins)) {
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("No Junk plugin available"));
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
gtk_widget_hide (GTK_WIDGET (prefs->plugin_image));
gtk_widget_hide (GTK_WIDGET (prefs->plugin_status));
gtk_image_set_from_stock (prefs->plugin_image, NULL, 0);
g_free (pdefault);
-
+
return;
}
-
+
while (plugins) {
struct _EMJunkHookItem *item = plugins->data;;
-
+
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), item->plugin_name);
if (!def_set && pdefault && item->plugin_name && !strcmp(pdefault, item->plugin_name)) {
gboolean status;
-
+
def_set = TRUE;
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), index);
status = e_plugin_invoke (item->hook->hook.plugin, item->validate_binary, NULL) != NULL;
if (status) {
char *text, *html;
gtk_image_set_from_stock (prefs->plugin_image, "gtk-dialog-info", GTK_ICON_SIZE_MENU);
- /* May be a better text */
+ /* May be a better text */
text = g_strdup_printf (_("%s plugin is available and the binary is installed."), item->plugin_name);
html = g_strdup_printf ("<i>%s</i>", text);
gtk_label_set_markup (prefs->plugin_status, html);
@@ -853,7 +853,7 @@ junk_plugin_setup (GtkWidget *combo, EMMailerPrefs *prefs)
html = g_strdup_printf ("<i>%s</i>", text);
gtk_label_set_markup (prefs->plugin_status, html);
g_free (html);
- g_free (text);
+ g_free (text);
}
}
plugins = plugins->next;
@@ -868,7 +868,7 @@ GtkWidget *
create_combo_text_widget (void) {
return gtk_combo_box_new_text ();
}
-
+
static void
em_mailer_prefs_construct (EMMailerPrefs *prefs)
{
@@ -886,7 +886,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
EMConfigTargetPrefs *target;
GSList *l;
char *gladefile;
-
+
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"mail-config.glade",
NULL);
@@ -910,13 +910,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
e_config_add_items((EConfig *)ec, l, NULL, NULL, emmp_free, prefs);
/* General tab */
-
+
/* Message Display */
prefs->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkMarkTimeout"));
toggle_button_init (prefs, prefs->timeout_toggle, FALSE,
"/apps/evolution/mail/display/mark_seen",
G_CALLBACK (toggle_button_toggled));
-
+
prefs->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
spin_button_init (prefs, prefs->timeout,
"/apps/evolution/mail/display/mark_seen_timeout",
@@ -926,30 +926,30 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
toggle_button_init (prefs, prefs->mlimit_toggle, FALSE,
"/apps/evolution/mail/display/force_message_limit",
G_CALLBACK (toggle_button_toggled));
-
+
prefs->mlimit_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "mlimit_spin"));
spin_button_init (prefs, prefs->mlimit_count,
"/apps/evolution/mail/display/message_text_part_limit",
1, G_CALLBACK (mlimit_count_changed));
-
+
prefs->address_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "address_checkbox"));
toggle_button_init (prefs, prefs->address_toggle, FALSE,
"/apps/evolution/mail/display/address_compress",
G_CALLBACK (toggle_button_toggled));
-
+
prefs->address_count = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "address_spin"));
spin_button_init (prefs, prefs->address_count,
"/apps/evolution/mail/display/address_count",
1, G_CALLBACK (address_compress_count_changed));
-
+
prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset"));
charset_menu_init (prefs);
-
+
prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations"));
toggle_button_init (prefs, prefs->citation_highlight, FALSE,
"/apps/evolution/mail/display/mark_citations",
G_CALLBACK (toggle_button_toggled));
-
+
prefs->citation_color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, "colorButtonHighlightCitations"));
buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL);
color_button_set_color (prefs->citation_color, buf ? buf : "#737373");
@@ -957,40 +957,40 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL))
gtk_widget_set_sensitive ((GtkWidget *) prefs->citation_color, FALSE);
g_free (buf);
-
+
/* Deleting Mail */
prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit"));
prefs->empty_trash_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuEmptyTrashDays"));
emmp_empty_trash_init (prefs);
-
+
prefs->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge"));
toggle_button_init (prefs, prefs->confirm_expunge, FALSE,
"/apps/evolution/mail/prompts/expunge",
G_CALLBACK (toggle_button_toggled));
-
+
/* New Mail Notification */
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/notify/type", NULL);
-
+
val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/notify/type", NULL);
prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot"));
gtk_toggle_button_set_active (prefs->notify_not, val == MAIL_CONFIG_NOTIFY_NOT);
g_signal_connect (prefs->notify_not, "toggled", G_CALLBACK (notify_type_changed), prefs);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_not, FALSE);
-
+
prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep"));
- prefs->notify_sound_file = GTK_FILE_CHOOSER_BUTTON (glade_xml_get_widget (gui, "fileNotifyPlaySoundButton"));
+ prefs->notify_sound_file = GTK_FILE_CHOOSER_BUTTON (glade_xml_get_widget (gui, "fileNotifyPlaySoundButton"));
gtk_toggle_button_set_active (prefs->notify_beep, val == MAIL_CONFIG_NOTIFY_BEEP);
g_signal_connect (prefs->notify_beep, "toggled", G_CALLBACK (notify_type_changed), prefs);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_beep, FALSE);
-
+
prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound"));
gtk_toggle_button_set_active (prefs->notify_play_sound, val == MAIL_CONFIG_NOTIFY_PLAY_SOUND);
g_signal_connect (prefs->notify_play_sound, "toggled", G_CALLBACK (notify_type_changed), prefs);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_play_sound, FALSE);
-
+
buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL);
if (buf && *buf)
gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (prefs->notify_sound_file), buf);
@@ -999,7 +999,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
if (val != MAIL_CONFIG_NOTIFY_PLAY_SOUND)
gtk_widget_set_sensitive ((GtkWidget *) prefs->notify_sound_file, FALSE);
g_free (buf);
-
+
/* Mail Fonts */
font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL);
prefs->font_fixed = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontFixed"));
@@ -1009,7 +1009,7 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_signal_connect (prefs->font_fixed, "font-set", G_CALLBACK (font_changed), prefs);
if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL))
gtk_widget_set_sensitive ((GtkWidget *) prefs->font_fixed, FALSE);
-
+
font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL);
prefs->font_variable = GTK_FONT_BUTTON (glade_xml_get_widget (gui, "FontVariable"));
gtk_font_button_set_font_name (prefs->font_variable, font);
@@ -1018,29 +1018,29 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_signal_connect (prefs->font_variable, "font-set", G_CALLBACK (font_changed), prefs);
if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL))
gtk_widget_set_sensitive ((GtkWidget *) prefs->font_variable, FALSE);
-
+
prefs->font_share = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radFontUseSame"));
toggle_button_init (prefs, prefs->font_share, TRUE,
"/apps/evolution/mail/display/fonts/use_custom",
G_CALLBACK (custom_font_changed));
custom_font_changed (prefs->font_share, prefs);
-
+
/* HTML Mail tab */
-
+
/* Loading Images */
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL);
-
+
val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL);
prefs->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesNever"));
gtk_toggle_button_set_active (prefs->images_never, val == MAIL_CONFIG_HTTP_NEVER);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->images_never, FALSE);
-
+
prefs->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesSometimes"));
gtk_toggle_button_set_active (prefs->images_sometimes, val == MAIL_CONFIG_HTTP_SOMETIMES);
if (locked)
gtk_widget_set_sensitive ((GtkWidget *) prefs->images_sometimes, FALSE);
-
+
prefs->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesAlways"));
gtk_toggle_button_set_active (prefs->images_always, val == MAIL_CONFIG_HTTP_ALWAYS);
if (locked)
@@ -1054,12 +1054,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
toggle_button_init (prefs, prefs->show_animated, FALSE,
"/apps/evolution/mail/display/animate_images",
G_CALLBACK (toggle_button_toggled));
-
+
prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML"));
toggle_button_init (prefs, prefs->prompt_unwanted_html, FALSE,
"/apps/evolution/mail/prompts/unwanted_html",
G_CALLBACK (toggle_button_toggled));
-
+
/* Labels... */
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/labels", NULL);
i = 0;
@@ -1068,33 +1068,33 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
MailConfigLabel *label;
char *widget_name;
label = list->data;
-
+
widget_name = g_strdup_printf ("txtLabel%d", i);
prefs->labels[i].name = GTK_ENTRY (glade_xml_get_widget (gui, widget_name));
gtk_widget_set_sensitive ((GtkWidget *) prefs->labels[i].name, !locked);
g_free (widget_name);
-
+
widget_name = g_strdup_printf ("colorLabel%d", i);
prefs->labels[i].color = GTK_COLOR_BUTTON (glade_xml_get_widget (gui, widget_name));
gtk_widget_set_sensitive ((GtkWidget *) prefs->labels[i].color, !locked);
g_free (widget_name);
-
+
gtk_entry_set_text (prefs->labels[i].name, label->name);
g_signal_connect (prefs->labels[i].name, "changed", G_CALLBACK (label_entry_changed), prefs);
-
+
color_button_set_color (prefs->labels[i].color, label->colour);
g_signal_connect (prefs->labels[i].color, "color-set", G_CALLBACK (label_color_set), prefs);
-
+
atk_object_set_name(gtk_widget_get_accessible((GtkWidget *)prefs->labels[i].color), label->name);
i++;
list = list->next;
}
-
+
prefs->restore_labels = GTK_BUTTON (glade_xml_get_widget (gui, "cmdRestoreLabels"));
gtk_widget_set_sensitive ((GtkWidget *) prefs->restore_labels, !locked);
g_signal_connect (prefs->restore_labels, "clicked", G_CALLBACK (restore_labels_clicked), prefs);
-
+
/* headers */
locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/headers", NULL);
@@ -1108,21 +1108,21 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
G_CALLBACK (toggle_button_toggled));
if (!gtk_toggle_button_get_active (prefs->photo_show))
gtk_widget_set_sensitive ((GtkWidget *) prefs->photo_local, FALSE);
-
+
/* always de-sensitised until the user types something in the entry */
prefs->add_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersAdd"));
gtk_widget_set_sensitive ((GtkWidget *) prefs->add_header, FALSE);
-
+
/* always de-sensitised until the user selects a header in the list */
prefs->remove_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersRemove"));
gtk_widget_set_sensitive ((GtkWidget *) prefs->remove_header, FALSE);
-
+
prefs->entry_header = GTK_ENTRY (glade_xml_get_widget (gui, "txtHeaders"));
gtk_widget_set_sensitive ((GtkWidget *) prefs->entry_header, !locked);
-
+
prefs->header_list = GTK_TREE_VIEW (glade_xml_get_widget (gui, "treeHeaders"));
gtk_widget_set_sensitive ((GtkWidget *) prefs->header_list, !locked);
-
+
selection = gtk_tree_view_get_selection (prefs->header_list);
g_signal_connect (selection, "changed", G_CALLBACK (emmp_header_list_row_selected), prefs);
g_signal_connect (prefs->entry_header, "changed", G_CALLBACK (emmp_header_entry_changed), prefs);
@@ -1132,29 +1132,29 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_signal_connect (prefs->add_header, "clicked", G_CALLBACK (emmp_header_add_header), prefs);
g_signal_connect (prefs->remove_header, "clicked", G_CALLBACK (emmp_header_remove_header), prefs);
gtk_tree_view_set_model (prefs->header_list, GTK_TREE_MODEL (prefs->header_list_store));
-
+
renderer = gtk_cell_renderer_toggle_new ();
g_object_set (renderer, "activatable", TRUE, NULL);
g_signal_connect (renderer, "toggled", G_CALLBACK (emmp_header_list_enabled_toggled), prefs);
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1,
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1,
"Enabled", renderer,
- "active", HEADER_LIST_ENABLED_COLUMN,
+ "active", HEADER_LIST_ENABLED_COLUMN,
NULL);
renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1,
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (prefs->header_list), -1,
"Name", renderer,
- "text", HEADER_LIST_NAME_COLUMN,
+ "text", HEADER_LIST_NAME_COLUMN,
NULL);
-
- /* populated the listview with entries; firstly we add all the default headers, and then
- we add read header configuration out of gconf. If a header in gconf is a default header,
+
+ /* populated the listview with entries; firstly we add all the default headers, and then
+ we add read header configuration out of gconf. If a header in gconf is a default header,
we update the enabled flag accordingly
*/
header_add_list = NULL;
default_header_hash = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS (default_headers); i++) {
struct _EMMailerPrefsHeader *h;
-
+
h = g_malloc (sizeof (struct _EMMailerPrefsHeader));
h->is_default = TRUE;
h->name = g_strdup (default_headers[i]);
@@ -1162,14 +1162,14 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
g_hash_table_insert (default_header_hash, (gpointer) default_headers[i], h);
header_add_list = g_slist_append (header_add_list, h);
}
-
+
/* read stored headers from gconf */
header_config_list = gconf_client_get_list (prefs->gconf, "/apps/evolution/mail/display/headers", GCONF_VALUE_STRING, NULL);
p = header_config_list;
while (p) {
struct _EMMailerPrefsHeader *h, *def;
char *xml = (char *) p->data;
-
+
h = em_mailer_prefs_header_from_xml (xml);
if (h) {
def = g_hash_table_lookup (default_header_hash, h->name);
@@ -1181,38 +1181,38 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
header_add_list = g_slist_append (header_add_list, h);
}
}
-
+
p = p->next;
}
-
+
g_hash_table_destroy (default_header_hash);
g_slist_foreach (header_config_list, (GFunc) g_free, NULL);
g_slist_free (header_config_list);
-
+
p = header_add_list;
while (p) {
struct _EMMailerPrefsHeader *h = (struct _EMMailerPrefsHeader *) p->data;
const char *name;
-
+
if (g_ascii_strcasecmp (h->name, EM_FORMAT_HEADER_XMAILER) == 0)
name = _("Mailer");
else
name = _(h->name);
-
+
gtk_list_store_append (prefs->header_list_store, &iter);
- gtk_list_store_set (prefs->header_list_store, &iter,
- HEADER_LIST_NAME_COLUMN, name,
- HEADER_LIST_ENABLED_COLUMN, h->enabled,
- HEADER_LIST_IS_DEFAULT_COLUMN, h->is_default,
- HEADER_LIST_HEADER_COLUMN, h->name,
+ gtk_list_store_set (prefs->header_list_store, &iter,
+ HEADER_LIST_NAME_COLUMN, name,
+ HEADER_LIST_ENABLED_COLUMN, h->enabled,
+ HEADER_LIST_IS_DEFAULT_COLUMN, h->is_default,
+ HEADER_LIST_HEADER_COLUMN, h->name,
-1);
-
+
em_mailer_prefs_header_free (h);
p = p->next;
}
-
+
g_slist_free (header_add_list);
-
+
/* Junk prefs */
prefs->check_incoming = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkCheckIncomingMail"));
toggle_button_init (prefs, prefs->check_incoming, FALSE,
@@ -1222,12 +1222,12 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs)
prefs->empty_junk = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "junk_empty_check"));
prefs->empty_junk_days = GTK_OPTION_MENU (glade_xml_get_widget (gui, "junk_empty_combo"));
emmp_empty_junk_init (prefs);
-
+
prefs->default_junk_plugin = GTK_COMBO_BOX (glade_xml_get_widget (gui, "default_junk_plugin"));
prefs->plugin_status = GTK_LABEL (glade_xml_get_widget (gui, "plugin_status"));
- prefs->plugin_image = GTK_IMAGE (glade_xml_get_widget (gui, "plugin_image"));
+ prefs->plugin_image = GTK_IMAGE (glade_xml_get_widget (gui, "plugin_image"));
junk_plugin_setup (GTK_WIDGET (prefs->default_junk_plugin), prefs);
-
+
/* get our toplevel widget */
target = em_config_target_new_prefs(ec, prefs->gconf);
e_config_set_target((EConfig *)ec, (EConfigTarget *)target);
@@ -1239,10 +1239,10 @@ GtkWidget *
em_mailer_prefs_new (void)
{
EMMailerPrefs *new;
-
+
new = (EMMailerPrefs *) g_object_new (em_mailer_prefs_get_type (), NULL);
em_mailer_prefs_construct (new);
-
+
return (GtkWidget *) new;
}
@@ -1253,27 +1253,27 @@ emmp_header_from_xmldoc (xmlDocPtr doc)
struct _EMMailerPrefsHeader *h;
xmlNodePtr root;
xmlChar *name;
-
+
if (doc == NULL)
return NULL;
-
+
root = doc->children;
if (strcmp ((char *)root->name, "header") != 0)
return NULL;
-
+
name = xmlGetProp (root, (const unsigned char *)"name");
if (name == NULL)
return NULL;
-
+
h = g_malloc0 (sizeof (struct _EMMailerPrefsHeader));
h->name = g_strdup ((gchar *)name);
xmlFree (name);
-
+
if (xmlHasProp (root, (const unsigned char *)"enabled"))
h->enabled = 1;
else
h->enabled = 0;
-
+
return h;
}
@@ -1281,9 +1281,9 @@ emmp_header_from_xmldoc (xmlDocPtr doc)
* em_mailer_prefs_header_from_xml
* @xml: XML configuration data
*
- * Parses passed XML data, which should be of
- * the format <header name="foo" enabled />, and
- * returns a EMMailerPrefs structure, or NULL if there
+ * Parses passed XML data, which should be of
+ * the format <header name="foo" enabled />, and
+ * returns a EMMailerPrefs structure, or NULL if there
* is an error.
**/
struct _EMMailerPrefsHeader *
@@ -1291,13 +1291,13 @@ em_mailer_prefs_header_from_xml (const char *xml)
{
struct _EMMailerPrefsHeader *header;
xmlDocPtr doc;
-
+
if (!(doc = xmlParseDoc ((unsigned char *) xml)))
return NULL;
-
+
header = emmp_header_from_xmldoc (doc);
xmlFreeDoc (doc);
-
+
return header;
}
@@ -1305,7 +1305,7 @@ em_mailer_prefs_header_from_xml (const char *xml)
* em_mailer_prefs_header_free
* @header: header to free
*
- * Frees the memory associated with the passed header
+ * Frees the memory associated with the passed header
* structure.
*/
void
@@ -1313,7 +1313,7 @@ em_mailer_prefs_header_free (struct _EMMailerPrefsHeader *header)
{
if (header == NULL)
return;
-
+
g_free (header->name);
g_free (header);
}
@@ -1322,7 +1322,7 @@ em_mailer_prefs_header_free (struct _EMMailerPrefsHeader *header)
* em_mailer_prefs_header_to_xml
* @header: header from which to generate XML
*
- * Returns the passed header as a XML structure,
+ * Returns the passed header as a XML structure,
* or NULL on error
*/
char *
@@ -1333,25 +1333,25 @@ em_mailer_prefs_header_to_xml (struct _EMMailerPrefsHeader *header)
xmlChar *xml;
char *out;
int size;
-
+
g_return_val_if_fail (header != NULL, NULL);
g_return_val_if_fail (header->name != NULL, NULL);
-
+
doc = xmlNewDoc ((const unsigned char *)"1.0");
-
+
root = xmlNewDocNode (doc, NULL, (const unsigned char *)"header", NULL);
xmlSetProp (root, (const unsigned char *)"name", (unsigned char *)header->name);
if (header->enabled)
xmlSetProp (root, (const unsigned char *)"enabled", NULL);
-
+
xmlDocSetRootElement (doc, root);
xmlDocDumpMemory (doc, &xml, &size);
xmlFreeDoc (doc);
-
+
out = g_malloc (size + 1);
memcpy (out, xml, size);
out[size] = '\0';
xmlFree (xml);
-
+
return out;
}