sync with sylpheed 0.7.0cvs24
[claws.git] / src / compose.c
index 0a8fc298ee7d649591c9ff9a5958d7008ba81e0e..946ef3b15eb41e4189985d39e9c607bc1f03f355 100644 (file)
@@ -451,12 +451,16 @@ void compose_headerentry_key_press_event_cb(GtkWidget            *entry,
 static void compose_show_first_last_header (Compose *compose, gboolean show_first);
 
 
-static void compose_check_backwards(Compose *compose);
+#if USE_PSPELL
+static void compose_check_all             (Compose *compose);
+static void compose_check_backwards       (Compose *compose);
 
-static void compose_check_forwards_go(Compose *compose);
+static void compose_check_forwards_go     (Compose *compose);
+#endif
 
-static void text_activated             (GtkWidget      *widget,
-                                        Compose        *compose);
+static gboolean compose_send_control_enter (Compose *compose);
+static void text_activated                (GtkWidget   *widget,
+                                           Compose     *compose);
 
 
 static GtkItemFactoryEntry compose_popup_entries[] =
@@ -556,17 +560,20 @@ static GtkItemFactoryEntry compose_entries[] =
                                        COMPOSE_CALL_GTK_STEXT_DELETE_TO_LINE_END,
                                        NULL},
        {N_("/_Edit/---"),              NULL, NULL, 0, "<Separator>"},
-#if USE_PSPELL
-       {N_("/_Edit/Check backwards misspelled word"),  "<control>;", compose_check_backwards , 0, NULL},
-       {N_("/_Edit/Forward to next misspelled word"),  "<control>!", compose_check_forwards_go, 0, NULL},
-       {N_("/_Edit/---"),              NULL, NULL, 0, "<Separator>"},
-#endif
        {N_("/_Edit/_Wrap current paragraph"),
                                        "<control>L", compose_wrap_line, 0, NULL},
        {N_("/_Edit/Wrap all long _lines"),
                                        "<control><alt>L", compose_wrap_line_all, 0, NULL},
        {N_("/_Edit/Edit with e_xternal editor"),
                                        "<control>X", compose_ext_editor_cb, 0, NULL},
+#if USE_PSPELL
+       {N_("/_Spelling"),              NULL, NULL, 0, "<Branch>"},
+       {N_("/_Spelling/Check all or selection"),NULL, compose_check_all, 0, NULL},
+       {N_("/_Spelling/Check backwards misspelled word"),      NULL, compose_check_backwards , 0, NULL},
+       {N_("/_Spelling/Forward to next misspelled word"),      NULL, compose_check_forwards_go, 0, NULL},
+       {N_("/_Spelling/---"),          NULL, NULL, 0, "<Separator>"},
+       {N_("/_Spelling/Spelling Configuration"),NULL, NULL, 0, "<Branch>"},
+#endif
 #if 0 /* NEW COMPOSE GUI */
        {N_("/_View"),                  NULL, NULL, 0, "<Branch>"},
        {N_("/_View/_To"),              NULL, compose_toggle_to_cb     , 0, "<ToggleItem>"},
@@ -1922,12 +1929,11 @@ static void compose_insert_sig(Compose *compose)
 
        if (compose->account && compose->account->sig_path)
                sigfile = g_strdup(compose->account->sig_path);
-       else {
+       else
                sigfile = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
                                      DEFAULT_SIGNATURE, NULL);
-       }
 
-       if (!is_file_or_fifo_exist(sigfile) & (sigfile[0] != '|')) {
+       if (!is_file_or_fifo_exist(sigfile) && sigfile[0] != '|') {
                g_free(sigfile);
                return;
        }
@@ -1941,13 +1947,9 @@ static void compose_insert_sig(Compose *compose)
        }
 
        if (sigfile[0] == '|')
-       {
                compose_exec_sig(compose, sigfile);
-       }
        else
-       {
                compose_insert_file(compose, sigfile);
-       }
        g_free(sigfile);
 }
 
@@ -2344,7 +2346,7 @@ static void compose_wrap_line_all(Compose *compose)
        gint ch_len;
        gboolean is_new_line = TRUE, do_delete = FALSE;
        guint qlen = 0, i_len = 0;
-       guint linewrap_quote = prefs_common.linewrap_quote;
+       gboolean linewrap_quote = TRUE;
        guint linewrap_len = prefs_common.linewrap_len;
        gchar *qfmt = prefs_common.quotemark;
        gchar cbuf[MB_LEN_MAX];
@@ -4650,20 +4652,24 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        compose->bounce_filename = NULL;
        compose->undostruct = undostruct;
 #if USE_PSPELL
-       menu_set_sensitive(ifactory, "/Edit/Check backwards misspelled word", FALSE);
-       menu_set_sensitive(ifactory, "/Edit/Forward to next misspelled word", FALSE);
+       
+       menu_set_sensitive(ifactory, "/Spelling", FALSE);
         if (prefs_common.enable_pspell) {
                gtkpspell = gtkpspell_new((const gchar*)prefs_common.dictionary,
                                          conv_get_current_charset_str(),
+                                         prefs_common.check_while_typing,
                                          GTK_STEXT(text));
                if (!gtkpspell) {
                        alertpanel_error(_("Spell checker could not be started.\n%s"), gtkpspellcheckers->error_message);
                        gtkpspell_checkers_reset();
                } else {
 
+                       GtkWidget *menuitem;
+
                        gtkpspell_set_sug_mode(gtkpspell, prefs_common.pspell_sugmode);
-                       menu_set_sensitive(ifactory, "/Edit/Check backwards misspelled word", TRUE);
-                       menu_set_sensitive(ifactory, "/Edit/Forward to next misspelled word", TRUE);
+                       menuitem = gtk_item_factory_get_item(ifactory, "/Spelling/Spelling Configuration");
+                       gtkpspell_populate_submenu(gtkpspell, menuitem);
+                       menu_set_sensitive(ifactory, "/Spelling", TRUE);
                        }
         }
 #endif
@@ -6635,6 +6641,12 @@ static gboolean compose_send_control_enter(Compose *compose)
 }
 
 #if USE_PSPELL
+static void compose_check_all(Compose *compose)
+{
+       if (compose->gtkpspell)
+               gtkpspell_check_all(compose->gtkpspell);
+}
+
 static void compose_check_backwards(Compose *compose)
 {
        if (compose->gtkpspell)