ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, N_("Turkish (ISO-8859-_9)")), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO compose_set_encoding_cb */
+ ENC_ACTION("Cyrillic/"CS_MACCYR, C_MACCYR, "_Mac-Cyrillic"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO compose_set_encoding_cb */
ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO compose_set_encoding_cb */
struct stat file_stat;
int ret;
GString *file_contents = NULL;
+ ComposeInsertResult result = COMPOSE_INSERT_SUCCESS;
cm_return_val_if_fail(file != NULL, COMPOSE_INSERT_NO_FILE);
if (g_utf8_validate(buf, -1, NULL) == TRUE)
str = g_strdup(buf);
- else
+ else {
+ codeconv_set_strict(TRUE);
str = conv_codeset_strdup
(buf, cur_encoding, CS_INTERNAL);
+ codeconv_set_strict(FALSE);
+
+ if (!str) {
+ result = COMPOSE_INSERT_INVALID_CHARACTER;
+ break;
+ }
+ }
if (!str) continue;
/* strip <CR> if DOS/Windows file,
g_free(str);
}
- gtk_text_buffer_insert(buffer, &iter, file_contents->str, -1);
- g_string_free(file_contents, TRUE);
+ if (result == COMPOSE_INSERT_SUCCESS) {
+ gtk_text_buffer_insert(buffer, &iter, file_contents->str, -1);
- compose_changed_cb(NULL, compose);
- g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
- G_CALLBACK(text_inserted),
- compose);
- compose->autowrap = prev_autowrap;
- if (compose->autowrap)
- compose_wrap_all(compose);
+ compose_changed_cb(NULL, compose);
+ g_signal_handlers_unblock_by_func(G_OBJECT(buffer),
+ G_CALLBACK(text_inserted),
+ compose);
+ compose->autowrap = prev_autowrap;
+ if (compose->autowrap)
+ compose_wrap_all(compose);
+ }
+ g_string_free(file_contents, TRUE);
fclose(fp);
- return COMPOSE_INSERT_SUCCESS;
+ return result;
}
static gboolean compose_attach_append(Compose *compose, const gchar *file,
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Cyrillic", "Options/Encoding/Cyrillic", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_ISO_8859_5, "Options/Encoding/Cyrillic/"CS_ISO_8859_5, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_KOI8_R, "Options/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_MACCYR, "Options/Encoding/Cyrillic/"CS_MACCYR, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_KOI8_U, "Options/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_WINDOWS_1251, "Options/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM)
case C_WINDOWS_1256: branch = "Menu/Options/Encoding/Arabic/" CS_WINDOWS_1256; break;
case C_ISO_8859_5: branch = "Menu/Options/Encoding/Cyrillic/" CS_ISO_8859_5; break;
case C_KOI8_R: branch = "Menu/Options/Encoding/Cyrillic/" CS_KOI8_R; break;
+ case C_MACCYR: branch = "Menu/Options/Encoding/Cyrillic/" CS_MACCYR; break;
case C_KOI8_U: branch = "Menu/Options/Encoding/Cyrillic/" CS_KOI8_U; break;
case C_WINDOWS_1251: branch = "Menu/Options/Encoding/Cyrillic/" CS_WINDOWS_1251; break;
case C_ISO_2022_JP: branch = "Menu/Options/Encoding/Japanese/" CS_ISO_2022_JP; break;
if (buf[0] == '0') { /* success */
GtkTextView *text = GTK_TEXT_VIEW(compose->text);
GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
+ GtkTextIter start, end;
+ gchar *chars;
gtk_text_buffer_set_text(buffer, "", -1);
compose_insert_file(compose, compose->exteditor_file);
if (claws_unlink(compose->exteditor_file) < 0)
FILE_OP_ERROR(compose->exteditor_file, "unlink");
+
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
+ gtk_text_buffer_get_start_iter(buffer, &start);
+ gtk_text_buffer_get_end_iter(buffer, &end);
+ chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+ if (chars && strlen(chars) > 0)
+ compose->modified = TRUE;
+ g_free(chars);
} else if (buf[0] == '1') { /* failed */
g_warning("Couldn't exec external editor\n");
if (claws_unlink(compose->exteditor_file) < 0)