[gedit] Move util function in the new utils file
- From: Paolo Borelli <pborelli src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit] Move util function in the new utils file
- Date: Tue, 5 Jan 2010 19:08:56 +0000 (UTC)
commit b2233b9b8aa342146e18195a97757ffa97a7e015
Author: Paolo Borelli <pborelli gnome org>
Date: Tue Jan 5 20:08:12 2010 +0100
Move util function in the new utils file
plugins/spell/gedit-spell-checker.c | 36 +----------------------
plugins/spell/gedit-spell-utils.c | 54 +++++++++++++++++++++++++++++++++++
plugins/spell/gedit-spell-utils.h | 2 +
3 files changed, 58 insertions(+), 34 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-checker.c b/plugins/spell/gedit-spell-checker.c
index 6325aad..b89981b 100644
--- a/plugins/spell/gedit-spell-checker.c
+++ b/plugins/spell/gedit-spell-checker.c
@@ -39,6 +39,7 @@
#include <glib.h>
#include "gedit-spell-checker.h"
+#include "gedit-spell-utils.h"
/* FIXME - Rename the marshal file - Paolo */
#include "gedit-spell-checker-dialog-marshal.h"
@@ -68,14 +69,10 @@ enum {
LAST_SIGNAL
};
-static gboolean is_digit (const char *text,
- gssize length);
-
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE(GeditSpellChecker, gedit_spell_checker, G_TYPE_OBJECT)
-
static void
gedit_spell_checker_set_property (GObject *object,
guint prop_id,
@@ -347,7 +344,7 @@ gedit_spell_checker_check_word (GeditSpellChecker *spell,
if (strcmp (word, "gedit") == 0)
return TRUE;
- if (is_digit (word, len))
+ if (gedit_spell_utils_is_digit (word, len))
return TRUE;
g_return_val_if_fail (spell->dict != NULL, FALSE);
@@ -523,32 +520,3 @@ gedit_spell_checker_set_correction (GeditSpellChecker *spell,
return TRUE;
}
-static gboolean
-is_digit (const char *text, gssize length)
-{
- gunichar c;
- const gchar *p;
- const gchar *end;
-
- g_return_val_if_fail (text != NULL, FALSE);
-
- if (length < 0)
- length = strlen (text);
-
- p = text;
- end = text + length;
-
- while (p != end) {
- const gchar *next;
- next = g_utf8_next_char (p);
-
- c = g_utf8_get_char (p);
-
- if (!g_unichar_isdigit (c) && c != '.' && c != ',')
- return FALSE;
-
- p = next;
- }
-
- return TRUE;
-}
diff --git a/plugins/spell/gedit-spell-utils.c b/plugins/spell/gedit-spell-utils.c
index f178416..0782d37 100644
--- a/plugins/spell/gedit-spell-utils.c
+++ b/plugins/spell/gedit-spell-utils.c
@@ -1,7 +1,61 @@
+/*
+ * gedit-spell-utils.c
+ * This file is part of gedit
+ *
+ * Copyright (C) 2010 - Jesse van den Kieboom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include <string.h>
+
#include "gedit-spell-utils.h"
#include <gtksourceview/gtksourcebuffer.h>
gboolean
+gedit_spell_utils_is_digit (const char *text, gssize length)
+{
+ gunichar c;
+ const gchar *p;
+ const gchar *end;
+
+ g_return_val_if_fail (text != NULL, FALSE);
+
+ if (length < 0)
+ length = strlen (text);
+
+ p = text;
+ end = text + length;
+
+ while (p != end) {
+ const gchar *next;
+ next = g_utf8_next_char (p);
+
+ c = g_utf8_get_char (p);
+
+ if (!g_unichar_isdigit (c) && c != '.' && c != ',')
+ return FALSE;
+
+ p = next;
+ }
+
+ return TRUE;
+}
+
+gboolean
gedit_spell_utils_skip_no_spell_check (GtkTextIter *start,
GtkTextIter *end)
{
diff --git a/plugins/spell/gedit-spell-utils.h b/plugins/spell/gedit-spell-utils.h
index c5caa04..fbfe4b1 100644
--- a/plugins/spell/gedit-spell-utils.h
+++ b/plugins/spell/gedit-spell-utils.h
@@ -27,6 +27,8 @@
G_BEGIN_DECLS
+gboolean gedit_spell_utils_is_digit (const char *text, gssize length);
+
gboolean gedit_spell_utils_skip_no_spell_check (GtkTextIter *start, GtkTextIter *end);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]