CVS: sylpheedclaws/sylpheed-claws/src compose.c,1.382.2.342,1.382.2.343 folder_item_prefs.h,1.2.2.5,1.2.2.6 prefs_common.c,1.204.2.113,1.204.2.114 prefs_common.h,1.103.2.70,1.103.2.71 prefs_folder_item.c,1.52.2.29,1.52.2.30 prefs_spelling.c,1.5.2.27,1.5.2.28

[email protected] Thu, 21 Dec 2006 08:15:43 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src
In directory sunsite.dk:/tmp/cvs-serv579/src

Modified Files:
      Tag: gtk2
	compose.c folder_item_prefs.h prefs_common.c prefs_common.h 
	prefs_folder_item.c prefs_spelling.c 
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: compose.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/compose.c,v
retrieving revision 1.382.2.342
retrieving revision 1.382.2.343
diff -u -d -r1.382.2.342 -r1.382.2.343
--- compose.c	2006/12/18 20:03:58	1.382.2.342
+++ compose.c	2006/12/21 08:15:34	1.382.2.343
@@ -972,10 +972,13 @@
 
 	undo_block(compose->undostruct);
 #ifdef USE_ASPELL
-	if (item && item->prefs && item->prefs->enable_default_dictionary &&
-	    compose->gtkaspell) {
-		gtkaspell_change_dict(compose->gtkaspell, 
-		    item->prefs->default_dictionary);
+	if (item && item->prefs && compose->gtkaspell) {
+		if (item->prefs->enable_default_dictionary)
+			gtkaspell_change_dict(compose->gtkaspell, 
+				    item->prefs->default_dictionary);
+		if (item->prefs->enable_default_alt_dictionary)
+			gtkaspell_change_dict(compose->gtkaspell, 
+				    item->prefs->default_alt_dictionary);
 		compose_spell_menu_changed(compose);
 	}
 #endif
@@ -1410,10 +1413,13 @@
 #ifdef USE_ASPELL
 	if (msginfo->folder && msginfo->folder->prefs && 
 	    msginfo->folder->prefs && 
-	    msginfo->folder->prefs->enable_default_dictionary &&
 	    compose->gtkaspell) {
-		gtkaspell_change_dict(compose->gtkaspell, 
-		    msginfo->folder->prefs->default_dictionary);
+		if (msginfo->folder->prefs->enable_default_dictionary)
+			gtkaspell_change_dict(compose->gtkaspell, 
+				    msginfo->folder->prefs->default_dictionary);
+		if (msginfo->folder->prefs->enable_default_alt_dictionary)
+			gtkaspell_change_dict(compose->gtkaspell, 
+				    msginfo->folder->prefs->default_alt_dictionary);
 		compose_spell_menu_changed(compose);
 	}
 #endif
@@ -6374,6 +6380,7 @@
 	    	    strcmp(prefs_common.dictionary, "")) {
 			gtkaspell = gtkaspell_new(prefs_common.aspell_path,
 						  prefs_common.dictionary,
+						  prefs_common.alt_dictionary,
 						  conv_get_locale_charset_str(),
 						  prefs_common.misspelled_col,
 						  prefs_common.check_while_typing,

Index: folder_item_prefs.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/folder_item_prefs.h,v
retrieving revision 1.2.2.5
retrieving revision 1.2.2.6
diff -u -d -r1.2.2.5 -r1.2.2.6
--- folder_item_prefs.h	2006/11/07 10:38:52	1.2.2.5
+++ folder_item_prefs.h	2006/12/21 08:15:35	1.2.2.6
@@ -61,6 +61,8 @@
 #if USE_ASPELL
 	gboolean enable_default_dictionary;
 	gchar *default_dictionary;
+	gboolean enable_default_alt_dictionary;
+	gchar *default_alt_dictionary;
 #endif
 	gboolean save_copy_to_folder;
 	guint color;

Index: prefs_common.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/prefs_common.c,v
retrieving revision 1.204.2.113
retrieving revision 1.204.2.114
diff -u -d -r1.204.2.113 -r1.204.2.114
--- prefs_common.c	2006/12/20 14:24:58	1.204.2.113
+++ prefs_common.c	2006/12/21 08:15:35	1.204.2.114
@@ -229,6 +229,8 @@
 	 NULL, NULL, NULL},
 	{"dictionary",  "", &prefs_common.dictionary, P_STRING,
 	 NULL, NULL, NULL},
+	{"alt_dictionary",  "", &prefs_common.alt_dictionary, P_STRING,
+	 NULL, NULL, NULL},
 	{"aspell_sugmode", "1", &prefs_common.aspell_sugmode, P_INT,
 	 NULL, NULL, NULL},
 	{"use_alternate_dict", "FALSE", &prefs_common.use_alternate, P_BOOL,

Index: prefs_common.h
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/prefs_common.h,v
retrieving revision 1.103.2.70
retrieving revision 1.103.2.71
diff -u -d -r1.103.2.70 -r1.103.2.71
--- prefs_common.h	2006/12/09 22:02:29	1.103.2.70
+++ prefs_common.h	2006/12/21 08:15:36	1.103.2.71
@@ -145,6 +145,7 @@
 	gboolean enable_aspell;
 	gchar *aspell_path;
 	gchar *dictionary;
+	gchar *alt_dictionary;
 	gulong misspelled_col;
 	gint aspell_sugmode;
 	gboolean check_while_typing;

Index: prefs_folder_item.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/prefs_folder_item.c,v
retrieving revision 1.52.2.29
retrieving revision 1.52.2.30
diff -u -d -r1.52.2.29 -r1.52.2.30
--- prefs_folder_item.c	2006/11/07 10:39:17	1.52.2.29
+++ prefs_folder_item.c	2006/12/21 08:15:36	1.52.2.30
@@ -111,7 +111,9 @@
 	GtkWidget *optmenu_default_account;
 #if USE_ASPELL
 	GtkWidget *checkbtn_enable_default_dictionary;
+	GtkWidget *checkbtn_enable_default_alt_dictionary;
 	GtkWidget *optmenu_default_dictionary;
+	GtkWidget *optmenu_default_alt_dictionary;
 #endif
 
 	/* apply to sub folders */
@@ -122,6 +124,7 @@
 	GtkWidget *default_account_rec_checkbtn;
 #if USE_ASPELL
 	GtkWidget *default_dictionary_rec_checkbtn;
+	GtkWidget *default_alt_dictionary_rec_checkbtn;
 #endif
 };
 
@@ -600,6 +603,8 @@
 #if USE_ASPELL
 	GtkWidget *checkbtn_enable_default_dictionary = NULL;
 	GtkWidget *optmenu_default_dictionary = NULL;
+	GtkWidget *checkbtn_enable_default_alt_dictionary = NULL;
+	GtkWidget *optmenu_default_alt_dictionary = NULL;
 #endif
 	GtkWidget *request_return_receipt_rec_checkbtn = NULL;
 	GtkWidget *save_copy_to_folder_rec_checkbtn = NULL;
@@ -608,6 +613,7 @@
 	GtkWidget *default_account_rec_checkbtn = NULL;
 #if USE_ASPELL
 	GtkWidget *default_dictionary_rec_checkbtn = NULL;
+	GtkWidget *default_alt_dictionary_rec_checkbtn = NULL;
 #endif
 
 	GList *cur_ac;
@@ -810,6 +816,39 @@
 			 rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
 	
 	rowcount++;
+
+	/* Default dictionary */
+	checkbtn_enable_default_alt_dictionary = gtk_check_button_new_with_label(_("Default alternate dictionary: "));
+	gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_alt_dictionary, 0, 1,
+	    		 rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary),
+	    			     item->prefs->enable_default_alt_dictionary);
+
+	optmenu_default_alt_dictionary = gtk_option_menu_new();
+	gtk_table_attach(GTK_TABLE(table), optmenu_default_alt_dictionary, 1, 2,
+	    		 rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+
+	gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu_default_alt_dictionary), 
+				 gtkaspell_dictionary_option_menu_new_with_refresh(
+					 prefs_common.aspell_path, FALSE));
+
+	dictionary = item->prefs->default_alt_dictionary;
+
+	optmenu = GTK_OPTION_MENU(optmenu_default_alt_dictionary);
+
+	menu = gtk_option_menu_get_menu(optmenu);
+	if (dictionary)
+		gtkaspell_set_dictionary_menu_active_item(optmenu_default_alt_dictionary, dictionary);
+	menuitem = gtk_menu_get_active(GTK_MENU(menu));
+	gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
+
+	SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_alt_dictionary, optmenu_default_alt_dictionary);
+
+	default_alt_dictionary_rec_checkbtn = gtk_check_button_new();
+	gtk_table_attach(GTK_TABLE(table), default_alt_dictionary_rec_checkbtn, 2, 3, 
+			 rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+	
+	rowcount++;
 #endif
 
 	gtk_widget_show_all(table);
@@ -828,6 +867,8 @@
 #ifdef USE_ASPELL
 	page->checkbtn_enable_default_dictionary = checkbtn_enable_default_dictionary;
 	page->optmenu_default_dictionary = optmenu_default_dictionary;
+	page->checkbtn_enable_default_alt_dictionary = checkbtn_enable_default_alt_dictionary;
+	page->optmenu_default_alt_dictionary = optmenu_default_alt_dictionary;
 #endif
 
 	page->request_return_receipt_rec_checkbtn = request_return_receipt_rec_checkbtn;
@@ -837,6 +878,7 @@
 	page->default_account_rec_checkbtn	  = default_account_rec_checkbtn;
 #if USE_ASPELL
 	page->default_dictionary_rec_checkbtn = default_dictionary_rec_checkbtn;
+	page->default_alt_dictionary_rec_checkbtn = default_alt_dictionary_rec_checkbtn;
 #endif
 
 	address_completion_start(page->window);
@@ -924,6 +966,13 @@
 		ASSIGN_STRING(prefs->default_dictionary,
 			      gtkaspell_get_dictionary_menu_active_item(menu));
 	}
+	if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn))) {
+		prefs->enable_default_alt_dictionary =
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_alt_dictionary));
+		menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(page->optmenu_default_alt_dictionary));
+		ASSIGN_STRING(prefs->default_alt_dictionary,
+			      gtkaspell_get_dictionary_menu_active_item(menu));
+	}
 #endif
 
 	folder_item_prefs_save_config(folder);
@@ -949,6 +998,7 @@
 	      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) ||
 #if USE_ASPELL
 	      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn)) ||
+	      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn)) ||
 #endif
 	      gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_reply_to_rec_checkbtn))))
 		return TRUE;
@@ -957,6 +1007,7 @@
 	    !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) 
 #if USE_ASPELL
 	      || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn))
+	      || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_alt_dictionary_rec_checkbtn))
 #endif
 		    ))
 		return TRUE;

Index: prefs_spelling.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/prefs_spelling.c,v
retrieving revision 1.5.2.27
retrieving revision 1.5.2.28
diff -u -d -r1.5.2.27 -r1.5.2.28
--- prefs_spelling.c	2006/11/07 10:39:22	1.5.2.27
+++ prefs_spelling.c	2006/12/21 08:15:37	1.5.2.28
@@ -63,6 +63,10 @@
 	GtkWidget *default_dict_optmenu;
 	GtkWidget *default_dict_optmenu_menu;
 
+	GtkWidget *default_alt_dict_label;
+	GtkWidget *default_alt_dict_optmenu;
+	GtkWidget *default_alt_dict_optmenu_menu;
+
 	GtkWidget *sugmode_label;
 	GtkWidget *sugmode_optmenu;
 	GtkWidget *sugmode_optmenu_menu;
@@ -74,33 +78,13 @@
 	gint	   misspell_col;
 } SpellingPage;
 
-static void prefs_spelling_enable(SpellingPage *spelling, gboolean enable)
-{
-	gtk_widget_set_sensitive(spelling->automatic_frame, enable);
-	gtk_widget_set_sensitive(spelling->dictionary_frame, enable);
-	gtk_widget_set_sensitive(spelling->path_frame, enable);
-	gtk_widget_set_sensitive(spelling->misspelled_label, enable);
-	gtk_widget_set_sensitive(spelling->misspelled_colorbtn, enable);
-	gtk_widget_set_sensitive(spelling->use_alternate_checkbtn, enable);
-}
-
-static void prefs_spelling_checkbtn_enable_aspell_toggle_cb
-	(GtkWidget *widget,
-	 gpointer data)
-{
-	SpellingPage *spelling = (SpellingPage *) data;
-	gboolean toggled;
-
-	toggled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
-	prefs_spelling_enable(spelling, toggled);
-}
-
 static void prefs_spelling_btn_aspell_path_clicked_cb(GtkWidget *widget,
 						     gpointer data)
 {
 	SpellingPage *spelling = (SpellingPage *) data;
 	gchar *file_path;
 	GtkWidget *new_menu;
+	GtkWidget *alt_new_menu;
 
 	file_path = filesel_select_file_open(_("Select dictionaries location"),
 					prefs_common.aspell_path);
@@ -115,10 +99,16 @@
 		gtk_option_menu_set_menu(GTK_OPTION_MENU(spelling->default_dict_optmenu),
 					 new_menu);
 
+		alt_new_menu = gtkaspell_dictionary_option_menu_new_with_refresh(tmp, FALSE);
+		gtk_option_menu_set_menu(GTK_OPTION_MENU(spelling->default_alt_dict_optmenu),
+					 alt_new_menu);
+
 		gtk_entry_set_text(GTK_ENTRY(spelling->aspell_path_entry), tmp);
 		/* select first one */
 		gtk_option_menu_set_history(GTK_OPTION_MENU(
 					spelling->default_dict_optmenu), 0);
+		gtk_option_menu_set_history(GTK_OPTION_MENU(
+					spelling->default_alt_dict_optmenu), 0);
 	
 		g_free(tmp);
 
@@ -165,6 +155,10 @@
 	GtkWidget *default_dict_optmenu;
 	GtkWidget *default_dict_optmenu_menu;
 
+	GtkWidget *default_alt_dict_label;
+	GtkWidget *default_alt_dict_optmenu;
+	GtkWidget *default_alt_dict_optmenu_menu;
+
 	GtkWidget *sugmode_label;
 	GtkWidget *sugmode_optmenu;
 	GtkWidget *sugmode_optmenu_menu;
@@ -232,7 +226,7 @@
 	gtk_widget_show(vbox2);
 	gtk_container_add(GTK_CONTAINER(dictionary_frame), vbox2);
 	
-	table = gtk_table_new(6, 2, FALSE);
+	table = gtk_table_new(6, 3, FALSE);
 	gtk_widget_show(table);
 	gtk_container_set_border_width(GTK_CONTAINER(table), 8);
  	gtk_table_set_row_spacings(GTK_TABLE(table), 4);
@@ -258,9 +252,27 @@
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(default_dict_optmenu),
 			default_dict_optmenu_menu);
 
+	default_alt_dict_label = gtk_label_new(_("Default alternate dictionary"));
+	gtk_widget_show(default_alt_dict_label);
+	gtk_table_attach(GTK_TABLE (table), default_alt_dict_label, 0, 1, 1, 2,
+                    	 (GtkAttachOptions) (GTK_FILL),
+                    	 (GtkAttachOptions) (0), 0, 2);
+	gtk_label_set_justify(GTK_LABEL(default_alt_dict_label), GTK_JUSTIFY_RIGHT);
+	gtk_misc_set_alignment(GTK_MISC(default_alt_dict_label), 1, 0.5);
+	
+	default_alt_dict_optmenu = gtk_option_menu_new();
+	gtk_widget_show(default_alt_dict_optmenu);
+	gtk_widget_set_size_request(default_alt_dict_optmenu, 180, -1);
+	gtk_table_attach (GTK_TABLE (table), default_alt_dict_optmenu, 1, 2, 1, 2,
+			  GTK_SHRINK, 0, 0, 0);
+
+	default_alt_dict_optmenu_menu = gtk_menu_new();
+	gtk_option_menu_set_menu(GTK_OPTION_MENU(default_alt_dict_optmenu),
+			default_alt_dict_optmenu_menu);
+
 	sugmode_label = gtk_label_new(_("Default suggestion mode"));
 	gtk_widget_show(sugmode_label);
-	gtk_table_attach(GTK_TABLE (table), sugmode_label, 0, 1, 1, 2,
+	gtk_table_attach(GTK_TABLE (table), sugmode_label, 0, 1, 2, 3,
                     	 (GtkAttachOptions) (GTK_FILL),
                     	 (GtkAttachOptions) (0), 0, 2);
 	gtk_label_set_justify(GTK_LABEL(sugmode_label), GTK_JUSTIFY_RIGHT);
@@ -269,7 +281,7 @@
 	sugmode_optmenu = gtk_option_menu_new();
 	gtk_widget_show(sugmode_optmenu);
 	gtk_widget_set_size_request(sugmode_optmenu, 180, -1); 
-	gtk_table_attach (GTK_TABLE (table), sugmode_optmenu, 1, 2, 1, 2,
+	gtk_table_attach (GTK_TABLE (table), sugmode_optmenu, 1, 2, 2, 3,
 			  GTK_SHRINK, 0, 0, 0);
 	
 	sugmode_optmenu_menu = gtk_menu_new();
@@ -297,11 +309,17 @@
 			     _("Pick color for misspelled word. "
 			       "Use black to underline"), NULL);
 
+	SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, automatic_frame);
+	SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, dictionary_frame);
+	SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, path_frame);
+	SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, misspelled_label);
+	SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, misspelled_colorbtn);
+	SET_TOGGLE_SENSITIVITY(enable_aspell_checkbtn, use_alternate_checkbtn);
+	SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, default_alt_dict_label);
+	SET_TOGGLE_SENSITIVITY(use_alternate_checkbtn, default_alt_dict_optmenu);
+
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enable_aspell_checkbtn),
 			prefs_common.enable_aspell);
-	g_signal_connect(G_OBJECT(enable_aspell_checkbtn), "toggled",
-			 G_CALLBACK(prefs_spelling_checkbtn_enable_aspell_toggle_cb),
-			 prefs_spelling);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_while_typing_checkbtn),
 			prefs_common.check_while_typing);
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(recheck_when_changing_dict_checkbtn),
@@ -316,6 +334,10 @@
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(default_dict_optmenu),
 				 gtkaspell_dictionary_option_menu_new(prefs_common.aspell_path));
 	gtkaspell_set_dictionary_menu_active_item(default_dict_optmenu, prefs_common.dictionary);
+	gtk_option_menu_set_menu(GTK_OPTION_MENU(default_alt_dict_optmenu),
+				 gtkaspell_dictionary_option_menu_new_with_refresh(prefs_common.aspell_path, FALSE));
+	gtkaspell_set_dictionary_menu_active_item(default_alt_dict_optmenu, prefs_common.alt_dictionary);
+
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(sugmode_optmenu),
 				 gtkaspell_sugmode_option_menu_new(prefs_common.aspell_sugmode));
 	gtkaspell_sugmode_option_menu_set(GTK_OPTION_MENU(sugmode_optmenu),
@@ -342,6 +364,10 @@
 	prefs_spelling->default_dict_optmenu	= default_dict_optmenu;
 	prefs_spelling->default_dict_optmenu_menu
 		= default_dict_optmenu_menu;
+	prefs_spelling->default_alt_dict_label	= default_alt_dict_label;
+	prefs_spelling->default_alt_dict_optmenu	= default_alt_dict_optmenu;
+	prefs_spelling->default_alt_dict_optmenu_menu
+		= default_alt_dict_optmenu_menu;
 	prefs_spelling->sugmode_label		= sugmode_label;
 	prefs_spelling->sugmode_optmenu		= sugmode_optmenu;
 	prefs_spelling->sugmode_optmenu_menu	= sugmode_optmenu_menu;
@@ -349,8 +375,6 @@
 	prefs_spelling->misspelled_colorbtn	= misspelled_colorbtn;
 
 	prefs_spelling->page.widget = vbox1;
-
-	prefs_spelling_enable(prefs_spelling, prefs_common.enable_aspell);
 }
 
 void prefs_spelling_save(PrefsPage *_page)
@@ -376,6 +400,13 @@
 			gtk_option_menu_get_menu(
 				GTK_OPTION_MENU(
 					spelling->default_dict_optmenu)));
+
+	g_free(prefs_common.alt_dictionary);
+	prefs_common.alt_dictionary = 
+		gtkaspell_get_dictionary_menu_active_item(
+			gtk_option_menu_get_menu(
+				GTK_OPTION_MENU(
+					spelling->default_alt_dict_optmenu)));
 
 	prefs_common.aspell_sugmode =
 		gtkaspell_get_sugmode_from_option_menu(