diff options
Diffstat (limited to 'plugins/spell/pluma-spell-checker-dialog.c')
-rw-r--r-- | plugins/spell/pluma-spell-checker-dialog.c | 166 |
1 files changed, 83 insertions, 83 deletions
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); |