[gedit] Port the spell plugin to gspell
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Port the spell plugin to gspell
- Date: Thu, 19 Nov 2015 19:50:08 +0000 (UTC)
commit 99f47410b8c8464b01fc58c0c30194fcdb195f5e
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Nov 19 17:24:57 2015 +0100
Port the spell plugin to gspell
The gspell code comes from gedit, so the port is quite straightforward.
https://wiki.gnome.org/Projects/gspell
configure.ac | 53 +-
plugins/spell/Makefile.am | 54 +-
plugins/spell/gedit-automatic-spell-checker.c | 1214 ---------------------
plugins/spell/gedit-automatic-spell-checker.h | 50 -
plugins/spell/gedit-spell-app-activatable.c | 2 +-
plugins/spell/gedit-spell-checker-dialog.c | 729 -------------
plugins/spell/gedit-spell-checker-dialog.h | 42 -
plugins/spell/gedit-spell-checker-language.c | 518 ---------
plugins/spell/gedit-spell-checker-language.h | 44 -
plugins/spell/gedit-spell-checker.c | 619 -----------
plugins/spell/gedit-spell-checker.h | 104 --
plugins/spell/gedit-spell-language-dialog.c | 220 ----
plugins/spell/gedit-spell-language-dialog.h | 44 -
plugins/spell/gedit-spell-navigator-gtv.c | 544 ---------
plugins/spell/gedit-spell-navigator-gtv.h | 47 -
plugins/spell/gedit-spell-navigator.c | 157 ---
plugins/spell/gedit-spell-navigator.h | 69 --
plugins/spell/gedit-spell-osx.c | 45 -
plugins/spell/gedit-spell-osx.h | 15 -
plugins/spell/gedit-spell-plugin.c | 186 ++--
plugins/spell/gedit-spell-utils.c | 89 --
plugins/spell/gedit-spell-utils.h | 37 -
plugins/spell/gtktextregion.c | 686 ------------
plugins/spell/gtktextregion.h | 98 --
plugins/spell/resources/gedit-spell.gresource.xml | 7 -
plugins/spell/resources/ui/languages-dialog.ui | 79 --
plugins/spell/resources/ui/spell-checker.ui | 252 -----
plugins/spell/spell.plugin.desktop.in | 4 +-
po/POTFILES.in | 11 -
29 files changed, 110 insertions(+), 5909 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cabb10c..d0cb79e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,8 +22,7 @@ GTK_REQUIRED=3.19.0
GTKSOURCEVIEW_REQUIRED=3.18
LIBPEAS_REQUIRED=1.14.1
LIBXML_REQUIRED=2.5.0
-ENCHANT_REQUIRED=1.2.0
-ISO_CODES_REQUIRED=0.35
+GSPELL_REQUIRED=0.1
PYGOBJECT_REQUIRED=3.0.0
AC_CONFIG_HEADERS(config.h)
@@ -233,48 +232,26 @@ fi
AM_CONDITIONAL(ENABLE_UPDATER, test x"$enable_updater" = "xyes")
dnl ================================================================
-dnl spell plugin checks: enchant and iso-codes
+dnl spell plugin checks
dnl ================================================================
AC_ARG_ENABLE([spell],
- AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
- [enable_enchant=$enableval],
- [enable_enchant=yes])
-
-if test "x$enable_enchant" = "xyes" ; then
-
- PKG_CHECK_MODULES(ENCHANT, enchant >= $ENCHANT_REQUIRED, \
- have_enchant=yes, have_enchant=no)
-
- if test "x$have_enchant" = "xyes"; then
-
- PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED],
- [have_iso_codes=yes],[have_iso_codes=no])
-
- if test "x$have_iso_codes" = "xyes"; then
- AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
- if $PKG_CONFIG --variable=domains iso-codes | grep 639 > /dev/null && \
- $PKG_CONFIG --variable=domains iso-codes | grep 3166 > /dev/null ; then
- result=yes
- else
- result=no
- have_iso_codes=no
- fi
- AC_MSG_RESULT([$result])
- fi
+ AS_HELP_STRING([--disable-spell],[Disable spell plugin (default: enabled)]),
+ [enable_spell=$enableval],
+ [enable_spell=yes])
- if test "x$have_iso_codes" = "xyes"; then
- AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix
iso-codes`"],[ISO codes prefix])
- else
- AC_MSG_ERROR([iso-codes is required to build the spell plugin. Use --disable-spell to
build without spell plugin.])
- fi
- else
- enable_enchant=no
- AC_MSG_ERROR([Enchant library not found or too old. Use --disable-spell to build without
spell plugin.])
+if test "x$enable_spell" = "xyes" ; then
+
+ PKG_CHECK_MODULES(GSPELL, gspell-1 >= $GSPELL_REQUIRED, \
+ have_gspell=yes, have_gspell=no)
+
+ if test "x$have_gspell" = "xno"; then
+ enable_spell=no
+ AC_MSG_ERROR([gspell library not found or too old. Use --disable-spell to build without spell
plugin.])
fi
fi
-AM_CONDITIONAL(ENABLE_ENCHANT, test x"$enable_enchant" = "xyes")
+AM_CONDITIONAL(ENABLE_SPELL, test x"$enable_spell" = "xyes")
dnl ================================================================
dnl Check Python support
@@ -477,7 +454,7 @@ Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
- Spell Plugin enabled: $enable_enchant
+ Spell Plugin enabled: $enable_spell
Gvfs metadata enabled: $enable_gvfs_metadata
Deprecations enabled: $enable_deprecations
GObject Introspection: $enable_introspection
diff --git a/plugins/spell/Makefile.am b/plugins/spell/Makefile.am
index 5d6d667..dabf36d 100644
--- a/plugins/spell/Makefile.am
+++ b/plugins/spell/Makefile.am
@@ -1,4 +1,4 @@
-if ENABLE_ENCHANT
+if ENABLE_SPELL
plugin_LTLIBRARIES += plugins/spell/libspell.la
@@ -6,70 +6,26 @@ plugins_spell_libspell_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
plugins_spell_libspell_la_LIBADD = \
$(top_builddir)/gedit/libgedit.la \
$(GEDIT_LIBS) \
- $(ENCHANT_LIBS)
+ $(GSPELL_LIBS)
plugins_spell_libspell_la_CPPFLAGS = \
-I$(top_srcdir) \
- -I$(top_builddir)/plugins/spell
+ -I$(top_srcdir)/plugins/spell
plugins_spell_libspell_la_CFLAGS = \
$(GEDIT_CFLAGS) \
- $(ENCHANT_CFLAGS) \
+ $(GSPELL_CFLAGS) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS)
-plugins_spell_built_sources = \
- plugins/spell/gedit-spell-resources.c
-
plugins_spell_libspell_la_SOURCES = \
plugins/spell/gedit-spell-plugin.c \
plugins/spell/gedit-spell-plugin.h \
plugins/spell/gedit-spell-app-activatable.c \
- plugins/spell/gedit-spell-app-activatable.h \
- plugins/spell/gedit-spell-checker.c \
- plugins/spell/gedit-spell-checker.h \
- plugins/spell/gedit-spell-checker-dialog.c \
- plugins/spell/gedit-spell-checker-dialog.h \
- plugins/spell/gedit-spell-checker-language.c \
- plugins/spell/gedit-spell-checker-language.h \
- plugins/spell/gedit-spell-language-dialog.c \
- plugins/spell/gedit-spell-language-dialog.h \
- plugins/spell/gedit-spell-navigator.c \
- plugins/spell/gedit-spell-navigator.h \
- plugins/spell/gedit-spell-navigator-gtv.c \
- plugins/spell/gedit-spell-navigator-gtv.h \
- plugins/spell/gedit-automatic-spell-checker.c \
- plugins/spell/gedit-automatic-spell-checker.h \
- plugins/spell/gedit-spell-utils.c \
- plugins/spell/gedit-spell-utils.h \
- plugins/spell/gtktextregion.c \
- plugins/spell/gtktextregion.h \
- $(plugins_spell_built_sources)
-
-# Mac OSX convenience library and ldflags
-if OS_OSX
-noinst_LTLIBRARIES += plugins/spell/libosx.la
-
-plugins_spell_libosx_la_LDFLAGS = -framework Cocoa $(GTK_MAC_LIBS)
-plugins_spell_libosx_la_CFLAGS = $(GEDIT_CFLAGS) $(GTK_MAC_CFLAGS) -xobjective-c
-
-plugins_spell_libosx_la_SOURCES = \
- plugins/spell/gedit-spell-osx.c \
- plugins/spell/gedit-spell-osx.h
-
-plugins_spell_libspell_la_LIBADD += plugins/spell/libosx.la
-endif
-
-spell_resource_deps = $(call GRESDEPS,plugins/spell/resources/gedit-spell.gresource.xml)
-plugins/spell/gedit-spell-resources.c: $(spell_resource_deps)
- $(GRESGEN)
+ plugins/spell/gedit-spell-app-activatable.h
plugin_in_files += plugins/spell/spell.plugin.desktop.in
-BUILT_SOURCES += $(plugins_spell_built_sources)
-
-EXTRA_DIST += $(spell_resource_deps)
-
else
dist_plugin_in_files += plugins/spell/spell.plugin.desktop.in
diff --git a/plugins/spell/gedit-spell-app-activatable.c b/plugins/spell/gedit-spell-app-activatable.c
index 73734e9..3d96e81 100644
--- a/plugins/spell/gedit-spell-app-activatable.c
+++ b/plugins/spell/gedit-spell-app-activatable.c
@@ -148,7 +148,7 @@ gedit_spell_app_activatable_activate (GeditAppActivatable *activatable)
gedit_menu_extension_append_menu_item (priv->menu_ext, item);
g_object_unref (item);
- item = g_menu_item_new (_("_Highlight Misspelled Words"), "win.auto-spell");
+ item = g_menu_item_new (_("_Highlight Misspelled Words"), "win.inline-checker");
gedit_menu_extension_append_menu_item (priv->menu_ext, item);
g_object_unref (item);
}
diff --git a/plugins/spell/gedit-spell-plugin.c b/plugins/spell/gedit-spell-plugin.c
index d282ee1..87b1ead 100644
--- a/plugins/spell/gedit-spell-plugin.c
+++ b/plugins/spell/gedit-spell-plugin.c
@@ -27,14 +27,9 @@
#include <gedit/gedit-window.h>
#include <gedit/gedit-window-activatable.h>
#include <gtksourceview/gtksource.h>
+#include <gspell/gspell.h>
-#include "gedit-automatic-spell-checker.h"
#include "gedit-spell-app-activatable.h"
-#include "gedit-spell-checker.h"
-#include "gedit-spell-checker-dialog.h"
-#include "gedit-spell-language-dialog.h"
-#include "gedit-spell-navigator-gtv.h"
-#include "gedit-spell-utils.h"
#ifdef G_OS_WIN32
#define GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE "spell-language"
@@ -65,7 +60,7 @@ struct _ViewData
{
GeditSpellPlugin *plugin;
GeditView *view;
- GeditAutomaticSpellChecker *auto_spell;
+ GspellInlineCheckerGtv *inline_checker;
/* The doc is also needed, to be sure that the signals are disconnected
* on the same doc.
@@ -89,18 +84,18 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED (GeditSpellPlugin,
static void spell_cb (GSimpleAction *action, GVariant *parameter, gpointer data);
static void set_language_cb (GSimpleAction *action, GVariant *parameter, gpointer data);
-static void auto_spell_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer data);
-static void auto_spell_change_state_cb (GSimpleAction *action, GVariant *state, gpointer data);
+static void inline_checker_activate_cb (GSimpleAction *action, GVariant *parameter, gpointer data);
+static void inline_checker_change_state_cb (GSimpleAction *action, GVariant *state, gpointer data);
static void on_document_loaded (GeditDocument *doc, ViewData *data);
static void on_document_saved (GeditDocument *doc, ViewData *data);
-static void set_auto_spell_from_metadata (ViewData *data);
+static void set_inline_checker_from_metadata (ViewData *data);
static GActionEntry action_entries[] =
{
{ "check-spell", spell_cb },
{ "config-spell", set_language_cb },
- { "auto-spell", auto_spell_activate_cb, NULL, "false", auto_spell_change_state_cb }
+ { "inline-checker", inline_checker_activate_cb, NULL, "false", inline_checker_change_state_cb }
};
static GQuark spell_checker_id = 0;
@@ -114,7 +109,7 @@ view_data_new (GeditSpellPlugin *plugin,
data = g_slice_new (ViewData);
data->plugin = g_object_ref (plugin);
data->view = g_object_ref (view);
- data->auto_spell = NULL;
+ data->inline_checker = NULL;
data->doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
g_object_ref (data->doc);
@@ -129,7 +124,7 @@ view_data_new (GeditSpellPlugin *plugin,
G_CALLBACK (on_document_saved),
data);
- set_auto_spell_from_metadata (data);
+ set_inline_checker_from_metadata (data);
return data;
}
@@ -150,15 +145,15 @@ view_data_free (ViewData *data)
g_object_unref (data->doc);
}
- if (data->auto_spell != NULL && data->view != NULL)
+ if (data->inline_checker != NULL && data->view != NULL)
{
- gedit_automatic_spell_checker_detach_view (data->auto_spell,
- GTK_TEXT_VIEW (data->view));
+ gspell_inline_checker_gtv_detach_view (data->inline_checker,
+ GTK_TEXT_VIEW (data->view));
}
g_clear_object (&data->plugin);
g_clear_object (&data->view);
- g_clear_object (&data->auto_spell);
+ g_clear_object (&data->inline_checker);
g_slice_free (ViewData, data);
}
@@ -224,19 +219,19 @@ gedit_spell_plugin_get_property (GObject *object,
}
static void
-language_notify_cb (GeditSpellChecker *checker,
- GParamSpec *pspec,
- GeditDocument *doc)
+language_notify_cb (GspellChecker *checker,
+ GParamSpec *pspec,
+ GeditDocument *doc)
{
- const GeditSpellCheckerLanguage *lang;
+ const GspellLanguage *lang;
const gchar *key;
g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
- lang = gedit_spell_checker_get_language (checker);
+ lang = gspell_checker_get_language (checker);
g_return_if_fail (lang != NULL);
- key = gedit_spell_checker_language_to_key (lang);
+ key = gspell_language_to_key (lang);
g_return_if_fail (key != NULL);
gedit_document_set_metadata (doc,
@@ -244,27 +239,27 @@ language_notify_cb (GeditSpellChecker *checker,
NULL);
}
-static const GeditSpellCheckerLanguage *
+static const GspellLanguage *
get_language_from_metadata (GeditDocument *doc)
{
- const GeditSpellCheckerLanguage *lang = NULL;
+ const GspellLanguage *lang = NULL;
gchar *value = NULL;
value = gedit_document_get_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE);
if (value != NULL)
{
- lang = gedit_spell_checker_language_from_key (value);
+ lang = gspell_language_from_key (value);
g_free (value);
}
return lang;
}
-static GeditSpellChecker *
+static GspellChecker *
get_spell_checker_from_document (GeditDocument *doc)
{
- GeditSpellChecker *checker;
+ GspellChecker *checker;
gpointer data;
gedit_debug (DEBUG_PLUGINS);
@@ -275,10 +270,10 @@ get_spell_checker_from_document (GeditDocument *doc)
if (data == NULL)
{
- const GeditSpellCheckerLanguage *lang;
+ const GspellLanguage *lang;
lang = get_language_from_metadata (doc);
- checker = gedit_spell_checker_new (lang);
+ checker = gspell_checker_new (lang);
g_object_set_qdata_full (G_OBJECT (doc),
spell_checker_id,
@@ -292,7 +287,7 @@ get_spell_checker_from_document (GeditDocument *doc)
}
else
{
- g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (data), NULL);
+ g_return_val_if_fail (GSPELL_IS_CHECKER (data), NULL);
checker = data;
}
@@ -300,9 +295,9 @@ get_spell_checker_from_document (GeditDocument *doc)
}
static void
-language_dialog_response (GtkDialog *dialog,
- gint response_id,
- GeditSpellChecker *checker)
+language_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
{
if (response_id == GTK_RESPONSE_HELP)
{
@@ -313,17 +308,6 @@ language_dialog_response (GtkDialog *dialog,
return;
}
- if (response_id == GTK_RESPONSE_OK)
- {
- const GeditSpellCheckerLanguage *lang;
-
- lang = gedit_spell_language_get_selected_language (GEDIT_SPELL_LANGUAGE_DIALOG (dialog));
- if (lang != NULL)
- {
- gedit_spell_checker_set_language (checker, lang);
- }
- }
-
gtk_widget_destroy (GTK_WIDGET (dialog));
}
@@ -335,8 +319,8 @@ set_language_cb (GSimpleAction *action,
GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (data);
GeditSpellPluginPrivate *priv;
GeditDocument *doc;
- GeditSpellChecker *checker;
- const GeditSpellCheckerLanguage *lang;
+ GspellChecker *checker;
+ const GspellLanguage *lang;
GtkWidget *dialog;
GtkWindowGroup *wg;
@@ -350,9 +334,13 @@ set_language_cb (GSimpleAction *action,
checker = get_spell_checker_from_document (doc);
g_return_if_fail (checker != NULL);
- lang = gedit_spell_checker_get_language (checker);
+ lang = gspell_checker_get_language (checker);
+
+ dialog = gspell_language_chooser_dialog_new (GTK_WINDOW (priv->window), lang);
- dialog = gedit_spell_language_dialog_new (GTK_WINDOW (priv->window), lang);
+ g_object_bind_property (dialog, "language",
+ checker, "language",
+ G_BINDING_DEFAULT);
wg = gedit_window_get_group (priv->window);
@@ -364,10 +352,10 @@ set_language_cb (GSimpleAction *action,
_("_Help"),
GTK_RESPONSE_HELP);
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (language_dialog_response),
- checker);
+ g_signal_connect_after (dialog,
+ "response",
+ G_CALLBACK (language_dialog_response_cb),
+ NULL);
gtk_widget_show (dialog);
}
@@ -381,8 +369,8 @@ spell_cb (GSimpleAction *action,
GeditSpellPluginPrivate *priv;
GeditView *view;
GeditDocument *doc;
- GeditSpellChecker *checker;
- GeditSpellNavigator *navigator;
+ GspellChecker *checker;
+ GspellNavigator *navigator;
GtkWidget *dialog;
gedit_debug (DEBUG_PLUGINS);
@@ -397,8 +385,8 @@ spell_cb (GSimpleAction *action,
checker = get_spell_checker_from_document (doc);
g_return_if_fail (checker != NULL);
- navigator = gedit_spell_navigator_gtv_new (GTK_TEXT_VIEW (view), checker);
- dialog = gedit_spell_checker_dialog_new (GTK_WINDOW (priv->window), navigator);
+ navigator = gspell_navigator_gtv_new (GTK_TEXT_VIEW (view), checker);
+ dialog = gspell_checker_dialog_new (GTK_WINDOW (priv->window), navigator);
g_object_unref (navigator);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
@@ -406,22 +394,22 @@ spell_cb (GSimpleAction *action,
}
static void
-set_auto_spell (ViewData *data,
- gboolean active)
+set_inline_checker (ViewData *data,
+ gboolean active)
{
if (!active)
{
- if (data->auto_spell != NULL && data->view != NULL)
+ if (data->inline_checker != NULL && data->view != NULL)
{
- gedit_automatic_spell_checker_detach_view (data->auto_spell,
- GTK_TEXT_VIEW (data->view));
+ gspell_inline_checker_gtv_detach_view (data->inline_checker,
+ GTK_TEXT_VIEW (data->view));
}
- g_clear_object (&data->auto_spell);
+ g_clear_object (&data->inline_checker);
}
- else if (data->auto_spell == NULL)
+ else if (data->inline_checker == NULL)
{
- GeditSpellChecker *checker;
+ GspellChecker *checker;
GtkTextBuffer *buffer;
checker = get_spell_checker_from_document (data->doc);
@@ -430,18 +418,18 @@ set_auto_spell (ViewData *data,
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->view));
g_return_if_fail (buffer == GTK_TEXT_BUFFER (data->doc));
- data->auto_spell = gedit_automatic_spell_checker_new (GTK_SOURCE_BUFFER (data->doc),
+ data->inline_checker = gspell_inline_checker_gtv_new (GTK_SOURCE_BUFFER (data->doc),
checker);
- gedit_automatic_spell_checker_attach_view (data->auto_spell,
- GTK_TEXT_VIEW (data->view));
+ gspell_inline_checker_gtv_attach_view (data->inline_checker,
+ GTK_TEXT_VIEW (data->view));
}
}
static void
-auto_spell_activate_cb (GSimpleAction *action,
- GVariant *parameter,
- gpointer data)
+inline_checker_activate_cb (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
{
GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (data);
GeditSpellPluginPrivate *priv = plugin->priv;
@@ -482,9 +470,9 @@ auto_spell_activate_cb (GSimpleAction *action,
}
static void
-auto_spell_change_state_cb (GSimpleAction *action,
- GVariant *state,
- gpointer data)
+inline_checker_change_state_cb (GSimpleAction *action,
+ GVariant *state,
+ gpointer data)
{
GeditSpellPlugin *plugin = GEDIT_SPELL_PLUGIN (data);
GeditSpellPluginPrivate *priv = plugin->priv;
@@ -495,7 +483,7 @@ auto_spell_change_state_cb (GSimpleAction *action,
active = g_variant_get_boolean (state);
- gedit_debug_message (DEBUG_PLUGINS, active ? "Auto Spell activated" : "Auto Spell deactivated");
+ gedit_debug_message (DEBUG_PLUGINS, active ? "Inline Checker activated" : "Inline Checker
deactivated");
view = gedit_window_get_active_view (priv->window);
if (view != NULL)
@@ -504,7 +492,7 @@ auto_spell_change_state_cb (GSimpleAction *action,
if (data != NULL)
{
- set_auto_spell (data, active);
+ set_inline_checker (data, active);
}
g_simple_action_set_state (action, g_variant_new_boolean (active));
@@ -518,7 +506,7 @@ update_ui (GeditSpellPlugin *plugin)
GeditView *view;
GAction *check_spell_action;
GAction *config_spell_action;
- GAction *auto_spell_action;
+ GAction *inline_checker_action;
gedit_debug (DEBUG_PLUGINS);
@@ -538,9 +526,9 @@ update_ui (GeditSpellPlugin *plugin)
(view != NULL) &&
gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
- auto_spell_action = g_action_map_lookup_action (G_ACTION_MAP (priv->window),
- "auto-spell");
- g_simple_action_set_enabled (G_SIMPLE_ACTION (auto_spell_action),
+ inline_checker_action = g_action_map_lookup_action (G_ACTION_MAP (priv->window),
+ "inline-checker");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (inline_checker_action),
(view != NULL) &&
gtk_text_view_get_editable (GTK_TEXT_VIEW (view)));
@@ -553,18 +541,18 @@ update_ui (GeditSpellPlugin *plugin)
g_return_if_fail (gedit_tab_get_view (tab) == view);
/* If the document is loading we can't get the metadata so we
- * endup with an useless speller.
+ * endup with a useless speller.
*/
if (gedit_tab_get_state (tab) == GEDIT_TAB_STATE_NORMAL)
{
ViewData *data;
- gboolean auto_spell_enabled;
+ gboolean inline_checker_enabled;
data = g_object_get_data (G_OBJECT (view), VIEW_DATA_KEY);
- auto_spell_enabled = data != NULL && data->auto_spell != NULL;
+ inline_checker_enabled = data != NULL && data->inline_checker != NULL;
- g_action_change_state (auto_spell_action,
- g_variant_new_boolean (auto_spell_enabled));
+ g_action_change_state (inline_checker_action,
+ g_variant_new_boolean (inline_checker_enabled));
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
@@ -575,7 +563,7 @@ update_ui (GeditSpellPlugin *plugin)
}
static void
-set_auto_spell_from_metadata (ViewData *data)
+set_inline_checker_from_metadata (ViewData *data)
{
GeditSpellPlugin *plugin = data->plugin;
gboolean active = FALSE;
@@ -589,7 +577,7 @@ set_auto_spell_from_metadata (ViewData *data)
g_free (active_str);
}
- set_auto_spell (data, active);
+ set_inline_checker (data, active);
/* In case that the view is the active one we mark the spell action */
active_view = gedit_window_get_active_view (plugin->priv->window);
@@ -599,7 +587,7 @@ set_auto_spell_from_metadata (ViewData *data)
GAction *action;
action = g_action_map_lookup_action (G_ACTION_MAP (plugin->priv->window),
- "auto-spell");
+ "inline-checker");
g_action_change_state (action, g_variant_new_boolean (active));
}
}
@@ -608,41 +596,41 @@ static void
on_document_loaded (GeditDocument *doc,
ViewData *data)
{
- GeditSpellChecker *checker;
+ GspellChecker *checker;
+
+ checker = GSPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc), spell_checker_id));
- checker = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc),
- spell_checker_id));
if (checker != NULL)
{
- const GeditSpellCheckerLanguage *lang;
+ const GspellLanguage *lang;
lang = get_language_from_metadata (doc);
if (lang != NULL)
{
g_signal_handlers_block_by_func (checker, language_notify_cb, doc);
- gedit_spell_checker_set_language (checker, lang);
+ gspell_checker_set_language (checker, lang);
g_signal_handlers_unblock_by_func (checker, language_notify_cb, doc);
}
}
- set_auto_spell_from_metadata (data);
+ set_inline_checker_from_metadata (data);
}
static void
on_document_saved (GeditDocument *doc,
ViewData *data)
{
- GeditSpellChecker *checker;
+ GspellChecker *checker;
const gchar *key;
/* Make sure to save the metadata here too */
- checker = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc), spell_checker_id));
+ checker = GSPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc), spell_checker_id));
if (checker != NULL)
{
- key = gedit_spell_checker_language_to_key (gedit_spell_checker_get_language (checker));
+ key = gspell_language_to_key (gspell_checker_get_language (checker));
}
else
{
@@ -651,7 +639,7 @@ on_document_saved (GeditDocument *doc,
gedit_document_set_metadata (doc,
GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED,
- data->auto_spell != NULL ? SPELL_ENABLED_STR : NULL,
+ data->inline_checker != NULL ? SPELL_ENABLED_STR : NULL,
GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE,
key,
NULL);
@@ -743,7 +731,7 @@ gedit_spell_plugin_deactivate (GeditWindowActivatable *activatable)
g_action_map_remove_action (G_ACTION_MAP (priv->window),
"config-spell");
g_action_map_remove_action (G_ACTION_MAP (priv->window),
- "auto-spell");
+ "inline-checker");
g_signal_handler_disconnect (priv->window, priv->tab_added_id);
g_signal_handler_disconnect (priv->window, priv->tab_removed_id);
diff --git a/plugins/spell/spell.plugin.desktop.in b/plugins/spell/spell.plugin.desktop.in
index c03830f..2f13d0d 100644
--- a/plugins/spell/spell.plugin.desktop.in
+++ b/plugins/spell/spell.plugin.desktop.in
@@ -4,6 +4,6 @@ IAge=3
_Name=Spell Checker
_Description=Checks the spelling of the current document.
Icon=gtk-spell-check
-Authors=Paolo Maggi <paolo gnome org>
-Copyright=Copyright © 2002-2005 Paolo Maggi
+Authors=Paolo Maggi <paolo gnome org>;Sébastien Wilmet <swilmet gnome org>
+Copyright=Copyright © 2002-2005 Paolo Maggi;Copyright © 2015 Sébastien Wilmet
Website=http://www.gedit.org
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2f0d0ce..c6c81e8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -105,19 +105,8 @@ plugins/snippets/snippets/windowactivatable.py
plugins/sort/gedit-sort-plugin.c
[type: gettext/glade]plugins/sort/resources/ui/gedit-sort-plugin.ui
plugins/sort/sort.plugin.desktop.in
-plugins/spell/gedit-automatic-spell-checker.c
plugins/spell/gedit-spell-app-activatable.c
-plugins/spell/gedit-spell-checker.c
-plugins/spell/gedit-spell-checker-dialog.c
-plugins/spell/gedit-spell-checker-language.c
-plugins/spell/gedit-spell-language-dialog.c
-plugins/spell/gedit-spell-navigator.c
-plugins/spell/gedit-spell-navigator.h
-plugins/spell/gedit-spell-navigator-gtv.c
-plugins/spell/gedit-spell-navigator-gtv.h
plugins/spell/gedit-spell-plugin.c
-[type: gettext/glade]plugins/spell/resources/ui/languages-dialog.ui
-[type: gettext/glade]plugins/spell/resources/ui/spell-checker.ui
plugins/spell/spell.plugin.desktop.in
plugins/time/gedit-time-plugin.c
[type: gettext/gsettings]plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]