[evolution] Bug 753059 - Crash in spell check dialog when clicking replace buttons with no suggestion selected
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 753059 - Crash in spell check dialog when clicking replace buttons with no suggestion selected
- Date: Fri, 31 Jul 2015 09:15:20 +0000 (UTC)
commit 5a8e2abe0b9a19c6cc6943360369bace0698f096
Author: Tomas Popela <tpopela redhat com>
Date: Fri Jul 31 10:46:44 2015 +0200
Bug 753059 - Crash in spell check dialog when clicking replace buttons with no suggestion selected
Avoid the crash by sticking to the GtkHTML based composer behavior. When there
are suggestions presented, automatically select the first one. If no suggestion
is presented, make the 'Replace' and 'Replace All' buttons insensitive.
e-util/e-html-editor-spell-check-dialog.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-html-editor-spell-check-dialog.c b/e-util/e-html-editor-spell-check-dialog.c
index 505097b..44875d7 100644
--- a/e-util/e-html-editor-spell-check-dialog.c
+++ b/e-util/e-html-editor-spell-check-dialog.c
@@ -75,6 +75,7 @@ html_editor_spell_check_dialog_set_word (EHTMLEditorSpellCheckDialog *dialog,
GtkListStore *store;
gchar *markup;
GList *list, *link;
+ gboolean empty;
if (word == NULL)
return;
@@ -96,6 +97,8 @@ html_editor_spell_check_dialog_set_word (EHTMLEditorSpellCheckDialog *dialog,
list = e_spell_dictionary_get_suggestions (
dialog->priv->current_dict, word, -1);
+ empty = list == NULL;
+
for (link = list; link != NULL; link = g_list_next (link)) {
GtkTreeIter iter;
gchar *suggestion = link->data;
@@ -104,6 +107,18 @@ html_editor_spell_check_dialog_set_word (EHTMLEditorSpellCheckDialog *dialog,
gtk_list_store_set (store, &iter, 0, suggestion, -1);
}
+ gtk_widget_set_sensitive (dialog->priv->replace_button, !empty);
+ gtk_widget_set_sensitive (dialog->priv->replace_all_button, !empty);
+
+ if (!empty) {
+ GtkTreeSelection *tree_selection;
+
+ /* Select the first suggestion */
+ tree_selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (dialog->priv->tree_view));
+ gtk_tree_selection_select_path (tree_selection, gtk_tree_path_new_first ());
+ }
+
g_list_free_full (list, (GDestroyNotify) g_free);
/* We give focus to WebKit so that the currently selected word
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]