renaming from gedit to pluma

This commit is contained in:
Perberos
2011-11-07 19:52:18 -03:00
parent f00b3a11a1
commit 5ded9cba85
557 changed files with 111730 additions and 111724 deletions

View File

@@ -1,59 +1,59 @@
# Spell checker plugin
plugindir = $(GEDIT_PLUGINS_LIBS_DIR)
plugindir = $(PLUMA_PLUGINS_LIBS_DIR)
INCLUDES = \
-I$(top_srcdir) \
$(GEDIT_CFLAGS) \
$(PLUMA_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED_CFLAGS)
BUILT_SOURCES = \
gedit-spell-marshal.c \
gedit-spell-marshal.h
pluma-spell-marshal.c \
pluma-spell-marshal.h
plugin_LTLIBRARIES = libspell.la
libspell_la_SOURCES = \
gedit-spell-plugin.c \
gedit-spell-plugin.h \
gedit-spell-checker.c \
gedit-spell-checker.h \
gedit-spell-checker-dialog.c \
gedit-spell-checker-dialog.h \
gedit-spell-checker-language.c \
gedit-spell-checker-language.h \
gedit-spell-language-dialog.c \
gedit-spell-language-dialog.h \
gedit-automatic-spell-checker.c \
gedit-automatic-spell-checker.h \
gedit-spell-utils.c \
gedit-spell-utils.h \
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 \
$(BUILT_SOURCES)
libspell_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
libspell_la_LIBADD = $(GEDIT_LIBS) $(ENCHANT_LIBS)
libspell_la_LIBADD = $(PLUMA_LIBS) $(ENCHANT_LIBS)
uidir = $(GEDIT_PLUGINS_DATA_DIR)/spell
uidir = $(PLUMA_PLUGINS_DATA_DIR)/spell
ui_DATA = spell-checker.ui languages-dialog.ui
gedit-spell-marshal.h: gedit-spell-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=gedit_marshal > $@
pluma-spell-marshal.h: pluma-spell-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=pluma_marshal > $@
gedit-spell-marshal.c: gedit-spell-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) echo "#include \"gedit-spell-marshal.h\"" > $@ && \
$(GLIB_GENMARSHAL) $< --body --prefix=gedit_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 >> $@
plugin_in_files = spell.gedit-plugin.desktop.in
plugin_in_files = spell.pluma-plugin.desktop.in
%.gedit-plugin: %.gedit-plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
%.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
plugin_DATA = $(plugin_in_files:.gedit-plugin.desktop.in=.gedit-plugin)
plugin_DATA = $(plugin_in_files:.pluma-plugin.desktop.in=.pluma-plugin)
EXTRA_DIST = \
$(ui_DATA) \
$(plugin_in_files) \
gedit-spell-marshal.list
pluma-spell-marshal.list
CLEANFILES = $(BUILT_SOURCES) $(plugin_DATA)

View File

@@ -1,67 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-automatic-spell-checker.h
* This file is part of gedit
*
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit 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 __GEDIT_AUTOMATIC_SPELL_CHECKER_H__
#define __GEDIT_AUTOMATIC_SPELL_CHECKER_H__
#include <gedit/gedit-document.h>
#include <gedit/gedit-view.h>
#include "gedit-spell-checker.h"
typedef struct _GeditAutomaticSpellChecker GeditAutomaticSpellChecker;
GeditAutomaticSpellChecker *gedit_automatic_spell_checker_new (
GeditDocument *doc,
GeditSpellChecker *checker);
GeditAutomaticSpellChecker *gedit_automatic_spell_checker_get_from_document (
const GeditDocument *doc);
void gedit_automatic_spell_checker_free (
GeditAutomaticSpellChecker *spell);
void gedit_automatic_spell_checker_attach_view (
GeditAutomaticSpellChecker *spell,
GeditView *view);
void gedit_automatic_spell_checker_detach_view (
GeditAutomaticSpellChecker *spell,
GeditView *view);
void gedit_automatic_spell_checker_recheck_all (
GeditAutomaticSpellChecker *spell);
#endif /* __GEDIT_AUTOMATIC_SPELL_CHECKER_H__ */

View File

@@ -1,92 +0,0 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-checker-dialog.h
* This file is part of gedit
*
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*/
#ifndef __GEDIT_SPELL_CHECKER_DIALOG_H__
#define __GEDIT_SPELL_CHECKER_DIALOG_H__
#include <gtk/gtk.h>
#include "gedit-spell-checker.h"
G_BEGIN_DECLS
#define GEDIT_TYPE_SPELL_CHECKER_DIALOG (gedit_spell_checker_dialog_get_type ())
#define GEDIT_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_SPELL_CHECKER_DIALOG, GeditSpellCheckerDialog))
#define GEDIT_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_SPELL_CHECKER_DIALOG, GeditSpellCheckerDialog))
#define GEDIT_IS_SPELL_CHECKER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_SPELL_CHECKER_DIALOG))
#define GEDIT_IS_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_SPELL_CHECKER_DIALOG))
#define GEDIT_SPELL_CHECKER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_SPELL_CHECKER_DIALOG, GeditSpellCheckerDialog))
typedef struct _GeditSpellCheckerDialog GeditSpellCheckerDialog;
typedef struct _GeditSpellCheckerDialogClass GeditSpellCheckerDialogClass;
struct _GeditSpellCheckerDialogClass
{
GtkWindowClass parent_class;
/* Signals */
void (*ignore) (GeditSpellCheckerDialog *dlg,
const gchar *word);
void (*ignore_all) (GeditSpellCheckerDialog *dlg,
const gchar *word);
void (*change) (GeditSpellCheckerDialog *dlg,
const gchar *word,
const gchar *change_to);
void (*change_all) (GeditSpellCheckerDialog *dlg,
const gchar *word,
const gchar *change_to);
void (*add_word_to_personal) (GeditSpellCheckerDialog *dlg,
const gchar *word);
};
GType gedit_spell_checker_dialog_get_type (void) G_GNUC_CONST;
/* Constructors */
GtkWidget *gedit_spell_checker_dialog_new (const gchar *data_dir);
GtkWidget *gedit_spell_checker_dialog_new_from_spell_checker
(GeditSpellChecker *spell,
const gchar *data_dir);
void gedit_spell_checker_dialog_set_spell_checker
(GeditSpellCheckerDialog *dlg,
GeditSpellChecker *spell);
void gedit_spell_checker_dialog_set_misspelled_word
(GeditSpellCheckerDialog *dlg,
const gchar* word,
gint len);
void gedit_spell_checker_dialog_set_completed
(GeditSpellCheckerDialog *dlg);
G_END_DECLS
#endif /* __GEDIT_SPELL_CHECKER_DIALOG_H__ */

View File

@@ -1,109 +0,0 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-checker.h
* This file is part of gedit
*
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*/
#ifndef __GEDIT_SPELL_CHECKER_H__
#define __GEDIT_SPELL_CHECKER_H__
#include <glib.h>
#include <glib-object.h>
#include "gedit-spell-checker-language.h"
G_BEGIN_DECLS
#define GEDIT_TYPE_SPELL_CHECKER (gedit_spell_checker_get_type ())
#define GEDIT_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_SPELL_CHECKER, GeditSpellChecker))
#define GEDIT_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_SPELL_CHECKER, GeditSpellChecker))
#define GEDIT_IS_SPELL_CHECKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_SPELL_CHECKER))
#define GEDIT_IS_SPELL_CHECKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_SPELL_CHECKER))
#define GEDIT_SPELL_CHECKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_SPELL_CHECKER, GeditSpellChecker))
typedef struct _GeditSpellChecker GeditSpellChecker;
typedef struct _GeditSpellCheckerClass GeditSpellCheckerClass;
struct _GeditSpellCheckerClass
{
GObjectClass parent_class;
/* Signals */
void (*add_word_to_personal) (GeditSpellChecker *spell,
const gchar *word,
gint len);
void (*add_word_to_session) (GeditSpellChecker *spell,
const gchar *word,
gint len);
void (*set_language) (GeditSpellChecker *spell,
const GeditSpellCheckerLanguage *lang);
void (*clear_session) (GeditSpellChecker *spell);
};
GType gedit_spell_checker_get_type (void) G_GNUC_CONST;
/* Constructors */
GeditSpellChecker *gedit_spell_checker_new (void);
gboolean gedit_spell_checker_set_language (GeditSpellChecker *spell,
const GeditSpellCheckerLanguage *lang);
const GeditSpellCheckerLanguage
*gedit_spell_checker_get_language (GeditSpellChecker *spell);
gboolean gedit_spell_checker_check_word (GeditSpellChecker *spell,
const gchar *word,
gssize len);
GSList *gedit_spell_checker_get_suggestions (GeditSpellChecker *spell,
const gchar *word,
gssize len);
gboolean gedit_spell_checker_add_word_to_personal
(GeditSpellChecker *spell,
const gchar *word,
gssize len);
gboolean gedit_spell_checker_add_word_to_session
(GeditSpellChecker *spell,
const gchar *word,
gssize len);
gboolean gedit_spell_checker_clear_session (GeditSpellChecker *spell);
gboolean gedit_spell_checker_set_correction (GeditSpellChecker *spell,
const gchar *word,
gssize w_len,
const gchar *replacement,
gssize r_len);
G_END_DECLS
#endif /* __GEDIT_SPELL_CHECKER_H__ */

View File

@@ -1,67 +0,0 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-language-dialog.h
* This file is part of gedit
*
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*/
#ifndef __GEDIT_SPELL_LANGUAGE_DIALOG_H__
#define __GEDIT_SPELL_LANGUAGE_DIALOG_H__
#include <gtk/gtk.h>
#include "gedit-spell-checker-language.h"
G_BEGIN_DECLS
#define GEDIT_TYPE_SPELL_LANGUAGE_DIALOG (gedit_spell_language_dialog_get_type())
#define GEDIT_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GEDIT_TYPE_SPELL_LANGUAGE_DIALOG, GeditSpellLanguageDialog))
#define GEDIT_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GEDIT_TYPE_SPELL_LANGUAGE_DIALOG, GeditSpellLanguageDialogClass))
#define GEDIT_IS_SPELL_LANGUAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GEDIT_TYPE_SPELL_LANGUAGE_DIALOG))
#define GEDIT_IS_SPELL_LANGUAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_SPELL_LANGUAGE_DIALOG))
#define GEDIT_SPELL_LANGUAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GEDIT_TYPE_SPELL_LANGUAGE_DIALOG, GeditSpellLanguageDialogClass))
typedef struct _GeditSpellLanguageDialog GeditSpellLanguageDialog;
typedef struct _GeditSpellLanguageDialogClass GeditSpellLanguageDialogClass;
struct _GeditSpellLanguageDialogClass
{
GtkDialogClass parent_class;
};
GType gedit_spell_language_dialog_get_type (void) G_GNUC_CONST;
GtkWidget *gedit_spell_language_dialog_new (GtkWindow *parent,
const GeditSpellCheckerLanguage *cur_lang,
const gchar *data_dir);
const GeditSpellCheckerLanguage *
gedit_spell_language_get_selected_language (GeditSpellLanguageDialog *dlg);
G_END_DECLS
#endif /* __GEDIT_SPELL_LANGUAGE_DIALOG_H__ */

View File

@@ -1,75 +0,0 @@
/*
* gedit-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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
#ifndef __GEDIT_SPELL_PLUGIN_H__
#define __GEDIT_SPELL_PLUGIN_H__
#include <glib.h>
#include <glib-object.h>
#include <gedit/gedit-plugin.h>
G_BEGIN_DECLS
/*
* Type checking and casting macros
*/
#define GEDIT_TYPE_SPELL_PLUGIN (gedit_spell_plugin_get_type ())
#define GEDIT_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GEDIT_TYPE_SPELL_PLUGIN, GeditSpellPlugin))
#define GEDIT_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GEDIT_TYPE_SPELL_PLUGIN, GeditSpellPluginClass))
#define GEDIT_IS_SPELL_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GEDIT_TYPE_SPELL_PLUGIN))
#define GEDIT_IS_SPELL_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GEDIT_TYPE_SPELL_PLUGIN))
#define GEDIT_SPELL_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GEDIT_TYPE_SPELL_PLUGIN, GeditSpellPluginClass))
/* Private structure type */
typedef struct _GeditSpellPluginPrivate GeditSpellPluginPrivate;
/*
* Main object structure
*/
typedef struct _GeditSpellPlugin GeditSpellPlugin;
struct _GeditSpellPlugin
{
GeditPlugin parent_instance;
};
/*
* Class definition
*/
typedef struct _GeditSpellPluginClass GeditSpellPluginClass;
struct _GeditSpellPluginClass
{
GeditPluginClass parent_class;
};
/*
* Public methods
*/
GType gedit_spell_plugin_get_type (void) G_GNUC_CONST;
/* All the plugins must implement this function */
G_MODULE_EXPORT GType register_gedit_plugin (GTypeModule *module);
G_END_DECLS
#endif /* __GEDIT_SPELL_PLUGIN_H__ */

View File

@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-automatic-spell-checker.c
* This file is part of gedit
* pluma-automatic-spell-checker.c
* This file is part of pluma
*
* Copyright (C) 2002 Paolo Maggi
*
@@ -22,8 +22,8 @@
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit Team.
* 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.
*/
@@ -40,11 +40,11 @@
#include <glib/gi18n.h>
#include "gedit-automatic-spell-checker.h"
#include "gedit-spell-utils.h"
#include "pluma-automatic-spell-checker.h"
#include "pluma-spell-utils.h"
struct _GeditAutomaticSpellChecker {
GeditDocument *doc;
struct _PlumaAutomaticSpellChecker {
PlumaDocument *doc;
GSList *views;
GtkTextMark *mark_insert_start;
@@ -54,22 +54,22 @@ struct _GeditAutomaticSpellChecker {
GtkTextTag *tag_highlight;
GtkTextMark *mark_click;
GeditSpellChecker *spell_checker;
PlumaSpellChecker *spell_checker;
};
static GQuark automatic_spell_checker_id = 0;
static GQuark suggestion_id = 0;
static void gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell);
static void pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell);
static void
view_destroy (GeditView *view, GeditAutomaticSpellChecker *spell)
view_destroy (PlumaView *view, PlumaAutomaticSpellChecker *spell)
{
gedit_automatic_spell_checker_detach_view (spell, view);
pluma_automatic_spell_checker_detach_view (spell, view);
}
static void
check_word (GeditAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end)
check_word (PlumaAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *end)
{
gchar *word;
@@ -80,7 +80,7 @@ check_word (GeditAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *
gtk_text_iter_get_offset (end));
*/
if (!gedit_spell_checker_check_word (spell->spell_checker, word, -1))
if (!pluma_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 (GeditAutomaticSpellChecker *spell, GtkTextIter *start, GtkTextIter *
}
static void
check_range (GeditAutomaticSpellChecker *spell,
check_range (PlumaAutomaticSpellChecker *spell,
GtkTextIter start,
GtkTextIter end,
gboolean force_all)
@@ -164,7 +164,7 @@ check_range (GeditAutomaticSpellChecker *spell,
wstart = start;
while (gedit_spell_utils_skip_no_spell_check (&wstart, &end) &&
while (pluma_spell_utils_skip_no_spell_check (&wstart, &end) &&
gtk_text_iter_compare (&wstart, &end) < 0)
{
gboolean inword;
@@ -208,7 +208,7 @@ check_range (GeditAutomaticSpellChecker *spell,
}
static void
check_deferred_range (GeditAutomaticSpellChecker *spell,
check_deferred_range (PlumaAutomaticSpellChecker *spell,
gboolean force_all)
{
GtkTextIter start, end;
@@ -232,14 +232,14 @@ check_deferred_range (GeditAutomaticSpellChecker *spell,
static void
insert_text_before (GtkTextBuffer *buffer, GtkTextIter *iter,
gchar *text, gint len, GeditAutomaticSpellChecker *spell)
gchar *text, gint len, PlumaAutomaticSpellChecker *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, GeditAutomaticSpellChecker *spell)
gchar *text, gint len, PlumaAutomaticSpellChecker *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,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
check_range (spell, *start, *end, FALSE);
}
@@ -269,7 +269,7 @@ static void
mark_set (GtkTextBuffer *buffer,
GtkTextIter *iter,
GtkTextMark *mark,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *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 (GeditAutomaticSpellChecker *spell, const gchar *word)
remove_tag_to_word (PlumaAutomaticSpellChecker *spell, const gchar *word)
{
GtkTextIter iter;
GtkTextIter match_start, match_end;
@@ -331,7 +331,7 @@ remove_tag_to_word (GeditAutomaticSpellChecker *spell, const gchar *word)
}
static void
add_to_dictionary (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
add_to_dictionary (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
{
gchar *word;
@@ -344,13 +344,13 @@ add_to_dictionary (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
&end,
FALSE);
gedit_spell_checker_add_word_to_personal (spell->spell_checker, word, -1);
pluma_spell_checker_add_word_to_personal (spell->spell_checker, word, -1);
g_free (word);
}
static void
ignore_all (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
ignore_all (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
{
gchar *word;
@@ -363,13 +363,13 @@ ignore_all (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
&end,
FALSE);
gedit_spell_checker_add_word_to_session (spell->spell_checker, word, -1);
pluma_spell_checker_add_word_to_session (spell->spell_checker, word, -1);
g_free (word);
}
static void
replace_word (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
replace_word (GtkWidget *menuitem, PlumaAutomaticSpellChecker *spell)
{
gchar *oldword;
const gchar *newword;
@@ -390,7 +390,7 @@ replace_word (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
gtk_text_buffer_end_user_action (GTK_TEXT_BUFFER (spell->doc));
gedit_spell_checker_set_correction (spell->spell_checker,
pluma_spell_checker_set_correction (spell->spell_checker,
oldword, strlen (oldword),
newword, strlen (newword));
@@ -398,7 +398,7 @@ replace_word (GtkWidget *menuitem, GeditAutomaticSpellChecker *spell)
}
static GtkWidget *
build_suggestion_menu (GeditAutomaticSpellChecker *spell, const gchar *word)
build_suggestion_menu (PlumaAutomaticSpellChecker *spell, const gchar *word)
{
GtkWidget *topmenu, *menu;
GtkWidget *mi;
@@ -408,7 +408,7 @@ build_suggestion_menu (GeditAutomaticSpellChecker *spell, const gchar *word)
topmenu = menu = gtk_menu_new();
suggestions = gedit_spell_checker_get_suggestions (spell->spell_checker, word, -1);
suggestions = pluma_spell_checker_get_suggestions (spell->spell_checker, word, -1);
list = suggestions;
@@ -529,7 +529,7 @@ build_suggestion_menu (GeditAutomaticSpellChecker *spell, const gchar *word)
}
static void
populate_popup (GtkTextView *textview, GtkMenu *menu, GeditAutomaticSpellChecker *spell)
populate_popup (GtkTextView *textview, GtkMenu *menu, PlumaAutomaticSpellChecker *spell)
{
GtkWidget *img, *mi;
GtkTextIter start, end;
@@ -563,7 +563,7 @@ populate_popup (GtkTextView *textview, GtkMenu *menu, GeditAutomaticSpellChecker
}
void
gedit_automatic_spell_checker_recheck_all (GeditAutomaticSpellChecker *spell)
pluma_automatic_spell_checker_recheck_all (PlumaAutomaticSpellChecker *spell)
{
GtkTextIter start, end;
@@ -575,10 +575,10 @@ gedit_automatic_spell_checker_recheck_all (GeditAutomaticSpellChecker *spell)
}
static void
add_word_signal_cb (GeditSpellChecker *checker,
add_word_signal_cb (PlumaSpellChecker *checker,
const gchar *word,
gint len,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
gchar *w;
@@ -593,18 +593,18 @@ add_word_signal_cb (GeditSpellChecker *checker,
}
static void
set_language_cb (GeditSpellChecker *checker,
const GeditSpellCheckerLanguage *lang,
GeditAutomaticSpellChecker *spell)
set_language_cb (PlumaSpellChecker *checker,
const PlumaSpellCheckerLanguage *lang,
PlumaAutomaticSpellChecker *spell)
{
gedit_automatic_spell_checker_recheck_all (spell);
pluma_automatic_spell_checker_recheck_all (spell);
}
static void
clear_session_cb (GeditSpellChecker *checker,
GeditAutomaticSpellChecker *spell)
clear_session_cb (PlumaSpellChecker *checker,
PlumaAutomaticSpellChecker *spell)
{
gedit_automatic_spell_checker_recheck_all (spell);
pluma_automatic_spell_checker_recheck_all (spell);
}
/* When the user right-clicks on a word, they want to check that word.
@@ -614,7 +614,7 @@ clear_session_cb (GeditSpellChecker *checker,
static gboolean
button_press_event (GtkTextView *view,
GdkEventButton *event,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
if (event->button == 3)
{
@@ -645,7 +645,7 @@ button_press_event (GtkTextView *view,
* will contain the wrong set of suggestions.
*/
static gboolean
popup_menu_event (GtkTextView *view, GeditAutomaticSpellChecker *spell)
popup_menu_event (GtkTextView *view, PlumaAutomaticSpellChecker *spell)
{
GtkTextIter iter;
GtkTextBuffer *buffer;
@@ -665,7 +665,7 @@ popup_menu_event (GtkTextView *view, GeditAutomaticSpellChecker *spell)
static void
tag_table_changed (GtkTextTagTable *table,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
g_return_if_fail (spell->tag_highlight != NULL);
@@ -676,7 +676,7 @@ tag_table_changed (GtkTextTagTable *table,
static void
tag_added_or_removed (GtkTextTagTable *table,
GtkTextTag *tag,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
tag_table_changed (table, spell);
}
@@ -685,7 +685,7 @@ static void
tag_changed (GtkTextTagTable *table,
GtkTextTag *tag,
gboolean size_changed,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
tag_table_changed (table, spell);
}
@@ -694,33 +694,33 @@ static void
highlight_updated (GtkSourceBuffer *buffer,
GtkTextIter *start,
GtkTextIter *end,
GeditAutomaticSpellChecker *spell)
PlumaAutomaticSpellChecker *spell)
{
check_range (spell, *start, *end, FALSE);
}
static void
spell_tag_destroyed (GeditAutomaticSpellChecker *spell,
spell_tag_destroyed (PlumaAutomaticSpellChecker *spell,
GObject *where_the_object_was)
{
spell->tag_highlight = NULL;
}
GeditAutomaticSpellChecker *
gedit_automatic_spell_checker_new (GeditDocument *doc,
GeditSpellChecker *checker)
PlumaAutomaticSpellChecker *
pluma_automatic_spell_checker_new (PlumaDocument *doc,
PlumaSpellChecker *checker)
{
GeditAutomaticSpellChecker *spell;
PlumaAutomaticSpellChecker *spell;
GtkTextTagTable *tag_table;
GtkTextIter start, end;
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (checker), NULL);
g_return_val_if_fail ((spell = gedit_automatic_spell_checker_get_from_document (doc)) == NULL,
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,
spell);
/* attach to the widget */
spell = g_new0 (GeditAutomaticSpellChecker, 1);
spell = g_new0 (PlumaAutomaticSpellChecker, 1);
spell->doc = doc;
spell->spell_checker = g_object_ref (checker);
@@ -728,17 +728,17 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
if (automatic_spell_checker_id == 0)
{
automatic_spell_checker_id =
g_quark_from_string ("GeditAutomaticSpellCheckerID");
g_quark_from_string ("PlumaAutomaticSpellCheckerID");
}
if (suggestion_id == 0)
{
suggestion_id = g_quark_from_string ("GeditAutoSuggestionID");
suggestion_id = g_quark_from_string ("PlumaAutoSuggestionID");
}
g_object_set_qdata_full (G_OBJECT (doc),
automatic_spell_checker_id,
spell,
(GDestroyNotify)gedit_automatic_spell_checker_free_internal);
(GDestroyNotify)pluma_automatic_spell_checker_free_internal);
g_signal_connect (doc,
"insert-text",
@@ -812,13 +812,13 @@ gedit_automatic_spell_checker_new (GeditDocument *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),
"gedit-automatic-spell-checker-insert-start");
"pluma-automatic-spell-checker-insert-start");
if (spell->mark_insert_start == NULL)
{
spell->mark_insert_start =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-insert-start",
"pluma-automatic-spell-checker-insert-start",
&start,
TRUE);
}
@@ -830,13 +830,13 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
}
spell->mark_insert_end = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-insert-end");
"pluma-automatic-spell-checker-insert-end");
if (spell->mark_insert_end == NULL)
{
spell->mark_insert_end =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-insert-end",
"pluma-automatic-spell-checker-insert-end",
&start,
TRUE);
}
@@ -848,13 +848,13 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
}
spell->mark_click = gtk_text_buffer_get_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-click");
"pluma-automatic-spell-checker-click");
if (spell->mark_click == NULL)
{
spell->mark_click =
gtk_text_buffer_create_mark (GTK_TEXT_BUFFER (doc),
"gedit-automatic-spell-checker-click",
"pluma-automatic-spell-checker-click",
&start,
TRUE);
}
@@ -870,10 +870,10 @@ gedit_automatic_spell_checker_new (GeditDocument *doc,
return spell;
}
GeditAutomaticSpellChecker *
gedit_automatic_spell_checker_get_from_document (const GeditDocument *doc)
PlumaAutomaticSpellChecker *
pluma_automatic_spell_checker_get_from_document (const PlumaDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), NULL);
g_return_val_if_fail (PLUMA_IS_DOCUMENT (doc), NULL);
if (automatic_spell_checker_id == 0)
return NULL;
@@ -882,10 +882,10 @@ gedit_automatic_spell_checker_get_from_document (const GeditDocument *doc)
}
void
gedit_automatic_spell_checker_free (GeditAutomaticSpellChecker *spell)
pluma_automatic_spell_checker_free (PlumaAutomaticSpellChecker *spell)
{
g_return_if_fail (spell != NULL);
g_return_if_fail (gedit_automatic_spell_checker_get_from_document (spell->doc) == spell);
g_return_if_fail (pluma_automatic_spell_checker_get_from_document (spell->doc) == spell);
if (automatic_spell_checker_id == 0)
return;
@@ -894,7 +894,7 @@ gedit_automatic_spell_checker_free (GeditAutomaticSpellChecker *spell)
}
static void
gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell)
pluma_automatic_spell_checker_free_internal (PlumaAutomaticSpellChecker *spell)
{
GtkTextTagTable *table;
GtkTextIter start, end;
@@ -937,7 +937,7 @@ gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell)
list = spell->views;
while (list != NULL)
{
GeditView *view = GEDIT_VIEW (list->data);
PlumaView *view = PLUMA_VIEW (list->data);
g_signal_handlers_disconnect_matched (G_OBJECT (view),
G_SIGNAL_MATCH_DATA,
@@ -958,12 +958,12 @@ gedit_automatic_spell_checker_free_internal (GeditAutomaticSpellChecker *spell)
}
void
gedit_automatic_spell_checker_attach_view (
GeditAutomaticSpellChecker *spell,
GeditView *view)
pluma_automatic_spell_checker_attach_view (
PlumaAutomaticSpellChecker *spell,
PlumaView *view)
{
g_return_if_fail (spell != NULL);
g_return_if_fail (GEDIT_IS_VIEW (view));
g_return_if_fail (PLUMA_IS_VIEW (view));
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
GTK_TEXT_BUFFER (spell->doc));
@@ -989,12 +989,12 @@ gedit_automatic_spell_checker_attach_view (
}
void
gedit_automatic_spell_checker_detach_view (
GeditAutomaticSpellChecker *spell,
GeditView *view)
pluma_automatic_spell_checker_detach_view (
PlumaAutomaticSpellChecker *spell,
PlumaView *view)
{
g_return_if_fail (spell != NULL);
g_return_if_fail (GEDIT_IS_VIEW (view));
g_return_if_fail (PLUMA_IS_VIEW (view));
g_return_if_fail (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) ==
GTK_TEXT_BUFFER (spell->doc));

View File

@@ -0,0 +1,67 @@
/* -*- 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, 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__ */

View File

@@ -1,7 +1,7 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-checker-dialog.c
* This file is part of gedit
* pluma-spell-checker-dialog.c
* This file is part of pluma
*
* Copyright (C) 2002 Paolo Maggi
*
@@ -22,8 +22,8 @@
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit Team.
* 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.
*/
@@ -34,15 +34,15 @@
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gedit/gedit-utils.h>
#include "gedit-spell-checker-dialog.h"
#include "gedit-spell-marshal.h"
#include <pluma/pluma-utils.h>
#include "pluma-spell-checker-dialog.h"
#include "pluma-spell-marshal.h"
struct _GeditSpellCheckerDialog
struct _PlumaSpellCheckerDialog
{
GtkWindow parent_instance;
GeditSpellChecker *spell_checker;
PlumaSpellChecker *spell_checker;
gchar *misspelled_word;
@@ -77,41 +77,41 @@ enum
NUM_COLUMNS
};
static void update_suggestions_list_model (GeditSpellCheckerDialog *dlg,
static void update_suggestions_list_model (PlumaSpellCheckerDialog *dlg,
GSList *suggestions);
static void word_entry_changed_handler (GtkEditable *editable,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void close_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void check_word_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void add_word_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void ignore_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void ignore_all_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void change_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void change_all_button_clicked_handler (GtkButton *button,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static void suggestions_list_row_activated_handler (GtkTreeView *view,
GtkTreePath *path,
GtkTreeViewColumn *column,
GeditSpellCheckerDialog *dlg);
PlumaSpellCheckerDialog *dlg);
static guint signals [LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE(GeditSpellCheckerDialog, gedit_spell_checker_dialog, GTK_TYPE_WINDOW)
G_DEFINE_TYPE(PlumaSpellCheckerDialog, pluma_spell_checker_dialog, GTK_TYPE_WINDOW)
static void
gedit_spell_checker_dialog_destroy (GtkObject *object)
pluma_spell_checker_dialog_destroy (GtkObject *object)
{
GeditSpellCheckerDialog *dlg = GEDIT_SPELL_CHECKER_DIALOG (object);
PlumaSpellCheckerDialog *dlg = PLUMA_SPELL_CHECKER_DIALOG (object);
if (dlg->spell_checker != NULL)
{
@@ -125,25 +125,25 @@ gedit_spell_checker_dialog_destroy (GtkObject *object)
dlg->misspelled_word = NULL;
}
GTK_OBJECT_CLASS (gedit_spell_checker_dialog_parent_class)->destroy (object);
GTK_OBJECT_CLASS (pluma_spell_checker_dialog_parent_class)->destroy (object);
}
static void
gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
pluma_spell_checker_dialog_class_init (PlumaSpellCheckerDialogClass * klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
GTK_OBJECT_CLASS (object_class)->destroy = gedit_spell_checker_dialog_destroy;
GTK_OBJECT_CLASS (object_class)->destroy = pluma_spell_checker_dialog_destroy;
signals[IGNORE] =
g_signal_new ("ignore",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerDialogClass, ignore),
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore),
NULL, NULL,
gedit_marshal_VOID__STRING,
pluma_marshal_VOID__STRING,
G_TYPE_NONE,
1,
G_TYPE_STRING);
@@ -152,9 +152,9 @@ gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
g_signal_new ("ignore_all",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerDialogClass, ignore_all),
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, ignore_all),
NULL, NULL,
gedit_marshal_VOID__STRING,
pluma_marshal_VOID__STRING,
G_TYPE_NONE,
1,
G_TYPE_STRING);
@@ -163,9 +163,9 @@ gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
g_signal_new ("change",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerDialogClass, change),
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change),
NULL, NULL,
gedit_marshal_VOID__STRING_STRING,
pluma_marshal_VOID__STRING_STRING,
G_TYPE_NONE,
2,
G_TYPE_STRING,
@@ -175,9 +175,9 @@ gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
g_signal_new ("change_all",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerDialogClass, change_all),
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, change_all),
NULL, NULL,
gedit_marshal_VOID__STRING_STRING,
pluma_marshal_VOID__STRING_STRING,
G_TYPE_NONE,
2,
G_TYPE_STRING,
@@ -187,16 +187,16 @@ gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass * klass)
g_signal_new ("add_word_to_personal",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerDialogClass, add_word_to_personal),
G_STRUCT_OFFSET (PlumaSpellCheckerDialogClass, add_word_to_personal),
NULL, NULL,
gedit_marshal_VOID__STRING,
pluma_marshal_VOID__STRING,
G_TYPE_NONE,
1,
G_TYPE_STRING);
}
static void
create_dialog (GeditSpellCheckerDialog *dlg,
create_dialog (PlumaSpellCheckerDialog *dlg,
const gchar *data_dir)
{
GtkWidget *error_widget;
@@ -223,7 +223,7 @@ create_dialog (GeditSpellCheckerDialog *dlg,
dlg->misspelled_word = NULL;
ui_file = g_build_filename (data_dir, "spell-checker.ui", NULL);
ret = gedit_utils_get_ui_objects (ui_file,
ret = pluma_utils_get_ui_objects (ui_file,
root_objects,
&error_widget,
@@ -321,17 +321,17 @@ create_dialog (GeditSpellCheckerDialog *dlg,
}
static void
gedit_spell_checker_dialog_init (GeditSpellCheckerDialog *dlg)
pluma_spell_checker_dialog_init (PlumaSpellCheckerDialog *dlg)
{
}
GtkWidget *
gedit_spell_checker_dialog_new (const gchar *data_dir)
pluma_spell_checker_dialog_new (const gchar *data_dir)
{
GeditSpellCheckerDialog *dlg;
PlumaSpellCheckerDialog *dlg;
dlg = GEDIT_SPELL_CHECKER_DIALOG (
g_object_new (GEDIT_TYPE_SPELL_CHECKER_DIALOG, NULL));
dlg = PLUMA_SPELL_CHECKER_DIALOG (
g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL));
g_return_val_if_fail (dlg != NULL, NULL);
@@ -341,33 +341,33 @@ gedit_spell_checker_dialog_new (const gchar *data_dir)
}
GtkWidget *
gedit_spell_checker_dialog_new_from_spell_checker (GeditSpellChecker *spell,
pluma_spell_checker_dialog_new_from_spell_checker (PlumaSpellChecker *spell,
const gchar *data_dir)
{
GeditSpellCheckerDialog *dlg;
PlumaSpellCheckerDialog *dlg;
g_return_val_if_fail (spell != NULL, NULL);
dlg = GEDIT_SPELL_CHECKER_DIALOG (
g_object_new (GEDIT_TYPE_SPELL_CHECKER_DIALOG, NULL));
dlg = PLUMA_SPELL_CHECKER_DIALOG (
g_object_new (PLUMA_TYPE_SPELL_CHECKER_DIALOG, NULL));
g_return_val_if_fail (dlg != NULL, NULL);
create_dialog (dlg, data_dir);
gedit_spell_checker_dialog_set_spell_checker (dlg, spell);
pluma_spell_checker_dialog_set_spell_checker (dlg, spell);
return GTK_WIDGET (dlg);
}
void
gedit_spell_checker_dialog_set_spell_checker (GeditSpellCheckerDialog *dlg, GeditSpellChecker *spell)
pluma_spell_checker_dialog_set_spell_checker (PlumaSpellCheckerDialog *dlg, PlumaSpellChecker *spell)
{
const GeditSpellCheckerLanguage* language;
const PlumaSpellCheckerLanguage* language;
const gchar *lang;
gchar *tmp;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (spell != NULL);
if (dlg->spell_checker != NULL)
@@ -376,16 +376,16 @@ gedit_spell_checker_dialog_set_spell_checker (GeditSpellCheckerDialog *dlg, Gedi
dlg->spell_checker = spell;
g_object_ref (dlg->spell_checker);
language = gedit_spell_checker_get_language (dlg->spell_checker);
language = pluma_spell_checker_get_language (dlg->spell_checker);
lang = gedit_spell_checker_language_to_string (language);
lang = pluma_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)
gedit_spell_checker_dialog_set_misspelled_word (dlg, dlg->misspelled_word, -1);
pluma_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 @@ gedit_spell_checker_dialog_set_spell_checker (GeditSpellCheckerDialog *dlg, Gedi
}
void
gedit_spell_checker_dialog_set_misspelled_word (GeditSpellCheckerDialog *dlg,
pluma_spell_checker_dialog_set_misspelled_word (PlumaSpellCheckerDialog *dlg,
const gchar *word,
gint len)
{
gchar *tmp;
GSList *sug;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (word != NULL);
g_return_if_fail (dlg->spell_checker != NULL);
g_return_if_fail (!gedit_spell_checker_check_word (dlg->spell_checker, word, -1));
g_return_if_fail (!pluma_spell_checker_check_word (dlg->spell_checker, word, -1));
/* build_suggestions_list */
if (dlg->misspelled_word != NULL)
@@ -416,7 +416,7 @@ gedit_spell_checker_dialog_set_misspelled_word (GeditSpellCheckerDialog *dlg,
gtk_label_set_label (GTK_LABEL (dlg->misspelled_word_label), tmp);
g_free (tmp);
sug = gedit_spell_checker_get_suggestions (dlg->spell_checker,
sug = pluma_spell_checker_get_suggestions (dlg->spell_checker,
dlg->misspelled_word,
-1);
@@ -432,13 +432,13 @@ gedit_spell_checker_dialog_set_misspelled_word (GeditSpellCheckerDialog *dlg,
}
static void
update_suggestions_list_model (GeditSpellCheckerDialog *dlg, GSList *suggestions)
update_suggestions_list_model (PlumaSpellCheckerDialog *dlg, GSList *suggestions)
{
GtkListStore *store;
GtkTreeIter iter;
GtkTreeSelection *sel;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_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 (GeditSpellCheckerDialog *dlg, GSList *suggestions
}
static void
word_entry_changed_handler (GtkEditable *editable, GeditSpellCheckerDialog *dlg)
word_entry_changed_handler (GtkEditable *editable, PlumaSpellCheckerDialog *dlg)
{
const gchar *text;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_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, GeditSpellCheckerDialog *dlg)
}
static void
close_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg)
close_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
gtk_widget_destroy (GTK_WIDGET (dlg));
}
static void
suggestions_list_selection_changed_handler (GtkTreeSelection *selection,
GeditSpellCheckerDialog *dlg)
PlumaSpellCheckerDialog *dlg)
{
GtkTreeIter iter;
GValue value = {0, };
const gchar *text;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_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, GeditSpellCheckerDialog *dlg)
check_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
const gchar *word;
gssize len;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_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 (gedit_spell_checker_check_word (dlg->spell_checker, word, len))
if (pluma_spell_checker_check_word (dlg->spell_checker, word, len))
{
GtkListStore *store;
GtkTreeIter iter;
@@ -568,7 +568,7 @@ check_word_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *d
{
GSList *sug;
sug = gedit_spell_checker_get_suggestions (dlg->spell_checker,
sug = pluma_spell_checker_get_suggestions (dlg->spell_checker,
word,
len);
@@ -581,14 +581,14 @@ check_word_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *d
}
static void
add_word_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg)
add_word_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (dlg->misspelled_word != NULL);
gedit_spell_checker_add_word_to_personal (dlg->spell_checker,
pluma_spell_checker_add_word_to_personal (dlg->spell_checker,
dlg->misspelled_word,
-1);
@@ -600,11 +600,11 @@ add_word_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg
}
static void
ignore_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg)
ignore_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_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, GeditSpellCheckerDialog *dlg)
}
static void
ignore_all_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg)
ignore_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (dlg->misspelled_word != NULL);
gedit_spell_checker_add_word_to_session (dlg->spell_checker,
pluma_spell_checker_add_word_to_session (dlg->spell_checker,
dlg->misspelled_word,
-1);
@@ -634,19 +634,19 @@ ignore_all_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *d
}
static void
change_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg)
change_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
gchar *change;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (dlg->misspelled_word != NULL);
change = g_strdup (gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)));
g_return_if_fail (change != NULL);
g_return_if_fail (*change != '\0');
gedit_spell_checker_set_correction (dlg->spell_checker,
pluma_spell_checker_set_correction (dlg->spell_checker,
dlg->misspelled_word, -1,
change, -1);
@@ -663,27 +663,27 @@ static void
suggestions_list_row_activated_handler (GtkTreeView *view,
GtkTreePath *path,
GtkTreeViewColumn *column,
GeditSpellCheckerDialog *dlg)
PlumaSpellCheckerDialog *dlg)
{
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
change_button_clicked_handler (GTK_BUTTON (dlg->change_button), dlg);
}
static void
change_all_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *dlg)
change_all_button_clicked_handler (GtkButton *button, PlumaSpellCheckerDialog *dlg)
{
gchar *word;
gchar *change;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (dlg->misspelled_word != NULL);
change = g_strdup (gtk_entry_get_text (GTK_ENTRY (dlg->word_entry)));
g_return_if_fail (change != NULL);
g_return_if_fail (*change != '\0');
gedit_spell_checker_set_correction (dlg->spell_checker,
pluma_spell_checker_set_correction (dlg->spell_checker,
dlg->misspelled_word, -1,
change, -1);
@@ -696,11 +696,11 @@ change_all_button_clicked_handler (GtkButton *button, GeditSpellCheckerDialog *d
}
void
gedit_spell_checker_dialog_set_completed (GeditSpellCheckerDialog *dlg)
pluma_spell_checker_dialog_set_completed (PlumaSpellCheckerDialog *dlg)
{
gchar *tmp;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dlg));
g_return_if_fail (PLUMA_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),

View File

@@ -0,0 +1,92 @@
/* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, 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__ */

View File

@@ -1,7 +1,7 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-checker-language.c
* This file is part of gedit
* pluma-spell-checker-language.c
* This file is part of pluma
*
* Copyright (C) 2006 Paolo Maggi
*
@@ -22,8 +22,8 @@
*/
/*
* Modified by the gedit Team, 2006. See the AUTHORS file for a
* list of people on the gedit Team.
* Modified by the pluma Team, 2006. See the AUTHORS file for a
* list of people on the pluma Team.
* See the ChangeLog files for a list of changes.
*/
@@ -43,16 +43,16 @@
#include <glib/gi18n.h>
#include <libxml/xmlreader.h>
#include "gedit-spell-checker-language.h"
#include "pluma-spell-checker-language.h"
#include <gedit/gedit-debug.h>
#include <pluma/pluma-debug.h>
#define ISO_639_DOMAIN "iso_639"
#define ISO_3166_DOMAIN "iso_3166"
#define ISOCODESLOCALEDIR ISO_CODES_PREFIX "/share/locale"
struct _GeditSpellCheckerLanguage
struct _PlumaSpellCheckerLanguage
{
gchar *abrev;
gchar *name;
@@ -154,7 +154,7 @@ load_iso_entries (int iso,
char *filename;
int ret = -1;
gedit_debug_message (DEBUG_PLUGINS, "Loading ISO-%d codes", iso);
pluma_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 GeditSpellCheckerLanguage *a,
const GeditSpellCheckerLanguage *b)
lang_cmp (const PlumaSpellCheckerLanguage *a,
const PlumaSpellCheckerLanguage *b)
{
return g_utf8_collate (a->name, b->name);
}
@@ -342,7 +342,7 @@ build_langs_list (const gchar *key,
const gchar *value,
gpointer data)
{
GeditSpellCheckerLanguage *lang = g_new (GeditSpellCheckerLanguage, 1);
PlumaSpellCheckerLanguage *lang = g_new (PlumaSpellCheckerLanguage, 1);
lang->abrev = g_strdup (key);
lang->name = g_strdup (value);
@@ -355,7 +355,7 @@ build_langs_list (const gchar *key,
}
const GSList *
gedit_spell_checker_get_available_languages (void)
pluma_spell_checker_get_available_languages (void)
{
EnchantBroker *broker;
GTree *dicts;
@@ -397,7 +397,7 @@ gedit_spell_checker_get_available_languages (void)
}
const gchar *
gedit_spell_checker_language_to_string (const GeditSpellCheckerLanguage *lang)
pluma_spell_checker_language_to_string (const PlumaSpellCheckerLanguage *lang)
{
if (lang == NULL)
/* Translators: this refers the Default language used by the
@@ -409,25 +409,25 @@ gedit_spell_checker_language_to_string (const GeditSpellCheckerLanguage *lang)
}
const gchar *
gedit_spell_checker_language_to_key (const GeditSpellCheckerLanguage *lang)
pluma_spell_checker_language_to_key (const PlumaSpellCheckerLanguage *lang)
{
g_return_val_if_fail (lang != NULL, NULL);
return lang->abrev;
}
const GeditSpellCheckerLanguage *
gedit_spell_checker_language_from_key (const gchar *key)
const PlumaSpellCheckerLanguage *
pluma_spell_checker_language_from_key (const gchar *key)
{
const GSList *langs;
g_return_val_if_fail (key != NULL, NULL);
langs = gedit_spell_checker_get_available_languages ();
langs = pluma_spell_checker_get_available_languages ();
while (langs != NULL)
{
const GeditSpellCheckerLanguage *l = (const GeditSpellCheckerLanguage *)langs->data;
const PlumaSpellCheckerLanguage *l = (const PlumaSpellCheckerLanguage *)langs->data;
if (g_ascii_strcasecmp (key, l->abrev) == 0)
return l;

View File

@@ -1,7 +1,7 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-checker-language.h
* This file is part of gedit
* pluma-spell-checker-language.h
* This file is part of pluma
*
* Copyright (C) 2006 Paolo Maggi
*
@@ -22,30 +22,30 @@
*/
/*
* Modified by the gedit Team, 2006. See the AUTHORS file for a
* list of people on the gedit Team.
* Modified by the pluma Team, 2006. See the AUTHORS file for a
* list of people on the pluma Team.
* See the ChangeLog files for a list of changes.
*/
#ifndef __GEDIT_SPELL_CHECKER_LANGUAGE_H__
#define __GEDIT_SPELL_CHECKER_LANGUAGE_H__
#ifndef __PLUMA_SPELL_CHECKER_LANGUAGE_H__
#define __PLUMA_SPELL_CHECKER_LANGUAGE_H__
#include <glib.h>
G_BEGIN_DECLS
typedef struct _GeditSpellCheckerLanguage GeditSpellCheckerLanguage;
typedef struct _PlumaSpellCheckerLanguage PlumaSpellCheckerLanguage;
const gchar *gedit_spell_checker_language_to_string (const GeditSpellCheckerLanguage *lang);
const gchar *pluma_spell_checker_language_to_string (const PlumaSpellCheckerLanguage *lang);
const gchar *gedit_spell_checker_language_to_key (const GeditSpellCheckerLanguage *lang);
const gchar *pluma_spell_checker_language_to_key (const PlumaSpellCheckerLanguage *lang);
const GeditSpellCheckerLanguage *gedit_spell_checker_language_from_key (const gchar *key);
const PlumaSpellCheckerLanguage *pluma_spell_checker_language_from_key (const gchar *key);
/* GSList contains "GeditSpellCheckerLanguage*" items */
const GSList *gedit_spell_checker_get_available_languages
/* GSList contains "PlumaSpellCheckerLanguage*" items */
const GSList *pluma_spell_checker_get_available_languages
(void);
G_END_DECLS
#endif /* __GEDIT_SPELL_CHECKER_LANGUAGE_H__ */
#endif /* __PLUMA_SPELL_CHECKER_LANGUAGE_H__ */

View File

@@ -1,7 +1,7 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-checker.c
* This file is part of gedit
* pluma-spell-checker.c
* This file is part of pluma
*
* Copyright (C) 2002-2006 Paolo Maggi
*
@@ -22,8 +22,8 @@
*/
/*
* Modified by the gedit Team, 2002-2006. See the AUTHORS file for a
* list of people on the gedit Team.
* Modified by the pluma Team, 2002-2006. See the AUTHORS file for a
* list of people on the pluma Team.
* See the ChangeLog files for a list of changes.
*/
@@ -38,17 +38,17 @@
#include <glib/gi18n.h>
#include <glib.h>
#include "gedit-spell-checker.h"
#include "gedit-spell-utils.h"
#include "gedit-spell-marshal.h"
#include "pluma-spell-checker.h"
#include "pluma-spell-utils.h"
#include "pluma-spell-marshal.h"
struct _GeditSpellChecker
struct _PlumaSpellChecker
{
GObject parent_instance;
EnchantDict *dict;
EnchantBroker *broker;
const GeditSpellCheckerLanguage *active_lang;
const PlumaSpellCheckerLanguage *active_lang;
};
/* GObject properties */
@@ -69,16 +69,16 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE(GeditSpellChecker, gedit_spell_checker, G_TYPE_OBJECT)
G_DEFINE_TYPE(PlumaSpellChecker, pluma_spell_checker, G_TYPE_OBJECT)
static void
gedit_spell_checker_set_property (GObject *object,
pluma_spell_checker_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
/*
GeditSpellChecker *spell = GEDIT_SPELL_CHECKER (object);
PlumaSpellChecker *spell = PLUMA_SPELL_CHECKER (object);
*/
switch (prop_id)
@@ -92,13 +92,13 @@ gedit_spell_checker_set_property (GObject *object,
}
static void
gedit_spell_checker_get_property (GObject *object,
pluma_spell_checker_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
/*
GeditSpellChecker *spell = GEDIT_SPELL_CHECKER (object);
PlumaSpellChecker *spell = PLUMA_SPELL_CHECKER (object);
*/
switch (prop_id)
@@ -111,13 +111,13 @@ gedit_spell_checker_get_property (GObject *object,
}
static void
gedit_spell_checker_finalize (GObject *object)
pluma_spell_checker_finalize (GObject *object)
{
GeditSpellChecker *spell_checker;
PlumaSpellChecker *spell_checker;
g_return_if_fail (GEDIT_IS_SPELL_CHECKER (object));
g_return_if_fail (PLUMA_IS_SPELL_CHECKER (object));
spell_checker = GEDIT_SPELL_CHECKER (object);
spell_checker = PLUMA_SPELL_CHECKER (object);
if (spell_checker->dict != NULL)
enchant_broker_free_dict (spell_checker->broker, spell_checker->dict);
@@ -125,20 +125,20 @@ gedit_spell_checker_finalize (GObject *object)
if (spell_checker->broker != NULL)
enchant_broker_free (spell_checker->broker);
G_OBJECT_CLASS (gedit_spell_checker_parent_class)->finalize (object);
G_OBJECT_CLASS (pluma_spell_checker_parent_class)->finalize (object);
}
static void
gedit_spell_checker_class_init (GeditSpellCheckerClass * klass)
pluma_spell_checker_class_init (PlumaSpellCheckerClass * klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gedit_spell_checker_set_property;
object_class->get_property = gedit_spell_checker_get_property;
object_class->set_property = pluma_spell_checker_set_property;
object_class->get_property = pluma_spell_checker_get_property;
object_class->finalize = gedit_spell_checker_finalize;
object_class->finalize = pluma_spell_checker_finalize;
g_object_class_install_property (object_class,
PROP_LANGUAGE,
@@ -151,9 +151,9 @@ gedit_spell_checker_class_init (GeditSpellCheckerClass * klass)
g_signal_new ("add_word_to_personal",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerClass, add_word_to_personal),
G_STRUCT_OFFSET (PlumaSpellCheckerClass, add_word_to_personal),
NULL, NULL,
gedit_marshal_VOID__STRING_INT,
pluma_marshal_VOID__STRING_INT,
G_TYPE_NONE,
2,
G_TYPE_STRING,
@@ -163,9 +163,9 @@ gedit_spell_checker_class_init (GeditSpellCheckerClass * klass)
g_signal_new ("add_word_to_session",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerClass, add_word_to_session),
G_STRUCT_OFFSET (PlumaSpellCheckerClass, add_word_to_session),
NULL, NULL,
gedit_marshal_VOID__STRING_INT,
pluma_marshal_VOID__STRING_INT,
G_TYPE_NONE,
2,
G_TYPE_STRING,
@@ -175,9 +175,9 @@ gedit_spell_checker_class_init (GeditSpellCheckerClass * klass)
g_signal_new ("set_language",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerClass, set_language),
G_STRUCT_OFFSET (PlumaSpellCheckerClass, set_language),
NULL, NULL,
gedit_marshal_VOID__POINTER,
pluma_marshal_VOID__POINTER,
G_TYPE_NONE,
1,
G_TYPE_POINTER);
@@ -186,28 +186,28 @@ gedit_spell_checker_class_init (GeditSpellCheckerClass * klass)
g_signal_new ("clear_session",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GeditSpellCheckerClass, clear_session),
G_STRUCT_OFFSET (PlumaSpellCheckerClass, clear_session),
NULL, NULL,
gedit_marshal_VOID__VOID,
pluma_marshal_VOID__VOID,
G_TYPE_NONE,
0);
}
static void
gedit_spell_checker_init (GeditSpellChecker *spell_checker)
pluma_spell_checker_init (PlumaSpellChecker *spell_checker)
{
spell_checker->broker = enchant_broker_init ();
spell_checker->dict = NULL;
spell_checker->active_lang = NULL;
}
GeditSpellChecker *
gedit_spell_checker_new (void)
PlumaSpellChecker *
pluma_spell_checker_new (void)
{
GeditSpellChecker *spell;
PlumaSpellChecker *spell;
spell = GEDIT_SPELL_CHECKER (
g_object_new (GEDIT_TYPE_SPELL_CHECKER, NULL));
spell = PLUMA_SPELL_CHECKER (
g_object_new (PLUMA_TYPE_SPELL_CHECKER, NULL));
g_return_val_if_fail (spell != NULL, NULL);
@@ -215,8 +215,8 @@ gedit_spell_checker_new (void)
}
static gboolean
lazy_init (GeditSpellChecker *spell,
const GeditSpellCheckerLanguage *language)
lazy_init (PlumaSpellChecker *spell,
const PlumaSpellCheckerLanguage *language)
{
if (spell->dict != NULL)
return TRUE;
@@ -232,13 +232,13 @@ lazy_init (GeditSpellChecker *spell,
else
{
/* First try to get a default language */
const GeditSpellCheckerLanguage *l;
const PlumaSpellCheckerLanguage *l;
gint i = 0;
const gchar * const *lang_tags = g_get_language_names ();
while (lang_tags [i])
{
l = gedit_spell_checker_language_from_key (lang_tags [i]);
l = pluma_spell_checker_language_from_key (lang_tags [i]);
if (l != NULL)
{
@@ -252,22 +252,22 @@ lazy_init (GeditSpellChecker *spell,
/* Second try to get a default language */
if (spell->active_lang == NULL)
spell->active_lang = gedit_spell_checker_language_from_key ("en_US");
spell->active_lang = pluma_spell_checker_language_from_key ("en_US");
/* Last try to get a default language */
if (spell->active_lang == NULL)
{
const GSList *langs;
langs = gedit_spell_checker_get_available_languages ();
langs = pluma_spell_checker_get_available_languages ();
if (langs != NULL)
spell->active_lang = (const GeditSpellCheckerLanguage *)langs->data;
spell->active_lang = (const PlumaSpellCheckerLanguage *)langs->data;
}
if (spell->active_lang != NULL)
{
const gchar *key;
key = gedit_spell_checker_language_to_key (spell->active_lang);
key = pluma_spell_checker_language_to_key (spell->active_lang);
spell->dict = enchant_broker_request_dict (spell->broker,
key);
@@ -287,12 +287,12 @@ lazy_init (GeditSpellChecker *spell,
}
gboolean
gedit_spell_checker_set_language (GeditSpellChecker *spell,
const GeditSpellCheckerLanguage *language)
pluma_spell_checker_set_language (PlumaSpellChecker *spell,
const PlumaSpellCheckerLanguage *language)
{
gboolean ret;
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
if (spell->dict != NULL)
{
@@ -306,15 +306,15 @@ gedit_spell_checker_set_language (GeditSpellChecker *spell,
g_signal_emit (G_OBJECT (spell), signals[SET_LANGUAGE], 0, language);
else
g_warning ("Spell checker plugin: cannot use language %s.",
gedit_spell_checker_language_to_string (language));
pluma_spell_checker_language_to_string (language));
return ret;
}
const GeditSpellCheckerLanguage *
gedit_spell_checker_get_language (GeditSpellChecker *spell)
const PlumaSpellCheckerLanguage *
pluma_spell_checker_get_language (PlumaSpellChecker *spell)
{
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), NULL);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), NULL);
if (!lazy_init (spell, spell->active_lang))
return NULL;
@@ -323,14 +323,14 @@ gedit_spell_checker_get_language (GeditSpellChecker *spell)
}
gboolean
gedit_spell_checker_check_word (GeditSpellChecker *spell,
pluma_spell_checker_check_word (PlumaSpellChecker *spell,
const gchar *word,
gssize len)
{
gint enchant_result;
gboolean res = FALSE;
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (word != NULL, FALSE);
if (!lazy_init (spell, spell->active_lang))
@@ -339,10 +339,10 @@ gedit_spell_checker_check_word (GeditSpellChecker *spell,
if (len < 0)
len = strlen (word);
if (strcmp (word, "gedit") == 0)
if (strcmp (word, "pluma") == 0)
return TRUE;
if (gedit_spell_utils_is_digit (word, len))
if (pluma_spell_utils_is_digit (word, len))
return TRUE;
g_return_val_if_fail (spell->dict != NULL, FALSE);
@@ -376,7 +376,7 @@ gedit_spell_checker_check_word (GeditSpellChecker *spell,
/* return NULL on error or if no suggestions are found */
GSList *
gedit_spell_checker_get_suggestions (GeditSpellChecker *spell,
pluma_spell_checker_get_suggestions (PlumaSpellChecker *spell,
const gchar *word,
gssize len)
{
@@ -385,7 +385,7 @@ gedit_spell_checker_get_suggestions (GeditSpellChecker *spell,
GSList *suggestions_list = NULL;
gint i;
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), NULL);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), NULL);
g_return_val_if_fail (word != NULL, NULL);
if (!lazy_init (spell, spell->active_lang))
@@ -418,11 +418,11 @@ gedit_spell_checker_get_suggestions (GeditSpellChecker *spell,
}
gboolean
gedit_spell_checker_add_word_to_personal (GeditSpellChecker *spell,
pluma_spell_checker_add_word_to_personal (PlumaSpellChecker *spell,
const gchar *word,
gssize len)
{
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (word != NULL, FALSE);
if (!lazy_init (spell, spell->active_lang))
@@ -441,11 +441,11 @@ gedit_spell_checker_add_word_to_personal (GeditSpellChecker *spell,
}
gboolean
gedit_spell_checker_add_word_to_session (GeditSpellChecker *spell,
pluma_spell_checker_add_word_to_session (PlumaSpellChecker *spell,
const gchar *word,
gssize len)
{
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (word != NULL, FALSE);
if (!lazy_init (spell, spell->active_lang))
@@ -464,9 +464,9 @@ gedit_spell_checker_add_word_to_session (GeditSpellChecker *spell,
}
gboolean
gedit_spell_checker_clear_session (GeditSpellChecker *spell)
pluma_spell_checker_clear_session (PlumaSpellChecker *spell)
{
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
/* free and re-request dictionary */
if (spell->dict != NULL)
@@ -488,13 +488,13 @@ gedit_spell_checker_clear_session (GeditSpellChecker *spell)
* 'replacement'
*/
gboolean
gedit_spell_checker_set_correction (GeditSpellChecker *spell,
pluma_spell_checker_set_correction (PlumaSpellChecker *spell,
const gchar *word,
gssize w_len,
const gchar *replacement,
gssize r_len)
{
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (spell), FALSE);
g_return_val_if_fail (word != NULL, FALSE);
g_return_val_if_fail (replacement != NULL, FALSE);

View File

@@ -0,0 +1,109 @@
/* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, 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__ */

View File

@@ -1,7 +1,7 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-spell-language-dialog.c
* This file is part of gedit
* pluma-spell-language-dialog.c
* This file is part of pluma
*
* Copyright (C) 2002 Paolo Maggi
*
@@ -22,8 +22,8 @@
*/
/*
* Modified by the gedit Team, 2002. See the AUTHORS file for a
* list of people on the gedit Team.
* 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.
*/
@@ -33,10 +33,10 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gedit/gedit-utils.h>
#include <gedit/gedit-help.h>
#include "gedit-spell-language-dialog.h"
#include "gedit-spell-checker-language.h"
#include <pluma/pluma-utils.h>
#include <pluma/pluma-help.h>
#include "pluma-spell-language-dialog.h"
#include "pluma-spell-checker-language.h"
enum
@@ -47,7 +47,7 @@ enum
};
struct _GeditSpellLanguageDialog
struct _PlumaSpellLanguageDialog
{
GtkDialog dialog;
@@ -55,11 +55,11 @@ struct _GeditSpellLanguageDialog
GtkTreeModel *model;
};
G_DEFINE_TYPE(GeditSpellLanguageDialog, gedit_spell_language_dialog, GTK_TYPE_DIALOG)
G_DEFINE_TYPE(PlumaSpellLanguageDialog, pluma_spell_language_dialog, GTK_TYPE_DIALOG)
static void
gedit_spell_language_dialog_class_init (GeditSpellLanguageDialogClass *klass)
pluma_spell_language_dialog_class_init (PlumaSpellLanguageDialogClass *klass)
{
/* GObjectClass *object_class = G_OBJECT_CLASS (klass); */
}
@@ -70,9 +70,9 @@ dialog_response_handler (GtkDialog *dlg,
{
if (res_id == GTK_RESPONSE_HELP)
{
gedit_help_display (GTK_WINDOW (dlg),
pluma_help_display (GTK_WINDOW (dlg),
NULL,
"gedit-spell-checker-plugin");
"pluma-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,
GeditSpellLanguageDialog *dialog)
PlumaSpellLanguageDialog *dialog)
{
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
}
static void
create_dialog (GeditSpellLanguageDialog *dlg,
create_dialog (PlumaSpellLanguageDialog *dlg,
const gchar *data_dir)
{
GtkWidget *error_widget;
@@ -158,7 +158,7 @@ create_dialog (GeditSpellLanguageDialog *dlg,
NULL);
ui_file = g_build_filename (data_dir, "languages-dialog.ui", NULL);
ret = gedit_utils_get_ui_objects (ui_file,
ret = pluma_utils_get_ui_objects (ui_file,
root_objects,
&error_widget,
"content", &content,
@@ -216,14 +216,14 @@ create_dialog (GeditSpellLanguageDialog *dlg,
}
static void
gedit_spell_language_dialog_init (GeditSpellLanguageDialog *dlg)
pluma_spell_language_dialog_init (PlumaSpellLanguageDialog *dlg)
{
}
static void
populate_language_list (GeditSpellLanguageDialog *dlg,
const GeditSpellCheckerLanguage *cur_lang)
populate_language_list (PlumaSpellLanguageDialog *dlg,
const PlumaSpellCheckerLanguage *cur_lang)
{
GtkListStore *store;
GtkTreeIter iter;
@@ -233,13 +233,13 @@ populate_language_list (GeditSpellLanguageDialog *dlg,
/* create list store */
store = GTK_LIST_STORE (dlg->model);
langs = gedit_spell_checker_get_available_languages ();
langs = pluma_spell_checker_get_available_languages ();
while (langs)
{
const gchar *name;
name = gedit_spell_checker_language_to_string ((const GeditSpellCheckerLanguage*)langs->data);
name = pluma_spell_checker_language_to_string ((const PlumaSpellCheckerLanguage*)langs->data);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
@@ -262,15 +262,15 @@ populate_language_list (GeditSpellLanguageDialog *dlg,
}
GtkWidget *
gedit_spell_language_dialog_new (GtkWindow *parent,
const GeditSpellCheckerLanguage *cur_lang,
pluma_spell_language_dialog_new (GtkWindow *parent,
const PlumaSpellCheckerLanguage *cur_lang,
const gchar *data_dir)
{
GeditSpellLanguageDialog *dlg;
PlumaSpellLanguageDialog *dlg;
g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
dlg = g_object_new (GEDIT_TYPE_SPELL_LANGUAGE_DIALOG, NULL);
dlg = g_object_new (PLUMA_TYPE_SPELL_LANGUAGE_DIALOG, NULL);
create_dialog (dlg, data_dir);
@@ -282,11 +282,11 @@ gedit_spell_language_dialog_new (GtkWindow *parent,
return GTK_WIDGET (dlg);
}
const GeditSpellCheckerLanguage *
gedit_spell_language_get_selected_language (GeditSpellLanguageDialog *dlg)
const PlumaSpellCheckerLanguage *
pluma_spell_language_get_selected_language (PlumaSpellLanguageDialog *dlg)
{
GValue value = {0, };
const GeditSpellCheckerLanguage* lang;
const PlumaSpellCheckerLanguage* lang;
GtkTreeIter iter;
GtkTreeSelection *selection;
@@ -302,7 +302,7 @@ gedit_spell_language_get_selected_language (GeditSpellLanguageDialog *dlg)
COLUMN_LANGUAGE_POINTER,
&value);
lang = (const GeditSpellCheckerLanguage* ) g_value_get_pointer (&value);
lang = (const PlumaSpellCheckerLanguage* ) g_value_get_pointer (&value);
return lang;
}

View File

@@ -0,0 +1,67 @@
/* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, 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__ */

View File

@@ -1,5 +1,5 @@
/*
* gedit-spell-plugin.c
* pluma-spell-plugin.c
*
* Copyright (C) 2002-2005 Paolo Maggi
*
@@ -24,40 +24,40 @@
#include <config.h>
#endif
#include "gedit-spell-plugin.h"
#include "gedit-spell-utils.h"
#include "pluma-spell-plugin.h"
#include "pluma-spell-utils.h"
#include <string.h> /* For strlen */
#include <glib/gi18n.h>
#include <gmodule.h>
#include <gedit/gedit-debug.h>
#include <gedit/gedit-prefs-manager.h>
#include <gedit/gedit-statusbar.h>
#include <pluma/pluma-debug.h>
#include <pluma/pluma-prefs-manager.h>
#include <pluma/pluma-statusbar.h>
#include "gedit-spell-checker.h"
#include "gedit-spell-checker-dialog.h"
#include "gedit-spell-language-dialog.h"
#include "gedit-automatic-spell-checker.h"
#include "pluma-spell-checker.h"
#include "pluma-spell-checker-dialog.h"
#include "pluma-spell-language-dialog.h"
#include "pluma-automatic-spell-checker.h"
#ifdef G_OS_WIN32
#include <gedit/gedit-metadata-manager.h>
#define GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE "spell-language"
#define GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED "spell-enabled"
#include <pluma/pluma-metadata-manager.h>
#define PLUMA_METADATA_ATTRIBUTE_SPELL_LANGUAGE "spell-language"
#define PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED "spell-enabled"
#else
#define GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE "metadata::gedit-spell-language"
#define GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED "metadata::gedit-spell-enabled"
#define PLUMA_METADATA_ATTRIBUTE_SPELL_LANGUAGE "metadata::pluma-spell-language"
#define PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED "metadata::pluma-spell-enabled"
#endif
#define WINDOW_DATA_KEY "GeditSpellPluginWindowData"
#define WINDOW_DATA_KEY "PlumaSpellPluginWindowData"
#define MENU_PATH "/MenuBar/ToolsMenu/ToolsOps_1"
#define GEDIT_SPELL_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
GEDIT_TYPE_SPELL_PLUGIN, \
GeditSpellPluginPrivate))
#define PLUMA_SPELL_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
PLUMA_TYPE_SPELL_PLUGIN, \
PlumaSpellPluginPrivate))
GEDIT_PLUGIN_REGISTER_TYPE(GeditSpellPlugin, gedit_spell_plugin)
PLUMA_PLUGIN_REGISTER_TYPE(PlumaSpellPlugin, pluma_spell_plugin)
typedef struct
{
@@ -70,13 +70,13 @@ typedef struct
typedef struct
{
GeditPlugin *plugin;
GeditWindow *window;
PlumaPlugin *plugin;
PlumaWindow *window;
} ActionData;
static void spell_cb (GtkAction *action, ActionData *action_data);
static void set_language_cb (GtkAction *action, ActionData *action_data);
static void auto_spell_cb (GtkAction *action, GeditWindow *window);
static void auto_spell_cb (GtkAction *action, PlumaWindow *window);
/* UI actions. */
static const GtkActionEntry action_entries[] =
@@ -127,66 +127,66 @@ static GQuark spell_checker_id = 0;
static GQuark check_range_id = 0;
static void
gedit_spell_plugin_init (GeditSpellPlugin *plugin)
pluma_spell_plugin_init (PlumaSpellPlugin *plugin)
{
gedit_debug_message (DEBUG_PLUGINS, "GeditSpellPlugin initializing");
pluma_debug_message (DEBUG_PLUGINS, "PlumaSpellPlugin initializing");
}
static void
gedit_spell_plugin_finalize (GObject *object)
pluma_spell_plugin_finalize (GObject *object)
{
gedit_debug_message (DEBUG_PLUGINS, "GeditSpellPlugin finalizing");
pluma_debug_message (DEBUG_PLUGINS, "PlumaSpellPlugin finalizing");
G_OBJECT_CLASS (gedit_spell_plugin_parent_class)->finalize (object);
G_OBJECT_CLASS (pluma_spell_plugin_parent_class)->finalize (object);
}
static void
set_spell_language_cb (GeditSpellChecker *spell,
const GeditSpellCheckerLanguage *lang,
GeditDocument *doc)
set_spell_language_cb (PlumaSpellChecker *spell,
const PlumaSpellCheckerLanguage *lang,
PlumaDocument *doc)
{
const gchar *key;
g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
g_return_if_fail (PLUMA_IS_DOCUMENT (doc));
g_return_if_fail (lang != NULL);
key = gedit_spell_checker_language_to_key (lang);
key = pluma_spell_checker_language_to_key (lang);
g_return_if_fail (key != NULL);
gedit_document_set_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE,
pluma_document_set_metadata (doc, PLUMA_METADATA_ATTRIBUTE_SPELL_LANGUAGE,
key, NULL);
}
static void
set_language_from_metadata (GeditSpellChecker *spell,
GeditDocument *doc)
set_language_from_metadata (PlumaSpellChecker *spell,
PlumaDocument *doc)
{
const GeditSpellCheckerLanguage *lang = NULL;
const PlumaSpellCheckerLanguage *lang = NULL;
gchar *value = NULL;
value = gedit_document_get_metadata (doc, GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE);
value = pluma_document_get_metadata (doc, PLUMA_METADATA_ATTRIBUTE_SPELL_LANGUAGE);
if (value != NULL)
{
lang = gedit_spell_checker_language_from_key (value);
lang = pluma_spell_checker_language_from_key (value);
g_free (value);
}
if (lang != NULL)
{
g_signal_handlers_block_by_func (spell, set_spell_language_cb, doc);
gedit_spell_checker_set_language (spell, lang);
pluma_spell_checker_set_language (spell, lang);
g_signal_handlers_unblock_by_func (spell, set_spell_language_cb, doc);
}
}
static GeditSpellChecker *
get_spell_checker_from_document (GeditDocument *doc)
static PlumaSpellChecker *
get_spell_checker_from_document (PlumaDocument *doc)
{
GeditSpellChecker *spell;
PlumaSpellChecker *spell;
gpointer data;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_val_if_fail (doc != NULL, NULL);
@@ -194,7 +194,7 @@ get_spell_checker_from_document (GeditDocument *doc)
if (data == NULL)
{
spell = gedit_spell_checker_new ();
spell = pluma_spell_checker_new ();
set_language_from_metadata (spell, doc);
@@ -210,19 +210,19 @@ get_spell_checker_from_document (GeditDocument *doc)
}
else
{
g_return_val_if_fail (GEDIT_IS_SPELL_CHECKER (data), NULL);
spell = GEDIT_SPELL_CHECKER (data);
g_return_val_if_fail (PLUMA_IS_SPELL_CHECKER (data), NULL);
spell = PLUMA_SPELL_CHECKER (data);
}
return spell;
}
static CheckRange *
get_check_range (GeditDocument *doc)
get_check_range (PlumaDocument *doc)
{
CheckRange *range;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_val_if_fail (doc != NULL, NULL);
@@ -232,14 +232,14 @@ get_check_range (GeditDocument *doc)
}
static void
update_current (GeditDocument *doc,
update_current (PlumaDocument *doc,
gint current)
{
CheckRange *range;
GtkTextIter iter;
GtkTextIter end_iter;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_if_fail (doc != NULL);
g_return_if_fail (current >= 0);
@@ -286,20 +286,20 @@ update_current (GeditDocument *doc,
}
static void
set_check_range (GeditDocument *doc,
set_check_range (PlumaDocument *doc,
GtkTextIter *start,
GtkTextIter *end)
{
CheckRange *range;
GtkTextIter iter;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
range = get_check_range (doc);
if (range == NULL)
{
gedit_debug_message (DEBUG_PLUGINS, "There was not a previous check range");
pluma_debug_message (DEBUG_PLUGINS, "There was not a previous check range");
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (doc), &iter);
@@ -320,7 +320,7 @@ set_check_range (GeditDocument *doc,
(GDestroyNotify)g_free);
}
if (gedit_spell_utils_skip_no_spell_check (start, end))
if (pluma_spell_utils_skip_no_spell_check (start, end))
{
if (!gtk_text_iter_inside_word (end))
{
@@ -359,14 +359,14 @@ set_check_range (GeditDocument *doc,
}
static gchar *
get_current_word (GeditDocument *doc, gint *start, gint *end)
get_current_word (PlumaDocument *doc, gint *start, gint *end)
{
const CheckRange *range;
GtkTextIter end_iter;
GtkTextIter current_iter;
gint range_end;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_val_if_fail (doc != NULL, NULL);
g_return_val_if_fail (start != NULL, NULL);
@@ -387,7 +387,7 @@ get_current_word (GeditDocument *doc, gint *start, gint *end)
if (!gtk_text_iter_is_end (&end_iter))
{
gedit_debug_message (DEBUG_PLUGINS, "Current is not end");
pluma_debug_message (DEBUG_PLUGINS, "Current is not end");
gtk_text_iter_forward_word_end (&end_iter);
}
@@ -395,7 +395,7 @@ get_current_word (GeditDocument *doc, gint *start, gint *end)
*start = gtk_text_iter_get_offset (&current_iter);
*end = MIN (gtk_text_iter_get_offset (&end_iter), range_end);
gedit_debug_message (DEBUG_PLUGINS, "Current word extends [%d, %d]", *start, *end);
pluma_debug_message (DEBUG_PLUGINS, "Current word extends [%d, %d]", *start, *end);
if (!(*start < *end))
return NULL;
@@ -407,14 +407,14 @@ get_current_word (GeditDocument *doc, gint *start, gint *end)
}
static gboolean
goto_next_word (GeditDocument *doc)
goto_next_word (PlumaDocument *doc)
{
CheckRange *range;
GtkTextIter current_iter;
GtkTextIter old_current_iter;
GtkTextIter end_iter;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_val_if_fail (doc != NULL, FALSE);
@@ -431,7 +431,7 @@ goto_next_word (GeditDocument *doc)
gtk_text_iter_forward_word_ends (&current_iter, 2);
gtk_text_iter_backward_word_start (&current_iter);
if (gedit_spell_utils_skip_no_spell_check (&current_iter, &end_iter) &&
if (pluma_spell_utils_skip_no_spell_check (&current_iter, &end_iter) &&
(gtk_text_iter_compare (&old_current_iter, &current_iter) < 0) &&
(gtk_text_iter_compare (&current_iter, &end_iter) < 0))
{
@@ -443,17 +443,17 @@ goto_next_word (GeditDocument *doc)
}
static gchar *
get_next_misspelled_word (GeditView *view)
get_next_misspelled_word (PlumaView *view)
{
GeditDocument *doc;
PlumaDocument *doc;
CheckRange *range;
gint start, end;
gchar *word;
GeditSpellChecker *spell;
PlumaSpellChecker *spell;
g_return_val_if_fail (view != NULL, NULL);
doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
g_return_val_if_fail (doc != NULL, NULL);
range = get_check_range (doc);
@@ -466,9 +466,9 @@ get_next_misspelled_word (GeditView *view)
if (word == NULL)
return NULL;
gedit_debug_message (DEBUG_PLUGINS, "Word to check: %s", word);
pluma_debug_message (DEBUG_PLUGINS, "Word to check: %s", word);
while (gedit_spell_checker_check_word (spell, word, -1))
while (pluma_spell_checker_check_word (spell, word, -1))
{
g_free (word);
@@ -480,7 +480,7 @@ get_next_misspelled_word (GeditView *view)
if (word == NULL)
return NULL;
gedit_debug_message (DEBUG_PLUGINS, "Word to check: %s", word);
pluma_debug_message (DEBUG_PLUGINS, "Word to check: %s", word);
}
if (!goto_next_word (doc))
@@ -493,14 +493,14 @@ get_next_misspelled_word (GeditView *view)
range->mw_start = start;
range->mw_end = end;
gedit_debug_message (DEBUG_PLUGINS, "Select [%d, %d]", start, end);
pluma_debug_message (DEBUG_PLUGINS, "Select [%d, %d]", start, end);
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), &s, start);
gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (doc), &e, end);
gtk_text_buffer_select_range (GTK_TEXT_BUFFER (doc), &s, &e);
gedit_view_scroll_to_cursor (view);
pluma_view_scroll_to_cursor (view);
}
else
{
@@ -512,13 +512,13 @@ get_next_misspelled_word (GeditView *view)
}
static void
ignore_cb (GeditSpellCheckerDialog *dlg,
ignore_cb (PlumaSpellCheckerDialog *dlg,
const gchar *w,
GeditView *view)
PlumaView *view)
{
gchar *word = NULL;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_if_fail (w != NULL);
g_return_if_fail (view != NULL);
@@ -526,12 +526,12 @@ ignore_cb (GeditSpellCheckerDialog *dlg,
word = get_next_misspelled_word (view);
if (word == NULL)
{
gedit_spell_checker_dialog_set_completed (dlg);
pluma_spell_checker_dialog_set_completed (dlg);
return;
}
gedit_spell_checker_dialog_set_misspelled_word (GEDIT_SPELL_CHECKER_DIALOG (dlg),
pluma_spell_checker_dialog_set_misspelled_word (PLUMA_SPELL_CHECKER_DIALOG (dlg),
word,
-1);
@@ -539,23 +539,23 @@ ignore_cb (GeditSpellCheckerDialog *dlg,
}
static void
change_cb (GeditSpellCheckerDialog *dlg,
change_cb (PlumaSpellCheckerDialog *dlg,
const gchar *word,
const gchar *change,
GeditView *view)
PlumaView *view)
{
GeditDocument *doc;
PlumaDocument *doc;
CheckRange *range;
gchar *w = NULL;
GtkTextIter start, end;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_if_fail (view != NULL);
g_return_if_fail (word != NULL);
g_return_if_fail (change != NULL);
doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
g_return_if_fail (doc != NULL);
range = get_check_range (doc);
@@ -592,24 +592,24 @@ change_cb (GeditSpellCheckerDialog *dlg,
}
static void
change_all_cb (GeditSpellCheckerDialog *dlg,
change_all_cb (PlumaSpellCheckerDialog *dlg,
const gchar *word,
const gchar *change,
GeditView *view)
PlumaView *view)
{
GeditDocument *doc;
PlumaDocument *doc;
CheckRange *range;
gchar *w = NULL;
GtkTextIter start, end;
gint flags = 0;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
g_return_if_fail (view != NULL);
g_return_if_fail (word != NULL);
g_return_if_fail (change != NULL);
doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
g_return_if_fail (doc != NULL);
range = get_check_range (doc);
@@ -632,11 +632,11 @@ change_all_cb (GeditSpellCheckerDialog *dlg,
g_free (w);
GEDIT_SEARCH_SET_CASE_SENSITIVE (flags, TRUE);
GEDIT_SEARCH_SET_ENTIRE_WORD (flags, TRUE);
PLUMA_SEARCH_SET_CASE_SENSITIVE (flags, TRUE);
PLUMA_SEARCH_SET_ENTIRE_WORD (flags, TRUE);
/* CHECK: currently this function does escaping etc */
gedit_document_replace_all (doc, word, change, flags);
pluma_document_replace_all (doc, word, change, flags);
update_current (doc, range->mw_start + g_utf8_strlen (change, -1));
@@ -645,9 +645,9 @@ change_all_cb (GeditSpellCheckerDialog *dlg,
}
static void
add_word_cb (GeditSpellCheckerDialog *dlg,
add_word_cb (PlumaSpellCheckerDialog *dlg,
const gchar *word,
GeditView *view)
PlumaView *view)
{
g_return_if_fail (view != NULL);
g_return_if_fail (word != NULL);
@@ -659,15 +659,15 @@ add_word_cb (GeditSpellCheckerDialog *dlg,
static void
language_dialog_response (GtkDialog *dlg,
gint res_id,
GeditSpellChecker *spell)
PlumaSpellChecker *spell)
{
if (res_id == GTK_RESPONSE_OK)
{
const GeditSpellCheckerLanguage *lang;
const PlumaSpellCheckerLanguage *lang;
lang = gedit_spell_language_get_selected_language (GEDIT_SPELL_LANGUAGE_DIALOG (dlg));
lang = pluma_spell_language_get_selected_language (PLUMA_SPELL_LANGUAGE_DIALOG (dlg));
if (lang != NULL)
gedit_spell_checker_set_language (spell, lang);
pluma_spell_checker_set_language (spell, lang);
}
gtk_widget_destroy (GTK_WIDGET (dlg));
@@ -677,30 +677,30 @@ static void
set_language_cb (GtkAction *action,
ActionData *action_data)
{
GeditDocument *doc;
GeditSpellChecker *spell;
const GeditSpellCheckerLanguage *lang;
PlumaDocument *doc;
PlumaSpellChecker *spell;
const PlumaSpellCheckerLanguage *lang;
GtkWidget *dlg;
GtkWindowGroup *wg;
gchar *data_dir;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
doc = gedit_window_get_active_document (action_data->window);
doc = pluma_window_get_active_document (action_data->window);
g_return_if_fail (doc != NULL);
spell = get_spell_checker_from_document (doc);
g_return_if_fail (spell != NULL);
lang = gedit_spell_checker_get_language (spell);
lang = pluma_spell_checker_get_language (spell);
data_dir = gedit_plugin_get_data_dir (action_data->plugin);
dlg = gedit_spell_language_dialog_new (GTK_WINDOW (action_data->window),
data_dir = pluma_plugin_get_data_dir (action_data->plugin);
dlg = pluma_spell_language_dialog_new (GTK_WINDOW (action_data->window),
lang,
data_dir);
g_free (data_dir);
wg = gedit_window_get_group (action_data->window);
wg = pluma_window_get_group (action_data->window);
gtk_window_group_add_window (wg, GTK_WINDOW (dlg));
@@ -718,20 +718,20 @@ static void
spell_cb (GtkAction *action,
ActionData *action_data)
{
GeditView *view;
GeditDocument *doc;
GeditSpellChecker *spell;
PlumaView *view;
PlumaDocument *doc;
PlumaSpellChecker *spell;
GtkWidget *dlg;
GtkTextIter start, end;
gchar *word;
gchar *data_dir;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
view = gedit_window_get_active_view (action_data->window);
view = pluma_window_get_active_view (action_data->window);
g_return_if_fail (view != NULL);
doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
doc = PLUMA_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
g_return_if_fail (doc != NULL);
spell = get_spell_checker_from_document (doc);
@@ -746,8 +746,8 @@ spell_cb (GtkAction *action,
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
statusbar = gedit_window_get_statusbar (action_data->window);
gedit_statusbar_flash_message (GEDIT_STATUSBAR (statusbar),
statusbar = pluma_window_get_statusbar (action_data->window);
pluma_statusbar_flash_message (PLUMA_STATUSBAR (statusbar),
data->message_cid,
_("The document is empty."));
@@ -776,16 +776,16 @@ spell_cb (GtkAction *action,
WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
statusbar = gedit_window_get_statusbar (action_data->window);
gedit_statusbar_flash_message (GEDIT_STATUSBAR (statusbar),
statusbar = pluma_window_get_statusbar (action_data->window);
pluma_statusbar_flash_message (PLUMA_STATUSBAR (statusbar),
data->message_cid,
_("No misspelled words"));
return;
}
data_dir = gedit_plugin_get_data_dir (action_data->plugin);
dlg = gedit_spell_checker_dialog_new_from_spell_checker (spell, data_dir);
data_dir = pluma_plugin_get_data_dir (action_data->plugin);
dlg = pluma_spell_checker_dialog_new_from_spell_checker (spell, data_dir);
g_free (data_dir);
gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
gtk_window_set_transient_for (GTK_WINDOW (dlg),
@@ -799,7 +799,7 @@ spell_cb (GtkAction *action,
g_signal_connect (dlg, "add_word_to_personal", G_CALLBACK (add_word_cb), view);
gedit_spell_checker_dialog_set_misspelled_word (GEDIT_SPELL_CHECKER_DIALOG (dlg),
pluma_spell_checker_dialog_set_misspelled_word (PLUMA_SPELL_CHECKER_DIALOG (dlg),
word,
-1);
@@ -809,59 +809,59 @@ spell_cb (GtkAction *action,
}
static void
set_auto_spell (GeditWindow *window,
GeditDocument *doc,
set_auto_spell (PlumaWindow *window,
PlumaDocument *doc,
gboolean active)
{
GeditAutomaticSpellChecker *autospell;
GeditSpellChecker *spell;
PlumaAutomaticSpellChecker *autospell;
PlumaSpellChecker *spell;
spell = get_spell_checker_from_document (doc);
g_return_if_fail (spell != NULL);
autospell = gedit_automatic_spell_checker_get_from_document (doc);
autospell = pluma_automatic_spell_checker_get_from_document (doc);
if (active)
{
if (autospell == NULL)
{
GeditView *active_view;
PlumaView *active_view;
active_view = gedit_window_get_active_view (window);
active_view = pluma_window_get_active_view (window);
g_return_if_fail (active_view != NULL);
autospell = gedit_automatic_spell_checker_new (doc, spell);
gedit_automatic_spell_checker_attach_view (autospell, active_view);
gedit_automatic_spell_checker_recheck_all (autospell);
autospell = pluma_automatic_spell_checker_new (doc, spell);
pluma_automatic_spell_checker_attach_view (autospell, active_view);
pluma_automatic_spell_checker_recheck_all (autospell);
}
}
else
{
if (autospell != NULL)
gedit_automatic_spell_checker_free (autospell);
pluma_automatic_spell_checker_free (autospell);
}
}
static void
auto_spell_cb (GtkAction *action,
GeditWindow *window)
PlumaWindow *window)
{
GeditDocument *doc;
PlumaDocument *doc;
gboolean active;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gedit_debug_message (DEBUG_PLUGINS, active ? "Auto Spell activated" : "Auto Spell deactivated");
pluma_debug_message (DEBUG_PLUGINS, active ? "Auto Spell activated" : "Auto Spell deactivated");
doc = gedit_window_get_active_document (window);
doc = pluma_window_get_active_document (window);
if (doc == NULL)
return;
gedit_document_set_metadata (doc,
GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED,
pluma_document_set_metadata (doc,
PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED,
active ? "1" : NULL, NULL);
set_auto_spell (window, doc, active);
@@ -885,33 +885,33 @@ free_action_data (gpointer data)
}
static void
update_ui_real (GeditWindow *window,
update_ui_real (PlumaWindow *window,
WindowData *data)
{
GeditDocument *doc;
GeditView *view;
PlumaDocument *doc;
PlumaView *view;
gboolean autospell;
GtkAction *action;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
doc = gedit_window_get_active_document (window);
view = gedit_window_get_active_view (window);
doc = pluma_window_get_active_document (window);
view = pluma_window_get_active_view (window);
autospell = (doc != NULL &&
gedit_automatic_spell_checker_get_from_document (doc) != NULL);
pluma_automatic_spell_checker_get_from_document (doc) != NULL);
if (doc != NULL)
{
GeditTab *tab;
GeditTabState state;
PlumaTab *tab;
PlumaTabState state;
tab = gedit_window_get_active_tab (window);
state = gedit_tab_get_state (tab);
tab = pluma_window_get_active_tab (window);
state = pluma_tab_get_state (tab);
/* If the document is loading we can't get the metadata so we
endup with an useless speller */
if (state == GEDIT_TAB_STATE_NORMAL)
if (state == PLUMA_TAB_STATE_NORMAL)
{
action = gtk_action_group_get_action (data->action_group,
"AutoSpell");
@@ -932,16 +932,16 @@ update_ui_real (GeditWindow *window,
}
static void
set_auto_spell_from_metadata (GeditWindow *window,
GeditDocument *doc,
set_auto_spell_from_metadata (PlumaWindow *window,
PlumaDocument *doc,
GtkActionGroup *action_group)
{
gboolean active = FALSE;
gchar *active_str;
GeditDocument *active_doc;
PlumaDocument *active_doc;
active_str = gedit_document_get_metadata (doc,
GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED);
active_str = pluma_document_get_metadata (doc,
PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED);
if (active_str)
{
@@ -953,7 +953,7 @@ set_auto_spell_from_metadata (GeditWindow *window,
set_auto_spell (window, doc, active);
/* In case that the doc is the active one we mark the spell action */
active_doc = gedit_window_get_active_document (window);
active_doc = pluma_window_get_active_document (window);
if (active_doc == doc && action_group != NULL)
{
@@ -972,16 +972,16 @@ set_auto_spell_from_metadata (GeditWindow *window,
}
static void
on_document_loaded (GeditDocument *doc,
on_document_loaded (PlumaDocument *doc,
const GError *error,
GeditWindow *window)
PlumaWindow *window)
{
if (error == NULL)
{
WindowData *data;
GeditSpellChecker *spell;
PlumaSpellChecker *spell;
spell = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc),
spell = PLUMA_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc),
spell_checker_id));
if (spell != NULL)
{
@@ -996,12 +996,12 @@ on_document_loaded (GeditDocument *doc,
}
static void
on_document_saved (GeditDocument *doc,
on_document_saved (PlumaDocument *doc,
const GError *error,
GeditWindow *window)
PlumaWindow *window)
{
GeditAutomaticSpellChecker *autospell;
GeditSpellChecker *spell;
PlumaAutomaticSpellChecker *autospell;
PlumaSpellChecker *spell;
const gchar *key;
if (error != NULL)
@@ -1010,36 +1010,36 @@ on_document_saved (GeditDocument *doc,
}
/* Make sure to save the metadata here too */
autospell = gedit_automatic_spell_checker_get_from_document (doc);
spell = GEDIT_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc), spell_checker_id));
autospell = pluma_automatic_spell_checker_get_from_document (doc);
spell = PLUMA_SPELL_CHECKER (g_object_get_qdata (G_OBJECT (doc), spell_checker_id));
if (spell != NULL)
{
key = gedit_spell_checker_language_to_key (gedit_spell_checker_get_language (spell));
key = pluma_spell_checker_language_to_key (pluma_spell_checker_get_language (spell));
}
else
{
key = NULL;
}
gedit_document_set_metadata (doc,
GEDIT_METADATA_ATTRIBUTE_SPELL_ENABLED,
pluma_document_set_metadata (doc,
PLUMA_METADATA_ATTRIBUTE_SPELL_ENABLED,
autospell != NULL ? "1" : NULL,
GEDIT_METADATA_ATTRIBUTE_SPELL_LANGUAGE,
PLUMA_METADATA_ATTRIBUTE_SPELL_LANGUAGE,
key,
NULL);
}
static void
tab_added_cb (GeditWindow *window,
GeditTab *tab,
tab_added_cb (PlumaWindow *window,
PlumaTab *tab,
gpointer useless)
{
GeditDocument *doc;
GeditView *view;
PlumaDocument *doc;
PlumaView *view;
doc = gedit_tab_get_document (tab);
view = gedit_tab_get_view (tab);
doc = pluma_tab_get_document (tab);
view = pluma_tab_get_view (tab);
g_signal_connect (doc, "loaded",
G_CALLBACK (on_document_loaded),
@@ -1051,39 +1051,39 @@ tab_added_cb (GeditWindow *window,
}
static void
tab_removed_cb (GeditWindow *window,
GeditTab *tab,
tab_removed_cb (PlumaWindow *window,
PlumaTab *tab,
gpointer useless)
{
GeditDocument *doc;
GeditView *view;
PlumaDocument *doc;
PlumaView *view;
doc = gedit_tab_get_document (tab);
view = gedit_tab_get_view (tab);
doc = pluma_tab_get_document (tab);
view = pluma_tab_get_view (tab);
g_signal_handlers_disconnect_by_func (doc, on_document_loaded, window);
g_signal_handlers_disconnect_by_func (doc, on_document_saved, window);
}
static void
impl_activate (GeditPlugin *plugin,
GeditWindow *window)
impl_activate (PlumaPlugin *plugin,
PlumaWindow *window)
{
GtkUIManager *manager;
WindowData *data;
ActionData *action_data;
GList *docs, *l;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
data = g_slice_new (WindowData);
action_data = g_slice_new (ActionData);
action_data->plugin = plugin;
action_data->window = window;
manager = gedit_window_get_ui_manager (window);
manager = pluma_window_get_ui_manager (window);
data->action_group = gtk_action_group_new ("GeditSpellPluginActions");
data->action_group = gtk_action_group_new ("PlumaSpellPluginActions");
gtk_action_group_set_translation_domain (data->action_group,
GETTEXT_PACKAGE);
gtk_action_group_add_actions_full (data->action_group,
@@ -1101,7 +1101,7 @@ impl_activate (GeditPlugin *plugin,
data->ui_id = gtk_ui_manager_new_merge_id (manager);
data->message_cid = gtk_statusbar_get_context_id
(GTK_STATUSBAR (gedit_window_get_statusbar (window)),
(GTK_STATUSBAR (pluma_window_get_statusbar (window)),
"spell_plugin_message");
g_object_set_data_full (G_OBJECT (window),
@@ -1135,10 +1135,10 @@ impl_activate (GeditPlugin *plugin,
update_ui_real (window, data);
docs = gedit_window_get_documents (window);
docs = pluma_window_get_documents (window);
for (l = docs; l != NULL; l = g_list_next (l))
{
GeditDocument *doc = GEDIT_DOCUMENT (l->data);
PlumaDocument *doc = PLUMA_DOCUMENT (l->data);
set_auto_spell_from_metadata (window, doc,
data->action_group);
@@ -1161,15 +1161,15 @@ impl_activate (GeditPlugin *plugin,
}
static void
impl_deactivate (GeditPlugin *plugin,
GeditWindow *window)
impl_deactivate (PlumaPlugin *plugin,
PlumaWindow *window)
{
GtkUIManager *manager;
WindowData *data;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
manager = gedit_window_get_ui_manager (window);
manager = pluma_window_get_ui_manager (window);
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
@@ -1184,12 +1184,12 @@ impl_deactivate (GeditPlugin *plugin,
}
static void
impl_update_ui (GeditPlugin *plugin,
GeditWindow *window)
impl_update_ui (PlumaPlugin *plugin,
PlumaWindow *window)
{
WindowData *data;
gedit_debug (DEBUG_PLUGINS);
pluma_debug (DEBUG_PLUGINS);
data = (WindowData *) g_object_get_data (G_OBJECT (window), WINDOW_DATA_KEY);
g_return_if_fail (data != NULL);
@@ -1198,19 +1198,19 @@ impl_update_ui (GeditPlugin *plugin,
}
static void
gedit_spell_plugin_class_init (GeditSpellPluginClass *klass)
pluma_spell_plugin_class_init (PlumaSpellPluginClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeditPluginClass *plugin_class = GEDIT_PLUGIN_CLASS (klass);
PlumaPluginClass *plugin_class = PLUMA_PLUGIN_CLASS (klass);
object_class->finalize = gedit_spell_plugin_finalize;
object_class->finalize = pluma_spell_plugin_finalize;
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
plugin_class->update_ui = impl_update_ui;
if (spell_checker_id == 0)
spell_checker_id = g_quark_from_string ("GeditSpellCheckerID");
spell_checker_id = g_quark_from_string ("PlumaSpellCheckerID");
if (check_range_id == 0)
check_range_id = g_quark_from_string ("CheckRangeID");

View File

@@ -0,0 +1,75 @@
/*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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;
};
/*
* 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__ */

View File

@@ -1,6 +1,6 @@
/*
* gedit-spell-utils.c
* This file is part of gedit
* pluma-spell-utils.c
* This file is part of pluma
*
* Copyright (C) 2010 - Jesse van den Kieboom
*
@@ -22,11 +22,11 @@
#include <string.h>
#include "gedit-spell-utils.h"
#include "pluma-spell-utils.h"
#include <gtksourceview/gtksourcebuffer.h>
gboolean
gedit_spell_utils_is_digit (const char *text, gssize length)
pluma_spell_utils_is_digit (const char *text, gssize length)
{
gunichar c;
const gchar *p;
@@ -56,7 +56,7 @@ gedit_spell_utils_is_digit (const char *text, gssize length)
}
gboolean
gedit_spell_utils_skip_no_spell_check (GtkTextIter *start,
pluma_spell_utils_skip_no_spell_check (GtkTextIter *start,
GtkTextIter *end)
{
GtkSourceBuffer *buffer = GTK_SOURCE_BUFFER (gtk_text_iter_get_buffer (start));

View File

@@ -1,6 +1,6 @@
/*
* gedit-spell-utils.h
* This file is part of gedit
* pluma-spell-utils.h
* This file is part of pluma
*
* Copyright (C) 2010 - Jesse van den Kieboom
*
@@ -20,18 +20,18 @@
* Boston, MA 02110-1301 USA
*/
#ifndef __GEDIT_SPELL_UTILS_H__
#define __GEDIT_SPELL_UTILS_H__
#ifndef __PLUMA_SPELL_UTILS_H__
#define __PLUMA_SPELL_UTILS_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
gboolean gedit_spell_utils_is_digit (const char *text, gssize length);
gboolean pluma_spell_utils_is_digit (const char *text, gssize length);
gboolean gedit_spell_utils_skip_no_spell_check (GtkTextIter *start, GtkTextIter *end);
gboolean pluma_spell_utils_skip_no_spell_check (GtkTextIter *start, GtkTextIter *end);
G_END_DECLS
#endif /* __GEDIT_SPELL_UTILS_H__ */
#endif /* __PLUMA_SPELL_UTILS_H__ */

View File

@@ -1,4 +1,4 @@
[Gedit Plugin]
[Pluma Plugin]
Module=spell
IAge=2
_Name=Spell Checker
@@ -6,4 +6,4 @@ _Description=Checks the spelling of the current document.
Icon=gtk-spell-check
Authors=Paolo Maggi <paolo@gnome.org>
Copyright=Copyright © 2002-2005 Paolo Maggi
Website=http://www.gedit.org
Website=http://www.pluma.org