2005-12-05 [paul] 1.9.100cvs61
[claws.git] / src / prefs_spelling.c
index 0c4473bc184c5f35726b376ed9332bcb12595308..bf0f4f06b71182e0b868176c97bfca7b08bf5c31 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 /*
@@ -33,9 +33,9 @@
 #include <stdlib.h>
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include "intl.h"
 #include "utils.h"
 #include "prefs_common.h"
 #include "prefs_gtk.h"
@@ -97,7 +97,7 @@ static void prefs_spelling_btn_aspell_path_clicked_cb(GtkWidget *widget,
        if (file_path != NULL) {
                gchar *tmp_path, *tmp;
 
-               tmp_path = g_dirname(file_path);
+               tmp_path = g_path_get_dirname(file_path);
                tmp = g_strdup_printf("%s%s", tmp_path, G_DIR_SEPARATOR_S);
                g_free(tmp_path);
 
@@ -152,12 +152,14 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
        GtkWidget *hbox1;
        GtkWidget *misspelled_btn;
        GtkTooltips *tooltips;
+       PangoFontDescription *font_desc;
+       gint size;
 
        tooltips = gtk_tooltips_new ();
 
        table = gtk_table_new(8, 3, FALSE);
        gtk_widget_show(table);
-       gtk_container_set_border_width(GTK_CONTAINER(table), 8);
+       gtk_container_set_border_width(GTK_CONTAINER(table), VBOX_BORDER);
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
 
@@ -241,7 +243,7 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
        gtk_label_set_justify(GTK_LABEL(label5), GTK_JUSTIFY_RIGHT);
        gtk_misc_set_alignment(GTK_MISC(label5), 1, 0.5);
 
-       btn_aspell_path = gtk_button_new_with_label(_(" ... "));
+       btn_aspell_path = gtkut_get_browse_directory_btn(_("_Browse"));
        gtk_widget_show(btn_aspell_path);
        gtk_table_attach(GTK_TABLE(table), btn_aspell_path, 2, 3, 4, 5,
                         (GtkAttachOptions) (GTK_FILL),
@@ -257,7 +259,12 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
        gtk_widget_show(misspelled_btn);
        gtk_box_pack_start(GTK_BOX(hbox1), misspelled_btn, FALSE, FALSE,
                           0);
-       gtk_widget_set_usize(misspelled_btn, 30, 20);
+       gtk_widget_set_size_request(misspelled_btn, 30, 20);
+       label5 = gtk_label_new(_("Use black to underline"));
+       gtkut_widget_set_small_font_size (label5);
+       gtk_widget_show(label5);
+       gtk_box_pack_start(GTK_BOX(hbox1), label5, FALSE, FALSE,
+                          4);
        /* END GLADE CODE */
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_aspell),
@@ -357,9 +364,10 @@ void prefs_spelling_init(void)
 {
        SpellingPage *page;
        static gchar *path[3];
-
+       const gchar* language = NULL;
+       
        path[0] = _("Compose");
-       path[1] = _("Spell Checker");
+       path[1] = _("Spell Checking");
        path[2] = NULL;
 
        page = g_new0(SpellingPage, 1);
@@ -367,10 +375,30 @@ void prefs_spelling_init(void)
        page->page.create_widget = prefs_spelling_create_widget;
        page->page.destroy_widget = prefs_spelling_destroy_widget;
        page->page.save_page = prefs_spelling_save;
-       page->page.weight = 50.0;
+       page->page.weight = 180.0;
 
        prefs_gtk_register_page((PrefsPage *) page);
        prefs_spelling = page;
+       
+       language = g_getenv("LANG");
+       if (language == NULL)
+               language = "en";
+       else if (!strcmp(language, "POSIX") || !strcmp(language, "C"))
+               language = "en";
+       
+       if (!prefs_common.dictionary)
+               prefs_common.dictionary = g_strdup_printf("%s%s",
+                                               prefs_common.aspell_path,
+                                               language);
+       if (!strlen(prefs_common.dictionary)
+       ||  !strcmp(prefs_common.dictionary,"(None"))
+               prefs_common.dictionary = g_strdup_printf("%s%s",
+                                               prefs_common.aspell_path,
+                                               language);
+       if (strcasestr(prefs_common.dictionary,".utf"))
+               *(strcasestr(prefs_common.dictionary,".utf")) = '\0';
+       if (strstr(prefs_common.dictionary,"@"))
+               *(strstr(prefs_common.dictionary,"@")) = '\0';
 }
 
 void prefs_spelling_done(void)