[balsa/gtk4] Build with the internal spell-checker
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk4] Build with the internal spell-checker
- Date: Wed, 18 Nov 2020 15:45:44 +0000 (UTC)
commit f6d7580be8ba36b997f20bfa57d6f2dd4a935954
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Nov 18 10:37:19 2020 -0500
Build with the internal spell-checker
modified: src/sendmsg-window.c
modified: src/spell-check.c
src/sendmsg-window.c | 10 +++++-----
src/spell-check.c | 19 +++++++++----------
2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index c7ab8dde5..cdbd3c6ca 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -6938,15 +6938,15 @@ sw_spell_check_activated(GSimpleAction * action,
GtkTextView *text_view = GTK_TEXT_VIEW(bsmsg->text);
BalsaSpellCheck *sc;
- if (bsmsg->spell_checker) {
- if (gtk_widget_get_window(bsmsg->spell_checker)) {
- gtk_window_present_with_time(GTK_WINDOW(bsmsg->spell_checker),
- gtk_get_current_event_time());
+ if (bsmsg->spell_checker != NULL) {
+ if (gtk_widget_get_realized(bsmsg->spell_checker)) {
+ gtk_window_present(GTK_WINDOW(bsmsg->spell_checker));
return;
- } else
+ } else {
/* A spell checker was created, but not shown because of
* errors; we'll destroy it, and create a new one. */
gtk_window_destroy(GTK_WINDOW(bsmsg->spell_checker));
+ }
}
sw_buffer_signals_disconnect(bsmsg);
diff --git a/src/spell-check.c b/src/spell-check.c
index 14137a6b6..18b22f24c 100644
--- a/src/spell-check.c
+++ b/src/spell-check.c
@@ -218,7 +218,6 @@ balsa_spell_check_new(GtkWindow *parent)
g_return_val_if_fail(GTK_IS_WINDOW(parent), NULL);
spell_check = g_object_new(BALSA_TYPE_SPELL_CHECK,
- "type", GTK_WINDOW_TOPLEVEL,
"transient-for", parent,
"destroy-with-parent", TRUE,
"title", _("Spell check"),
@@ -308,24 +307,24 @@ balsa_spell_check_init(BalsaSpellCheck *spell_check)
widget = gtk_entry_new();
spell_check->entry = GTK_ENTRY(widget);
box = gtk_box_new(GTK_ORIENTATION_VERTICAL, BALSA_SPELL_CHECK_PADDING);
- gtk_container_add(GTK_CONTAINER(spell_check), box);
+ gtk_window_set_child(GTK_WINDOW(spell_check), box);
- gtk_container_add(GTK_CONTAINER(box), widget);
+ gtk_box_append(GTK_BOX(box), widget);
- sw = gtk_scrolled_window_new(NULL, NULL);
+ sw = gtk_scrolled_window_new();
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_widget_set_vexpand(sw, TRUE);
gtk_widget_set_valign(sw, GTK_ALIGN_FILL);
- gtk_container_add(GTK_CONTAINER(box), sw);
+ gtk_box_append(GTK_BOX(box), sw);
/* setup suggestion list */
store = gtk_list_store_new(1, G_TYPE_STRING);
widget = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
g_object_unref(store);
- gtk_container_add(GTK_CONTAINER(sw), widget);
+ gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(sw), widget);
spell_check->tree_view = tree_view = GTK_TREE_VIEW(widget);
renderer = gtk_cell_renderer_text_new();
@@ -342,7 +341,7 @@ balsa_spell_check_init(BalsaSpellCheck *spell_check)
/* setup buttons to perform actions */
widget = gtk_grid_new();
- gtk_container_add(GTK_CONTAINER(box), widget);
+ gtk_box_append(GTK_BOX(box), widget);
grid = GTK_GRID(widget);
gtk_grid_set_row_spacing(grid, BALSA_SPELL_CHECK_PADDING);
@@ -418,7 +417,7 @@ select_word_cb(GtkTreeSelection *selection,
BalsaSpellCheck *spell_check = BALSA_SPELL_CHECK(data);
gtk_tree_model_get(model, &iter, 0, &str, -1);
- gtk_entry_set_text(spell_check->entry, str);
+ gtk_editable_set_text(GTK_EDITABLE(spell_check->entry), str);
g_free(str);
}
}
@@ -643,7 +642,7 @@ balsa_spell_check_start(BalsaSpellCheck *spell_check)
/* start the check */
if (!balsa_spell_check_next(spell_check))
- gtk_widget_show_all(GTK_WIDGET(spell_check));
+ gtk_widget_show(GTK_WIDGET(spell_check));
}
@@ -998,7 +997,7 @@ finish_check(BalsaSpellCheck *spell_check)
/* get rid of the suggestions */
gtk_list_store_clear(GTK_LIST_STORE(model));
- gtk_entry_set_text(spell_check->entry, "");
+ gtk_editable_set_text(GTK_EDITABLE(spell_check->entry), "");
enchant_dict_free_string_list(spell_check->dict,
spell_check->suggestions);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]