[gedit/wip/spell-checking: 3/5] auto-spell: don't depend on GeditView
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/spell-checking: 3/5] auto-spell: don't depend on GeditView
- Date: Fri, 17 Jul 2015 11:37:01 +0000 (UTC)
commit fb7ce5dd9eb4213f7b16429e171eb1ec8e3aa193
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Jul 17 13:16:13 2015 +0200
auto-spell: don't depend on GeditView
Depend only on GtkTextView, so the code is more easily reusable for
other text editors.
plugins/spell/gedit-automatic-spell-checker.c | 20 ++++++++++----------
plugins/spell/gedit-automatic-spell-checker.h | 6 ++----
plugins/spell/gedit-spell-plugin.c | 2 +-
3 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/plugins/spell/gedit-automatic-spell-checker.c b/plugins/spell/gedit-automatic-spell-checker.c
index b5a55b5..4ea630a 100644
--- a/plugins/spell/gedit-automatic-spell-checker.c
+++ b/plugins/spell/gedit-automatic-spell-checker.c
@@ -35,6 +35,8 @@
struct _GeditAutomaticSpellChecker
{
GtkSourceBuffer *buffer;
+
+ /* List of GtkTextView* */
GSList *views;
GtkTextMark *mark_insert_start;
@@ -54,7 +56,7 @@ struct _GeditAutomaticSpellChecker
static void gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell);
static void
-view_destroy (GeditView *view,
+view_destroy (GtkTextView *view,
GeditAutomaticSpellChecker *spell)
{
gedit_automatic_spell_checker_detach_view (spell, view);
@@ -926,7 +928,7 @@ gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell)
list = spell->views;
while (list != NULL)
{
- GeditView *view = GEDIT_VIEW (list->data);
+ GtkTextView *view = GTK_TEXT_VIEW (list->data);
g_signal_handlers_disconnect_matched (G_OBJECT (view),
G_SIGNAL_MATCH_DATA,
@@ -948,13 +950,12 @@ gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell)
void
gedit_automatic_spell_checker_attach_view (GeditAutomaticSpellChecker *spell,
- GeditView *view)
+ GtkTextView *view)
{
g_return_if_fail (spell != NULL);
- g_return_if_fail (GEDIT_IS_VIEW (view));
+ g_return_if_fail (GTK_IS_TEXT_VIEW (view));
- g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
- GTK_TEXT_BUFFER (spell->buffer));
+ g_return_if_fail (gtk_text_view_get_buffer (view) == GTK_TEXT_BUFFER (spell->buffer));
g_signal_connect (view,
"button-press-event",
@@ -978,13 +979,12 @@ gedit_automatic_spell_checker_attach_view (GeditAutomaticSpellChecker *spell,
void
gedit_automatic_spell_checker_detach_view (GeditAutomaticSpellChecker *spell,
- GeditView *view)
+ GtkTextView *view)
{
g_return_if_fail (spell != NULL);
- g_return_if_fail (GEDIT_IS_VIEW (view));
+ g_return_if_fail (GTK_IS_TEXT_VIEW (view));
- g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
- GTK_TEXT_BUFFER (spell->buffer));
+ g_return_if_fail (gtk_text_view_get_buffer (view) == GTK_TEXT_BUFFER (spell->buffer));
g_return_if_fail (spell->views != NULL);
g_signal_handlers_disconnect_matched (G_OBJECT (view),
diff --git a/plugins/spell/gedit-automatic-spell-checker.h b/plugins/spell/gedit-automatic-spell-checker.h
index 3797e94..715cfce 100644
--- a/plugins/spell/gedit-automatic-spell-checker.h
+++ b/plugins/spell/gedit-automatic-spell-checker.h
@@ -27,8 +27,6 @@
#define __GEDIT_AUTOMATIC_SPELL_CHECKER_H__
#include <gtksourceview/gtksource.h>
-#include <gedit/gedit-view.h>
-
#include "gedit-spell-checker.h"
typedef struct _GeditAutomaticSpellChecker GeditAutomaticSpellChecker;
@@ -43,10 +41,10 @@ GeditAutomaticSpellChecker *
void gedit_automatic_spell_checker_free (GeditAutomaticSpellChecker *spell);
void gedit_automatic_spell_checker_attach_view (GeditAutomaticSpellChecker *spell,
- GeditView *view);
+ GtkTextView *view);
void gedit_automatic_spell_checker_detach_view (GeditAutomaticSpellChecker *spell,
- GeditView *view);
+ GtkTextView *view);
void gedit_automatic_spell_checker_recheck_all (GeditAutomaticSpellChecker *spell);
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index cecd71f..54c71e5 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -881,7 +881,7 @@ set_auto_spell (GeditWindow *window,
if (autospell == NULL)
{
autospell = gedit_automatic_spell_checker_new (GTK_SOURCE_BUFFER (doc), spell);
- gedit_automatic_spell_checker_attach_view (autospell, view);
+ gedit_automatic_spell_checker_attach_view (autospell, GTK_TEXT_VIEW (view));
gedit_automatic_spell_checker_recheck_all (autospell);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]