diff options
Diffstat (limited to 'plugins/spell')
-rw-r--r-- | plugins/spell/pluma-automatic-spell-checker.c | 320 | ||||
-rw-r--r-- | plugins/spell/pluma-automatic-spell-checker.h | 14 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-checker-dialog.c | 166 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-checker-dialog.h | 32 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-checker-language.c | 64 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-checker-language.h | 14 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-language-dialog.c | 36 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-language-dialog.h | 16 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-plugin.c | 70 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-plugin.h | 4 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-utils.c | 2 | ||||
-rw-r--r-- | plugins/spell/pluma-spell-utils.h | 2 |
12 files changed, 370 insertions, 370 deletions
diff --git a/plugins/spell/pluma-automatic-spell-checker.c b/plugins/spell/pluma-automatic-spell-checker.c index 0bf16147..5b53e110 100644 --- a/plugins/spell/pluma-automatic-spell-checker.c +++ b/plugins/spell/pluma-automatic-spell-checker.c @@ -3,7 +3,7 @@ * pluma-automatic-spell-checker.c * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ /* This is a modified version of gtkspell 2.0.5 (gtkspell.sf.net) */ @@ -46,7 +46,7 @@ struct _PlumaAutomaticSpellChecker { PlumaDocument *doc; GSList *views; - + GtkTextMark *mark_insert_start; GtkTextMark *mark_insert_end; gboolean deferred_check; @@ -69,7 +69,7 @@ view_destroy (PlumaView *view, PlumaAutomaticSpellChecker *spell) } static void -check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end) +check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end) { gchar *word; @@ -80,34 +80,34 @@ check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter * gtk_text_iter_get_offset (end)); */ - if (!pluma_spell_checker_check_word (spell->spell_checker, word, -1)) + if (!pluma_spell_checker_check_word (spell->spell_checker, word, -1)) { /* g_print ("Apply tag: [%d - %d]\n", gtk_text_iter_get_offset (start), gtk_text_iter_get_offset (end)); */ - gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), - spell->tag_highlight, - start, + gtk_text_buffer_apply_tag (GTK_TEXT_BUFFER (spell->doc), + spell->tag_highlight, + start, end); } - + g_free (word); } static void -check_range (PlumaAutomaticSpellChecker *spell, - GtkTextIter start, +check_range (PlumaAutomaticSpellChecker *spell, + GtkTextIter start, GtkTextIter end, - gboolean force_all) + gboolean force_all) { /* we need to "split" on word boundaries. - * luckily, Pango knows what "words" are + * luckily, Pango knows what "words" are * so we don't have to figure it out. */ GtkTextIter wstart; GtkTextIter wend; - GtkTextIter cursor; + GtkTextIter cursor; GtkTextIter precursor; gboolean highlight; @@ -118,65 +118,65 @@ check_range (PlumaAutomaticSpellChecker *spell, if (gtk_text_iter_inside_word (&end)) gtk_text_iter_forward_word_end (&end); - - if (!gtk_text_iter_starts_word (&start)) + + if (!gtk_text_iter_starts_word (&start)) { - if (gtk_text_iter_inside_word (&start) || - gtk_text_iter_ends_word (&start)) + if (gtk_text_iter_inside_word (&start) || + gtk_text_iter_ends_word (&start)) { gtk_text_iter_backward_word_start (&start); - } - else + } + else { /* if we're neither at the beginning nor inside a word, * me must be in some spaces. * skip forward to the beginning of the next word. */ - + if (gtk_text_iter_forward_word_end (&start)) gtk_text_iter_backward_word_start (&start); } } - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), &cursor, gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (spell->doc))); - + precursor = cursor; gtk_text_iter_backward_char (&precursor); - + highlight = gtk_text_iter_has_tag (&cursor, spell->tag_highlight) || gtk_text_iter_has_tag (&precursor, spell->tag_highlight); - - gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), - spell->tag_highlight, - &start, + + gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), + spell->tag_highlight, + &start, &end); /* Fix a corner case when replacement occurs at beginning of buffer: * An iter at offset 0 seems to always be inside a word, * even if it's not. Possibly a pango bug. */ - if (gtk_text_iter_get_offset (&start) == 0) + if (gtk_text_iter_get_offset (&start) == 0) { gtk_text_iter_forward_word_end(&start); gtk_text_iter_backward_word_start(&start); } wstart = start; - + while (pluma_spell_utils_skip_no_spell_check (&wstart, &end) && - gtk_text_iter_compare (&wstart, &end) < 0) + gtk_text_iter_compare (&wstart, &end) < 0) { - gboolean inword; + gboolean inword; /* move wend to the end of the current word. */ wend = wstart; - + gtk_text_iter_forward_word_end (&wend); inword = (gtk_text_iter_compare (&wstart, &cursor) < 0) && (gtk_text_iter_compare (&cursor, &wend) <= 0); - + if (inword && !force_all) { /* this word is being actively edited, @@ -186,8 +186,8 @@ check_range (PlumaAutomaticSpellChecker *spell, check_word (spell, &wstart, &wend); else spell->deferred_check = TRUE; - } - else + } + else { check_word (spell, &wstart, &wend); spell->deferred_check = FALSE; @@ -196,7 +196,7 @@ check_range (PlumaAutomaticSpellChecker *spell, /* now move wend to the beginning of the next word, */ gtk_text_iter_forward_word_end (&wend); gtk_text_iter_backward_word_start (&wend); - + /* make sure we've actually advanced * (we don't advance in some corner cases), */ if (gtk_text_iter_equal (&wstart, &wend)) @@ -208,16 +208,16 @@ check_range (PlumaAutomaticSpellChecker *spell, } static void -check_deferred_range (PlumaAutomaticSpellChecker *spell, - gboolean force_all) +check_deferred_range (PlumaAutomaticSpellChecker *spell, + gboolean force_all) { GtkTextIter start, end; - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), - &start, + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), + &start, spell->mark_insert_start); gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (spell->doc), - &end, + &end, spell->mark_insert_end); check_range (spell, start, end, force_all); @@ -232,20 +232,20 @@ check_deferred_range (PlumaAutomaticSpellChecker *spell, static void insert_text_before (GtkTextBuffer *buffer, GtkTextIter *iter, - gchar *text, gint len, PlumaAutomaticSpellChecker *spell) + gchar *text, gint len, PlumaAutomaticSpellChecker *spell) { gtk_text_buffer_move_mark (buffer, spell->mark_insert_start, iter); } static void insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter, - gchar *text, gint len, PlumaAutomaticSpellChecker *spell) + gchar *text, gint len, PlumaAutomaticSpellChecker *spell) { GtkTextIter start; /* we need to check a range of text. */ gtk_text_buffer_get_iter_at_mark (buffer, &start, spell->mark_insert_start); - + check_range (spell, start, *iter, FALSE); gtk_text_buffer_move_mark (buffer, spell->mark_insert_end, iter); @@ -259,17 +259,17 @@ insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter, */ static void -delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, - PlumaAutomaticSpellChecker *spell) +delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end, + PlumaAutomaticSpellChecker *spell) { check_range (spell, *start, *end, FALSE); } static void -mark_set (GtkTextBuffer *buffer, +mark_set (GtkTextBuffer *buffer, GtkTextIter *iter, - GtkTextMark *mark, - PlumaAutomaticSpellChecker *spell) + GtkTextMark *mark, + PlumaAutomaticSpellChecker *spell) { /* if the cursor has moved and there is a deferred check so handle it now */ if ((mark == gtk_text_buffer_get_insert (buffer)) && spell->deferred_check) @@ -277,18 +277,18 @@ mark_set (GtkTextBuffer *buffer, } static void -get_word_extents_from_mark (GtkTextBuffer *buffer, - GtkTextIter *start, +get_word_extents_from_mark (GtkTextBuffer *buffer, + GtkTextIter *start, GtkTextIter *end, GtkTextMark *mark) { gtk_text_buffer_get_iter_at_mark(buffer, start, mark); - - if (!gtk_text_iter_starts_word (start)) + + if (!gtk_text_iter_starts_word (start)) gtk_text_iter_backward_word_start (start); - + *end = *start; - + if (gtk_text_iter_inside_word (end)) gtk_text_iter_forward_word_end (end); } @@ -302,17 +302,17 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word) gboolean found; gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (spell->doc), &iter, 0); - + found = TRUE; while (found) { - found = gtk_text_iter_forward_search (&iter, - word, + found = gtk_text_iter_forward_search (&iter, + word, GTK_TEXT_SEARCH_VISIBLE_ONLY | GTK_TEXT_SEARCH_TEXT_ONLY, - &match_start, + &match_start, &match_end, - NULL); + NULL); if (found) { @@ -321,7 +321,7 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word) { gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), spell->tag_highlight, - &match_start, + &match_start, &match_end); } @@ -331,55 +331,55 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word) } static void -add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) +add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) { gchar *word; - + GtkTextIter start, end; - - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); - word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), - &start, - &end, + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + + word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), + &start, + &end, FALSE); - + pluma_spell_checker_add_word_to_personal (spell->spell_checker, word, -1); g_free (word); } static void -ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) +ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) { gchar *word; - + GtkTextIter start, end; - - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); - word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), - &start, - &end, + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + + word = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), + &start, + &end, FALSE); - + pluma_spell_checker_add_word_to_session (spell->spell_checker, word, -1); g_free (word); } static void -replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) +replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) { gchar *oldword; const gchar *newword; - + GtkTextIter start, end; - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); oldword = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (spell->doc), &start, &end, FALSE); - + newword = g_object_get_qdata (G_OBJECT (menuitem), suggestion_id); g_return_if_fail (newword != NULL); @@ -390,7 +390,7 @@ replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (spell->doc)); - pluma_spell_checker_set_correction (spell->spell_checker, + pluma_spell_checker_set_correction (spell->spell_checker, oldword, strlen (oldword), newword, strlen (newword)); @@ -398,49 +398,49 @@ replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell) } static GtkWidget * -build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) +build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) { GtkWidget *topmenu, *menu; GtkWidget *mi; GSList *suggestions; GSList *list; gchar *label_text; - + topmenu = menu = gtk_menu_new(); suggestions = pluma_spell_checker_get_suggestions (spell->spell_checker, word, -1); list = suggestions; - if (suggestions == NULL) - { + if (suggestions == NULL) + { /* no suggestions. put something in the menu anyway... */ GtkWidget *label; /* Translators: Displayed in the "Check Spelling" dialog if there are no suggestions for the current misspelled word */ label = gtk_label_new (_("(no suggested words)")); - + mi = gtk_menu_item_new (); gtk_widget_set_sensitive (mi, FALSE); gtk_container_add (GTK_CONTAINER(mi), label); gtk_widget_show_all (mi); gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), mi); - } - else + } + else { gint count = 0; - + /* build a set of menus with suggestions. */ - while (suggestions != NULL) + while (suggestions != NULL) { GtkWidget *label; - if (count == 10) + if (count == 10) { /* Separator */ mi = gtk_menu_item_new (); gtk_widget_show (mi); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - + mi = gtk_menu_item_new_with_mnemonic (_("_More...")); gtk_widget_show (mi); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); @@ -449,22 +449,22 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), menu); count = 0; } - + label_text = g_strdup_printf ("<b>%s</b>", (gchar*) suggestions->data); - + label = gtk_label_new (label_text); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); gtk_label_set_xalign (GTK_LABEL (label), 0.0); mi = gtk_menu_item_new (); gtk_container_add (GTK_CONTAINER(mi), label); - + gtk_widget_show_all (mi); gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi); - g_object_set_qdata_full (G_OBJECT (mi), - suggestion_id, - g_strdup (suggestions->data), + g_object_set_qdata_full (G_OBJECT (mi), + suggestion_id, + g_strdup (suggestions->data), (GDestroyNotify)g_free); g_free (label_text); @@ -498,9 +498,9 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) /* Ignore all */ mi = gtk_image_menu_item_new_with_mnemonic (_("_Ignore All")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), - gtk_image_new_from_icon_name ("go-bottom", + gtk_image_new_from_icon_name ("go-bottom", GTK_ICON_SIZE_MENU)); - + g_signal_connect (mi, "activate", G_CALLBACK(ignore_all), @@ -513,7 +513,7 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) /* + Add to Dictionary */ mi = gtk_image_menu_item_new_with_mnemonic (_("_Add")); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (mi), - gtk_image_new_from_icon_name ("list-add", + gtk_image_new_from_icon_name ("list-add", GTK_ICON_SIZE_MENU)); g_signal_connect (mi, @@ -522,23 +522,23 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word) spell); gtk_widget_show_all (mi); - + gtk_menu_shell_append (GTK_MENU_SHELL (topmenu), mi); return topmenu; } static void -populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker *spell) +populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker *spell) { GtkWidget *img, *mi; GtkTextIter start, end; char *word; /* we need to figure out if they picked a misspelled word. */ - get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); + get_word_extents_from_mark (GTK_TEXT_BUFFER (spell->doc), &start, &end, spell->mark_click); - /* if our highlight algorithm ever messes up, + /* if our highlight algorithm ever messes up, * this isn't correct, either. */ if (!gtk_text_iter_has_tag (&start, spell->tag_highlight)) return; /* word wasn't misspelled. */ @@ -574,9 +574,9 @@ pluma_automatic_spell_checker_recheck_all (PlumaAutomaticSpellChecker *spell) check_range (spell, start, end, TRUE); } -static void -add_word_signal_cb (PlumaSpellChecker *checker, - const gchar *word, +static void +add_word_signal_cb (PlumaSpellChecker *checker, + const gchar *word, gint len, PlumaAutomaticSpellChecker *spell) { @@ -592,7 +592,7 @@ add_word_signal_cb (PlumaSpellChecker *checker, g_free (w); } -static void +static void set_language_cb (PlumaSpellChecker *checker, const PlumaSpellCheckerLanguage *lang, PlumaAutomaticSpellChecker *spell) @@ -600,7 +600,7 @@ set_language_cb (PlumaSpellChecker *checker, pluma_automatic_spell_checker_recheck_all (spell); } -static void +static void clear_session_cb (PlumaSpellChecker *checker, PlumaAutomaticSpellChecker *spell) { @@ -609,14 +609,14 @@ clear_session_cb (PlumaSpellChecker *checker, /* When the user right-clicks on a word, they want to check that word. * Here, we do NOT move the cursor to the location of the clicked-upon word - * since that prevents the use of edit functions on the context menu. + * since that prevents the use of edit functions on the context menu. */ static gboolean button_press_event (GtkTextView *view, GdkEventButton *event, - PlumaAutomaticSpellChecker *spell) + PlumaAutomaticSpellChecker *spell) { - if (event->button == 3) + if (event->button == 3) { gint x, y; GtkTextIter iter; @@ -627,11 +627,11 @@ button_press_event (GtkTextView *view, if (spell->deferred_check) check_deferred_range (spell, TRUE); - gtk_text_view_window_to_buffer_coords (view, - GTK_TEXT_WINDOW_TEXT, + gtk_text_view_window_to_buffer_coords (view, + GTK_TEXT_WINDOW_TEXT, event->x, event->y, &x, &y); - + gtk_text_view_get_iter_at_location (view, &iter, x, y); gtk_text_buffer_move_mark (buffer, spell->mark_click, &iter); @@ -645,7 +645,7 @@ button_press_event (GtkTextView *view, * will contain the wrong set of suggestions. */ static gboolean -popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell) +popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell) { GtkTextIter iter; GtkTextBuffer *buffer; @@ -673,7 +673,7 @@ tag_table_changed (GtkTextTagTable *table, gtk_text_tag_table_get_size (table) - 1); } -static void +static void tag_added_or_removed (GtkTextTagTable *table, GtkTextTag *tag, PlumaAutomaticSpellChecker *spell) @@ -681,7 +681,7 @@ tag_added_or_removed (GtkTextTagTable *table, tag_table_changed (table, spell); } -static void +static void tag_changed (GtkTextTagTable *table, GtkTextTag *tag, gboolean size_changed, @@ -718,7 +718,7 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (checker), NULL); g_return_val_if_fail ((spell = pluma_automatic_spell_checker_get_from_document (doc)) == NULL, spell); - + /* attach to the widget */ spell = g_new0 (PlumaAutomaticSpellChecker, 1); @@ -727,7 +727,7 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, if (automatic_spell_checker_id == 0) { - automatic_spell_checker_id = + automatic_spell_checker_id = g_quark_from_string ("PlumaAutomaticSpellCheckerID"); } if (suggestion_id == 0) @@ -735,26 +735,26 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, suggestion_id = g_quark_from_string ("PlumaAutoSuggestionID"); } - g_object_set_qdata_full (G_OBJECT (doc), - automatic_spell_checker_id, - spell, + g_object_set_qdata_full (G_OBJECT (doc), + automatic_spell_checker_id, + spell, (GDestroyNotify)pluma_automatic_spell_checker_free_internal); g_signal_connect (doc, "insert-text", - G_CALLBACK (insert_text_before), + G_CALLBACK (insert_text_before), spell); g_signal_connect_after (doc, "insert-text", - G_CALLBACK (insert_text_after), + G_CALLBACK (insert_text_after), spell); g_signal_connect_after (doc, "delete-range", - G_CALLBACK (delete_range_after), + G_CALLBACK (delete_range_after), spell); g_signal_connect (doc, "mark-set", - G_CALLBACK (mark_set), + G_CALLBACK (mark_set), spell); g_signal_connect (doc, @@ -791,7 +791,7 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (doc)); - gtk_text_tag_set_priority (spell->tag_highlight, + gtk_text_tag_set_priority (spell->tag_highlight, gtk_text_tag_table_get_size (tag_table) - 1); g_signal_connect (tag_table, @@ -810,16 +810,16 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, /* we create the mark here, but we don't use it until text is * inserted, so we don't really care where iter points. */ gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &start, &end); - + spell->mark_insert_start = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-insert-start"); if (spell->mark_insert_start == NULL) { - spell->mark_insert_start = + spell->mark_insert_start = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-insert-start", - &start, + &start, TRUE); } else @@ -834,10 +834,10 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, if (spell->mark_insert_end == NULL) { - spell->mark_insert_end = + spell->mark_insert_end = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-insert-end", - &start, + &start, TRUE); } else @@ -852,10 +852,10 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc, if (spell->mark_click == NULL) { - spell->mark_click = + spell->mark_click = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "pluma-automatic-spell-checker-click", - &start, + &start, TRUE); } else @@ -879,18 +879,18 @@ pluma_automatic_spell_checker_get_from_document (const PlumaDocument *doc) return NULL; return g_object_get_qdata (G_OBJECT (doc), automatic_spell_checker_id); -} +} void pluma_automatic_spell_checker_free (PlumaAutomaticSpellChecker *spell) { g_return_if_fail (spell != NULL); g_return_if_fail (pluma_automatic_spell_checker_get_from_document (spell->doc) == spell); - + if (automatic_spell_checker_id == 0) return; - g_object_set_qdata (G_OBJECT (spell->doc), automatic_spell_checker_id, NULL); + g_object_set_qdata (G_OBJECT (spell->doc), automatic_spell_checker_id, NULL); } static void @@ -899,19 +899,19 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) GtkTextTagTable *table; GtkTextIter start, end; GSList *list; - + g_return_if_fail (spell != NULL); table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (spell->doc)); if (table != NULL && spell->tag_highlight != NULL) { - gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), - &start, + gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (spell->doc), + &start, &end); - gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), - spell->tag_highlight, - &start, + gtk_text_buffer_remove_tag (GTK_TEXT_BUFFER (spell->doc), + spell->tag_highlight, + &start, &end); g_signal_handlers_disconnect_matched (G_OBJECT (table), @@ -921,7 +921,7 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) gtk_text_tag_table_remove (table, spell->tag_highlight); } - + g_signal_handlers_disconnect_matched (G_OBJECT (spell->doc), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, @@ -938,7 +938,7 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) while (list != NULL) { PlumaView *view = PLUMA_VIEW (list->data); - + g_signal_handlers_disconnect_matched (G_OBJECT (view), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, @@ -953,13 +953,13 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell) } g_slist_free (spell->views); - + g_free (spell); } void pluma_automatic_spell_checker_attach_view ( - PlumaAutomaticSpellChecker *spell, + PlumaAutomaticSpellChecker *spell, PlumaView *view) { g_return_if_fail (spell != NULL); @@ -970,25 +970,25 @@ pluma_automatic_spell_checker_attach_view ( g_signal_connect (view, "button-press-event", - G_CALLBACK (button_press_event), + G_CALLBACK (button_press_event), spell); g_signal_connect (view, "popup-menu", - G_CALLBACK (popup_menu_event), + G_CALLBACK (popup_menu_event), spell); g_signal_connect (view, "populate-popup", - G_CALLBACK (populate_popup), + G_CALLBACK (populate_popup), spell); g_signal_connect (view, "destroy", - G_CALLBACK (view_destroy), + G_CALLBACK (view_destroy), spell); spell->views = g_slist_prepend (spell->views, view); } -void +void pluma_automatic_spell_checker_detach_view ( PlumaAutomaticSpellChecker *spell, PlumaView *view) diff --git a/plugins/spell/pluma-automatic-spell-checker.h b/plugins/spell/pluma-automatic-spell-checker.h index e45c0e38..7fbb75f0 100644 --- a/plugins/spell/pluma-automatic-spell-checker.h +++ b/plugins/spell/pluma-automatic-spell-checker.h @@ -3,7 +3,7 @@ * pluma-automatic-spell-checker.h * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ /* This is a modified version of gtkspell 2.0.2 (gtkspell.sf.net) */ @@ -48,7 +48,7 @@ PlumaAutomaticSpellChecker *pluma_automatic_spell_checker_new ( PlumaAutomaticSpellChecker *pluma_automatic_spell_checker_get_from_document ( const PlumaDocument *doc); - + void pluma_automatic_spell_checker_free ( PlumaAutomaticSpellChecker *spell); diff --git a/plugins/spell/pluma-spell-checker-dialog.c b/plugins/spell/pluma-spell-checker-dialog.c index 05a69d4b..3689a280 100644 --- a/plugins/spell/pluma-spell-checker-dialog.c +++ b/plugins/spell/pluma-spell-checker-dialog.c @@ -3,7 +3,7 @@ * pluma-spell-checker-dialog.c * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifdef HAVE_CONFIG_H @@ -38,7 +38,7 @@ #include "pluma-spell-checker-dialog.h" #include "pluma-spell-marshal.h" -struct _PlumaSpellCheckerDialog +struct _PlumaSpellCheckerDialog { GtkWindow parent_instance; @@ -77,26 +77,26 @@ enum NUM_COLUMNS }; -static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, +static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions); -static void word_entry_changed_handler (GtkEditable *editable, +static void word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg); -static void close_button_clicked_handler (GtkButton *button, +static void close_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); static void suggestions_list_selection_changed_handler (GtkTreeSelection *selection, PlumaSpellCheckerDialog *dlg); -static void check_word_button_clicked_handler (GtkButton *button, +static void check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void add_word_button_clicked_handler (GtkButton *button, +static void add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void ignore_button_clicked_handler (GtkButton *button, +static void ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void ignore_all_button_clicked_handler (GtkButton *button, +static void ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void change_button_clicked_handler (GtkButton *button, +static void change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); -static void change_all_button_clicked_handler (GtkButton *button, +static void change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg); static void suggestions_list_row_activated_handler (GtkTreeView *view, GtkTreePath *path, @@ -137,61 +137,61 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass) object_class->dispose = pluma_spell_checker_dialog_dispose; - signals[IGNORE] = + signals[IGNORE] = g_signal_new ("ignore", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore), NULL, NULL, pluma_marshal_VOID__STRING, - G_TYPE_NONE, - 1, + G_TYPE_NONE, + 1, G_TYPE_STRING); - signals[IGNORE_ALL] = + signals[IGNORE_ALL] = g_signal_new ("ignore_all", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore_all), NULL, NULL, pluma_marshal_VOID__STRING, - G_TYPE_NONE, - 1, + G_TYPE_NONE, + 1, G_TYPE_STRING); - signals[CHANGE] = + signals[CHANGE] = g_signal_new ("change", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change), NULL, NULL, pluma_marshal_VOID__STRING_STRING, - G_TYPE_NONE, - 2, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_STRING); - - signals[CHANGE_ALL] = + + signals[CHANGE_ALL] = g_signal_new ("change_all", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change_all), NULL, NULL, pluma_marshal_VOID__STRING_STRING, - G_TYPE_NONE, - 2, + G_TYPE_NONE, + 2, G_TYPE_STRING, G_TYPE_STRING); - signals[ADD_WORD_TO_PERSONAL] = + signals[ADD_WORD_TO_PERSONAL] = g_signal_new ("add_word_to_personal", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, add_word_to_personal), NULL, NULL, pluma_marshal_VOID__STRING, - G_TYPE_NONE, - 1, + G_TYPE_NONE, + 1, G_TYPE_STRING); } @@ -216,7 +216,7 @@ create_dialog (PlumaSpellCheckerDialog *dlg, }; gboolean ret; gchar *ui_file; - + g_return_if_fail (dlg != NULL); dlg->spell_checker = NULL; @@ -260,9 +260,9 @@ create_dialog (PlumaSpellCheckerDialog *dlg, gtk_widget_set_sensitive (dlg->change_button, FALSE); gtk_widget_set_sensitive (dlg->change_all_button, FALSE); gtk_widget_set_sensitive (dlg->add_word_button, FALSE); - + gtk_label_set_label (GTK_LABEL (dlg->language_label), ""); - + gtk_container_add (GTK_CONTAINER (dlg), content); g_object_unref (content); @@ -273,14 +273,14 @@ create_dialog (PlumaSpellCheckerDialog *dlg, dlg->suggestions_list_model = GTK_TREE_MODEL ( gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING)); - gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->suggestions_list), + gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->suggestions_list), dlg->suggestions_list_model); /* Add the suggestions column */ cell = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes (_("Suggestions"), cell, + column = gtk_tree_view_column_new_with_attributes (_("Suggestions"), cell, "text", COLUMN_SUGGESTIONS, NULL); - + gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->suggestions_list), column); gtk_tree_view_set_search_column (GTK_TREE_VIEW (dlg->suggestions_list), @@ -304,8 +304,8 @@ create_dialog (PlumaSpellCheckerDialog *dlg, G_CALLBACK (word_entry_changed_handler), dlg); g_signal_connect (dlg->close_button, "clicked", G_CALLBACK (close_button_clicked_handler), dlg); - g_signal_connect (selection, "changed", - G_CALLBACK (suggestions_list_selection_changed_handler), + g_signal_connect (selection, "changed", + G_CALLBACK (suggestions_list_selection_changed_handler), dlg); g_signal_connect (dlg->check_word_button, "clicked", G_CALLBACK (check_word_button_clicked_handler), dlg); @@ -337,7 +337,7 @@ pluma_spell_checker_dialog_new (const gchar *data_dir) g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL)); g_return_val_if_fail (dlg != NULL, NULL); - + create_dialog (dlg, data_dir); return GTK_WIDGET (dlg); @@ -355,7 +355,7 @@ pluma_spell_checker_dialog_new_from_spell_checker (PlumaSpellChecker *spell, g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL)); g_return_val_if_fail (dlg != NULL, NULL); - + create_dialog (dlg, data_dir); pluma_spell_checker_dialog_set_spell_checker (dlg, spell); @@ -369,16 +369,16 @@ pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, Plum const PlumaSpellCheckerLanguage* language; const gchar *lang; gchar *tmp; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (spell != NULL); - + if (dlg->spell_checker != NULL) g_object_unref (dlg->spell_checker); dlg->spell_checker = spell; g_object_ref (dlg->spell_checker); - + language = pluma_spell_checker_get_language (dlg->spell_checker); lang = pluma_spell_checker_language_to_string (language); @@ -396,13 +396,13 @@ pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, Plum } void -pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, +pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, const gchar *word, gint len) { gchar *tmp; GSList *sug; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (word != NULL); @@ -414,15 +414,15 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, g_free (dlg->misspelled_word); dlg->misspelled_word = g_strdup (word); - + tmp = g_strdup_printf("<b>%s</b>", word); gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp); g_free (tmp); sug = pluma_spell_checker_get_suggestions (dlg->spell_checker, - dlg->misspelled_word, + dlg->misspelled_word, -1); - + update_suggestions_list_model (dlg, sug); /* free the suggestion list */ @@ -431,19 +431,19 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg, gtk_widget_set_sensitive (dlg->ignore_button, TRUE); gtk_widget_set_sensitive (dlg->ignore_all_button, TRUE); - gtk_widget_set_sensitive (dlg->add_word_button, TRUE); + gtk_widget_set_sensitive (dlg->add_word_button, TRUE); } - + static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions) { GtkListStore *store; GtkTreeIter iter; GtkTreeSelection *sel; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (GTK_IS_LIST_STORE (dlg->suggestions_list_model)); - + store = GTK_LIST_STORE (dlg->suggestions_list_model); gtk_list_store_clear (store); @@ -461,7 +461,7 @@ update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), ""); gtk_widget_set_sensitive (dlg->suggestions_list, FALSE); - + return; } @@ -488,7 +488,7 @@ static void word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg) { const gchar *text; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)); @@ -512,11 +512,11 @@ close_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); - gtk_widget_destroy (GTK_WIDGET (dlg)); + gtk_widget_destroy (GTK_WIDGET (dlg)); } static void -suggestions_list_selection_changed_handler (GtkTreeSelection *selection, +suggestions_list_selection_changed_handler (GtkTreeSelection *selection, PlumaSpellCheckerDialog *dlg) { GtkTreeIter iter; @@ -535,7 +535,7 @@ suggestions_list_selection_changed_handler (GtkTreeSelection *selection, text = g_value_get_string (&value); gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), text); - + g_value_unset (&value); } @@ -544,18 +544,18 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d { const gchar *word; gssize len; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); word = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)); len = strlen (word); g_return_if_fail (len > 0); - + if (pluma_spell_checker_check_word (dlg->spell_checker, word, len)) { GtkListStore *store; GtkTreeIter iter; - + store = GTK_LIST_STORE (dlg->suggestions_list_model); gtk_list_store_clear (store); @@ -574,7 +574,7 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d sug = pluma_spell_checker_get_suggestions (dlg->spell_checker, word, len); - + update_suggestions_list_model (dlg, sug); /* free the suggestion list */ @@ -586,13 +586,13 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d static void add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { - gchar *word; - + gchar *word; + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); - pluma_spell_checker_add_word_to_personal (dlg->spell_checker, - dlg->misspelled_word, + pluma_spell_checker_add_word_to_personal (dlg->spell_checker, + dlg->misspelled_word, -1); word = g_strdup (dlg->misspelled_word); @@ -606,7 +606,7 @@ static void ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { gchar *word; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); @@ -621,12 +621,12 @@ static void ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) { gchar *word; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); pluma_spell_checker_add_word_to_session (dlg->spell_checker, - dlg->misspelled_word, + dlg->misspelled_word, -1); word = g_strdup (dlg->misspelled_word); @@ -651,16 +651,16 @@ change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg) g_return_if_fail (*entry_text != '\0'); change = g_strdup (entry_text); - pluma_spell_checker_set_correction (dlg->spell_checker, - dlg->misspelled_word, -1, + pluma_spell_checker_set_correction (dlg->spell_checker, + dlg->misspelled_word, -1, change, -1); - + word = g_strdup (dlg->misspelled_word); g_signal_emit (G_OBJECT (dlg), signals [CHANGE], 0, word, change); g_free (word); - g_free (change); + g_free (change); } /* double click on one of the suggestions is like clicking on "change" */ @@ -681,7 +681,7 @@ change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d const gchar *entry_text; gchar *change; gchar *word; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); g_return_if_fail (dlg->misspelled_word != NULL); @@ -690,33 +690,33 @@ change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d g_return_if_fail (*entry_text != '\0'); change = g_strdup (entry_text); - pluma_spell_checker_set_correction (dlg->spell_checker, + pluma_spell_checker_set_correction (dlg->spell_checker, dlg->misspelled_word, -1, change, -1); - + word = g_strdup (dlg->misspelled_word); g_signal_emit (G_OBJECT (dlg), signals [CHANGE_ALL], 0, word, change); g_free (word); - g_free (change); + g_free (change); } -void +void pluma_spell_checker_dialog_set_completed (PlumaSpellCheckerDialog *dlg) { gchar *tmp; - + g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg)); tmp = g_strdup_printf("<b>%s</b>", _("Completed spell checking")); - gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), + gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp); g_free (tmp); gtk_list_store_clear (GTK_LIST_STORE (dlg->suggestions_list_model)); gtk_entry_set_text (GTK_ENTRY (dlg->word_entry), ""); - + gtk_widget_set_sensitive (dlg->word_entry, FALSE); gtk_widget_set_sensitive (dlg->check_word_button, FALSE); gtk_widget_set_sensitive (dlg->ignore_button, FALSE); diff --git a/plugins/spell/pluma-spell-checker-dialog.h b/plugins/spell/pluma-spell-checker-dialog.h index 61166785..6fadff8d 100644 --- a/plugins/spell/pluma-spell-checker-dialog.h +++ b/plugins/spell/pluma-spell-checker-dialog.h @@ -3,7 +3,7 @@ * pluma-spell-checker-dialog.h * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_SPELL_CHECKER_DIALOG_H__ @@ -47,7 +47,7 @@ typedef struct _PlumaSpellCheckerDialog PlumaSpellCheckerDialog; typedef struct _PlumaSpellCheckerDialogClass PlumaSpellCheckerDialogClass; -struct _PlumaSpellCheckerDialogClass +struct _PlumaSpellCheckerDialogClass { GtkWindowClass parent_class; @@ -57,10 +57,10 @@ struct _PlumaSpellCheckerDialogClass void (*ignore_all) (PlumaSpellCheckerDialog *dlg, const gchar *word); void (*change) (PlumaSpellCheckerDialog *dlg, - const gchar *word, + const gchar *word, const gchar *change_to); void (*change_all) (PlumaSpellCheckerDialog *dlg, - const gchar *word, + const gchar *word, const gchar *change_to); void (*add_word_to_personal) (PlumaSpellCheckerDialog *dlg, const gchar *word); @@ -71,21 +71,21 @@ GType pluma_spell_checker_dialog_get_type (void) G_GNUC_CONST; /* Constructors */ GtkWidget *pluma_spell_checker_dialog_new (const gchar *data_dir); -GtkWidget *pluma_spell_checker_dialog_new_from_spell_checker +GtkWidget *pluma_spell_checker_dialog_new_from_spell_checker (PlumaSpellChecker *spell, const gchar *data_dir); void pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, PlumaSpellChecker *spell); -void pluma_spell_checker_dialog_set_misspelled_word - (PlumaSpellCheckerDialog *dlg, - const gchar* word, +void pluma_spell_checker_dialog_set_misspelled_word + (PlumaSpellCheckerDialog *dlg, + const gchar* word, gint len); -void pluma_spell_checker_dialog_set_completed +void pluma_spell_checker_dialog_set_completed (PlumaSpellCheckerDialog *dlg); - + G_END_DECLS #endif /* __PLUMA_SPELL_CHECKER_DIALOG_H__ */ diff --git a/plugins/spell/pluma-spell-checker-language.c b/plugins/spell/pluma-spell-checker-language.c index 960d91cd..f8e1dd19 100644 --- a/plugins/spell/pluma-spell-checker-language.c +++ b/plugins/spell/pluma-spell-checker-language.c @@ -3,7 +3,7 @@ * pluma-spell-checker-language.c * This file is part of pluma * - * Copyright (C) 2006 Paolo Maggi + * Copyright (C) 2006 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2006. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2006. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ /* Part of the code taked from Epiphany. @@ -52,10 +52,10 @@ #define ISOCODESLOCALEDIR ISO_CODES_PREFIX "/share/locale" -struct _PlumaSpellCheckerLanguage +struct _PlumaSpellCheckerLanguage { gchar *abrev; - gchar *name; + gchar *name; }; static gboolean available_languages_initialized = FALSE; @@ -126,7 +126,7 @@ read_iso_3166_entry (xmlTextReaderPtr reader, xmlFree (code); /* g_print ("%s -> %s\n", lcode, name); */ - + g_hash_table_insert (table, lcode, name); } else @@ -242,7 +242,7 @@ create_iso_3166_table (void) table = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) xmlFree); - + load_iso_entries (3166, (GFunc) read_iso_3166_entry, table); return table; @@ -258,7 +258,7 @@ create_name_for_language (const char *code) g_return_val_if_fail (iso_639_table != NULL, NULL); g_return_val_if_fail (iso_3166_table != NULL, NULL); - + str = g_strsplit (code, "_", -1); len = g_strv_length (str); g_return_val_if_fail (len != 0, NULL); @@ -272,10 +272,10 @@ create_name_for_language (const char *code) else if (len == 2 && langname != NULL) { gchar *locale_code = g_ascii_strdown (str[1], -1); - + localename = (const char *) g_hash_table_lookup (iso_3166_table, locale_code); g_free (locale_code); - + if (localename != NULL) { /* Translators: the first %s is the language name, and @@ -313,14 +313,14 @@ enumerate_dicts (const char * const lang_tag, void * user_data) { gchar *lang_name; - + GTree *dicts = (GTree *)user_data; - + lang_name = create_name_for_language (lang_tag); g_return_if_fail (lang_name != NULL); - + /* g_print ("%s - %s\n", lang_tag, lang_name); */ - + g_tree_replace (dicts, g_strdup (lang_tag), lang_name); } @@ -338,15 +338,15 @@ lang_cmp (const PlumaSpellCheckerLanguage *a, } static gboolean -build_langs_list (const gchar *key, - const gchar *value, +build_langs_list (const gchar *key, + const gchar *value, gpointer data) { PlumaSpellCheckerLanguage *lang = g_new (PlumaSpellCheckerLanguage, 1); - + lang->abrev = g_strdup (key); lang->name = g_strdup (value); - + available_languages = g_slist_insert_sorted (available_languages, lang, (GCompareFunc)lang_cmp); @@ -364,12 +364,12 @@ pluma_spell_checker_get_available_languages (void) return available_languages; g_return_val_if_fail (available_languages == NULL, NULL); - + available_languages_initialized = TRUE; - + broker = enchant_broker_init (); g_return_val_if_fail (broker != NULL, NULL); - + /* Use a GTree to efficiently remove duplicates while building the list */ dicts = g_tree_new_full (key_cmp, NULL, @@ -378,21 +378,21 @@ pluma_spell_checker_get_available_languages (void) iso_639_table = create_iso_639_table (); iso_3166_table = create_iso_3166_table (); - + enchant_broker_list_dicts (broker, enumerate_dicts, dicts); enchant_broker_free (broker); - + g_hash_table_destroy (iso_639_table); g_hash_table_destroy (iso_3166_table); - + iso_639_table = NULL; iso_3166_table = NULL; - + g_tree_foreach (dicts, (GTraverseFunc)build_langs_list, NULL); - + g_tree_destroy (dicts); - + return available_languages; } @@ -412,7 +412,7 @@ const gchar * pluma_spell_checker_language_to_key (const PlumaSpellCheckerLanguage *lang) { g_return_val_if_fail (lang != NULL, NULL); - + return lang->abrev; } diff --git a/plugins/spell/pluma-spell-checker-language.h b/plugins/spell/pluma-spell-checker-language.h index d2ba1c14..39764cd7 100644 --- a/plugins/spell/pluma-spell-checker-language.h +++ b/plugins/spell/pluma-spell-checker-language.h @@ -3,7 +3,7 @@ * pluma-spell-checker-language.h * This file is part of pluma * - * Copyright (C) 2006 Paolo Maggi + * Copyright (C) 2006 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2006. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2006. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_SPELL_CHECKER_LANGUAGE_H__ diff --git a/plugins/spell/pluma-spell-language-dialog.c b/plugins/spell/pluma-spell-language-dialog.c index d5a70127..363d11af 100644 --- a/plugins/spell/pluma-spell-language-dialog.c +++ b/plugins/spell/pluma-spell-language-dialog.c @@ -3,7 +3,7 @@ * pluma-spell-language-dialog.c * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifdef HAVE_CONFIG_H @@ -47,7 +47,7 @@ enum }; -struct _PlumaSpellLanguageDialog +struct _PlumaSpellLanguageDialog { GtkDialog dialog; @@ -58,7 +58,7 @@ struct _PlumaSpellLanguageDialog G_DEFINE_TYPE(PlumaSpellLanguageDialog, pluma_spell_language_dialog, GTK_TYPE_DIALOG) -static void +static void pluma_spell_language_dialog_class_init (PlumaSpellLanguageDialogClass *klass) { /* GObjectClass *object_class = G_OBJECT_CLASS (klass); */ @@ -78,7 +78,7 @@ dialog_response_handler (GtkDialog *dlg, } } -static void +static void scroll_to_selected (GtkTreeView *tree_view) { GtkTreeModel *model; @@ -128,7 +128,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg, "content", NULL }; - + pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Cancel"), "process-stop", GTK_RESPONSE_CANCEL); pluma_dialog_add_button (GTK_DIALOG (dlg), _("_OK"), "gtk-ok", GTK_RESPONSE_OK); pluma_dialog_add_button (GTK_DIALOG (dlg), _("_Help"), "help-browser", GTK_RESPONSE_HELP); @@ -149,13 +149,13 @@ create_dialog (PlumaSpellLanguageDialog *dlg, ui_file = g_build_filename (data_dir, "languages-dialog.ui", NULL); ret = pluma_utils_get_ui_objects (ui_file, - root_objects, + root_objects, &error_widget, "content", &content, "languages_treeview", &dlg->languages_treeview, NULL); g_free (ui_file); - + if (!ret) { gtk_widget_show (error_widget); @@ -184,11 +184,11 @@ create_dialog (PlumaSpellLanguageDialog *dlg, /* Add the encoding column */ cell = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (_("Languages"), - cell, + cell, "text", COLUMN_LANGUAGE_NAME, NULL); - + gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->languages_treeview), column); @@ -200,7 +200,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg, G_CALLBACK (scroll_to_selected), dlg); g_signal_connect (dlg->languages_treeview, - "row-activated", + "row-activated", G_CALLBACK (language_row_activated), dlg); } @@ -208,7 +208,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg, static void pluma_spell_language_dialog_init (PlumaSpellLanguageDialog *dlg) { - + } static void @@ -267,7 +267,7 @@ pluma_spell_language_dialog_new (GtkWindow *parent, populate_language_list (dlg, cur_lang); gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); - gtk_widget_grab_focus (dlg->languages_treeview); + gtk_widget_grab_focus (dlg->languages_treeview); return GTK_WIDGET (dlg); } diff --git a/plugins/spell/pluma-spell-language-dialog.h b/plugins/spell/pluma-spell-language-dialog.h index 7c014872..b2a59514 100644 --- a/plugins/spell/pluma-spell-language-dialog.h +++ b/plugins/spell/pluma-spell-language-dialog.h @@ -3,7 +3,7 @@ * pluma-spell-language-dialog.h * This file is part of pluma * - * Copyright (C) 2002 Paolo Maggi + * Copyright (C) 2002 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ - + /* - * Modified by the pluma Team, 2002. See the AUTHORS file for a - * list of people on the pluma Team. - * See the ChangeLog files for a list of changes. + * Modified by the pluma Team, 2002. See the AUTHORS file for a + * list of people on the pluma Team. + * See the ChangeLog files for a list of changes. */ #ifndef __PLUMA_SPELL_LANGUAGE_DIALOG_H__ @@ -47,7 +47,7 @@ typedef struct _PlumaSpellLanguageDialog PlumaSpellLanguageDialog; typedef struct _PlumaSpellLanguageDialogClass PlumaSpellLanguageDialogClass; -struct _PlumaSpellLanguageDialogClass +struct _PlumaSpellLanguageDialogClass { GtkDialogClass parent_class; }; diff --git a/plugins/spell/pluma-spell-plugin.c b/plugins/spell/pluma-spell-plugin.c index 9c17c76f..b50319ce 100644 --- a/plugins/spell/pluma-spell-plugin.c +++ b/plugins/spell/pluma-spell-plugin.c @@ -1,13 +1,13 @@ /* * pluma-spell-plugin.c - * - * Copyright (C) 2002-2005 Paolo Maggi + * + * Copyright (C) 2002-2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -194,7 +194,7 @@ pluma_spell_plugin_dispose (GObject *object) G_OBJECT_CLASS (pluma_spell_plugin_parent_class)->dispose (object); } -static void +static void set_spell_language_cb (PlumaSpellChecker *spell, const PlumaSpellCheckerLanguage *lang, PlumaDocument *doc) @@ -278,9 +278,9 @@ get_spell_checker_from_document (PlumaDocument *doc) set_language_from_metadata (spell, doc); - g_object_set_qdata_full (G_OBJECT (doc), - spell_checker_id, - spell, + g_object_set_qdata_full (G_OBJECT (doc), + spell_checker_id, + spell, (GDestroyNotify) g_object_unref); g_signal_connect (spell, @@ -327,24 +327,24 @@ update_current (PlumaDocument *doc, range = get_check_range (doc); g_return_if_fail (range != NULL); - gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), &iter, current); if (!gtk_text_iter_inside_word (&iter)) - { + { /* if we're not inside a word, * we must be in some spaces. * skip forward to the beginning of the next word. */ if (!gtk_text_iter_is_end (&iter)) { gtk_text_iter_forward_word_end (&iter); - gtk_text_iter_backward_word_start (&iter); + gtk_text_iter_backward_word_start (&iter); } } else { if (!gtk_text_iter_starts_word (&iter)) - gtk_text_iter_backward_word_start (&iter); + gtk_text_iter_backward_word_start (&iter); } gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), @@ -352,7 +352,7 @@ update_current (PlumaDocument *doc, range->end_mark); if (gtk_text_iter_compare (&end_iter, &iter) < 0) - { + { gtk_text_buffer_move_mark (GTK_TEXT_BUFFER (doc), range->current_mark, &end_iter); @@ -394,9 +394,9 @@ set_check_range (PlumaDocument *doc, range->current_mark = gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc), "check_range_current_mark", &iter, TRUE); - g_object_set_qdata_full (G_OBJECT (doc), - check_range_id, - range, + g_object_set_qdata_full (G_OBJECT (doc), + check_range_id, + range, (GDestroyNotify)g_free); } @@ -455,12 +455,12 @@ get_current_word (PlumaDocument *doc, gint *start, gint *end) range = get_check_range (doc); g_return_val_if_fail (range != NULL, NULL); - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), &end_iter, range->end_mark); range_end = gtk_text_iter_get_offset (&end_iter); - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), ¤t_iter, range->current_mark); end_iter = current_iter; @@ -501,7 +501,7 @@ goto_next_word (PlumaDocument *doc) range = get_check_range (doc); g_return_val_if_fail (range != NULL, FALSE); - gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), + gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (doc), ¤t_iter, range->current_mark); gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &end_iter); @@ -607,7 +607,7 @@ ignore_cb (PlumaSpellCheckerDialog *dlg, if (word == NULL) { pluma_spell_checker_dialog_set_completed (dlg); - + return; } @@ -1076,7 +1076,7 @@ update_ui (PlumaSpellPlugin *plugin) { action = gtk_action_group_get_action (data->action_group, "AutoSpell"); - + g_signal_handlers_block_by_func (action, auto_spell_cb, plugin); set_auto_spell (window, doc, autospell); @@ -1127,7 +1127,7 @@ set_auto_spell_from_metadata (PlumaSpellPlugin *plugin, if (active_str) { active = *active_str == '1'; - + g_free (active_str); } @@ -1141,7 +1141,7 @@ set_auto_spell_from_metadata (PlumaSpellPlugin *plugin, if (active_doc == doc && action_group != NULL) { GtkAction *action; - + action = gtk_action_group_get_action (action_group, "AutoSpell"); @@ -1256,7 +1256,7 @@ tab_removed_cb (PlumaWindow *window, PlumaDocument *doc; doc = pluma_tab_get_document (tab); - + g_signal_handlers_disconnect_by_func (doc, on_document_loaded, plugin); g_signal_handlers_disconnect_by_func (doc, on_document_saved, plugin); } @@ -1279,13 +1279,13 @@ pluma_spell_plugin_activate (PeasActivatable *activatable) manager = pluma_window_get_ui_manager (window); data->action_group = gtk_action_group_new ("PlumaSpellPluginActions"); - gtk_action_group_set_translation_domain (data->action_group, + gtk_action_group_set_translation_domain (data->action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (data->action_group, action_entries, G_N_ELEMENTS (action_entries), plugin); - gtk_action_group_add_toggle_actions (data->action_group, + gtk_action_group_add_toggle_actions (data->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), plugin); @@ -1295,7 +1295,7 @@ pluma_spell_plugin_activate (PeasActivatable *activatable) data->ui_id = gtk_ui_manager_new_merge_id (manager); data->message_cid = gtk_statusbar_get_context_id - (GTK_STATUSBAR (pluma_window_get_statusbar (window)), + (GTK_STATUSBAR (pluma_window_get_statusbar (window)), "spell_plugin_message"); gtk_ui_manager_add_ui (manager, @@ -1303,23 +1303,23 @@ pluma_spell_plugin_activate (PeasActivatable *activatable) MENU_PATH, "CheckSpell", "CheckSpell", - GTK_UI_MANAGER_MENUITEM, + GTK_UI_MANAGER_MENUITEM, FALSE); - gtk_ui_manager_add_ui (manager, - data->ui_id, + gtk_ui_manager_add_ui (manager, + data->ui_id, MENU_PATH, - "AutoSpell", "AutoSpell", - GTK_UI_MANAGER_MENUITEM, + "AutoSpell", + GTK_UI_MANAGER_MENUITEM, FALSE); - gtk_ui_manager_add_ui (manager, - data->ui_id, + gtk_ui_manager_add_ui (manager, + data->ui_id, MENU_PATH, - "ConfigSpell", "ConfigSpell", - GTK_UI_MANAGER_MENUITEM, + "ConfigSpell", + GTK_UI_MANAGER_MENUITEM, FALSE); update_ui (plugin); diff --git a/plugins/spell/pluma-spell-plugin.h b/plugins/spell/pluma-spell-plugin.h index aa45eb63..cecde9ce 100644 --- a/plugins/spell/pluma-spell-plugin.h +++ b/plugins/spell/pluma-spell-plugin.h @@ -1,7 +1,7 @@ /* * pluma-spell-plugin.h - * - * Copyright (C) 2002-2005 Paolo Maggi + * + * Copyright (C) 2002-2005 Paolo Maggi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/plugins/spell/pluma-spell-utils.c b/plugins/spell/pluma-spell-utils.c index 24a211c8..6898fa34 100644 --- a/plugins/spell/pluma-spell-utils.c +++ b/plugins/spell/pluma-spell-utils.c @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ diff --git a/plugins/spell/pluma-spell-utils.h b/plugins/spell/pluma-spell-utils.h index a9d2eaf2..c0d5ffac 100644 --- a/plugins/spell/pluma-spell-utils.h +++ b/plugins/spell/pluma-spell-utils.h @@ -16,7 +16,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ |