2008-09-16 [colin] 3.5.0cvs110
[claws.git] / src / prefs_folder_item.c
index fd502334d2ad000e659fc50fe9fdc879642f85f6..f4ef920e7d3d977598c0f2933040d7989708e8ac 100644 (file)
@@ -50,7 +50,7 @@
 #include "quote_fmt.h"
 #include "combobox.h"
 
-#if USE_ASPELL
+#if USE_ENCHANT
 #include "gtkaspell.h"
 #endif
 
@@ -122,7 +122,7 @@ struct _FolderItemComposePage
        GtkWidget *entry_default_reply_to;
        GtkWidget *checkbtn_enable_default_account;
        GtkWidget *optmenu_default_account;
-#if USE_ASPELL
+#if USE_ENCHANT
        GtkWidget *checkbtn_enable_default_dictionary;
        GtkWidget *checkbtn_enable_default_alt_dictionary;
        GtkWidget *combo_default_dictionary;
@@ -135,7 +135,7 @@ struct _FolderItemComposePage
        GtkWidget *default_to_rec_checkbtn;
        GtkWidget *default_reply_to_rec_checkbtn;
        GtkWidget *default_account_rec_checkbtn;
-#if USE_ASPELL
+#if USE_ENCHANT
        GtkWidget *default_dictionary_rec_checkbtn;
        GtkWidget *default_alt_dictionary_rec_checkbtn;
 #endif
@@ -234,9 +234,8 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        GtkWidget *enable_processing_when_opening_rec_checkbtn;
        GtkWidget *newmailcheck_rec_checkbtn;
        GtkWidget *offlinesync_rec_checkbtn;
-       GtkTooltips *tooltips;
+       CLAWS_TIP_DECL();
 
-       tooltips = gtk_tooltips_new();
        page->item         = item;
 
        /* Table */
@@ -368,7 +367,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        entry_regexp_test_result = gtk_entry_new();
        gtk_box_pack_end (GTK_BOX(hbox_regexp), entry_regexp_test_result, TRUE, TRUE, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, entry_regexp_test_result);
-       gtk_entry_set_editable(GTK_ENTRY(entry_regexp_test_result), FALSE);
+       gtk_editable_set_editable(GTK_EDITABLE(entry_regexp_test_result), FALSE);
 
        rowcount++;
 
@@ -411,8 +410,8 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        folder_color_btn = gtk_button_new_with_label("");
        gtk_widget_set_size_request(folder_color_btn, 36, 26);
        gtk_box_pack_start (GTK_BOX(hbox), folder_color_btn, FALSE, FALSE, 0);
-       gtk_tooltips_set_tip(tooltips, folder_color_btn,
-                            _("Pick color for folder"), NULL);
+       CLAWS_SET_TIP(folder_color_btn,
+                            _("Pick color for folder"));
 
        page->folder_color = item->prefs->color;
 
@@ -460,10 +459,10 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
 
        /* Check folder for new mail */
        checkbtn_newmailcheck = gtk_check_button_new_with_label(_("Scan for new mail"));
-       gtk_tooltips_set_tip(tooltips, checkbtn_newmailcheck,
+       CLAWS_SET_TIP(checkbtn_newmailcheck,
                             _("Turn this option on if mail is delivered directly "
                               "to this folder by server side filtering on IMAP or "
-                              "by an external application"), NULL);
+                              "by an external application"));
        gtk_table_attach(GTK_TABLE(table), checkbtn_newmailcheck, 0, 2,
                         rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
        
@@ -504,7 +503,7 @@ static void prefs_folder_item_general_create_widget_func(PrefsPage * page_,
        entry_offlinesync = gtk_entry_new();
        gtk_widget_set_size_request (entry_offlinesync, 64, -1);
        gtk_widget_show (entry_offlinesync);
-       gtk_tooltips_set_tip(tooltips, entry_offlinesync, _("0: all bodies"), NULL);
+       CLAWS_SET_TIP(entry_offlinesync, _("0: all bodies"));
        gtk_box_pack_start (GTK_BOX (hbox), entry_offlinesync, FALSE, FALSE, 0);
 
        label_end_offlinesync = gtk_label_new(_("days"));
@@ -745,7 +744,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        GtkWidget *optmenu_default_account = NULL;
        GtkListStore *optmenu_default_account_menu = NULL;
        GtkTreeIter iter;
-#if USE_ASPELL
+#if USE_ENCHANT
        GtkWidget *checkbtn_enable_default_dictionary = NULL;
        GtkWidget *combo_default_dictionary = NULL;
        GtkWidget *checkbtn_enable_default_alt_dictionary = NULL;
@@ -768,7 +767,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->item         = item;
 
        /* Table */
-#if USE_ASPELL
+#if USE_ENCHANT
 # define TABLEHEIGHT 7
 #else
 # define TABLEHEIGHT 6
@@ -921,7 +920,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
                         rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
        rowcount++;
 
-#if USE_ASPELL
+#if USE_ENCHANT
        /* Default dictionary */
        checkbtn_enable_default_dictionary = gtk_check_button_new_with_label(_("Default dictionary"));
        gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_dictionary, 0, 1,
@@ -929,12 +928,20 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_dictionary),
                                     item->prefs->enable_default_dictionary);
 
-       combo_default_dictionary = gtkaspell_dictionary_combo_new(
-                                               prefs_common.aspell_path, TRUE);
+       combo_default_dictionary = gtkaspell_dictionary_combo_new(TRUE);
        gtk_table_attach(GTK_TABLE(table), combo_default_dictionary, 1, 2,
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
 
        dictionary = item->prefs->default_dictionary;
+       if (dictionary && strrchr(dictionary, '/')) {
+               gchar *tmp = g_strdup(strrchr(dictionary, '/')+1);
+               g_free(item->prefs->default_dictionary);
+               item->prefs->default_dictionary = tmp;
+               dictionary = item->prefs->default_dictionary;
+       }
+       if (strchr(item->prefs->default_dictionary, '-')) {
+               *(strchr(item->prefs->default_dictionary, '-')) = '\0';
+       }
        if (dictionary)
                gtkaspell_set_dictionary_menu_active_item(
                        GTK_COMBO_BOX(combo_default_dictionary), dictionary);
@@ -954,12 +961,20 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_alt_dictionary),
                                     item->prefs->enable_default_alt_dictionary);
 
-       combo_default_alt_dictionary = gtkaspell_dictionary_combo_new(
-                                               prefs_common.aspell_path, FALSE);
+       combo_default_alt_dictionary = gtkaspell_dictionary_combo_new(FALSE);
        gtk_table_attach(GTK_TABLE(table), combo_default_alt_dictionary, 1, 2,
                         rowcount, rowcount + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
 
        dictionary = item->prefs->default_alt_dictionary;
+       if (dictionary && strrchr(dictionary, '/')) {
+               gchar *tmp = g_strdup(strrchr(dictionary, '/')+1);
+               g_free(item->prefs->default_alt_dictionary);
+               item->prefs->default_alt_dictionary = tmp;
+               dictionary = item->prefs->default_alt_dictionary;
+       }
+       if (strchr(item->prefs->default_alt_dictionary, '-')) {
+               *(strchr(item->prefs->default_alt_dictionary, '-')) = '\0';
+       }
        if (dictionary)
                gtkaspell_set_dictionary_menu_active_item(
                        GTK_COMBO_BOX(combo_default_alt_dictionary), dictionary);
@@ -986,7 +1001,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->entry_default_reply_to = entry_default_reply_to;
        page->checkbtn_enable_default_account = checkbtn_enable_default_account;
        page->optmenu_default_account = optmenu_default_account;
-#ifdef USE_ASPELL
+#ifdef USE_ENCHANT
        page->checkbtn_enable_default_dictionary = checkbtn_enable_default_dictionary;
        page->combo_default_dictionary = combo_default_dictionary;
        page->checkbtn_enable_default_alt_dictionary = checkbtn_enable_default_alt_dictionary;
@@ -998,7 +1013,7 @@ static void prefs_folder_item_compose_create_widget_func(PrefsPage * page_,
        page->default_to_rec_checkbtn             = default_to_rec_checkbtn;
        page->default_reply_to_rec_checkbtn       = default_reply_to_rec_checkbtn;
        page->default_account_rec_checkbtn        = default_account_rec_checkbtn;
-#if USE_ASPELL
+#if USE_ENCHANT
        page->default_dictionary_rec_checkbtn = default_dictionary_rec_checkbtn;
        page->default_alt_dictionary_rec_checkbtn = default_alt_dictionary_rec_checkbtn;
 #endif
@@ -1078,7 +1093,7 @@ static void compose_save_folder_prefs(FolderItem *folder, FolderItemComposePage
                                GTK_COMBO_BOX(page->optmenu_default_account));
        }
 
-#if USE_ASPELL
+#if USE_ENCHANT
        if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_dictionary_rec_checkbtn))) {
                prefs->enable_default_dictionary =
                        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_dictionary));
@@ -1116,7 +1131,7 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->save_copy_to_folder_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_to_rec_checkbtn)) ||
              gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) ||
-#if USE_ASPELL
+#if USE_ENCHANT
              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
@@ -1124,7 +1139,7 @@ static gboolean compose_save_recurse_func(GNode *node, gpointer data)
                return TRUE;
        else if ((node == page->item->node) && item_protocol(item) == A_NNTP &&
            !(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->default_account_rec_checkbtn)) 
-#if USE_ASPELL
+#if USE_ENCHANT
              || 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
@@ -1177,7 +1192,6 @@ static void prefs_folder_item_templates_create_widget_func(PrefsPage * page_,
        /* Notebook */
        notebook = gtk_notebook_new();
        gtk_widget_show(notebook);
-       gtk_notebook_set_homogeneous_tabs(GTK_NOTEBOOK(notebook), TRUE);
        gtk_box_pack_start(GTK_BOX(page_vbox), notebook, TRUE, TRUE, 0);
 
        /* compose format */