[balsa/gtk3] Avoid critical message from GtkSourceView
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Avoid critical message from GtkSourceView
- Date: Tue, 10 Mar 2015 01:03:30 +0000 (UTC)
commit 5b6564390b3bfa23b14409ede5fdd94bb3f4522b
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Mon Mar 9 21:00:58 2015 -0400
Avoid critical message from GtkSourceView
* src/spell-check.c (balsa_spell_check_start), (spch_finish):
save the current state in a GtkSourceBuffer when we are using
GtkSourceview.
ChangeLog | 8 ++++++++
src/spell-check.c | 23 +++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a2471ec..8a8da20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2015-03-09 Peter Bloomfield <pbloomfield bellsouth net>
+ Avoid critical message from GtkSourceView
+
+ * src/spell-check.c (balsa_spell_check_start), (spch_finish):
+ save the current state in a GtkSourceBuffer when we are using
+ GtkSourceview.
+
+2015-03-09 Peter Bloomfield <pbloomfield bellsouth net>
+
Build with the home-grown spell checker
* src/spell-check.c (balsa_spell_check_init): put button grid in
diff --git a/src/spell-check.c b/src/spell-check.c
index 952c1af..9590b0f 100644
--- a/src/spell-check.c
+++ b/src/spell-check.c
@@ -40,6 +40,10 @@
#include "quote-color.h"
#include "balsa-icons.h"
+#if HAVE_GTKSOURCEVIEW
+#include <gtksourceview/gtksourcebuffer.h>
+#endif /* HAVE_GTKSOURCEVIEW */
+
/* the basic structures */
struct _BalsaSpellCheck {
GtkDialog dialog;
@@ -54,7 +58,11 @@ struct _BalsaSpellCheck {
gchar **suggestions;
/* restoration information */
+#if HAVE_GTKSOURCEVIEW
+ GtkSourceBuffer *original_text;
+#else /* HAVE_GTKSOURCEVIEW */
GtkTextBuffer *original_text;
+#endif /* HAVE_GTKSOURCEVIEW */
GtkTextMark *original_mark;
gint original_offset;
@@ -598,12 +606,23 @@ balsa_spell_check_start(BalsaSpellCheck * spell_check)
gtk_text_buffer_create_mark(buffer, NULL, &start, FALSE);
/* Get the original text so we can always revert */
+#if HAVE_GTKSOURCEVIEW
+ spell_check->original_text =
+ gtk_source_buffer_new(gtk_text_buffer_get_tag_table(buffer));
+ gtk_text_buffer_get_start_iter((GtkTextBuffer *)
+ spell_check->original_text, &iter);
+ gtk_text_buffer_get_bounds((GtkTextBuffer *) buffer, &start, &end);
+ gtk_text_buffer_insert_range((GtkTextBuffer *)
+ spell_check->original_text, &iter,
+ &start, &end);
+#else /* HAVE_GTKSOURCEVIEW */
spell_check->original_text =
gtk_text_buffer_new(gtk_text_buffer_get_tag_table(buffer));
gtk_text_buffer_get_start_iter(spell_check->original_text, &iter);
gtk_text_buffer_get_bounds(buffer, &start, &end);
gtk_text_buffer_insert_range(spell_check->original_text, &iter,
&start, &end);
+#endif /* HAVE_GTKSOURCEVIEW */
if (balsa_app.debug)
balsa_information(LIBBALSA_INFORMATION_DEBUG,
@@ -887,7 +906,11 @@ spch_finish(BalsaSpellCheck * spell_check, gboolean keep_changes)
g_object_unref(spell_check->original_text);
} else {
/* replace corrected text with original text */
+#if HAVE_GTKSOURCEVIEW
+ buffer = (GtkTextBuffer *) spell_check->original_text;
+#else /* HAVE_GTKSOURCEVIEW */
buffer = spell_check->original_text;
+#endif /* HAVE_GTKSOURCEVIEW */
gtk_text_view_set_buffer(spell_check->text_view, buffer);
gtk_text_buffer_get_iter_at_offset(buffer, &original,
spell_check->original_offset);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]