CVS: sylpheedclaws/sylpheed-claws/src/gtk gtkaspell.c,1.9.2.44,1.9.2.45 gtkaspell.h,1.5.2.7,1.5.2.8

[email protected] Thu, 21 Dec 2006 08:15: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-serv579/src/gtk

Modified Files:
      Tag: gtk2
	gtkaspell.c gtkaspell.h 
Log Message:
2006-12-21 [wwp]	2.6.1cvs61

	* src/compose.c
	* src/folder_item_prefs.h
	* src/prefs_common.c
	* src/prefs_common.h
	* src/prefs_folder_item.c
	* src/prefs_spelling.c
	* src/gtk/gtkaspell.c
	* src/gtk/gtkaspell.h
		Add global and per-folder prefs to set the default
		alternate dictionary.

Index: gtkaspell.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/gtkaspell.c,v
retrieving revision 1.9.2.44
retrieving revision 1.9.2.45
diff -u -d -r1.9.2.44 -r1.9.2.45
--- gtkaspell.c	2006/11/14 07:26:43	1.9.2.44
+++ gtkaspell.c	2006/12/21 08:15:41	1.9.2.45
@@ -373,6 +373,7 @@
 
 GtkAspell *gtkaspell_new(const gchar *dictionary_path,
 			 const gchar *dictionary, 
+			 const gchar *alt_dictionary, 
 			 const gchar *encoding,
 			 gint  misspelled_color,
 			 gboolean check_while_typing,
@@ -391,6 +392,10 @@
 	g_return_val_if_fail(gtktext, NULL);
 	g_return_val_if_fail(dictionary && strlen(dictionary) > 0, 
 			NULL);
+	if (use_alternate) {
+		g_return_val_if_fail(alt_dictionary && strlen(alt_dictionary) > 0, 
+				NULL);
+	}
 	g_return_val_if_fail(dictionary_path && strlen(dictionary_path) > 0, 
 			NULL);
 
@@ -411,7 +416,26 @@
 	gtkaspell->dictionary_path    = g_strdup(dictionary_path);
 
 	gtkaspell->gtkaspeller	      = gtkaspeller;
-	gtkaspell->alternate_speller  = NULL;
+
+	if (use_alternate) {
+		Dictionary 	*alt_dict;
+		GtkAspeller 	*alt_gtkaspeller;
+
+		alt_dict 	       = g_new0(Dictionary, 1);
+		alt_dict->fullname = g_strdup(alt_dictionary);
+		alt_dict->encoding = g_strdup(encoding);
+
+		alt_gtkaspeller    = gtkaspeller_new(alt_dict);
+		dictionary_delete(alt_dict);
+
+		if (!alt_gtkaspeller)
+			return NULL;
+
+		gtkaspell->alternate_speller  = alt_gtkaspeller;
+	} else {
+		gtkaspell->alternate_speller  = NULL;
+	}
+
 	gtkaspell->theword[0]	      = 0x00;
 	gtkaspell->start_pos	      = 0;
 	gtkaspell->end_pos	      = 0;
@@ -466,7 +490,7 @@
 	
 	gtkaspeller_delete(gtkaspell->gtkaspeller);
 
-	if (gtkaspell->use_alternate && gtkaspell->alternate_speller)
+	if (gtkaspell->alternate_speller)
 		gtkaspeller_delete(gtkaspell->alternate_speller);
 
 	if (gtkaspell->suggestions_list)
@@ -1720,14 +1744,15 @@
 }
 
 /* FIXME */
-GtkWidget *gtkaspell_dictionary_option_menu_new(const gchar *aspell_path)
+GtkWidget *gtkaspell_dictionary_option_menu_new_with_refresh(const gchar *aspell_path,
+							     gboolean refresh)
 {
 	GSList *dict_list, *tmp;
 	GtkWidget *item;
 	GtkWidget *menu;
 	Dictionary *dict;
 
-	dict_list = gtkaspell_get_dictionary_list(aspell_path, TRUE);
+	dict_list = gtkaspell_get_dictionary_list(aspell_path, refresh);
 	g_return_val_if_fail(dict_list, NULL);
 
 	menu = gtk_menu_new();
@@ -1745,6 +1770,13 @@
 	gtk_widget_show(menu);
 
 	return menu;
+}
+
+GtkWidget *gtkaspell_dictionary_option_menu_new(const gchar *aspell_path)
+{
+	return gtkaspell_dictionary_option_menu_new_with_refresh
+		(aspell_path, TRUE);
+
 }
 
 gchar *gtkaspell_get_dictionary_menu_active_item(GtkWidget *menu)

Index: gtkaspell.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/gtk/gtkaspell.h,v
retrieving revision 1.5.2.7
retrieving revision 1.5.2.8
diff -u -d -r1.5.2.7 -r1.5.2.8
--- gtkaspell.h	2006/11/07 10:40:23	1.5.2.7
+++ gtkaspell.h	2006/12/21 08:15:41	1.5.2.8
@@ -52,6 +52,7 @@
 
 GtkAspell*	gtkaspell_new			(const gchar *dictionary_path,
 						 const gchar *dictionary, 
+						 const gchar *alt_dictionary, 
 						 const gchar *encoding,
 						 gint  misspelled_color,
 						 gboolean check_while_typing,
@@ -87,6 +88,9 @@
 void 		gtkaspell_highlight_all		(GtkAspell *gtkaspell);
 
 GtkWidget*	gtkaspell_dictionary_option_menu_new	(const gchar *aspell_path);
+GtkWidget*	gtkaspell_dictionary_option_menu_new_with_refresh
+							(const gchar *aspell_path,
+							 gboolean     refresh);
 
 gchar*		gtkaspell_get_dictionary_menu_active_item
 							(GtkWidget *menu);