Index: plugins/spell/gedit-spell-checker.c
===================================================================
RCS file: /cvs/gnome/gedit/plugins/spell/gedit-spell-checker.c,v
retrieving revision 1.7
diff -u -p -r1.7 gedit-spell-checker.c
--- plugins/spell/gedit-spell-checker.c	30 Sep 2003 14:49:47 -0000	1.7
+++ plugins/spell/gedit-spell-checker.c	30 Apr 2004 11:33:36 -0000
@@ -37,12 +37,16 @@
 
 #include <glib/gstrfuncs.h>
 #include <bonobo/bonobo-i18n.h>
+#include <gconf/gconf-client.h>
 
 #include "gedit-spell-checker.h"
 
 /* FIXME - Rename the marshal file - Paolo */
 #include "gedit-spell-checker-dialog-marshal.h"
 
+#define DEAFAULT_LANG_KEY	"/apps/gedit-2/plugins/spell/default_lang"
+
+
 struct _GeditSpellChecker 
 {
 	GObject parent_instance;
@@ -129,6 +133,57 @@ gedit_spell_checker_error_quark (void)
 	return q;
 }
 
+static const GeditLanguage *
+get_language_from_abrev (const gchar *abrev)
+{
+	int i;
+
+	if (abrev == NULL)
+		return;
+
+	for (i = 0; known_languages [i].abrev; i++) 
+	{
+		if (g_ascii_strncasecmp (abrev, known_languages [i].abrev, strlen(known_languages [i].abrev)) == 0)
+			return &known_languages [i];
+	}
+
+	return NULL;
+}
+
+static const GeditLanguage *
+get_default_language ()
+{
+	GConfClient *client;
+	const gchar *lang_str;
+	const GeditLanguage *lang;
+
+	client = gconf_client_get_default ();
+
+	lang_str = gconf_client_get_string (client,
+					    DEAFAULT_LANG_KEY,
+					    NULL);
+	g_object_unref (client);
+
+	lang = get_language_from_abrev (lang_str);
+
+	return lang;
+}
+
+static void
+set_default_language (const GeditLanguage *lang)
+{
+	GConfClient *client;
+
+	client = gconf_client_get_default ();
+
+	gconf_client_set_string (client,
+				 DEAFAULT_LANG_KEY,
+				 lang->abrev,
+				 NULL);
+
+	g_object_unref (client);
+}
+
 GType
 gedit_spell_checker_get_type (void)
 {
@@ -272,12 +327,11 @@ gedit_spell_checker_class_init (GeditSpe
 			  0); 
 }
 
-
 static void
 gedit_spell_checker_init (GeditSpellChecker *spell_checker)
 {
 	spell_checker->manager = NULL;
-	spell_checker->active_lang = NULL;
+	spell_checker->active_lang = get_default_language ();
 }
 
 GeditSpellChecker *
@@ -293,7 +347,6 @@ gedit_spell_checker_new	(void)
 	return spell;
 }
 
-
 static void 
 gedit_spell_checker_finalize (GObject *object)
 {
@@ -307,22 +360,6 @@ gedit_spell_checker_finalize (GObject *o
 		delete_pspell_manager (spell_checker->manager);
 }
 
-static const GeditLanguage*
-get_language_from_abrev (const gchar *abrev)
-{
-	int i;
-	
-	g_return_val_if_fail (abrev != NULL, NULL);
-	
-	for (i = 0; known_languages [i].abrev; i++) 
-	{
-		if (g_ascii_strncasecmp (abrev, known_languages [i].abrev, strlen(known_languages [i].abrev)) == 0)
-			return &known_languages [i];
-	}
-
-	return NULL;
-}
-
 static gboolean
 lazy_init (GeditSpellChecker *spell, const GeditLanguage *language, GError **error) 
 {
@@ -337,14 +374,12 @@ lazy_init (GeditSpellChecker *spell, con
 	config = new_pspell_config ();
 	g_return_val_if_fail (config != NULL, FALSE);
 	
-	if (language != NULL)
+	if (language != NULL && language->abrev != NULL)
+	{
 		pspell_config_replace (config, "language-tag", language->abrev);
-		
-	pspell_config_replace (config, "encoding", "utf-8");
-	
-	pspell_config_replace (config, "mode", "url");
-
-	if (language == NULL)
+		spell->active_lang = language;
+	}
+	else
 	{
 		const gchar *language_tag;
 
@@ -354,17 +389,10 @@ lazy_init (GeditSpellChecker *spell, con
 		{
 			spell->active_lang = get_language_from_abrev (language_tag);
 		}
-
-		/*
-		g_print ("Language tag: %s\n", language_tag);
-		*/
 	}
-	else
-		spell->active_lang = language;
 
-	/*
-	g_print ("Language: %s\n", gedit_language_to_string (spell->active_lang ));
-	*/
+	pspell_config_replace (config, "encoding", "utf-8");
+	pspell_config_replace (config, "mode", "url");
 
 	err = new_pspell_manager (config);
 
@@ -425,8 +453,9 @@ gedit_spell_checker_get_available_langua
 
 gboolean
 gedit_spell_checker_set_language (GeditSpellChecker *spell, 
-			const GeditLanguage *language,
-			GError **error)
+				  const GeditLanguage *language,
+				  gboolean default_lang,
+				  GError **error)
 {
 	gboolean ret;
 	
@@ -438,6 +467,9 @@ gedit_spell_checker_set_language (GeditS
 		delete_pspell_manager (spell->manager);
 		spell->manager = NULL;
 	}
+
+	if (default_lang)
+		set_default_language (language);
 
 	ret = lazy_init (spell, language, error);
 
Index: plugins/spell/gedit-spell-checker.h
===================================================================
RCS file: /cvs/gnome/gedit/plugins/spell/gedit-spell-checker.h,v
retrieving revision 1.4
diff -u -p -r1.4 gedit-spell-checker.h
--- plugins/spell/gedit-spell-checker.h	18 Apr 2003 15:31:16 -0000	1.4
+++ plugins/spell/gedit-spell-checker.h	30 Apr 2004 11:33:36 -0000
@@ -90,9 +90,9 @@ GeditSpellChecker	*gedit_spell_checker_n
 /* GSList contains GeditLanguage* items */
 const GSList 		*gedit_spell_checker_get_available_languages (void);
 
-
 gboolean		 gedit_spell_checker_set_language 	(GeditSpellChecker *spell, 
 								 const GeditLanguage *lang,
+								 gboolean default_lang,
 								 GError **error);
 const GeditLanguage 	*gedit_spell_checker_get_language 	(GeditSpellChecker *spell);
 
Index: plugins/spell/gedit-spell-language-dialog.c
===================================================================
RCS file: /cvs/gnome/gedit/plugins/spell/gedit-spell-language-dialog.c,v
retrieving revision 1.3
diff -u -p -r1.3 gedit-spell-language-dialog.c
--- plugins/spell/gedit-spell-language-dialog.c	27 Jan 2003 11:26:30 -0000	1.3
+++ plugins/spell/gedit-spell-language-dialog.c	30 Apr 2004 11:33:36 -0000
@@ -53,8 +53,9 @@ struct _GeditSpellLanguageDialog 
 {
 	GtkWidget *dialog;
 	
-	GtkWidget *languages_treeview;
 	GtkTreeModel *model;
+	GtkWidget *languages_treeview;
+	GtkWidget *default_lang_checkbutton;
 
 	GeditSpellChecker *spell_checker;
 };
@@ -102,6 +103,7 @@ ok_button_pressed (GeditSpellLanguageDia
 	GError *error = NULL;
 	GValue value = {0, };
 	const GeditLanguage* lang;
+	gboolean default_lang;
 
 	GtkTreeIter iter;
 	GtkTreeSelection *selection;
@@ -110,15 +112,17 @@ ok_button_pressed (GeditSpellLanguageDia
 	g_return_if_fail (selection != NULL);
 
 	if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
-			return;
+		return;
 
 	gtk_tree_model_get_value (dialog->model, &iter,
 			    COLUMN_LANGUAGE_POINTER, &value);
 
 	lang = (const GeditLanguage* ) g_value_get_pointer (&value);
 	g_return_if_fail (lang != NULL);
-	
-	gedit_spell_checker_set_language (dialog->spell_checker, lang, &error);
+
+	default_lang = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->default_lang_checkbutton));
+
+	gedit_spell_checker_set_language (dialog->spell_checker, lang, default_lang, &error);
 
 	if (error)
 	{
@@ -223,18 +227,19 @@ get_languages_dialog (GeditSpellChecker 
 	dialog->spell_checker = spell_checker;
 
 	dialog->dialog = glade_xml_get_widget (gui, "dialog");
-	
 	dialog->languages_treeview = glade_xml_get_widget (gui, "languages_treeview");
+	dialog->default_lang_checkbutton = glade_xml_get_widget (gui, "default_lang_checkbutton");
 
 	if (!dialog->dialog || 
-	    !dialog->languages_treeview) 
+	    !dialog->languages_treeview ||
+	    !dialog->default_lang_checkbutton) 
 	{
 		g_warning (
 			_("Could not find the required widgets inside %s."), "languages-dialog.glade2.");
 		g_object_unref (gui);
 		return NULL;
 	}
-	
+
 	g_signal_connect(G_OBJECT (dialog->dialog), "destroy",
 			 G_CALLBACK (dialog_destroyed), &dialog);
 
@@ -261,12 +266,11 @@ get_languages_dialog (GeditSpellChecker 
 	g_signal_connect (G_OBJECT (dialog->languages_treeview), "realize", 
 			  G_CALLBACK (scroll_to_selected), 
 			  dialog);
-	
+
 	g_object_unref (gui);
 
 	return dialog;
 }
-
 
 void 
 gedit_spell_language_dialog_run (GeditSpellChecker *spell_checker, GtkWindow *parent)
Index: plugins/spell/languages-dialog.glade2
===================================================================
RCS file: /cvs/gnome/gedit/plugins/spell/languages-dialog.glade2,v
retrieving revision 1.2
diff -u -p -r1.2 languages-dialog.glade2
--- plugins/spell/languages-dialog.glade2	5 Jan 2004 16:53:00 -0000	1.2
+++ plugins/spell/languages-dialog.glade2	30 Apr 2004 11:33:37 -0000
@@ -2,6 +2,7 @@
 <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
 
 <glade-interface>
+<requires lib="gnome"/>
 
 <widget class="GtkDialog" id="dialog">
   <property name="title" translatable="yes">Set language</property>
@@ -10,6 +11,11 @@
   <property name="modal">True</property>
   <property name="resizable">False</property>
   <property name="destroy_with_parent">True</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="has_separator">False</property>
 
   <child internal-child="vbox">
@@ -31,6 +37,7 @@
 	      <property name="label">gtk-help</property>
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-11</property>
 	    </widget>
 	  </child>
@@ -43,6 +50,7 @@
 	      <property name="label">gtk-cancel</property>
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-6</property>
 	    </widget>
 	  </child>
@@ -55,6 +63,7 @@
 	      <property name="label">gtk-ok</property>
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
 	      <property name="response_id">-5</property>
 	    </widget>
 	  </child>
@@ -121,6 +130,25 @@
 	      <property name="padding">0</property>
 	      <property name="expand">True</property>
 	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="default_lang_checkbutton">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Set selected language as _default</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
 	    </packing>
 	  </child>
 	</widget>
