[gnome-builder/wip/slaf/spellcheck-sidebar: 24/33] spellchecker: plumb IdeEditorSpellLanguagePopover



commit 820c634603e0d56b89ba47d0ca86de73a830d8ec
Author: Sébastien Lafargue <slafargue gnome org>
Date:   Tue Jan 10 22:20:32 2017 +0100

    spellchecker: plumb IdeEditorSpellLanguagePopover

 libide/editor/ide-editor-spell-widget.c  |   13 ++++++++++---
 libide/editor/ide-editor-spell-widget.ui |    2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/libide/editor/ide-editor-spell-widget.c b/libide/editor/ide-editor-spell-widget.c
index 6eded56..a3ee2ad 100644
--- a/libide/editor/ide-editor-spell-widget.c
+++ b/libide/editor/ide-editor-spell-widget.c
@@ -22,6 +22,7 @@
 
 #include "ide-editor-spell-dict.h"
 #include "ide-editor-spell-navigator.h"
+#include "ide-editor-spell-language-popover.h"
 
 #include "ide-editor-spell-widget.h"
 
@@ -544,11 +545,16 @@ remove_dict_row (IdeEditorSpellWidget *self,
 {
   GtkListBoxRow *next_row;
   gchar *word;
+  gboolean exist;
 
   g_assert (IDE_IS_EDITOR_SPELL_WIDGET (self));
   g_assert (GTK_IS_LIST_BOX (listbox));
   g_assert (GTK_IS_LIST_BOX_ROW (row));
 
+  word = g_object_get_data (G_OBJECT (row), "word");
+  exist = ide_editor_spell_dict_remove_word_from_personal (self->dict, word);
+  g_assert (exist == TRUE);
+
   if (row == gtk_list_box_get_selected_row (listbox))
     {
       if (NULL != (next_row = get_next_row_to_focus (listbox, row)))
@@ -560,9 +566,8 @@ remove_dict_row (IdeEditorSpellWidget *self,
         gtk_widget_grab_focus (GTK_WIDGET (self->word_entry));
     }
 
-  word = g_object_get_data (G_OBJECT (row), "word");
-  gspell_checker_remove_word_from_personal (self->checker, word, -1);
   gtk_container_remove (GTK_CONTAINER (self->dict_words_list), GTK_WIDGET (row));
+  ide_editor_spell_widget__dict_word_entry_changed_cb (self, GTK_ENTRY (self->dict_word_entry));
 }
 
 static void
@@ -658,9 +663,11 @@ ide_editor_spell_widget__add_button_clicked_cb (IdeEditorSpellWidget *self,
   /* TODO: check if word already in dict */
   if (check_dict_available (self) && !ide_str_empty0 (word))
     {
+      if (!ide_editor_spell_dict_add_word_to_personal (self->dict, word))
+        return;
+
       item = dict_create_word_row (self, word);
       gtk_list_box_insert (GTK_LIST_BOX (self->dict_words_list), item, 0);
-      gspell_checker_add_word_to_personal (self->checker, word, -1);
 
       gtk_widget_grab_focus (self->dict_word_entry);
       gtk_entry_set_text (GTK_ENTRY (self->dict_word_entry), "");
diff --git a/libide/editor/ide-editor-spell-widget.ui b/libide/editor/ide-editor-spell-widget.ui
index e8676a1..0ea1e72 100644
--- a/libide/editor/ide-editor-spell-widget.ui
+++ b/libide/editor/ide-editor-spell-widget.ui
@@ -301,7 +301,7 @@
           </packing>
         </child>
         <child>
-          <object class="GspellLanguageChooserButton" id="language_chooser_button">
+          <object class="IdeEditorSpellLanguagePopover" id="language_chooser_button">
             <property name="visible">true</property>
             <property name="can_focus">true</property>
             <property name="hexpand">true</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]