diff options
-rw-r--r-- | composer/ChangeLog | 7 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 70 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 143 |
3 files changed, 140 insertions, 80 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 72b39840ac..8ad37b0cb7 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,10 @@ +2002-01-31 Radek Doulik <rodo@ximian.com> + + * e-msg-composer.c (e_msg_composer_ignore): new method, tells + composer to ignore all word in str string + (next_word): helper function to get next word from s, saves rest + of s to sr + 2002-01-29 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (build_message): If we are in redirect mode, diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index c7499d9137..3dfd9962f8 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -48,6 +48,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <gal/unicode/gunicode.h> #include <libgnome/gnome-defs.h> #include <libgnomeui/gnome-app.h> #include <libgnomeui/gnome-uidefs.h> @@ -68,6 +69,7 @@ #include <gal/widgets/e-scroll-frame.h> #include <gal/e-text/e-entry.h> #include <gtkhtml/gtkhtml.h> +#include <gtkhtml/htmlselection.h> /*#include <addressbook/backend/ebook/e-card.h>*/ @@ -1413,7 +1415,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path) composer = E_MSG_COMPOSER (data); CORBA_exception_init (&ev); - GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Delete all but signature", "Undelete all", &ev); + GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Delete all but signature", "Undelete all", &ev); GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "disable-selection", &ev); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "text-default-color", &ev); @@ -1428,7 +1430,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path) e_msg_composer_show_sig_file (composer); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "style-normal", &ev); GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev); - GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev); + GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev); CORBA_exception_free (&ev); printf ("delete all\n"); @@ -1475,11 +1477,11 @@ menu_file_insert_file_cb (BonoboUIComponent *uic, CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-save", &ev); - GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Insert file", "Uninsert file", &ev); + GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Insert file", "Uninsert file", &ev); if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (composer->editor_engine, &ev)) GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "insert-paragraph", &ev); GNOME_GtkHTML_Editor_Engine_insertHTML (composer->editor_engine, html, &ev); - GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev); + GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-restore", &ev); GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev); CORBA_exception_free (&ev); @@ -3326,7 +3328,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) CORBA_exception_init (&ev); GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-save", &ev); - GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Set signature", "Reset signature", &ev); + GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Set signature", "Reset signature", &ev); delete_old_signature (composer); html = get_signature_html (composer); @@ -3339,7 +3341,7 @@ e_msg_composer_show_sig_file (EMsgComposer *composer) GNOME_GtkHTML_Editor_Engine_insertHTML (composer->editor_engine, html, &ev); g_free (html); } - GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev); + GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev); GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-restore", &ev); GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev); CORBA_exception_free (&ev); @@ -3856,5 +3858,59 @@ e_msg_composer_set_enable_autosave (EMsgComposer *composer, gboolean enabled) composer->enable_autosave = enabled; } +static gchar * +next_word (const gchar *s, const gchar **sr) +{ + if (!s || !*s) + return NULL; + else { + const gchar *begin; + gunichar uc; + gboolean cited; + + do { + begin = s; + cited = FALSE; + uc = g_utf8_get_char (s); + s = g_utf8_next_char (s); + } while (!html_selection_spell_word (uc, &cited) && !cited && s); + + /* we are at beginning of word */ + if (s && *s) { + gboolean cited_end; + + cited_end = FALSE; + uc = g_utf8_get_char (s); + + /* go to end of word */ + while (html_selection_spell_word (uc, &cited_end) || (!cited && cited_end)) { + cited_end = FALSE; + s = g_utf8_next_char (s); + if (!s) + break; + uc = g_utf8_get_char (s); + } + *sr = s; + return s ? g_strndup (begin, s - begin) : g_strdup (begin); + } else + return NULL; + } +} + +void +e_msg_composer_ignore (EMsgComposer *composer, const gchar *str) +{ + CORBA_Environment ev; + gchar *word; + + if (!str) + return; - + CORBA_exception_init (&ev); + while ((word = next_word (str, &str))) { + /* printf ("ignore word %s\n", word); */ + GNOME_GtkHTML_Editor_Engine_ignoreWord (composer->editor_engine, word, &ev); + g_free (word); + } + CORBA_exception_free (&ev); +} diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index e9c07c3ce2..4e8cfd1288 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -110,86 +110,83 @@ struct _EMsgComposerClass { }; -GtkType e_msg_composer_get_type (void); -EMsgComposer *e_msg_composer_new (void); -EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg); -EMsgComposer *e_msg_composer_new_from_url (const char *url); -EMsgComposer *e_msg_composer_new_redirect (CamelMimeMessage *message, - const char *resent_from); - -void e_msg_composer_show_attachments (EMsgComposer *composer, - gboolean show); -void e_msg_composer_set_headers (EMsgComposer *composer, - const char *from, - EDestination **to, - EDestination **cc, - EDestination **bcc, - const char *subject); -void e_msg_composer_set_body_text (EMsgComposer *composer, - const char *text); -void e_msg_composer_add_header (EMsgComposer *composer, - const char *name, - const char *value); -void e_msg_composer_attach (EMsgComposer *composer, - CamelMimePart *attachment); -CamelMimePart *e_msg_composer_add_inline_image_from_file (EMsgComposer *composer, - const char *filename); -void e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer, - CamelMimePart *part); -CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer); -CamelMimeMessage *e_msg_composer_get_message_draft (EMsgComposer *composer); -void e_msg_composer_show_sig_file (EMsgComposer *composer); -gboolean e_msg_composer_get_send_html (EMsgComposer *composer); -void e_msg_composer_set_send_html (EMsgComposer *composer, - gboolean send_html); -gboolean e_msg_composer_get_view_from (EMsgComposer *composer); -void e_msg_composer_set_view_from (EMsgComposer *composer, - gboolean view_from); - -gboolean e_msg_composer_get_view_replyto (EMsgComposer *composer); -void e_msg_composer_set_view_replyto (EMsgComposer *composer, - gboolean view_replyto); - -gboolean e_msg_composer_get_view_bcc (EMsgComposer *composer); -void e_msg_composer_set_view_bcc (EMsgComposer *composer, - gboolean view_bcc); -gboolean e_msg_composer_get_view_cc (EMsgComposer *composer); -void e_msg_composer_set_view_cc (EMsgComposer *composer, - gboolean view_cc); +GtkType e_msg_composer_get_type (void); +EMsgComposer *e_msg_composer_new (void); +EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg); +EMsgComposer *e_msg_composer_new_from_url (const char *url); +EMsgComposer *e_msg_composer_new_redirect (CamelMimeMessage *message, + const char *resent_from); +void e_msg_composer_show_attachments (EMsgComposer *composer, + gboolean show); +void e_msg_composer_set_headers (EMsgComposer *composer, + const char *from, + EDestination **to, + EDestination **cc, + EDestination **bcc, + const char *subject); +void e_msg_composer_set_body_text (EMsgComposer *composer, + const char *text); +void e_msg_composer_add_header (EMsgComposer *composer, + const char *name, + const char *value); +void e_msg_composer_attach (EMsgComposer *composer, + CamelMimePart *attachment); +CamelMimePart *e_msg_composer_add_inline_image_from_file (EMsgComposer *composer, + const char *filename); +void e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer, + CamelMimePart *part); +CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer); +CamelMimeMessage *e_msg_composer_get_message_draft (EMsgComposer *composer); +void e_msg_composer_show_sig_file (EMsgComposer *composer); +gboolean e_msg_composer_get_send_html (EMsgComposer *composer); +void e_msg_composer_set_send_html (EMsgComposer *composer, + gboolean send_html); +gboolean e_msg_composer_get_view_from (EMsgComposer *composer); +void e_msg_composer_set_view_from (EMsgComposer *composer, + gboolean view_from); +gboolean e_msg_composer_get_view_replyto (EMsgComposer *composer); +void e_msg_composer_set_view_replyto (EMsgComposer *composer, + gboolean view_replyto); +gboolean e_msg_composer_get_view_bcc (EMsgComposer *composer); +void e_msg_composer_set_view_bcc (EMsgComposer *composer, + gboolean view_bcc); +gboolean e_msg_composer_get_view_cc (EMsgComposer *composer); +void e_msg_composer_set_view_cc (EMsgComposer *composer, + gboolean view_cc); EDestination **e_msg_composer_get_recipients (EMsgComposer *composer); -const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer); - -void e_msg_composer_clear_inlined_table (EMsgComposer *composer); -gchar * e_msg_composer_guess_mime_type (const gchar *file_name); - -void e_msg_composer_set_changed (EMsgComposer *composer); -void e_msg_composer_unset_changed (EMsgComposer *composer); -gboolean e_msg_composer_is_dirty (EMsgComposer *composer); -void e_msg_composer_set_enable_autosave (EMsgComposer *composer, gboolean enabled); +const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer); +void e_msg_composer_clear_inlined_table (EMsgComposer *composer); +gchar *e_msg_composer_guess_mime_type (const gchar *file_name); +void e_msg_composer_set_changed (EMsgComposer *composer); +void e_msg_composer_unset_changed (EMsgComposer *composer); +gboolean e_msg_composer_is_dirty (EMsgComposer *composer); +void e_msg_composer_set_enable_autosave (EMsgComposer *composer, + gboolean enabled); /* PGP */ -void e_msg_composer_set_pgp_sign (EMsgComposer *composer, - gboolean pgp_sign); -gboolean e_msg_composer_get_pgp_sign (EMsgComposer *composer); -void e_msg_composer_set_pgp_encrypt (EMsgComposer *composer, - gboolean pgp_encrypt); -gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *composer); +void e_msg_composer_set_pgp_sign (EMsgComposer *composer, + gboolean pgp_sign); +gboolean e_msg_composer_get_pgp_sign (EMsgComposer *composer); +void e_msg_composer_set_pgp_encrypt (EMsgComposer *composer, + gboolean pgp_encrypt); +gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *composer); /* S/MIME */ -void e_msg_composer_set_smime_sign (EMsgComposer *composer, - gboolean smime_sign); -gboolean e_msg_composer_get_smime_sign (EMsgComposer *composer); -void e_msg_composer_set_smime_encrypt (EMsgComposer *composer, - gboolean smime_encrypt); -gboolean e_msg_composer_get_smime_encrypt (EMsgComposer *composer); -gchar * e_msg_composer_get_sig_file_content (const char *sigfile, - gboolean in_html); - -void e_msg_composer_add_message_attachments (EMsgComposer *composer, - CamelMimeMessage *message, - gboolean just_inlines); +void e_msg_composer_set_smime_sign (EMsgComposer *composer, + gboolean smime_sign); +gboolean e_msg_composer_get_smime_sign (EMsgComposer *composer); +void e_msg_composer_set_smime_encrypt (EMsgComposer *composer, + gboolean smime_encrypt); +gboolean e_msg_composer_get_smime_encrypt (EMsgComposer *composer); +gchar *e_msg_composer_get_sig_file_content (const char *sigfile, + gboolean in_html); +void e_msg_composer_add_message_attachments (EMsgComposer *composer, + CamelMimeMessage *message, + gboolean just_inlines); +void e_msg_composer_ignore (EMsgComposer *composer, + const gchar *str); #ifdef __cplusplus } |