CVS: sylpheedclaws/sylpheed-claws/src/gtk gtkaspell.c,1.9.2.47,1.9.2.48 gtkaspell.h,1.5.2.9,1.5.2.10
[email protected] Wed, 27 Dec 2006 11:19:44 +0000
| Newsgroups | gmane.mail.sylpheed.claws.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk
In directory sunsite.dk:/tmp/cvs-serv9894/src/gtk
Modified Files:
Tag: gtk2
gtkaspell.c gtkaspell.h
Log Message:
2006-12-27 [wwp] 2.6.1cvs81
* src/gtk/gtkaspell.c
* src/gtk/gtkaspell.h
* src/compose.c
Fix assignment of compose's default and alternate dictionary from
account or folder settings. Now gtkaspell_change_dict does rotate
dicts only when it's called from a menu cb.
Index: gtkaspell.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/gtkaspell.c,v
retrieving revision 1.9.2.47
retrieving revision 1.9.2.48
diff -u -d -r1.9.2.47 -r1.9.2.48
--- gtkaspell.c 2006/12/21 10:52:33 1.9.2.47
+++ gtkaspell.c 2006/12/27 11:19:38 1.9.2.48
@@ -2312,9 +2312,16 @@
gtkaspell->theword);
}
-/* Menu call backs */
-
-gboolean gtkaspell_change_dict(GtkAspell *gtkaspell, const gchar *dictionary)
+/* change the current dictionary of gtkaspell
+ - if always_set_alt_dict is set, the alternate dict is unconditionally set to the former
+ current dictionary (common use: from menu callbacks)
+ - if always_set_alt_dict is NOT set, the alternate dict will be set to the former
+ current dictionary only if there is no alternate dictionary already set
+ (this is when we need to set the current dictionary then the alternate one
+ when creating a compose window, from the account and folder settings)
+*/
+gboolean gtkaspell_change_dict(GtkAspell *gtkaspell, const gchar *dictionary,
+ gboolean always_set_alt_dict)
{
Dictionary *dict;
GtkAspeller *gtkaspeller;
@@ -2329,14 +2336,6 @@
dict->fullname = g_strdup(dictionary);
dict->encoding = g_strdup(gtkaspell->gtkaspeller->dictionary->encoding);
- if (gtkaspell->use_alternate && gtkaspell->alternate_speller &&
- dict == gtkaspell->alternate_speller->dictionary) {
- use_alternate_dict(gtkaspell);
- dictionary_delete(dict);
- gtkaspell->alternate_speller->dictionary = NULL;
- return TRUE;
- }
-
gtkaspeller = gtkaspeller_new(dict);
if (!gtkaspeller) {
@@ -2348,9 +2347,16 @@
g_free(message);
} else {
if (gtkaspell->use_alternate) {
- if (gtkaspell->alternate_speller)
- gtkaspeller_delete(gtkaspell->alternate_speller);
- gtkaspell->alternate_speller = gtkaspell->gtkaspeller;
+ if (gtkaspell->alternate_speller) {
+ if (always_set_alt_dict) {
+ gtkaspeller_delete(gtkaspell->alternate_speller);
+ gtkaspell->alternate_speller = gtkaspell->gtkaspeller;
+ } else
+ gtkaspeller_delete(gtkaspell->gtkaspeller);
+ } else
+ /* should never be reached as the dicts are always set
+ to a default value */
+ gtkaspell->alternate_speller = gtkaspell->gtkaspeller;
} else
gtkaspeller_delete(gtkaspell->gtkaspeller);
@@ -2363,6 +2369,41 @@
return TRUE;
}
+/* change the alternate dictionary of gtkaspell (doesn't affect the default dictionary) */
+gboolean gtkaspell_change_alt_dict(GtkAspell *gtkaspell, const gchar *alt_dictionary)
+{
+ Dictionary *dict;
+ GtkAspeller *gtkaspeller;
+
+ g_return_val_if_fail(gtkaspell, FALSE);
+ g_return_val_if_fail(alt_dictionary, FALSE);
+
+ dict = g_new0(Dictionary, 1);
+ dict->fullname = g_strdup(alt_dictionary);
+ dict->encoding = g_strdup(gtkaspell->gtkaspeller->dictionary->encoding);
+
+ gtkaspeller = gtkaspeller_new(dict);
+
+ if (!gtkaspeller) {
+ gchar *message;
+ message = g_strdup_printf(_("The spell checker could not change the alternate dictionary.\n%s"),
+ gtkaspellcheckers->error_message);
+
+ alertpanel_warning(message);
+ g_free(message);
+ } else {
+ if (gtkaspell->alternate_speller)
+ gtkaspeller_delete(gtkaspell->alternate_speller);
+ gtkaspell->alternate_speller = gtkaspeller;
+ }
+
+ dictionary_delete(dict);
+
+ return TRUE;
+}
+
+/* Menu call backs */
+
/* change_dict_cb() - Menu callback : change dict */
static void change_dict_cb(GtkWidget *w, GtkAspell *gtkaspell)
{
@@ -2373,7 +2414,7 @@
if (!strcmp2(fullname, _("None")))
return;
- gtkaspell_change_dict(gtkaspell, fullname);
+ gtkaspell_change_dict(gtkaspell, fullname, TRUE);
if (gtkaspell->recheck_when_changing_dict) {
gtkaspell_highlight_all(gtkaspell);
}
Index: gtkaspell.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/gtkaspell.h,v
retrieving revision 1.5.2.9
retrieving revision 1.5.2.10
diff -u -d -r1.5.2.9 -r1.5.2.10
--- gtkaspell.h 2006/12/21 10:52:33 1.5.2.9
+++ gtkaspell.h 2006/12/27 11:19:38 1.5.2.10
@@ -69,7 +69,11 @@
guchar* gtkaspell_get_dict (GtkAspell *gtkaspell);
gboolean gtkaspell_change_dict (GtkAspell *gtkaspell,
- const gchar* dictionary);
+ const gchar* dictionary,
+ gboolean always_set_alt_dict);
+
+gboolean gtkaspell_change_alt_dict (GtkAspell *gtkaspell,
+ const gchar* alt_dictionary);
guchar* gtkaspell_get_path (GtkAspell *gtkaspell);