Rename Pluma to Xedit
This commit is contained in:
@@ -1,57 +1,57 @@
|
||||
# Spell checker plugin
|
||||
plugindir = $(PLUMA_PLUGINS_LIBS_DIR)
|
||||
plugindir = $(XEDIT_PLUGINS_LIBS_DIR)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(PLUMA_CFLAGS) \
|
||||
$(XEDIT_CFLAGS) \
|
||||
$(ENCHANT_CFLAGS) \
|
||||
$(WARN_CFLAGS) \
|
||||
$(DISABLE_DEPRECATED_CFLAGS)
|
||||
|
||||
BUILT_SOURCES = \
|
||||
pluma-spell-marshal.c \
|
||||
pluma-spell-marshal.h
|
||||
xedit-spell-marshal.c \
|
||||
xedit-spell-marshal.h
|
||||
|
||||
plugin_LTLIBRARIES = libspell.la
|
||||
|
||||
libspell_la_SOURCES = \
|
||||
pluma-spell-plugin.c \
|
||||
pluma-spell-plugin.h \
|
||||
pluma-spell-checker.c \
|
||||
pluma-spell-checker.h \
|
||||
pluma-spell-checker-dialog.c \
|
||||
pluma-spell-checker-dialog.h \
|
||||
pluma-spell-checker-language.c \
|
||||
pluma-spell-checker-language.h \
|
||||
pluma-spell-language-dialog.c \
|
||||
pluma-spell-language-dialog.h \
|
||||
pluma-automatic-spell-checker.c \
|
||||
pluma-automatic-spell-checker.h \
|
||||
pluma-spell-utils.c \
|
||||
pluma-spell-utils.h \
|
||||
xedit-spell-plugin.c \
|
||||
xedit-spell-plugin.h \
|
||||
xedit-spell-checker.c \
|
||||
xedit-spell-checker.h \
|
||||
xedit-spell-checker-dialog.c \
|
||||
xedit-spell-checker-dialog.h \
|
||||
xedit-spell-checker-language.c \
|
||||
xedit-spell-checker-language.h \
|
||||
xedit-spell-language-dialog.c \
|
||||
xedit-spell-language-dialog.h \
|
||||
xedit-automatic-spell-checker.c \
|
||||
xedit-automatic-spell-checker.h \
|
||||
xedit-spell-utils.c \
|
||||
xedit-spell-utils.h \
|
||||
$(BUILT_SOURCES)
|
||||
|
||||
libspell_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
|
||||
libspell_la_LIBADD = $(PLUMA_LIBS) $(ENCHANT_LIBS)
|
||||
libspell_la_LIBADD = $(XEDIT_LIBS) $(ENCHANT_LIBS)
|
||||
|
||||
uidir = $(PLUMA_PLUGINS_DATA_DIR)/spell
|
||||
ui_DATA = spell-checker.ui languages-dialog.ui pluma-spell-setup-dialog.ui
|
||||
uidir = $(XEDIT_PLUGINS_DATA_DIR)/spell
|
||||
ui_DATA = spell-checker.ui languages-dialog.ui xedit-spell-setup-dialog.ui
|
||||
|
||||
pluma-spell-marshal.h: pluma-spell-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=pluma_marshal > $@
|
||||
xedit-spell-marshal.h: xedit-spell-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=xedit_marshal > $@
|
||||
|
||||
pluma-spell-marshal.c: pluma-spell-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) echo "#include \"pluma-spell-marshal.h\"" > $@ && \
|
||||
$(GLIB_GENMARSHAL) $< --body --prefix=pluma_marshal >> $@
|
||||
xedit-spell-marshal.c: xedit-spell-marshal.list $(GLIB_GENMARSHAL)
|
||||
$(AM_V_GEN) echo "#include \"xedit-spell-marshal.h\"" > $@ && \
|
||||
$(GLIB_GENMARSHAL) $< --body --prefix=xedit_marshal >> $@
|
||||
|
||||
plugin_in_files = spell.pluma-plugin.desktop.in
|
||||
plugin_in_files = spell.xedit-plugin.desktop.in
|
||||
|
||||
%.pluma-plugin: %.pluma-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
%.xedit-plugin: %.xedit-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
|
||||
|
||||
plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
|
||||
plugin_DATA = $(plugin_in_files:.xedit-plugin.desktop.in=.xedit-plugin)
|
||||
|
||||
@INTLTOOL_XML_NOMERGE_RULE@
|
||||
spell_gschema_in = org.mate.pluma.plugins.spell.gschema.xml.in
|
||||
spell_gschema_in = org.x.editor.plugins.spell.gschema.xml.in
|
||||
gsettings_SCHEMAS = $(spell_gschema_in:.xml.in=.xml)
|
||||
@GSETTINGS_RULES@
|
||||
|
||||
@@ -59,7 +59,7 @@ gsettings_SCHEMAS = $(spell_gschema_in:.xml.in=.xml)
|
||||
EXTRA_DIST = \
|
||||
$(ui_DATA) \
|
||||
$(plugin_in_files) \
|
||||
pluma-spell-marshal.list \
|
||||
xedit-spell-marshal.list \
|
||||
$(spell_gschema_in)
|
||||
|
||||
CLEANFILES = $(BUILT_SOURCES) $(plugin_DATA) $(gsettings_SCHEMAS)
|
||||
|
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="@GETTEXT_PACKAGE@">
|
||||
<enum id="org.mate.pluma.plugins.spell.AutocheckType">
|
||||
<enum id="org.x.editor.plugins.spell.AutocheckType">
|
||||
<value value="0" nick="never"/>
|
||||
<value value="1" nick="document"/>
|
||||
<value value="2" nick="always"/>
|
||||
</enum>
|
||||
<schema path="/org/mate/pluma/plugins/spell/" id="org.mate.pluma.plugins.spell">
|
||||
<key name="autocheck-type" enum="org.mate.pluma.plugins.spell.AutocheckType">
|
||||
<schema path="/org.x.editor/plugins/spell/" id="org.x.editor.plugins.spell">
|
||||
<key name="autocheck-type" enum="org.x.editor.plugins.spell.AutocheckType">
|
||||
<default>'document'</default>
|
||||
<summary>Autocheck Type</summary>
|
||||
</key>
|
@@ -1,67 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-automatic-spell-checker.h
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
/* This is a modified version of gtkspell 2.0.2 (gtkspell.sf.net) */
|
||||
/* gtkspell - a spell-checking addon for GTK's TextView widget
|
||||
* Copyright (c) 2002 Evan Martin.
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_AUTOMATIC_SPELL_CHECKER_H__
|
||||
#define __PLUMA_AUTOMATIC_SPELL_CHECKER_H__
|
||||
|
||||
#include <pluma/pluma-document.h>
|
||||
#include <pluma/pluma-view.h>
|
||||
|
||||
#include "pluma-spell-checker.h"
|
||||
|
||||
typedef struct _PlumaAutomaticSpellChecker PlumaAutomaticSpellChecker;
|
||||
|
||||
PlumaAutomaticSpellChecker *pluma_automatic_spell_checker_new (
|
||||
PlumaDocument *doc,
|
||||
PlumaSpellChecker *checker);
|
||||
|
||||
PlumaAutomaticSpellChecker *pluma_automatic_spell_checker_get_from_document (
|
||||
const PlumaDocument *doc);
|
||||
|
||||
void pluma_automatic_spell_checker_free (
|
||||
PlumaAutomaticSpellChecker *spell);
|
||||
|
||||
void pluma_automatic_spell_checker_attach_view (
|
||||
PlumaAutomaticSpellChecker *spell,
|
||||
PlumaView *view);
|
||||
|
||||
void pluma_automatic_spell_checker_detach_view (
|
||||
PlumaAutomaticSpellChecker *spell,
|
||||
PlumaView *view);
|
||||
|
||||
void pluma_automatic_spell_checker_recheck_all (
|
||||
PlumaAutomaticSpellChecker *spell);
|
||||
|
||||
#endif /* __PLUMA_AUTOMATIC_SPELL_CHECKER_H__ */
|
||||
|
@@ -1,92 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-checker-dialog.h
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_SPELL_CHECKER_DIALOG_H__
|
||||
#define __PLUMA_SPELL_CHECKER_DIALOG_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "pluma-spell-checker.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PLUMA_TYPE_SPELL_CHECKER_DIALOG (pluma_spell_checker_dialog_get_type ())
|
||||
#define PLUMA_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_SPELL_CHECKER_DIALOG, PlumaSpellCheckerDialog))
|
||||
#define PLUMA_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUMA_TYPE_SPELL_CHECKER_DIALOG, PlumaSpellCheckerDialog))
|
||||
#define PLUMA_IS_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUMA_TYPE_SPELL_CHECKER_DIALOG))
|
||||
#define PLUMA_IS_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_SPELL_CHECKER_DIALOG))
|
||||
#define PLUMA_SPELL_CHECKER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLUMA_TYPE_SPELL_CHECKER_DIALOG, PlumaSpellCheckerDialog))
|
||||
|
||||
|
||||
typedef struct _PlumaSpellCheckerDialog PlumaSpellCheckerDialog;
|
||||
|
||||
typedef struct _PlumaSpellCheckerDialogClass PlumaSpellCheckerDialogClass;
|
||||
|
||||
struct _PlumaSpellCheckerDialogClass
|
||||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*ignore) (PlumaSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
void (*ignore_all) (PlumaSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
void (*change) (PlumaSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
const gchar *change_to);
|
||||
void (*change_all) (PlumaSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
const gchar *change_to);
|
||||
void (*add_word_to_personal) (PlumaSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
|
||||
};
|
||||
|
||||
GType pluma_spell_checker_dialog_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Constructors */
|
||||
GtkWidget *pluma_spell_checker_dialog_new (const gchar *data_dir);
|
||||
GtkWidget *pluma_spell_checker_dialog_new_from_spell_checker
|
||||
(PlumaSpellChecker *spell,
|
||||
const gchar *data_dir);
|
||||
|
||||
void pluma_spell_checker_dialog_set_spell_checker
|
||||
(PlumaSpellCheckerDialog *dlg,
|
||||
PlumaSpellChecker *spell);
|
||||
void pluma_spell_checker_dialog_set_misspelled_word
|
||||
(PlumaSpellCheckerDialog *dlg,
|
||||
const gchar* word,
|
||||
gint len);
|
||||
|
||||
void pluma_spell_checker_dialog_set_completed
|
||||
(PlumaSpellCheckerDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PLUMA_SPELL_CHECKER_DIALOG_H__ */
|
||||
|
@@ -1,109 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-checker.h
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2002-2006 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_SPELL_CHECKER_H__
|
||||
#define __PLUMA_SPELL_CHECKER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "pluma-spell-checker-language.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PLUMA_TYPE_SPELL_CHECKER (pluma_spell_checker_get_type ())
|
||||
#define PLUMA_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_SPELL_CHECKER, PlumaSpellChecker))
|
||||
#define PLUMA_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUMA_TYPE_SPELL_CHECKER, PlumaSpellChecker))
|
||||
#define PLUMA_IS_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUMA_TYPE_SPELL_CHECKER))
|
||||
#define PLUMA_IS_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_SPELL_CHECKER))
|
||||
#define PLUMA_SPELL_CHECKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLUMA_TYPE_SPELL_CHECKER, PlumaSpellChecker))
|
||||
|
||||
typedef struct _PlumaSpellChecker PlumaSpellChecker;
|
||||
|
||||
typedef struct _PlumaSpellCheckerClass PlumaSpellCheckerClass;
|
||||
|
||||
struct _PlumaSpellCheckerClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*add_word_to_personal) (PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gint len);
|
||||
|
||||
void (*add_word_to_session) (PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gint len);
|
||||
|
||||
void (*set_language) (PlumaSpellChecker *spell,
|
||||
const PlumaSpellCheckerLanguage *lang);
|
||||
|
||||
void (*clear_session) (PlumaSpellChecker *spell);
|
||||
};
|
||||
|
||||
|
||||
GType pluma_spell_checker_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Constructors */
|
||||
PlumaSpellChecker *pluma_spell_checker_new (void);
|
||||
|
||||
gboolean pluma_spell_checker_set_language (PlumaSpellChecker *spell,
|
||||
const PlumaSpellCheckerLanguage *lang);
|
||||
const PlumaSpellCheckerLanguage
|
||||
*pluma_spell_checker_get_language (PlumaSpellChecker *spell);
|
||||
|
||||
gboolean pluma_spell_checker_check_word (PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
GSList *pluma_spell_checker_get_suggestions (PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean pluma_spell_checker_add_word_to_personal
|
||||
(PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean pluma_spell_checker_add_word_to_session
|
||||
(PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean pluma_spell_checker_clear_session (PlumaSpellChecker *spell);
|
||||
|
||||
gboolean pluma_spell_checker_set_correction (PlumaSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize w_len,
|
||||
const gchar *replacement,
|
||||
gssize r_len);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PLUMA_SPELL_CHECKER_H__ */
|
||||
|
@@ -1,67 +0,0 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-language-dialog.h
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_SPELL_LANGUAGE_DIALOG_H__
|
||||
#define __PLUMA_SPELL_LANGUAGE_DIALOG_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "pluma-spell-checker-language.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PLUMA_TYPE_SPELL_LANGUAGE_DIALOG (pluma_spell_language_dialog_get_type())
|
||||
#define PLUMA_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_SPELL_LANGUAGE_DIALOG, PlumaSpellLanguageDialog))
|
||||
#define PLUMA_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_SPELL_LANGUAGE_DIALOG, PlumaSpellLanguageDialogClass))
|
||||
#define PLUMA_IS_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_SPELL_LANGUAGE_DIALOG))
|
||||
#define PLUMA_IS_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_SPELL_LANGUAGE_DIALOG))
|
||||
#define PLUMA_SPELL_LANGUAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_SPELL_LANGUAGE_DIALOG, PlumaSpellLanguageDialogClass))
|
||||
|
||||
|
||||
typedef struct _PlumaSpellLanguageDialog PlumaSpellLanguageDialog;
|
||||
|
||||
typedef struct _PlumaSpellLanguageDialogClass PlumaSpellLanguageDialogClass;
|
||||
|
||||
struct _PlumaSpellLanguageDialogClass
|
||||
{
|
||||
GtkDialogClass parent_class;
|
||||
};
|
||||
|
||||
GType pluma_spell_language_dialog_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *pluma_spell_language_dialog_new (GtkWindow *parent,
|
||||
const PlumaSpellCheckerLanguage *cur_lang,
|
||||
const gchar *data_dir);
|
||||
|
||||
const PlumaSpellCheckerLanguage *
|
||||
pluma_spell_language_get_selected_language (PlumaSpellLanguageDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PLUMA_SPELL_LANGUAGE_DIALOG_H__ */
|
||||
|
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* pluma-spell-plugin.h
|
||||
*
|
||||
* Copyright (C) 2002-2005 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_SPELL_PLUGIN_H__
|
||||
#define __PLUMA_SPELL_PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <pluma/pluma-plugin.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define PLUMA_TYPE_SPELL_PLUGIN (pluma_spell_plugin_get_type ())
|
||||
#define PLUMA_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PLUMA_TYPE_SPELL_PLUGIN, PlumaSpellPlugin))
|
||||
#define PLUMA_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PLUMA_TYPE_SPELL_PLUGIN, PlumaSpellPluginClass))
|
||||
#define PLUMA_IS_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PLUMA_TYPE_SPELL_PLUGIN))
|
||||
#define PLUMA_IS_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PLUMA_TYPE_SPELL_PLUGIN))
|
||||
#define PLUMA_SPELL_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PLUMA_TYPE_SPELL_PLUGIN, PlumaSpellPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _PlumaSpellPluginPrivate PlumaSpellPluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _PlumaSpellPlugin PlumaSpellPlugin;
|
||||
|
||||
struct _PlumaSpellPlugin
|
||||
{
|
||||
PlumaPlugin parent_instance;
|
||||
|
||||
PlumaSpellPluginPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _PlumaSpellPluginClass PlumaSpellPluginClass;
|
||||
|
||||
struct _PlumaSpellPluginClass
|
||||
{
|
||||
PlumaPluginClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType pluma_spell_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_pluma_plugin (GTypeModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PLUMA_SPELL_PLUGIN_H__ */
|
@@ -1,4 +1,4 @@
|
||||
[Pluma Plugin]
|
||||
[Xedit Plugin]
|
||||
Module=spell
|
||||
IAge=2
|
||||
_Name=Spell Checker
|
@@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-automatic-spell-checker.c
|
||||
* This file is part of pluma
|
||||
* xedit-automatic-spell-checker.c
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
@@ -40,11 +40,11 @@
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "pluma-automatic-spell-checker.h"
|
||||
#include "pluma-spell-utils.h"
|
||||
#include "xedit-automatic-spell-checker.h"
|
||||
#include "xedit-spell-utils.h"
|
||||
|
||||
struct _PlumaAutomaticSpellChecker {
|
||||
PlumaDocument *doc;
|
||||
struct _XeditAutomaticSpellChecker {
|
||||
XeditDocument *doc;
|
||||
GSList *views;
|
||||
|
||||
GtkTextMark *mark_insert_start;
|
||||
@@ -54,22 +54,22 @@ struct _PlumaAutomaticSpellChecker {
|
||||
GtkTextTag *tag_highlight;
|
||||
GtkTextMark *mark_click;
|
||||
|
||||
PlumaSpellChecker *spell_checker;
|
||||
XeditSpellChecker *spell_checker;
|
||||
};
|
||||
|
||||
static GQuark automatic_spell_checker_id = 0;
|
||||
static GQuark suggestion_id = 0;
|
||||
|
||||
static void pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell);
|
||||
static void xedit_automatic_spell_checker_free_internal (XeditAutomaticSpellChecker *spell);
|
||||
|
||||
static void
|
||||
view_destroy (PlumaView *view, PlumaAutomaticSpellChecker *spell)
|
||||
view_destroy (XeditView *view, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
pluma_automatic_spell_checker_detach_view (spell, view);
|
||||
xedit_automatic_spell_checker_detach_view (spell, view);
|
||||
}
|
||||
|
||||
static void
|
||||
check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end)
|
||||
check_word (XeditAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
@@ -80,7 +80,7 @@ check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *
|
||||
gtk_text_iter_get_offset (end));
|
||||
*/
|
||||
|
||||
if (!pluma_spell_checker_check_word (spell->spell_checker, word, -1))
|
||||
if (!xedit_spell_checker_check_word (spell->spell_checker, word, -1))
|
||||
{
|
||||
/*
|
||||
g_print ("Apply tag: [%d - %d]\n", gtk_text_iter_get_offset (start),
|
||||
@@ -96,7 +96,7 @@ check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *
|
||||
}
|
||||
|
||||
static void
|
||||
check_range (PlumaAutomaticSpellChecker *spell,
|
||||
check_range (XeditAutomaticSpellChecker *spell,
|
||||
GtkTextIter start,
|
||||
GtkTextIter end,
|
||||
gboolean force_all)
|
||||
@@ -164,7 +164,7 @@ check_range (PlumaAutomaticSpellChecker *spell,
|
||||
|
||||
wstart = start;
|
||||
|
||||
while (pluma_spell_utils_skip_no_spell_check (&wstart, &end) &&
|
||||
while (xedit_spell_utils_skip_no_spell_check (&wstart, &end) &&
|
||||
gtk_text_iter_compare (&wstart, &end) < 0)
|
||||
{
|
||||
gboolean inword;
|
||||
@@ -208,7 +208,7 @@ check_range (PlumaAutomaticSpellChecker *spell,
|
||||
}
|
||||
|
||||
static void
|
||||
check_deferred_range (PlumaAutomaticSpellChecker *spell,
|
||||
check_deferred_range (XeditAutomaticSpellChecker *spell,
|
||||
gboolean force_all)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
@@ -232,14 +232,14 @@ check_deferred_range (PlumaAutomaticSpellChecker *spell,
|
||||
|
||||
static void
|
||||
insert_text_before (GtkTextBuffer *buffer, GtkTextIter *iter,
|
||||
gchar *text, gint len, PlumaAutomaticSpellChecker *spell)
|
||||
gchar *text, gint len, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
gtk_text_buffer_move_mark (buffer, spell->mark_insert_start, iter);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter,
|
||||
gchar *text, gint len, PlumaAutomaticSpellChecker *spell)
|
||||
gchar *text, gint len, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter start;
|
||||
|
||||
@@ -260,7 +260,7 @@ insert_text_after (GtkTextBuffer *buffer, GtkTextIter *iter,
|
||||
|
||||
static void
|
||||
delete_range_after (GtkTextBuffer *buffer, GtkTextIter *start, GtkTextIter *end,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
check_range (spell, *start, *end, FALSE);
|
||||
}
|
||||
@@ -269,7 +269,7 @@ static void
|
||||
mark_set (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
GtkTextMark *mark,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
/* if the cursor has moved and there is a deferred check so handle it now */
|
||||
if ((mark == gtk_text_buffer_get_insert (buffer)) && spell->deferred_check)
|
||||
@@ -294,7 +294,7 @@ get_word_extents_from_mark (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
static void
|
||||
remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word)
|
||||
remove_tag_to_word (XeditAutomaticSpellChecker *spell, const gchar *word)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextIter match_start, match_end;
|
||||
@@ -331,7 +331,7 @@ remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word)
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
add_to_dictionary (GtkWidget *menuitem, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
@@ -344,13 +344,13 @@ add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
&end,
|
||||
FALSE);
|
||||
|
||||
pluma_spell_checker_add_word_to_personal (spell->spell_checker, word, -1);
|
||||
xedit_spell_checker_add_word_to_personal (spell->spell_checker, word, -1);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
ignore_all (GtkWidget *menuitem, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
@@ -363,13 +363,13 @@ ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
&end,
|
||||
FALSE);
|
||||
|
||||
pluma_spell_checker_add_word_to_session (spell->spell_checker, word, -1);
|
||||
xedit_spell_checker_add_word_to_session (spell->spell_checker, word, -1);
|
||||
|
||||
g_free (word);
|
||||
}
|
||||
|
||||
static void
|
||||
replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
replace_word (GtkWidget *menuitem, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *oldword;
|
||||
const gchar *newword;
|
||||
@@ -390,7 +390,7 @@ replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
|
||||
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (spell->doc));
|
||||
|
||||
pluma_spell_checker_set_correction (spell->spell_checker,
|
||||
xedit_spell_checker_set_correction (spell->spell_checker,
|
||||
oldword, strlen (oldword),
|
||||
newword, strlen (newword));
|
||||
|
||||
@@ -398,7 +398,7 @@ replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word)
|
||||
build_suggestion_menu (XeditAutomaticSpellChecker *spell, const gchar *word)
|
||||
{
|
||||
GtkWidget *topmenu, *menu;
|
||||
GtkWidget *mi;
|
||||
@@ -408,7 +408,7 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word)
|
||||
|
||||
topmenu = menu = gtk_menu_new();
|
||||
|
||||
suggestions = pluma_spell_checker_get_suggestions (spell->spell_checker, word, -1);
|
||||
suggestions = xedit_spell_checker_get_suggestions (spell->spell_checker, word, -1);
|
||||
|
||||
list = suggestions;
|
||||
|
||||
@@ -533,7 +533,7 @@ build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word)
|
||||
}
|
||||
|
||||
static void
|
||||
populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker *spell)
|
||||
populate_popup (GtkTextView *textview, GtkMenu *menu, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkWidget *img, *mi;
|
||||
GtkTextIter start, end;
|
||||
@@ -567,7 +567,7 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker
|
||||
}
|
||||
|
||||
void
|
||||
pluma_automatic_spell_checker_recheck_all (PlumaAutomaticSpellChecker *spell)
|
||||
xedit_automatic_spell_checker_recheck_all (XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
@@ -579,10 +579,10 @@ pluma_automatic_spell_checker_recheck_all (PlumaAutomaticSpellChecker *spell)
|
||||
}
|
||||
|
||||
static void
|
||||
add_word_signal_cb (PlumaSpellChecker *checker,
|
||||
add_word_signal_cb (XeditSpellChecker *checker,
|
||||
const gchar *word,
|
||||
gint len,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
gchar *w;
|
||||
|
||||
@@ -597,18 +597,18 @@ add_word_signal_cb (PlumaSpellChecker *checker,
|
||||
}
|
||||
|
||||
static void
|
||||
set_language_cb (PlumaSpellChecker *checker,
|
||||
const PlumaSpellCheckerLanguage *lang,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
set_language_cb (XeditSpellChecker *checker,
|
||||
const XeditSpellCheckerLanguage *lang,
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
pluma_automatic_spell_checker_recheck_all (spell);
|
||||
xedit_automatic_spell_checker_recheck_all (spell);
|
||||
}
|
||||
|
||||
static void
|
||||
clear_session_cb (PlumaSpellChecker *checker,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
clear_session_cb (XeditSpellChecker *checker,
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
pluma_automatic_spell_checker_recheck_all (spell);
|
||||
xedit_automatic_spell_checker_recheck_all (spell);
|
||||
}
|
||||
|
||||
/* When the user right-clicks on a word, they want to check that word.
|
||||
@@ -618,7 +618,7 @@ clear_session_cb (PlumaSpellChecker *checker,
|
||||
static gboolean
|
||||
button_press_event (GtkTextView *view,
|
||||
GdkEventButton *event,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
if (event->button == 3)
|
||||
{
|
||||
@@ -649,7 +649,7 @@ button_press_event (GtkTextView *view,
|
||||
* will contain the wrong set of suggestions.
|
||||
*/
|
||||
static gboolean
|
||||
popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell)
|
||||
popup_menu_event (GtkTextView *view, XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextBuffer *buffer;
|
||||
@@ -669,7 +669,7 @@ popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell)
|
||||
|
||||
static void
|
||||
tag_table_changed (GtkTextTagTable *table,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
g_return_if_fail (spell->tag_highlight != NULL);
|
||||
|
||||
@@ -680,7 +680,7 @@ tag_table_changed (GtkTextTagTable *table,
|
||||
static void
|
||||
tag_added_or_removed (GtkTextTagTable *table,
|
||||
GtkTextTag *tag,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
tag_table_changed (table, spell);
|
||||
}
|
||||
@@ -689,7 +689,7 @@ static void
|
||||
tag_changed (GtkTextTagTable *table,
|
||||
GtkTextTag *tag,
|
||||
gboolean size_changed,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
tag_table_changed (table, spell);
|
||||
}
|
||||
@@ -698,33 +698,33 @@ static void
|
||||
highlight_updated (GtkSourceBuffer *buffer,
|
||||
GtkTextIter *start,
|
||||
GtkTextIter *end,
|
||||
PlumaAutomaticSpellChecker *spell)
|
||||
XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
check_range (spell, *start, *end, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
spell_tag_destroyed (PlumaAutomaticSpellChecker *spell,
|
||||
spell_tag_destroyed (XeditAutomaticSpellChecker *spell,
|
||||
GObject *where_the_object_was)
|
||||
{
|
||||
spell->tag_highlight = NULL;
|
||||
}
|
||||
|
||||
PlumaAutomaticSpellChecker *
|
||||
pluma_automatic_spell_checker_new (PlumaDocument *doc,
|
||||
PlumaSpellChecker *checker)
|
||||
XeditAutomaticSpellChecker *
|
||||
xedit_automatic_spell_checker_new (XeditDocument *doc,
|
||||
XeditSpellChecker *checker)
|
||||
{
|
||||
PlumaAutomaticSpellChecker *spell;
|
||||
XeditAutomaticSpellChecker *spell;
|
||||
GtkTextTagTable *tag_table;
|
||||
GtkTextIter start, end;
|
||||
|
||||
g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), NULL);
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (checker), NULL);
|
||||
g_return_val_if_fail ((spell = pluma_automatic_spell_checker_get_from_document (doc)) == NULL,
|
||||
g_return_val_if_fail (XEDIT_IS_DOCUMENT (doc), NULL);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (checker), NULL);
|
||||
g_return_val_if_fail ((spell = xedit_automatic_spell_checker_get_from_document (doc)) == NULL,
|
||||
spell);
|
||||
|
||||
/* attach to the widget */
|
||||
spell = g_new0 (PlumaAutomaticSpellChecker, 1);
|
||||
spell = g_new0 (XeditAutomaticSpellChecker, 1);
|
||||
|
||||
spell->doc = doc;
|
||||
spell->spell_checker = g_object_ref (checker);
|
||||
@@ -732,17 +732,17 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc,
|
||||
if (automatic_spell_checker_id == 0)
|
||||
{
|
||||
automatic_spell_checker_id =
|
||||
g_quark_from_string ("PlumaAutomaticSpellCheckerID");
|
||||
g_quark_from_string ("XeditAutomaticSpellCheckerID");
|
||||
}
|
||||
if (suggestion_id == 0)
|
||||
{
|
||||
suggestion_id = g_quark_from_string ("PlumaAutoSuggestionID");
|
||||
suggestion_id = g_quark_from_string ("XeditAutoSuggestionID");
|
||||
}
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (doc),
|
||||
automatic_spell_checker_id,
|
||||
spell,
|
||||
(GDestroyNotify)pluma_automatic_spell_checker_free_internal);
|
||||
(GDestroyNotify)xedit_automatic_spell_checker_free_internal);
|
||||
|
||||
g_signal_connect (doc,
|
||||
"insert-text",
|
||||
@@ -816,13 +816,13 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc,
|
||||
gtk_text_buffer_get_bounds (GTK_TEXT_BUFFER (doc), &start, &end);
|
||||
|
||||
spell->mark_insert_start = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
|
||||
"pluma-automatic-spell-checker-insert-start");
|
||||
"xedit-automatic-spell-checker-insert-start");
|
||||
|
||||
if (spell->mark_insert_start == NULL)
|
||||
{
|
||||
spell->mark_insert_start =
|
||||
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
"pluma-automatic-spell-checker-insert-start",
|
||||
"xedit-automatic-spell-checker-insert-start",
|
||||
&start,
|
||||
TRUE);
|
||||
}
|
||||
@@ -834,13 +834,13 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc,
|
||||
}
|
||||
|
||||
spell->mark_insert_end = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
|
||||
"pluma-automatic-spell-checker-insert-end");
|
||||
"xedit-automatic-spell-checker-insert-end");
|
||||
|
||||
if (spell->mark_insert_end == NULL)
|
||||
{
|
||||
spell->mark_insert_end =
|
||||
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
"pluma-automatic-spell-checker-insert-end",
|
||||
"xedit-automatic-spell-checker-insert-end",
|
||||
&start,
|
||||
TRUE);
|
||||
}
|
||||
@@ -852,13 +852,13 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc,
|
||||
}
|
||||
|
||||
spell->mark_click = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
|
||||
"pluma-automatic-spell-checker-click");
|
||||
"xedit-automatic-spell-checker-click");
|
||||
|
||||
if (spell->mark_click == NULL)
|
||||
{
|
||||
spell->mark_click =
|
||||
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
|
||||
"pluma-automatic-spell-checker-click",
|
||||
"xedit-automatic-spell-checker-click",
|
||||
&start,
|
||||
TRUE);
|
||||
}
|
||||
@@ -874,10 +874,10 @@ pluma_automatic_spell_checker_new (PlumaDocument *doc,
|
||||
return spell;
|
||||
}
|
||||
|
||||
PlumaAutomaticSpellChecker *
|
||||
pluma_automatic_spell_checker_get_from_document (const PlumaDocument *doc)
|
||||
XeditAutomaticSpellChecker *
|
||||
xedit_automatic_spell_checker_get_from_document (const XeditDocument *doc)
|
||||
{
|
||||
g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), NULL);
|
||||
g_return_val_if_fail (XEDIT_IS_DOCUMENT (doc), NULL);
|
||||
|
||||
if (automatic_spell_checker_id == 0)
|
||||
return NULL;
|
||||
@@ -886,10 +886,10 @@ pluma_automatic_spell_checker_get_from_document (const PlumaDocument *doc)
|
||||
}
|
||||
|
||||
void
|
||||
pluma_automatic_spell_checker_free (PlumaAutomaticSpellChecker *spell)
|
||||
xedit_automatic_spell_checker_free (XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
g_return_if_fail (spell != NULL);
|
||||
g_return_if_fail (pluma_automatic_spell_checker_get_from_document (spell->doc) == spell);
|
||||
g_return_if_fail (xedit_automatic_spell_checker_get_from_document (spell->doc) == spell);
|
||||
|
||||
if (automatic_spell_checker_id == 0)
|
||||
return;
|
||||
@@ -898,7 +898,7 @@ pluma_automatic_spell_checker_free (PlumaAutomaticSpellChecker *spell)
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell)
|
||||
xedit_automatic_spell_checker_free_internal (XeditAutomaticSpellChecker *spell)
|
||||
{
|
||||
GtkTextTagTable *table;
|
||||
GtkTextIter start, end;
|
||||
@@ -941,7 +941,7 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell)
|
||||
list = spell->views;
|
||||
while (list != NULL)
|
||||
{
|
||||
PlumaView *view = PLUMA_VIEW (list->data);
|
||||
XeditView *view = XEDIT_VIEW (list->data);
|
||||
|
||||
g_signal_handlers_disconnect_matched (G_OBJECT (view),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
@@ -962,12 +962,12 @@ pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell)
|
||||
}
|
||||
|
||||
void
|
||||
pluma_automatic_spell_checker_attach_view (
|
||||
PlumaAutomaticSpellChecker *spell,
|
||||
PlumaView *view)
|
||||
xedit_automatic_spell_checker_attach_view (
|
||||
XeditAutomaticSpellChecker *spell,
|
||||
XeditView *view)
|
||||
{
|
||||
g_return_if_fail (spell != NULL);
|
||||
g_return_if_fail (PLUMA_IS_VIEW (view));
|
||||
g_return_if_fail (XEDIT_IS_VIEW (view));
|
||||
|
||||
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
|
||||
GTK_TEXT_BUFFER (spell->doc));
|
||||
@@ -993,12 +993,12 @@ pluma_automatic_spell_checker_attach_view (
|
||||
}
|
||||
|
||||
void
|
||||
pluma_automatic_spell_checker_detach_view (
|
||||
PlumaAutomaticSpellChecker *spell,
|
||||
PlumaView *view)
|
||||
xedit_automatic_spell_checker_detach_view (
|
||||
XeditAutomaticSpellChecker *spell,
|
||||
XeditView *view)
|
||||
{
|
||||
g_return_if_fail (spell != NULL);
|
||||
g_return_if_fail (PLUMA_IS_VIEW (view));
|
||||
g_return_if_fail (XEDIT_IS_VIEW (view));
|
||||
|
||||
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
|
||||
GTK_TEXT_BUFFER (spell->doc));
|
67
plugins/spell/xedit-automatic-spell-checker.h
Normal file
67
plugins/spell/xedit-automatic-spell-checker.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xedit-automatic-spell-checker.h
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
/* This is a modified version of gtkspell 2.0.2 (gtkspell.sf.net) */
|
||||
/* gtkspell - a spell-checking addon for GTK's TextView widget
|
||||
* Copyright (c) 2002 Evan Martin.
|
||||
*/
|
||||
|
||||
#ifndef __XEDIT_AUTOMATIC_SPELL_CHECKER_H__
|
||||
#define __XEDIT_AUTOMATIC_SPELL_CHECKER_H__
|
||||
|
||||
#include <xedit/xedit-document.h>
|
||||
#include <xedit/xedit-view.h>
|
||||
|
||||
#include "xedit-spell-checker.h"
|
||||
|
||||
typedef struct _XeditAutomaticSpellChecker XeditAutomaticSpellChecker;
|
||||
|
||||
XeditAutomaticSpellChecker *xedit_automatic_spell_checker_new (
|
||||
XeditDocument *doc,
|
||||
XeditSpellChecker *checker);
|
||||
|
||||
XeditAutomaticSpellChecker *xedit_automatic_spell_checker_get_from_document (
|
||||
const XeditDocument *doc);
|
||||
|
||||
void xedit_automatic_spell_checker_free (
|
||||
XeditAutomaticSpellChecker *spell);
|
||||
|
||||
void xedit_automatic_spell_checker_attach_view (
|
||||
XeditAutomaticSpellChecker *spell,
|
||||
XeditView *view);
|
||||
|
||||
void xedit_automatic_spell_checker_detach_view (
|
||||
XeditAutomaticSpellChecker *spell,
|
||||
XeditView *view);
|
||||
|
||||
void xedit_automatic_spell_checker_recheck_all (
|
||||
XeditAutomaticSpellChecker *spell);
|
||||
|
||||
#endif /* __XEDIT_AUTOMATIC_SPELL_CHECKER_H__ */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-checker-dialog.c
|
||||
* This file is part of pluma
|
||||
* xedit-spell-checker-dialog.c
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
@@ -34,15 +34,15 @@
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <pluma/pluma-utils.h>
|
||||
#include "pluma-spell-checker-dialog.h"
|
||||
#include "pluma-spell-marshal.h"
|
||||
#include <xedit/xedit-utils.h>
|
||||
#include "xedit-spell-checker-dialog.h"
|
||||
#include "xedit-spell-marshal.h"
|
||||
|
||||
struct _PlumaSpellCheckerDialog
|
||||
struct _XeditSpellCheckerDialog
|
||||
{
|
||||
GtkWindow parent_instance;
|
||||
|
||||
PlumaSpellChecker *spell_checker;
|
||||
XeditSpellChecker *spell_checker;
|
||||
|
||||
gchar *misspelled_word;
|
||||
|
||||
@@ -77,41 +77,41 @@ enum
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg,
|
||||
static void update_suggestions_list_model (XeditSpellCheckerDialog *dlg,
|
||||
GSList *suggestions);
|
||||
|
||||
static void word_entry_changed_handler (GtkEditable *editable,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void close_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void check_word_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void add_word_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void ignore_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void ignore_all_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void change_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void change_all_button_clicked_handler (GtkButton *button,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
static void suggestions_list_row_activated_handler (GtkTreeView *view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
PlumaSpellCheckerDialog *dlg);
|
||||
XeditSpellCheckerDialog *dlg);
|
||||
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE(PlumaSpellCheckerDialog, pluma_spell_checker_dialog, GTK_TYPE_WINDOW)
|
||||
G_DEFINE_TYPE(XeditSpellCheckerDialog, xedit_spell_checker_dialog, GTK_TYPE_WINDOW)
|
||||
|
||||
static void
|
||||
pluma_spell_checker_dialog_dispose (GObject *object)
|
||||
xedit_spell_checker_dialog_dispose (GObject *object)
|
||||
{
|
||||
PlumaSpellCheckerDialog *dlg = PLUMA_SPELL_CHECKER_DIALOG (object);
|
||||
XeditSpellCheckerDialog *dlg = XEDIT_SPELL_CHECKER_DIALOG (object);
|
||||
|
||||
if (dlg->spell_checker != NULL)
|
||||
{
|
||||
@@ -125,25 +125,25 @@ pluma_spell_checker_dialog_dispose (GObject *object)
|
||||
dlg->misspelled_word = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (pluma_spell_checker_dialog_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (xedit_spell_checker_dialog_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
|
||||
xedit_spell_checker_dialog_class_init (XeditSpellCheckerDialogClass * klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = pluma_spell_checker_dialog_dispose;
|
||||
object_class->dispose = xedit_spell_checker_dialog_dispose;
|
||||
|
||||
signals[IGNORE] =
|
||||
g_signal_new ("ignore",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerDialogClass, ignore),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING,
|
||||
xedit_marshal_VOID__STRING,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_STRING);
|
||||
@@ -152,9 +152,9 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
|
||||
g_signal_new ("ignore_all",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore_all),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerDialogClass, ignore_all),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING,
|
||||
xedit_marshal_VOID__STRING,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_STRING);
|
||||
@@ -163,9 +163,9 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
|
||||
g_signal_new ("change",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerDialogClass, change),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING_STRING,
|
||||
xedit_marshal_VOID__STRING_STRING,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
@@ -175,9 +175,9 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
|
||||
g_signal_new ("change_all",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change_all),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerDialogClass, change_all),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING_STRING,
|
||||
xedit_marshal_VOID__STRING_STRING,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
@@ -187,16 +187,16 @@ pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
|
||||
g_signal_new ("add_word_to_personal",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, add_word_to_personal),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerDialogClass, add_word_to_personal),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING,
|
||||
xedit_marshal_VOID__STRING,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_STRING);
|
||||
}
|
||||
|
||||
static void
|
||||
create_dialog (PlumaSpellCheckerDialog *dlg,
|
||||
create_dialog (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
GtkWidget *error_widget;
|
||||
@@ -223,7 +223,7 @@ create_dialog (PlumaSpellCheckerDialog *dlg,
|
||||
dlg->misspelled_word = NULL;
|
||||
|
||||
ui_file = g_build_filename (data_dir, "spell-checker.ui", NULL);
|
||||
ret = pluma_utils_get_ui_objects (ui_file,
|
||||
ret = xedit_utils_get_ui_objects (ui_file,
|
||||
root_objects,
|
||||
&error_widget,
|
||||
|
||||
@@ -321,17 +321,17 @@ create_dialog (PlumaSpellCheckerDialog *dlg,
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_checker_dialog_init (PlumaSpellCheckerDialog *dlg)
|
||||
xedit_spell_checker_dialog_init (XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
pluma_spell_checker_dialog_new (const gchar *data_dir)
|
||||
xedit_spell_checker_dialog_new (const gchar *data_dir)
|
||||
{
|
||||
PlumaSpellCheckerDialog *dlg;
|
||||
XeditSpellCheckerDialog *dlg;
|
||||
|
||||
dlg = PLUMA_SPELL_CHECKER_DIALOG (
|
||||
g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL));
|
||||
dlg = XEDIT_SPELL_CHECKER_DIALOG (
|
||||
g_object_new (XEDIT_TYPE_SPELL_CHECKER_DIALOG, NULL));
|
||||
|
||||
g_return_val_if_fail (dlg != NULL, NULL);
|
||||
|
||||
@@ -341,33 +341,33 @@ pluma_spell_checker_dialog_new (const gchar *data_dir)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
pluma_spell_checker_dialog_new_from_spell_checker (PlumaSpellChecker *spell,
|
||||
xedit_spell_checker_dialog_new_from_spell_checker (XeditSpellChecker *spell,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
PlumaSpellCheckerDialog *dlg;
|
||||
XeditSpellCheckerDialog *dlg;
|
||||
|
||||
g_return_val_if_fail (spell != NULL, NULL);
|
||||
|
||||
dlg = PLUMA_SPELL_CHECKER_DIALOG (
|
||||
g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL));
|
||||
dlg = XEDIT_SPELL_CHECKER_DIALOG (
|
||||
g_object_new (XEDIT_TYPE_SPELL_CHECKER_DIALOG, NULL));
|
||||
|
||||
g_return_val_if_fail (dlg != NULL, NULL);
|
||||
|
||||
create_dialog (dlg, data_dir);
|
||||
|
||||
pluma_spell_checker_dialog_set_spell_checker (dlg, spell);
|
||||
xedit_spell_checker_dialog_set_spell_checker (dlg, spell);
|
||||
|
||||
return GTK_WIDGET (dlg);
|
||||
}
|
||||
|
||||
void
|
||||
pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, PlumaSpellChecker *spell)
|
||||
xedit_spell_checker_dialog_set_spell_checker (XeditSpellCheckerDialog *dlg, XeditSpellChecker *spell)
|
||||
{
|
||||
const PlumaSpellCheckerLanguage* language;
|
||||
const XeditSpellCheckerLanguage* language;
|
||||
const gchar *lang;
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (spell != NULL);
|
||||
|
||||
if (dlg->spell_checker != NULL)
|
||||
@@ -376,16 +376,16 @@ pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, Plum
|
||||
dlg->spell_checker = spell;
|
||||
g_object_ref (dlg->spell_checker);
|
||||
|
||||
language = pluma_spell_checker_get_language (dlg->spell_checker);
|
||||
language = xedit_spell_checker_get_language (dlg->spell_checker);
|
||||
|
||||
lang = pluma_spell_checker_language_to_string (language);
|
||||
lang = xedit_spell_checker_language_to_string (language);
|
||||
tmp = g_strdup_printf("<b>%s</b>", lang);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (dlg->language_label), tmp);
|
||||
g_free (tmp);
|
||||
|
||||
if (dlg->misspelled_word != NULL)
|
||||
pluma_spell_checker_dialog_set_misspelled_word (dlg, dlg->misspelled_word, -1);
|
||||
xedit_spell_checker_dialog_set_misspelled_word (dlg, dlg->misspelled_word, -1);
|
||||
else
|
||||
gtk_list_store_clear (GTK_LIST_STORE (dlg->suggestions_list_model));
|
||||
|
||||
@@ -393,18 +393,18 @@ pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, Plum
|
||||
}
|
||||
|
||||
void
|
||||
pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg,
|
||||
xedit_spell_checker_dialog_set_misspelled_word (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
gint len)
|
||||
{
|
||||
gchar *tmp;
|
||||
GSList *sug;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (word != NULL);
|
||||
|
||||
g_return_if_fail (dlg->spell_checker != NULL);
|
||||
g_return_if_fail (!pluma_spell_checker_check_word (dlg->spell_checker, word, -1));
|
||||
g_return_if_fail (!xedit_spell_checker_check_word (dlg->spell_checker, word, -1));
|
||||
|
||||
/* build_suggestions_list */
|
||||
if (dlg->misspelled_word != NULL)
|
||||
@@ -416,7 +416,7 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg,
|
||||
gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp);
|
||||
g_free (tmp);
|
||||
|
||||
sug = pluma_spell_checker_get_suggestions (dlg->spell_checker,
|
||||
sug = xedit_spell_checker_get_suggestions (dlg->spell_checker,
|
||||
dlg->misspelled_word,
|
||||
-1);
|
||||
|
||||
@@ -432,13 +432,13 @@ pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg,
|
||||
}
|
||||
|
||||
static void
|
||||
update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions)
|
||||
update_suggestions_list_model (XeditSpellCheckerDialog *dlg, GSList *suggestions)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (dlg->suggestions_list_model));
|
||||
|
||||
store = GTK_LIST_STORE (dlg->suggestions_list_model);
|
||||
@@ -482,11 +482,11 @@ update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions
|
||||
}
|
||||
|
||||
static void
|
||||
word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg)
|
||||
word_entry_changed_handler (GtkEditable *editable, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *text;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
|
||||
@@ -505,22 +505,22 @@ word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg)
|
||||
}
|
||||
|
||||
static void
|
||||
close_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
close_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (dlg));
|
||||
}
|
||||
|
||||
static void
|
||||
suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
|
||||
PlumaSpellCheckerDialog *dlg)
|
||||
XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
const gchar *text;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
@@ -537,18 +537,18 @@ suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
|
||||
}
|
||||
|
||||
static void
|
||||
check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
check_word_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *word;
|
||||
gssize len;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
word = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
len = strlen (word);
|
||||
g_return_if_fail (len > 0);
|
||||
|
||||
if (pluma_spell_checker_check_word (dlg->spell_checker, word, len))
|
||||
if (xedit_spell_checker_check_word (dlg->spell_checker, word, len))
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
@@ -568,7 +568,7 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d
|
||||
{
|
||||
GSList *sug;
|
||||
|
||||
sug = pluma_spell_checker_get_suggestions (dlg->spell_checker,
|
||||
sug = xedit_spell_checker_get_suggestions (dlg->spell_checker,
|
||||
word,
|
||||
len);
|
||||
|
||||
@@ -581,14 +581,14 @@ check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d
|
||||
}
|
||||
|
||||
static void
|
||||
add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
add_word_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
pluma_spell_checker_add_word_to_personal (dlg->spell_checker,
|
||||
xedit_spell_checker_add_word_to_personal (dlg->spell_checker,
|
||||
dlg->misspelled_word,
|
||||
-1);
|
||||
|
||||
@@ -600,11 +600,11 @@ add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
ignore_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
word = g_strdup (dlg->misspelled_word);
|
||||
@@ -615,14 +615,14 @@ ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
}
|
||||
|
||||
static void
|
||||
ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
ignore_all_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
pluma_spell_checker_add_word_to_session (dlg->spell_checker,
|
||||
xedit_spell_checker_add_word_to_session (dlg->spell_checker,
|
||||
dlg->misspelled_word,
|
||||
-1);
|
||||
|
||||
@@ -634,13 +634,13 @@ ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d
|
||||
}
|
||||
|
||||
static void
|
||||
change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
change_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *entry_text;
|
||||
gchar *change;
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
@@ -648,7 +648,7 @@ change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
g_return_if_fail (*entry_text != '\0');
|
||||
change = g_strdup (entry_text);
|
||||
|
||||
pluma_spell_checker_set_correction (dlg->spell_checker,
|
||||
xedit_spell_checker_set_correction (dlg->spell_checker,
|
||||
dlg->misspelled_word, -1,
|
||||
change, -1);
|
||||
|
||||
@@ -665,21 +665,21 @@ static void
|
||||
suggestions_list_row_activated_handler (GtkTreeView *view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
PlumaSpellCheckerDialog *dlg)
|
||||
XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
change_button_clicked_handler (GTK_BUTTON (dlg->change_button), dlg);
|
||||
}
|
||||
|
||||
static void
|
||||
change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
|
||||
change_all_button_clicked_handler (GtkButton *button, XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
const gchar *entry_text;
|
||||
gchar *change;
|
||||
gchar *word;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (dlg->misspelled_word != NULL);
|
||||
|
||||
entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->word_entry));
|
||||
@@ -687,7 +687,7 @@ change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d
|
||||
g_return_if_fail (*entry_text != '\0');
|
||||
change = g_strdup (entry_text);
|
||||
|
||||
pluma_spell_checker_set_correction (dlg->spell_checker,
|
||||
xedit_spell_checker_set_correction (dlg->spell_checker,
|
||||
dlg->misspelled_word, -1,
|
||||
change, -1);
|
||||
|
||||
@@ -700,11 +700,11 @@ change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *d
|
||||
}
|
||||
|
||||
void
|
||||
pluma_spell_checker_dialog_set_completed (PlumaSpellCheckerDialog *dlg)
|
||||
xedit_spell_checker_dialog_set_completed (XeditSpellCheckerDialog *dlg)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
|
||||
|
||||
tmp = g_strdup_printf("<b>%s</b>", _("Completed spell checking"));
|
||||
gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label),
|
92
plugins/spell/xedit-spell-checker-dialog.h
Normal file
92
plugins/spell/xedit-spell-checker-dialog.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xedit-spell-checker-dialog.h
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XEDIT_SPELL_CHECKER_DIALOG_H__
|
||||
#define __XEDIT_SPELL_CHECKER_DIALOG_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "xedit-spell-checker.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XEDIT_TYPE_SPELL_CHECKER_DIALOG (xedit_spell_checker_dialog_get_type ())
|
||||
#define XEDIT_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XEDIT_TYPE_SPELL_CHECKER_DIALOG, XeditSpellCheckerDialog))
|
||||
#define XEDIT_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XEDIT_TYPE_SPELL_CHECKER_DIALOG, XeditSpellCheckerDialog))
|
||||
#define XEDIT_IS_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XEDIT_TYPE_SPELL_CHECKER_DIALOG))
|
||||
#define XEDIT_IS_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XEDIT_TYPE_SPELL_CHECKER_DIALOG))
|
||||
#define XEDIT_SPELL_CHECKER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XEDIT_TYPE_SPELL_CHECKER_DIALOG, XeditSpellCheckerDialog))
|
||||
|
||||
|
||||
typedef struct _XeditSpellCheckerDialog XeditSpellCheckerDialog;
|
||||
|
||||
typedef struct _XeditSpellCheckerDialogClass XeditSpellCheckerDialogClass;
|
||||
|
||||
struct _XeditSpellCheckerDialogClass
|
||||
{
|
||||
GtkWindowClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*ignore) (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
void (*ignore_all) (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
void (*change) (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
const gchar *change_to);
|
||||
void (*change_all) (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *word,
|
||||
const gchar *change_to);
|
||||
void (*add_word_to_personal) (XeditSpellCheckerDialog *dlg,
|
||||
const gchar *word);
|
||||
|
||||
};
|
||||
|
||||
GType xedit_spell_checker_dialog_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Constructors */
|
||||
GtkWidget *xedit_spell_checker_dialog_new (const gchar *data_dir);
|
||||
GtkWidget *xedit_spell_checker_dialog_new_from_spell_checker
|
||||
(XeditSpellChecker *spell,
|
||||
const gchar *data_dir);
|
||||
|
||||
void xedit_spell_checker_dialog_set_spell_checker
|
||||
(XeditSpellCheckerDialog *dlg,
|
||||
XeditSpellChecker *spell);
|
||||
void xedit_spell_checker_dialog_set_misspelled_word
|
||||
(XeditSpellCheckerDialog *dlg,
|
||||
const gchar* word,
|
||||
gint len);
|
||||
|
||||
void xedit_spell_checker_dialog_set_completed
|
||||
(XeditSpellCheckerDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XEDIT_SPELL_CHECKER_DIALOG_H__ */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-checker-language.c
|
||||
* This file is part of pluma
|
||||
* xedit-spell-checker-language.c
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2006 Paolo Maggi
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2006. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* Modified by the xedit Team, 2006. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
@@ -43,16 +43,16 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
#include "pluma-spell-checker-language.h"
|
||||
#include "xedit-spell-checker-language.h"
|
||||
|
||||
#include <pluma/pluma-debug.h>
|
||||
#include <xedit/xedit-debug.h>
|
||||
|
||||
#define ISO_639_DOMAIN "iso_639"
|
||||
#define ISO_3166_DOMAIN "iso_3166"
|
||||
|
||||
#define ISOCODESLOCALEDIR ISO_CODES_PREFIX "/share/locale"
|
||||
|
||||
struct _PlumaSpellCheckerLanguage
|
||||
struct _XeditSpellCheckerLanguage
|
||||
{
|
||||
gchar *abrev;
|
||||
gchar *name;
|
||||
@@ -154,7 +154,7 @@ load_iso_entries (int iso,
|
||||
char *filename;
|
||||
int ret = -1;
|
||||
|
||||
pluma_debug_message (DEBUG_PLUGINS, "Loading ISO-%d codes", iso);
|
||||
xedit_debug_message (DEBUG_PLUGINS, "Loading ISO-%d codes", iso);
|
||||
|
||||
filename = g_strdup_printf (ISO_CODES_PREFIX "/share/xml/iso-codes/iso_%d.xml", iso);
|
||||
reader = xmlNewTextReaderFilename (filename);
|
||||
@@ -331,8 +331,8 @@ key_cmp (gconstpointer a, gconstpointer b, gpointer user_data)
|
||||
}
|
||||
|
||||
static gint
|
||||
lang_cmp (const PlumaSpellCheckerLanguage *a,
|
||||
const PlumaSpellCheckerLanguage *b)
|
||||
lang_cmp (const XeditSpellCheckerLanguage *a,
|
||||
const XeditSpellCheckerLanguage *b)
|
||||
{
|
||||
return g_utf8_collate (a->name, b->name);
|
||||
}
|
||||
@@ -342,7 +342,7 @@ build_langs_list (const gchar *key,
|
||||
const gchar *value,
|
||||
gpointer data)
|
||||
{
|
||||
PlumaSpellCheckerLanguage *lang = g_new (PlumaSpellCheckerLanguage, 1);
|
||||
XeditSpellCheckerLanguage *lang = g_new (XeditSpellCheckerLanguage, 1);
|
||||
|
||||
lang->abrev = g_strdup (key);
|
||||
lang->name = g_strdup (value);
|
||||
@@ -355,7 +355,7 @@ build_langs_list (const gchar *key,
|
||||
}
|
||||
|
||||
const GSList *
|
||||
pluma_spell_checker_get_available_languages (void)
|
||||
xedit_spell_checker_get_available_languages (void)
|
||||
{
|
||||
EnchantBroker *broker;
|
||||
GTree *dicts;
|
||||
@@ -397,7 +397,7 @@ pluma_spell_checker_get_available_languages (void)
|
||||
}
|
||||
|
||||
const gchar *
|
||||
pluma_spell_checker_language_to_string (const PlumaSpellCheckerLanguage *lang)
|
||||
xedit_spell_checker_language_to_string (const XeditSpellCheckerLanguage *lang)
|
||||
{
|
||||
if (lang == NULL)
|
||||
/* Translators: this refers the Default language used by the
|
||||
@@ -409,25 +409,25 @@ pluma_spell_checker_language_to_string (const PlumaSpellCheckerLanguage *lang)
|
||||
}
|
||||
|
||||
const gchar *
|
||||
pluma_spell_checker_language_to_key (const PlumaSpellCheckerLanguage *lang)
|
||||
xedit_spell_checker_language_to_key (const XeditSpellCheckerLanguage *lang)
|
||||
{
|
||||
g_return_val_if_fail (lang != NULL, NULL);
|
||||
|
||||
return lang->abrev;
|
||||
}
|
||||
|
||||
const PlumaSpellCheckerLanguage *
|
||||
pluma_spell_checker_language_from_key (const gchar *key)
|
||||
const XeditSpellCheckerLanguage *
|
||||
xedit_spell_checker_language_from_key (const gchar *key)
|
||||
{
|
||||
const GSList *langs;
|
||||
|
||||
g_return_val_if_fail (key != NULL, NULL);
|
||||
|
||||
langs = pluma_spell_checker_get_available_languages ();
|
||||
langs = xedit_spell_checker_get_available_languages ();
|
||||
|
||||
while (langs != NULL)
|
||||
{
|
||||
const PlumaSpellCheckerLanguage *l = (const PlumaSpellCheckerLanguage *)langs->data;
|
||||
const XeditSpellCheckerLanguage *l = (const XeditSpellCheckerLanguage *)langs->data;
|
||||
|
||||
if (g_ascii_strcasecmp (key, l->abrev) == 0)
|
||||
return l;
|
@@ -1,7 +1,7 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-checker-language.h
|
||||
* This file is part of pluma
|
||||
* xedit-spell-checker-language.h
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2006 Paolo Maggi
|
||||
*
|
||||
@@ -22,30 +22,30 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2006. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* Modified by the xedit Team, 2006. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_SPELL_CHECKER_LANGUAGE_H__
|
||||
#define __PLUMA_SPELL_CHECKER_LANGUAGE_H__
|
||||
#ifndef __XEDIT_SPELL_CHECKER_LANGUAGE_H__
|
||||
#define __XEDIT_SPELL_CHECKER_LANGUAGE_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _PlumaSpellCheckerLanguage PlumaSpellCheckerLanguage;
|
||||
typedef struct _XeditSpellCheckerLanguage XeditSpellCheckerLanguage;
|
||||
|
||||
const gchar *pluma_spell_checker_language_to_string (const PlumaSpellCheckerLanguage *lang);
|
||||
const gchar *xedit_spell_checker_language_to_string (const XeditSpellCheckerLanguage *lang);
|
||||
|
||||
const gchar *pluma_spell_checker_language_to_key (const PlumaSpellCheckerLanguage *lang);
|
||||
const gchar *xedit_spell_checker_language_to_key (const XeditSpellCheckerLanguage *lang);
|
||||
|
||||
const PlumaSpellCheckerLanguage *pluma_spell_checker_language_from_key (const gchar *key);
|
||||
const XeditSpellCheckerLanguage *xedit_spell_checker_language_from_key (const gchar *key);
|
||||
|
||||
/* GSList contains "PlumaSpellCheckerLanguage*" items */
|
||||
const GSList *pluma_spell_checker_get_available_languages
|
||||
/* GSList contains "XeditSpellCheckerLanguage*" items */
|
||||
const GSList *xedit_spell_checker_get_available_languages
|
||||
(void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PLUMA_SPELL_CHECKER_LANGUAGE_H__ */
|
||||
#endif /* __XEDIT_SPELL_CHECKER_LANGUAGE_H__ */
|
@@ -1,7 +1,7 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-checker.c
|
||||
* This file is part of pluma
|
||||
* xedit-spell-checker.c
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002-2006 Paolo Maggi
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002-2006. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* Modified by the xedit Team, 2002-2006. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
@@ -38,17 +38,17 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "pluma-spell-checker.h"
|
||||
#include "pluma-spell-utils.h"
|
||||
#include "pluma-spell-marshal.h"
|
||||
#include "xedit-spell-checker.h"
|
||||
#include "xedit-spell-utils.h"
|
||||
#include "xedit-spell-marshal.h"
|
||||
|
||||
struct _PlumaSpellChecker
|
||||
struct _XeditSpellChecker
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
EnchantDict *dict;
|
||||
EnchantBroker *broker;
|
||||
const PlumaSpellCheckerLanguage *active_lang;
|
||||
const XeditSpellCheckerLanguage *active_lang;
|
||||
};
|
||||
|
||||
/* GObject properties */
|
||||
@@ -69,16 +69,16 @@ enum {
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE(PlumaSpellChecker, pluma_spell_checker, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE(XeditSpellChecker, xedit_spell_checker, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
pluma_spell_checker_set_property (GObject *object,
|
||||
xedit_spell_checker_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
/*
|
||||
PlumaSpellChecker *spell = PLUMA_SPELL_CHECKER (object);
|
||||
XeditSpellChecker *spell = XEDIT_SPELL_CHECKER (object);
|
||||
*/
|
||||
|
||||
switch (prop_id)
|
||||
@@ -92,13 +92,13 @@ pluma_spell_checker_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_checker_get_property (GObject *object,
|
||||
xedit_spell_checker_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
/*
|
||||
PlumaSpellChecker *spell = PLUMA_SPELL_CHECKER (object);
|
||||
XeditSpellChecker *spell = XEDIT_SPELL_CHECKER (object);
|
||||
*/
|
||||
|
||||
switch (prop_id)
|
||||
@@ -111,13 +111,13 @@ pluma_spell_checker_get_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_checker_finalize (GObject *object)
|
||||
xedit_spell_checker_finalize (GObject *object)
|
||||
{
|
||||
PlumaSpellChecker *spell_checker;
|
||||
XeditSpellChecker *spell_checker;
|
||||
|
||||
g_return_if_fail (PLUMA_IS_SPELL_CHECKER (object));
|
||||
g_return_if_fail (XEDIT_IS_SPELL_CHECKER (object));
|
||||
|
||||
spell_checker = PLUMA_SPELL_CHECKER (object);
|
||||
spell_checker = XEDIT_SPELL_CHECKER (object);
|
||||
|
||||
if (spell_checker->dict != NULL)
|
||||
enchant_broker_free_dict (spell_checker->broker, spell_checker->dict);
|
||||
@@ -125,20 +125,20 @@ pluma_spell_checker_finalize (GObject *object)
|
||||
if (spell_checker->broker != NULL)
|
||||
enchant_broker_free (spell_checker->broker);
|
||||
|
||||
G_OBJECT_CLASS (pluma_spell_checker_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (xedit_spell_checker_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_checker_class_init (PlumaSpellCheckerClass * klass)
|
||||
xedit_spell_checker_class_init (XeditSpellCheckerClass * klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = pluma_spell_checker_set_property;
|
||||
object_class->get_property = pluma_spell_checker_get_property;
|
||||
object_class->set_property = xedit_spell_checker_set_property;
|
||||
object_class->get_property = xedit_spell_checker_get_property;
|
||||
|
||||
object_class->finalize = pluma_spell_checker_finalize;
|
||||
object_class->finalize = xedit_spell_checker_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_LANGUAGE,
|
||||
@@ -151,9 +151,9 @@ pluma_spell_checker_class_init (PlumaSpellCheckerClass * klass)
|
||||
g_signal_new ("add_word_to_personal",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerClass, add_word_to_personal),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerClass, add_word_to_personal),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING_INT,
|
||||
xedit_marshal_VOID__STRING_INT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
@@ -163,9 +163,9 @@ pluma_spell_checker_class_init (PlumaSpellCheckerClass * klass)
|
||||
g_signal_new ("add_word_to_session",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerClass, add_word_to_session),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerClass, add_word_to_session),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__STRING_INT,
|
||||
xedit_marshal_VOID__STRING_INT,
|
||||
G_TYPE_NONE,
|
||||
2,
|
||||
G_TYPE_STRING,
|
||||
@@ -175,9 +175,9 @@ pluma_spell_checker_class_init (PlumaSpellCheckerClass * klass)
|
||||
g_signal_new ("set_language",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerClass, set_language),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerClass, set_language),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__POINTER,
|
||||
xedit_marshal_VOID__POINTER,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
G_TYPE_POINTER);
|
||||
@@ -186,28 +186,28 @@ pluma_spell_checker_class_init (PlumaSpellCheckerClass * klass)
|
||||
g_signal_new ("clear_session",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (PlumaSpellCheckerClass, clear_session),
|
||||
G_STRUCT_OFFSET (XeditSpellCheckerClass, clear_session),
|
||||
NULL, NULL,
|
||||
pluma_marshal_VOID__VOID,
|
||||
xedit_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_checker_init (PlumaSpellChecker *spell_checker)
|
||||
xedit_spell_checker_init (XeditSpellChecker *spell_checker)
|
||||
{
|
||||
spell_checker->broker = enchant_broker_init ();
|
||||
spell_checker->dict = NULL;
|
||||
spell_checker->active_lang = NULL;
|
||||
}
|
||||
|
||||
PlumaSpellChecker *
|
||||
pluma_spell_checker_new (void)
|
||||
XeditSpellChecker *
|
||||
xedit_spell_checker_new (void)
|
||||
{
|
||||
PlumaSpellChecker *spell;
|
||||
XeditSpellChecker *spell;
|
||||
|
||||
spell = PLUMA_SPELL_CHECKER (
|
||||
g_object_new (PLUMA_TYPE_SPELL_CHECKER, NULL));
|
||||
spell = XEDIT_SPELL_CHECKER (
|
||||
g_object_new (XEDIT_TYPE_SPELL_CHECKER, NULL));
|
||||
|
||||
g_return_val_if_fail (spell != NULL, NULL);
|
||||
|
||||
@@ -215,8 +215,8 @@ pluma_spell_checker_new (void)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
lazy_init (PlumaSpellChecker *spell,
|
||||
const PlumaSpellCheckerLanguage *language)
|
||||
lazy_init (XeditSpellChecker *spell,
|
||||
const XeditSpellCheckerLanguage *language)
|
||||
{
|
||||
if (spell->dict != NULL)
|
||||
return TRUE;
|
||||
@@ -232,13 +232,13 @@ lazy_init (PlumaSpellChecker *spell,
|
||||
else
|
||||
{
|
||||
/* First try to get a default language */
|
||||
const PlumaSpellCheckerLanguage *l;
|
||||
const XeditSpellCheckerLanguage *l;
|
||||
gint i = 0;
|
||||
const gchar * const *lang_tags = g_get_language_names ();
|
||||
|
||||
while (lang_tags [i])
|
||||
{
|
||||
l = pluma_spell_checker_language_from_key (lang_tags [i]);
|
||||
l = xedit_spell_checker_language_from_key (lang_tags [i]);
|
||||
|
||||
if (l != NULL)
|
||||
{
|
||||
@@ -252,22 +252,22 @@ lazy_init (PlumaSpellChecker *spell,
|
||||
|
||||
/* Second try to get a default language */
|
||||
if (spell->active_lang == NULL)
|
||||
spell->active_lang = pluma_spell_checker_language_from_key ("en_US");
|
||||
spell->active_lang = xedit_spell_checker_language_from_key ("en_US");
|
||||
|
||||
/* Last try to get a default language */
|
||||
if (spell->active_lang == NULL)
|
||||
{
|
||||
const GSList *langs;
|
||||
langs = pluma_spell_checker_get_available_languages ();
|
||||
langs = xedit_spell_checker_get_available_languages ();
|
||||
if (langs != NULL)
|
||||
spell->active_lang = (const PlumaSpellCheckerLanguage *)langs->data;
|
||||
spell->active_lang = (const XeditSpellCheckerLanguage *)langs->data;
|
||||
}
|
||||
|
||||
if (spell->active_lang != NULL)
|
||||
{
|
||||
const gchar *key;
|
||||
|
||||
key = pluma_spell_checker_language_to_key (spell->active_lang);
|
||||
key = xedit_spell_checker_language_to_key (spell->active_lang);
|
||||
|
||||
spell->dict = enchant_broker_request_dict (spell->broker,
|
||||
key);
|
||||
@@ -287,12 +287,12 @@ lazy_init (PlumaSpellChecker *spell,
|
||||
}
|
||||
|
||||
gboolean
|
||||
pluma_spell_checker_set_language (PlumaSpellChecker *spell,
|
||||
const PlumaSpellCheckerLanguage *language)
|
||||
xedit_spell_checker_set_language (XeditSpellChecker *spell,
|
||||
const XeditSpellCheckerLanguage *language)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), FALSE);
|
||||
|
||||
if (spell->dict != NULL)
|
||||
{
|
||||
@@ -306,15 +306,15 @@ pluma_spell_checker_set_language (PlumaSpellChecker *spell,
|
||||
g_signal_emit (G_OBJECT (spell), signals[SET_LANGUAGE], 0, language);
|
||||
else
|
||||
g_warning ("Spell checker plugin: cannot use language %s.",
|
||||
pluma_spell_checker_language_to_string (language));
|
||||
xedit_spell_checker_language_to_string (language));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const PlumaSpellCheckerLanguage *
|
||||
pluma_spell_checker_get_language (PlumaSpellChecker *spell)
|
||||
const XeditSpellCheckerLanguage *
|
||||
xedit_spell_checker_get_language (XeditSpellChecker *spell)
|
||||
{
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), NULL);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), NULL);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
return NULL;
|
||||
@@ -323,14 +323,14 @@ pluma_spell_checker_get_language (PlumaSpellChecker *spell)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pluma_spell_checker_check_word (PlumaSpellChecker *spell,
|
||||
xedit_spell_checker_check_word (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
gint enchant_result;
|
||||
gboolean res = FALSE;
|
||||
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
@@ -339,10 +339,10 @@ pluma_spell_checker_check_word (PlumaSpellChecker *spell,
|
||||
if (len < 0)
|
||||
len = strlen (word);
|
||||
|
||||
if (strcmp (word, "pluma") == 0)
|
||||
if (strcmp (word, "xedit") == 0)
|
||||
return TRUE;
|
||||
|
||||
if (pluma_spell_utils_is_digit (word, len))
|
||||
if (xedit_spell_utils_is_digit (word, len))
|
||||
return TRUE;
|
||||
|
||||
g_return_val_if_fail (spell->dict != NULL, FALSE);
|
||||
@@ -376,7 +376,7 @@ pluma_spell_checker_check_word (PlumaSpellChecker *spell,
|
||||
|
||||
/* return NULL on error or if no suggestions are found */
|
||||
GSList *
|
||||
pluma_spell_checker_get_suggestions (PlumaSpellChecker *spell,
|
||||
xedit_spell_checker_get_suggestions (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
@@ -385,7 +385,7 @@ pluma_spell_checker_get_suggestions (PlumaSpellChecker *spell,
|
||||
GSList *suggestions_list = NULL;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), NULL);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), NULL);
|
||||
g_return_val_if_fail (word != NULL, NULL);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
@@ -418,11 +418,11 @@ pluma_spell_checker_get_suggestions (PlumaSpellChecker *spell,
|
||||
}
|
||||
|
||||
gboolean
|
||||
pluma_spell_checker_add_word_to_personal (PlumaSpellChecker *spell,
|
||||
xedit_spell_checker_add_word_to_personal (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
@@ -441,11 +441,11 @@ pluma_spell_checker_add_word_to_personal (PlumaSpellChecker *spell,
|
||||
}
|
||||
|
||||
gboolean
|
||||
pluma_spell_checker_add_word_to_session (PlumaSpellChecker *spell,
|
||||
xedit_spell_checker_add_word_to_session (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len)
|
||||
{
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
|
||||
if (!lazy_init (spell, spell->active_lang))
|
||||
@@ -464,9 +464,9 @@ pluma_spell_checker_add_word_to_session (PlumaSpellChecker *spell,
|
||||
}
|
||||
|
||||
gboolean
|
||||
pluma_spell_checker_clear_session (PlumaSpellChecker *spell)
|
||||
xedit_spell_checker_clear_session (XeditSpellChecker *spell)
|
||||
{
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), FALSE);
|
||||
|
||||
/* free and re-request dictionary */
|
||||
if (spell->dict != NULL)
|
||||
@@ -488,13 +488,13 @@ pluma_spell_checker_clear_session (PlumaSpellChecker *spell)
|
||||
* 'replacement'
|
||||
*/
|
||||
gboolean
|
||||
pluma_spell_checker_set_correction (PlumaSpellChecker *spell,
|
||||
xedit_spell_checker_set_correction (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize w_len,
|
||||
const gchar *replacement,
|
||||
gssize r_len)
|
||||
{
|
||||
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (XEDIT_IS_SPELL_CHECKER (spell), FALSE);
|
||||
g_return_val_if_fail (word != NULL, FALSE);
|
||||
g_return_val_if_fail (replacement != NULL, FALSE);
|
||||
|
109
plugins/spell/xedit-spell-checker.h
Normal file
109
plugins/spell/xedit-spell-checker.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xedit-spell-checker.h
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002-2006 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XEDIT_SPELL_CHECKER_H__
|
||||
#define __XEDIT_SPELL_CHECKER_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "xedit-spell-checker-language.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XEDIT_TYPE_SPELL_CHECKER (xedit_spell_checker_get_type ())
|
||||
#define XEDIT_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XEDIT_TYPE_SPELL_CHECKER, XeditSpellChecker))
|
||||
#define XEDIT_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XEDIT_TYPE_SPELL_CHECKER, XeditSpellChecker))
|
||||
#define XEDIT_IS_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XEDIT_TYPE_SPELL_CHECKER))
|
||||
#define XEDIT_IS_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XEDIT_TYPE_SPELL_CHECKER))
|
||||
#define XEDIT_SPELL_CHECKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XEDIT_TYPE_SPELL_CHECKER, XeditSpellChecker))
|
||||
|
||||
typedef struct _XeditSpellChecker XeditSpellChecker;
|
||||
|
||||
typedef struct _XeditSpellCheckerClass XeditSpellCheckerClass;
|
||||
|
||||
struct _XeditSpellCheckerClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*add_word_to_personal) (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gint len);
|
||||
|
||||
void (*add_word_to_session) (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gint len);
|
||||
|
||||
void (*set_language) (XeditSpellChecker *spell,
|
||||
const XeditSpellCheckerLanguage *lang);
|
||||
|
||||
void (*clear_session) (XeditSpellChecker *spell);
|
||||
};
|
||||
|
||||
|
||||
GType xedit_spell_checker_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Constructors */
|
||||
XeditSpellChecker *xedit_spell_checker_new (void);
|
||||
|
||||
gboolean xedit_spell_checker_set_language (XeditSpellChecker *spell,
|
||||
const XeditSpellCheckerLanguage *lang);
|
||||
const XeditSpellCheckerLanguage
|
||||
*xedit_spell_checker_get_language (XeditSpellChecker *spell);
|
||||
|
||||
gboolean xedit_spell_checker_check_word (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
GSList *xedit_spell_checker_get_suggestions (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean xedit_spell_checker_add_word_to_personal
|
||||
(XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean xedit_spell_checker_add_word_to_session
|
||||
(XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize len);
|
||||
|
||||
gboolean xedit_spell_checker_clear_session (XeditSpellChecker *spell);
|
||||
|
||||
gboolean xedit_spell_checker_set_correction (XeditSpellChecker *spell,
|
||||
const gchar *word,
|
||||
gssize w_len,
|
||||
const gchar *replacement,
|
||||
gssize r_len);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XEDIT_SPELL_CHECKER_H__ */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* pluma-spell-language-dialog.c
|
||||
* This file is part of pluma
|
||||
* xedit-spell-language-dialog.c
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the pluma Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the pluma Team.
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <pluma/pluma-utils.h>
|
||||
#include <pluma/pluma-help.h>
|
||||
#include "pluma-spell-language-dialog.h"
|
||||
#include "pluma-spell-checker-language.h"
|
||||
#include <xedit/xedit-utils.h>
|
||||
#include <xedit/xedit-help.h>
|
||||
#include "xedit-spell-language-dialog.h"
|
||||
#include "xedit-spell-checker-language.h"
|
||||
|
||||
|
||||
enum
|
||||
@@ -47,7 +47,7 @@ enum
|
||||
};
|
||||
|
||||
|
||||
struct _PlumaSpellLanguageDialog
|
||||
struct _XeditSpellLanguageDialog
|
||||
{
|
||||
GtkDialog dialog;
|
||||
|
||||
@@ -55,11 +55,11 @@ struct _PlumaSpellLanguageDialog
|
||||
GtkTreeModel *model;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(PlumaSpellLanguageDialog, pluma_spell_language_dialog, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE(XeditSpellLanguageDialog, xedit_spell_language_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
|
||||
static void
|
||||
pluma_spell_language_dialog_class_init (PlumaSpellLanguageDialogClass *klass)
|
||||
xedit_spell_language_dialog_class_init (XeditSpellLanguageDialogClass *klass)
|
||||
{
|
||||
/* GObjectClass *object_class = G_OBJECT_CLASS (klass); */
|
||||
}
|
||||
@@ -70,9 +70,9 @@ dialog_response_handler (GtkDialog *dlg,
|
||||
{
|
||||
if (res_id == GTK_RESPONSE_HELP)
|
||||
{
|
||||
pluma_help_display (GTK_WINDOW (dlg),
|
||||
xedit_help_display (GTK_WINDOW (dlg),
|
||||
NULL,
|
||||
"pluma-spell-checker-plugin");
|
||||
"xedit-spell-checker-plugin");
|
||||
|
||||
g_signal_stop_emission_by_name (dlg, "response");
|
||||
}
|
||||
@@ -109,13 +109,13 @@ static void
|
||||
language_row_activated (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
PlumaSpellLanguageDialog *dialog)
|
||||
XeditSpellLanguageDialog *dialog)
|
||||
{
|
||||
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
static void
|
||||
create_dialog (PlumaSpellLanguageDialog *dlg,
|
||||
create_dialog (XeditSpellLanguageDialog *dlg,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
GtkWidget *error_widget;
|
||||
@@ -157,7 +157,7 @@ create_dialog (PlumaSpellLanguageDialog *dlg,
|
||||
NULL);
|
||||
|
||||
ui_file = g_build_filename (data_dir, "languages-dialog.ui", NULL);
|
||||
ret = pluma_utils_get_ui_objects (ui_file,
|
||||
ret = xedit_utils_get_ui_objects (ui_file,
|
||||
root_objects,
|
||||
&error_widget,
|
||||
"content", &content,
|
||||
@@ -215,14 +215,14 @@ create_dialog (PlumaSpellLanguageDialog *dlg,
|
||||
}
|
||||
|
||||
static void
|
||||
pluma_spell_language_dialog_init (PlumaSpellLanguageDialog *dlg)
|
||||
xedit_spell_language_dialog_init (XeditSpellLanguageDialog *dlg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
populate_language_list (PlumaSpellLanguageDialog *dlg,
|
||||
const PlumaSpellCheckerLanguage *cur_lang)
|
||||
populate_language_list (XeditSpellLanguageDialog *dlg,
|
||||
const XeditSpellCheckerLanguage *cur_lang)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
@@ -232,13 +232,13 @@ populate_language_list (PlumaSpellLanguageDialog *dlg,
|
||||
/* create list store */
|
||||
store = GTK_LIST_STORE (dlg->model);
|
||||
|
||||
langs = pluma_spell_checker_get_available_languages ();
|
||||
langs = xedit_spell_checker_get_available_languages ();
|
||||
|
||||
while (langs)
|
||||
{
|
||||
const gchar *name;
|
||||
|
||||
name = pluma_spell_checker_language_to_string ((const PlumaSpellCheckerLanguage*)langs->data);
|
||||
name = xedit_spell_checker_language_to_string ((const XeditSpellCheckerLanguage*)langs->data);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
@@ -261,15 +261,15 @@ populate_language_list (PlumaSpellLanguageDialog *dlg,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
pluma_spell_language_dialog_new (GtkWindow *parent,
|
||||
const PlumaSpellCheckerLanguage *cur_lang,
|
||||
xedit_spell_language_dialog_new (GtkWindow *parent,
|
||||
const XeditSpellCheckerLanguage *cur_lang,
|
||||
const gchar *data_dir)
|
||||
{
|
||||
PlumaSpellLanguageDialog *dlg;
|
||||
XeditSpellLanguageDialog *dlg;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
|
||||
|
||||
dlg = g_object_new (PLUMA_TYPE_SPELL_LANGUAGE_DIALOG, NULL);
|
||||
dlg = g_object_new (XEDIT_TYPE_SPELL_LANGUAGE_DIALOG, NULL);
|
||||
|
||||
create_dialog (dlg, data_dir);
|
||||
|
||||
@@ -281,11 +281,11 @@ pluma_spell_language_dialog_new (GtkWindow *parent,
|
||||
return GTK_WIDGET (dlg);
|
||||
}
|
||||
|
||||
const PlumaSpellCheckerLanguage *
|
||||
pluma_spell_language_get_selected_language (PlumaSpellLanguageDialog *dlg)
|
||||
const XeditSpellCheckerLanguage *
|
||||
xedit_spell_language_get_selected_language (XeditSpellLanguageDialog *dlg)
|
||||
{
|
||||
GValue value = {0, };
|
||||
const PlumaSpellCheckerLanguage* lang;
|
||||
const XeditSpellCheckerLanguage* lang;
|
||||
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *selection;
|
||||
@@ -301,7 +301,7 @@ pluma_spell_language_get_selected_language (PlumaSpellLanguageDialog *dlg)
|
||||
COLUMN_LANGUAGE_POINTER,
|
||||
&value);
|
||||
|
||||
lang = (const PlumaSpellCheckerLanguage* ) g_value_get_pointer (&value);
|
||||
lang = (const XeditSpellCheckerLanguage* ) g_value_get_pointer (&value);
|
||||
|
||||
return lang;
|
||||
}
|
67
plugins/spell/xedit-spell-language-dialog.h
Normal file
67
plugins/spell/xedit-spell-language-dialog.h
Normal file
@@ -0,0 +1,67 @@
|
||||
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* xedit-spell-language-dialog.h
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2002 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the xedit Team, 2002. See the AUTHORS file for a
|
||||
* list of people on the xedit Team.
|
||||
* See the ChangeLog files for a list of changes.
|
||||
*/
|
||||
|
||||
#ifndef __XEDIT_SPELL_LANGUAGE_DIALOG_H__
|
||||
#define __XEDIT_SPELL_LANGUAGE_DIALOG_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "xedit-spell-checker-language.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XEDIT_TYPE_SPELL_LANGUAGE_DIALOG (xedit_spell_language_dialog_get_type())
|
||||
#define XEDIT_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XEDIT_TYPE_SPELL_LANGUAGE_DIALOG, XeditSpellLanguageDialog))
|
||||
#define XEDIT_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XEDIT_TYPE_SPELL_LANGUAGE_DIALOG, XeditSpellLanguageDialogClass))
|
||||
#define XEDIT_IS_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XEDIT_TYPE_SPELL_LANGUAGE_DIALOG))
|
||||
#define XEDIT_IS_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XEDIT_TYPE_SPELL_LANGUAGE_DIALOG))
|
||||
#define XEDIT_SPELL_LANGUAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XEDIT_TYPE_SPELL_LANGUAGE_DIALOG, XeditSpellLanguageDialogClass))
|
||||
|
||||
|
||||
typedef struct _XeditSpellLanguageDialog XeditSpellLanguageDialog;
|
||||
|
||||
typedef struct _XeditSpellLanguageDialogClass XeditSpellLanguageDialogClass;
|
||||
|
||||
struct _XeditSpellLanguageDialogClass
|
||||
{
|
||||
GtkDialogClass parent_class;
|
||||
};
|
||||
|
||||
GType xedit_spell_language_dialog_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget *xedit_spell_language_dialog_new (GtkWindow *parent,
|
||||
const XeditSpellCheckerLanguage *cur_lang,
|
||||
const gchar *data_dir);
|
||||
|
||||
const XeditSpellCheckerLanguage *
|
||||
xedit_spell_language_get_selected_language (XeditSpellLanguageDialog *dlg);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XEDIT_SPELL_LANGUAGE_DIALOG_H__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
77
plugins/spell/xedit-spell-plugin.h
Normal file
77
plugins/spell/xedit-spell-plugin.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* xedit-spell-plugin.h
|
||||
*
|
||||
* Copyright (C) 2002-2005 Paolo Maggi
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XEDIT_SPELL_PLUGIN_H__
|
||||
#define __XEDIT_SPELL_PLUGIN_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <xedit/xedit-plugin.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Type checking and casting macros
|
||||
*/
|
||||
#define XEDIT_TYPE_SPELL_PLUGIN (xedit_spell_plugin_get_type ())
|
||||
#define XEDIT_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XEDIT_TYPE_SPELL_PLUGIN, XeditSpellPlugin))
|
||||
#define XEDIT_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), XEDIT_TYPE_SPELL_PLUGIN, XeditSpellPluginClass))
|
||||
#define XEDIT_IS_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XEDIT_TYPE_SPELL_PLUGIN))
|
||||
#define XEDIT_IS_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XEDIT_TYPE_SPELL_PLUGIN))
|
||||
#define XEDIT_SPELL_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XEDIT_TYPE_SPELL_PLUGIN, XeditSpellPluginClass))
|
||||
|
||||
/* Private structure type */
|
||||
typedef struct _XeditSpellPluginPrivate XeditSpellPluginPrivate;
|
||||
|
||||
/*
|
||||
* Main object structure
|
||||
*/
|
||||
typedef struct _XeditSpellPlugin XeditSpellPlugin;
|
||||
|
||||
struct _XeditSpellPlugin
|
||||
{
|
||||
XeditPlugin parent_instance;
|
||||
|
||||
XeditSpellPluginPrivate *priv;
|
||||
};
|
||||
|
||||
/*
|
||||
* Class definition
|
||||
*/
|
||||
typedef struct _XeditSpellPluginClass XeditSpellPluginClass;
|
||||
|
||||
struct _XeditSpellPluginClass
|
||||
{
|
||||
XeditPluginClass parent_class;
|
||||
};
|
||||
|
||||
/*
|
||||
* Public methods
|
||||
*/
|
||||
GType xedit_spell_plugin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* All the plugins must implement this function */
|
||||
G_MODULE_EXPORT GType register_xedit_plugin (GTypeModule *module);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XEDIT_SPELL_PLUGIN_H__ */
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* pluma-spell-utils.c
|
||||
* This file is part of pluma
|
||||
* xedit-spell-utils.c
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2010 - Jesse van den Kieboom
|
||||
*
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "pluma-spell-utils.h"
|
||||
#include "xedit-spell-utils.h"
|
||||
#include <gtksourceview/gtksourcebuffer.h>
|
||||
|
||||
gboolean
|
||||
pluma_spell_utils_is_digit (const char *text, gssize length)
|
||||
xedit_spell_utils_is_digit (const char *text, gssize length)
|
||||
{
|
||||
gunichar c;
|
||||
const gchar *p;
|
||||
@@ -56,7 +56,7 @@ pluma_spell_utils_is_digit (const char *text, gssize length)
|
||||
}
|
||||
|
||||
gboolean
|
||||
pluma_spell_utils_skip_no_spell_check (GtkTextIter *start,
|
||||
xedit_spell_utils_skip_no_spell_check (GtkTextIter *start,
|
||||
GtkTextIter *end)
|
||||
{
|
||||
GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (gtk_text_iter_get_buffer (start));
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* pluma-spell-utils.h
|
||||
* This file is part of pluma
|
||||
* xedit-spell-utils.h
|
||||
* This file is part of xedit
|
||||
*
|
||||
* Copyright (C) 2010 - Jesse van den Kieboom
|
||||
*
|
||||
@@ -20,18 +20,18 @@
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef __PLUMA_SPELL_UTILS_H__
|
||||
#define __PLUMA_SPELL_UTILS_H__
|
||||
#ifndef __XEDIT_SPELL_UTILS_H__
|
||||
#define __XEDIT_SPELL_UTILS_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
gboolean pluma_spell_utils_is_digit (const char *text, gssize length);
|
||||
gboolean xedit_spell_utils_is_digit (const char *text, gssize length);
|
||||
|
||||
gboolean pluma_spell_utils_skip_no_spell_check (GtkTextIter *start, GtkTextIter *end);
|
||||
gboolean xedit_spell_utils_skip_no_spell_check (GtkTextIter *start, GtkTextIter *end);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PLUMA_SPELL_UTILS_H__ */
|
||||
#endif /* __XEDIT_SPELL_UTILS_H__ */
|
||||
|
Reference in New Issue
Block a user