aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog4
-rw-r--r--mail/mail-composer-prefs.c16
2 files changed, 16 insertions, 4 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 5e63ab9271..b50f207c4e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,7 @@
+2002-05-23 Radek Doulik <rodo@ximian.com>
+
+ * mail-composer-prefs.c: be more careful about language_str{_orig}
+
2002-05-21 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (sig_fill_options): Only clear the text/html
diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c
index 15f87826c6..29f0802b42 100644
--- a/mail/mail-composer-prefs.c
+++ b/mail/mail-composer-prefs.c
@@ -566,7 +566,7 @@ spell_get_language_str (MailComposerPrefs *prefs)
rv = str->str;
g_string_free (str, FALSE);
- return rv;
+ return rv ? rv : g_strdup ("");
}
static void
@@ -589,7 +589,7 @@ static void
spell_save_orig (MailComposerPrefs *prefs)
{
g_free (prefs->language_str_orig);
- prefs->language_str_orig = g_strdup (prefs->language_str);
+ prefs->language_str_orig = g_strdup (prefs->language_str ? prefs->language_str : "");
prefs->spell_error_color_orig = prefs->spell_error_color;
}
@@ -605,9 +605,11 @@ static void
spell_load_values (MailComposerPrefs *prefs)
{
GConfValue *val;
+ gchar *def_lang;
+ def_lang = g_strdup (_("en"));
g_free (prefs->language_str);
- prefs->language_str = g_strdup (_("en"));
+ prefs->language_str = g_strdup (def_lang);
prefs->spell_error_color.red = 0xffff;
prefs->spell_error_color.green = 0;
prefs->spell_error_color.blue = 0;
@@ -617,7 +619,12 @@ spell_load_values (MailComposerPrefs *prefs)
GET (int, "/spell_error_color_blue", prefs->spell_error_color.blue,,);
GET (string, "/language", prefs->language_str, g_free (prefs->language_str), g_strdup);
+ if (prefs->language_str == NULL)
+ prefs->language_str = g_strdup (def_lang);
+
spell_save_orig (prefs);
+
+ g_free (def_lang);
}
#define SET(t,x,prop) \
@@ -633,8 +640,9 @@ spell_save_values (MailComposerPrefs *prefs, gboolean force)
SET (int, "/spell_error_color_green", prefs->spell_error_color.green);
SET (int, "/spell_error_color_blue", prefs->spell_error_color.blue);
}
+
if (force || !STR_EQUAL (prefs->language_str, prefs->language_str_orig)) {
- SET (string, "/language", prefs->language_str);
+ SET (string, "/language", prefs->language_str ? prefs->language_str : "");
}
gconf_client_suggest_sync (prefs->gconf, NULL);