2004-09-02 [colin] 0.9.12cvs87
[claws.git] / src / prefs_spelling.c
index b0ae2455e47ac7e61952128fdbbff501f60c9900..21e6101178d4c59aa52fde48d61d6568a598a1bb 100644 (file)
@@ -139,7 +139,6 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
        GtkWidget *checkbtn_enable_aspell;
        GtkWidget *checkbtn_check_while_typing;
        GtkWidget *checkbtn_use_alternate;
-       GtkWidget *label1;
        GtkWidget *label2;
        GtkWidget *entry_aspell_path;
        GtkWidget *label3;
@@ -152,6 +151,9 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
        GtkWidget *btn_aspell_path;
        GtkWidget *hbox1;
        GtkWidget *misspelled_btn;
+       GtkTooltips *tooltips;
+
+       tooltips = gtk_tooltips_new ();
 
        table = gtk_table_new(8, 3, FALSE);
        gtk_widget_show(table);
@@ -180,15 +182,8 @@ void prefs_spelling_create_widget(PrefsPage *_page, GtkWindow *window, gpointer
        gtk_table_attach(GTK_TABLE(table), checkbtn_use_alternate, 0, 3, 2,
                         3, (GtkAttachOptions) (GTK_FILL),
                         (GtkAttachOptions) (0), 0, 0);
-
-       label1 =
-           gtk_label_new(_
-                         ("Enabling an alternate dictionary makes switching\nwith the last used dictionary faster"));
-       gtk_widget_show(label1);
-       gtk_table_attach(GTK_TABLE(table), label1, 0, 3, 3, 4,
-                        (GtkAttachOptions) (GTK_FILL),
-                        (GtkAttachOptions) (0), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label1), 7.45058e-09, 0.5);
+       gtk_tooltips_set_tip (tooltips, checkbtn_use_alternate, 
+                       _("Faster switching with last used dictionary"), NULL);
 
        label2 = gtk_label_new(_("Dictionaries path:"));
        gtk_widget_show(label2);
@@ -361,15 +356,35 @@ SpellingPage *prefs_spelling;
 void prefs_spelling_init(void)
 {
        SpellingPage *page;
+       static gchar *path[3];
+
+       path[0] = _("Compose");
+       path[1] = _("Spell Checker");
+       path[2] = NULL;
 
        page = g_new0(SpellingPage, 1);
-       page->page.path = _("Compose/Spell Checker");
+       page->page.path = path;
        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;
+
        prefs_gtk_register_page((PrefsPage *) page);
        prefs_spelling = page;
+
+       if (!prefs_common.dictionary)
+               prefs_common.dictionary = g_strdup_printf("%s%s",
+                                               prefs_common.aspell_path,
+                                               g_getenv("LANG"));
+       if (!strlen(prefs_common.dictionary)
+       ||  !strcmp(prefs_common.dictionary,"(None"))
+               prefs_common.dictionary = g_strdup_printf("%s%s",
+                                               prefs_common.aspell_path,
+                                               g_getenv("LANG"));
+       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)