[gtksourceview/wip/regex-search: 1/2] SearchSettings
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/regex-search: 1/2] SearchSettings
- Date: Mon, 29 Jul 2013 21:59:08 +0000 (UTC)
commit 83da3b2b83c5c498e787d88552b144637ac693ca
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jul 29 22:47:07 2013 +0200
SearchSettings
The code doesn't compile, just wanted a backup.
gtksourceview/Makefile.am | 2 +
gtksourceview/gtksource.h | 1 +
gtksourceview/gtksourcesearchcontext.c | 95 +------
gtksourceview/gtksourcesearchcontext.h | 25 --
gtksourceview/gtksourcesearchsettings.c | 471 +++++++++++++++++++++++++++++++
gtksourceview/gtksourcesearchsettings.h | 83 ++++++
gtksourceview/gtksourcetypes.h | 1 +
po/POTFILES.in | 1 +
8 files changed, 560 insertions(+), 119 deletions(-)
---
diff --git a/gtksourceview/Makefile.am b/gtksourceview/Makefile.am
index 9479ede..c05795c 100644
--- a/gtksourceview/Makefile.am
+++ b/gtksourceview/Makefile.am
@@ -40,6 +40,7 @@ libgtksourceview_headers = \
gtksourcemarkattributes.h \
gtksourceprintcompositor.h \
gtksourcesearchcontext.h \
+ gtksourcesearchsettings.h \
gtksourcestyle.h \
gtksourcestylescheme.h \
gtksourcestyleschememanager.h \
@@ -103,6 +104,7 @@ libgtksourceview_c_files = \
gtksourcemarkattributes.c \
gtksourceprintcompositor.c \
gtksourcesearchcontext.c \
+ gtksourcesearchsettings.c \
gtksourcestyle.c \
gtksourcestylescheme.c \
gtksourcestyleschememanager.c \
diff --git a/gtksourceview/gtksource.h b/gtksourceview/gtksource.h
index 1b258ba..1c7bd79 100644
--- a/gtksourceview/gtksource.h
+++ b/gtksourceview/gtksource.h
@@ -38,6 +38,7 @@
#include <gtksourceview/gtksourcemarkattributes.h>
#include <gtksourceview/gtksourceprintcompositor.h>
#include <gtksourceview/gtksourcesearchcontext.h>
+#include <gtksourceview/gtksourcesearchsettings.h>
#include <gtksourceview/gtksourcestyle.h>
#include <gtksourceview/gtksourcestylescheme.h>
#include <gtksourceview/gtksourcestyleschememanager.h>
diff --git a/gtksourceview/gtksourcesearchcontext.c b/gtksourceview/gtksourcesearchcontext.c
index b97783d..cc42659 100644
--- a/gtksourceview/gtksourcesearchcontext.c
+++ b/gtksourceview/gtksourcesearchcontext.c
@@ -186,13 +186,7 @@
enum
{
PROP_0,
- PROP_HIGHLIGHT,
- PROP_SEARCH_TEXT,
PROP_OCCURRENCES_COUNT,
- PROP_CASE_SENSITIVE,
- PROP_AT_WORD_BOUNDARIES,
- PROP_WRAP_AROUND,
- PROP_REGEX_ENABLED,
PROP_REGEX_ERROR
};
@@ -220,16 +214,10 @@ struct _GtkSourceSearchContextPrivate
GtkTextTag *found_tag;
- /* State of the search. If text is NULL, the search is disabled. */
- gchar *text;
+ GtkSourceSearchSettings *settings;
gint text_nb_lines;
GRegex *regex;
GError *regex_error;
- GtkTextSearchFlags flags;
- guint at_word_boundaries : 1;
- guint wrap_around : 1;
- guint regex_enabled : 1;
- guint highlight : 1;
};
/* Data for the asynchronous forward and backward search tasks. */
@@ -2545,23 +2533,6 @@ gtk_source_search_context_class_init (GtkSourceSearchContextClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
- * GtkSourceSearchContext:search-text:
- *
- * A search string, or %NULL if the search is disabled. If the regular
- * expression search is enabled, #GtkSourceSearchContext:search-text is
- * the pattern.
- *
- * Since: 3.10
- */
- g_object_class_install_property (object_class,
- PROP_SEARCH_TEXT,
- g_param_spec_string ("search-text",
- _("Search text"),
- _("The text to search"),
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
* GtkSourceSearchContext:occurrences-count:
*
* The total number of search occurrences. If the search is disabled,
@@ -2581,70 +2552,6 @@ gtk_source_search_context_class_init (GtkSourceSearchContextClass *klass)
G_PARAM_READABLE));
/**
- * GtkSourceSearchContext:case-sensitive:
- *
- * Whether the search is case sensitive.
- *
- * Since: 3.10
- */
- g_object_class_install_property (object_class,
- PROP_CASE_SENSITIVE,
- g_param_spec_boolean ("case-sensitive",
- _("Case sensitive"),
- _("Case sensitive"),
- FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
- * GtkSourceSearchContext:at-word-boundaries:
- *
- * If %TRUE, a search match must start and end a word. The match can
- * span multiple words.
- *
- * Since: 3.10
- */
- g_object_class_install_property (object_class,
- PROP_AT_WORD_BOUNDARIES,
- g_param_spec_boolean ("at-word-boundaries",
- _("At word boundaries"),
- _("Search at word boundaries"),
- FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
- * GtkSourceSearchContext:wrap-around:
- *
- * For a forward search, continue at the beginning of the buffer if no
- * search occurrence is found. For a backward search, continue at the
- * end of the buffer.
- *
- * Since: 3.10
- */
- g_object_class_install_property (object_class,
- PROP_WRAP_AROUND,
- g_param_spec_boolean ("wrap-around",
- _("Wrap around"),
- _("Wrap around"),
- TRUE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
- * GtkSourceSearchContext:regex-enabled:
- *
- * Search by regular expressions with
- * #GtkSourceSearchContext:search-text as the pattern.
- *
- * Since: 3.10
- */
- g_object_class_install_property (object_class,
- PROP_REGEX_ENABLED,
- g_param_spec_boolean ("regex-enabled",
- _("Regex enabled"),
- _("Whether to search by regular expression"),
- FALSE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- /**
* GtkSourceSearchContext:regex-error:
*
* If the regex search pattern doesn't follow all the rules, this
diff --git a/gtksourceview/gtksourcesearchcontext.h b/gtksourceview/gtksourcesearchcontext.h
index e835088..ddb74c2 100644
--- a/gtksourceview/gtksourcesearchcontext.h
+++ b/gtksourceview/gtksourcesearchcontext.h
@@ -53,31 +53,6 @@ GType gtk_source_search_context_get_type
(void) G_GNUC_CONST;
GtkSourceSearchContext *gtk_source_search_context_new (GtkSourceBuffer
*buffer);
-void gtk_source_search_context_set_text (GtkSourceSearchContext
*search,
- const gchar
*text);
-
-const gchar * gtk_source_search_context_get_text (GtkSourceSearchContext
*search);
-
-void gtk_source_search_context_set_case_sensitive (GtkSourceSearchContext
*search,
- gboolean
case_sensitive);
-
-gboolean gtk_source_search_context_get_case_sensitive (GtkSourceSearchContext
*search);
-
-void gtk_source_search_context_set_at_word_boundaries (GtkSourceSearchContext
*search,
- gboolean
at_word_boundaries);
-
-gboolean gtk_source_search_context_get_at_word_boundaries (GtkSourceSearchContext
*search);
-
-void gtk_source_search_context_set_wrap_around (GtkSourceSearchContext
*search,
- gboolean
wrap_around);
-
-gboolean gtk_source_search_context_get_wrap_around (GtkSourceSearchContext
*search);
-
-void gtk_source_search_context_set_regex_enabled (GtkSourceSearchContext
*search,
- gboolean
regex_enabled);
-
-gboolean gtk_source_search_context_get_regex_enabled (GtkSourceSearchContext
*search);
-
GError * gtk_source_search_context_get_regex_error (GtkSourceSearchContext
*search);
void gtk_source_search_context_set_highlight (GtkSourceSearchContext
*search,
diff --git a/gtksourceview/gtksourcesearchsettings.c b/gtksourceview/gtksourcesearchsettings.c
new file mode 100644
index 0000000..869e2a6
--- /dev/null
+++ b/gtksourceview/gtksourcesearchsettings.c
@@ -0,0 +1,471 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcesearchsettings.c
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2013 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * GtkSourceView is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "gtksourcesearchsettings.h"
+
+enum
+{
+ PROP_0,
+ PROP_SEARCH_TEXT,
+ PROP_CASE_SENSITIVE,
+ PROP_AT_WORD_BOUNDARIES,
+ PROP_WRAP_AROUND,
+ PROP_REGEX_ENABLED
+};
+
+struct _GtkSourceSearchSettingsPrivate
+{
+ gchar *search_text;
+ guint case_sensitive : 1;
+ guint at_word_boundaries : 1;
+ guint wrap_around : 1;
+ guint regex_enabled : 1;
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceSearchSettings, gtk_source_search_settings, G_TYPE_OBJECT)
+
+static void
+gtk_source_search_settings_finalize (GObject *object)
+{
+ GtkSourceSearchSettings *settings = GTK_SOURCE_SEARCH_SETTINGS (object);
+
+ g_free (settings->priv->search_text);
+
+ G_OBJECT_CLASS (gtk_source_search_settings_parent_class)->finalize (object);
+}
+
+static void
+gtk_source_search_settings_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSourceSearchSettings *settings;
+
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (object));
+
+ settings = GTK_SOURCE_SEARCH_SETTINGS (object);
+
+ switch (prop_id)
+ {
+ case PROP_SEARCH_TEXT:
+ g_value_set_string (value, settings->priv->search_text);
+ break;
+
+ case PROP_CASE_SENSITIVE:
+ g_value_set_boolean (value, settings->priv->case_sensitive);
+ break;
+
+ case PROP_AT_WORD_BOUNDARIES:
+ g_value_set_boolean (value, settings->priv->at_word_boundaries);
+ break;
+
+ case PROP_WRAP_AROUND:
+ g_value_set_boolean (value, settings->priv->wrap_around);
+ break;
+
+ case PROP_REGEX_ENABLED:
+ g_value_set_boolean (value, settings->priv->regex_enabled);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_source_search_settings_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkSourceSearchSettings *settings;
+
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (object));
+
+ settings = GTK_SOURCE_SEARCH_SETTINGS (object);
+
+ switch (prop_id)
+ {
+ case PROP_SEARCH_TEXT:
+ g_free (settings->priv->search_text);
+ settings->priv->search_text = g_value_dup_string (value);
+ break;
+
+ case PROP_CASE_SENSITIVE:
+ settings->priv->case_sensitive = g_value_get_boolean (value);
+ break;
+
+ case PROP_AT_WORD_BOUNDARIES:
+ settings->priv->at_word_boundaries = g_value_get_boolean (value);
+ break;
+
+ case PROP_WRAP_AROUND:
+ settings->priv->wrap_around = g_value_get_boolean (value);
+ break;
+
+ case PROP_REGEX_ENABLED:
+ settings->priv->regex_enabled = g_value_get_boolean (value);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_source_search_settings_class_init (GtkSourceSearchSettingsClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gtk_source_search_settings_finalize;
+ object_class->get_property = gtk_source_search_settings_get_property;
+ object_class->set_property = gtk_source_search_settings_set_property;
+
+ /**
+ * GtkSourceSearchSettings:search-text:
+ *
+ * A search string, or %NULL if the search is disabled. If the regular
+ * expression search is enabled, #GtkSourceSearchSettings:search-text is
+ * the pattern.
+ *
+ * Since: 3.10
+ */
+ g_object_class_install_property (object_class,
+ PROP_SEARCH_TEXT,
+ g_param_spec_string ("search-text",
+ _("Search text"),
+ _("The text to search"),
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
+ * GtkSourceSearchSettings:case-sensitive:
+ *
+ * Whether the search is case sensitive.
+ *
+ * Since: 3.10
+ */
+ g_object_class_install_property (object_class,
+ PROP_CASE_SENSITIVE,
+ g_param_spec_boolean ("case-sensitive",
+ _("Case sensitive"),
+ _("Case sensitive"),
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
+ * GtkSourceSearchSettings:at-word-boundaries:
+ *
+ * If %TRUE, a search match must start and end a word. The match can
+ * span multiple words.
+ *
+ * Since: 3.10
+ */
+ g_object_class_install_property (object_class,
+ PROP_AT_WORD_BOUNDARIES,
+ g_param_spec_boolean ("at-word-boundaries",
+ _("At word boundaries"),
+ _("Search at word boundaries"),
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
+ * GtkSourceSearchSettings:wrap-around:
+ *
+ * For a forward search, continue at the beginning of the buffer if no
+ * search occurrence is found. For a backward search, continue at the
+ * end of the buffer.
+ *
+ * Since: 3.10
+ */
+ g_object_class_install_property (object_class,
+ PROP_WRAP_AROUND,
+ g_param_spec_boolean ("wrap-around",
+ _("Wrap around"),
+ _("Wrap around"),
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ /**
+ * GtkSourceSearchSettings:regex-enabled:
+ *
+ * Search by regular expressions with
+ * #GtkSourceSearchSettings:search-text as the pattern.
+ *
+ * Since: 3.10
+ */
+ g_object_class_install_property (object_class,
+ PROP_REGEX_ENABLED,
+ g_param_spec_boolean ("regex-enabled",
+ _("Regex enabled"),
+ _("Whether to search by regular expression"),
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+}
+
+static void
+gtk_source_search_settings_init (GtkSourceSearchSettings *self)
+{
+ self->priv = gtk_source_search_settings_get_instance_private (self);
+}
+
+/**
+ * gtk_source_search_settings_new:
+ *
+ * Creates a new search settings object.
+ *
+ * Returns: a new search settings object.
+ * Since: 3.10
+ */
+GtkSourceSearchSettings *
+gtk_source_search_settings_new (void)
+{
+ return g_object_new (GTK_SOURCE_TYPE_SEARCH_SETTINGS, NULL);
+}
+
+/**
+ * gtk_source_search_settings_set_search_text:
+ * @settings: a #GtkSourceSearchSettings.
+ * @text: (allow-none): the nul-terminated text to search, or %NULL to disable the search.
+ *
+ * Sets the text to search. If @text is %NULL or is empty, the search will be
+ * disabled. A copy of @text will be made, so you can safely free @text after
+ * a call to this function.
+ *
+ * You may be interested to call gtk_source_utils_unescape_search_text() before
+ * this function.
+ *
+ * Since: 3.10
+ */
+void
+gtk_source_search_settings_set_search_text (GtkSourceSearchSettings *settings,
+ const gchar *search_text)
+{
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings));
+ g_return_if_fail (search_text == NULL || g_utf8_validate (search_text, -1, NULL));
+
+ if ((settings->priv->search_text == NULL &&
+ (search_text == NULL || search_text[0] == '\0')) ||
+ g_strcmp0 (settings->priv->search_text, search_text) == 0)
+ {
+ return;
+ }
+
+ g_free (settings->priv->search_text);
+
+ if (search_text == NULL || search_text[0] == '\0')
+ {
+ settings->priv->search_text = NULL;
+ }
+ else
+ {
+ settings->priv->search_text = g_strdup (search_text);
+ }
+
+ g_object_notify (G_OBJECT (settings), "search-text");
+}
+
+/**
+ * gtk_source_search_settings_get_search_text:
+ * @settings: a #GtkSourceSearchSettings.
+ *
+ * Gets the text to search. The return value must not be freed.
+ *
+ * You may be interested to call gtk_source_utils_escape_search_text() after
+ * this function.
+ *
+ * Returns: the text to search, or %NULL if the search is disabled.
+ * Since: 3.10
+ */
+const gchar *
+gtk_source_search_settings_get_search_text (GtkSourceSearchSettings *settings)
+{
+ g_return_val_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings), NULL);
+
+ return settings->priv->search_text;
+}
+
+/**
+ * gtk_source_search_settings_set_case_sensitive:
+ * @settings: a #GtkSourceSearchSettings.
+ * @case_sensitive: the setting.
+ *
+ * Enables or disables the case sensitivity for the search.
+ *
+ * Since: 3.10
+ */
+void
+gtk_source_search_settings_set_case_sensitive (GtkSourceSearchSettings *settings,
+ gboolean case_sensitive)
+{
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings));
+
+ case_sensitive = case_sensitive != FALSE;
+
+ if (settings->priv->case_sensitive != case_sensitive)
+ {
+ settings->priv->case_sensitive = case_sensitive;
+ g_object_notify (G_OBJECT (settings), "case-sensitive");
+ }
+}
+
+/**
+ * gtk_source_search_settings_get_case_sensitive:
+ * @settings: a #GtkSourceSearchSettings.
+ *
+ * Returns: whether the search is case sensitive.
+ * Since: 3.10
+ */
+gboolean
+gtk_source_search_settings_get_case_sensitive (GtkSourceSearchSettings *settings)
+{
+ g_return_val_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings), FALSE);
+
+ return settings->priv->case_sensitive;
+}
+
+/**
+ * gtk_source_search_settings_set_at_word_boundaries:
+ * @settings: a #GtkSourceSearchSettings.
+ * @at_word_boundaries: the setting.
+ *
+ * Change whether the search is done at word boundaries. If @at_word_boundaries
+ * is %TRUE, a search match must start and end a word. The match can span
+ * multiple words. See also gtk_text_iter_starts_word() and
+ * gtk_text_iter_ends_word().
+ *
+ * Since: 3.10
+ */
+void
+gtk_source_search_settings_set_at_word_boundaries (GtkSourceSearchSettings *settings,
+ gboolean at_word_boundaries)
+{
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings));
+
+ at_word_boundaries = at_word_boundaries != FALSE;
+
+ if (settings->priv->at_word_boundaries != at_word_boundaries)
+ {
+ settings->priv->at_word_boundaries = at_word_boundaries;
+ g_object_notify (G_OBJECT (settings), "at-word-boundaries");
+ }
+}
+
+/**
+ * gtk_source_search_settings_get_at_word_boundaries:
+ * @settings: a #GtkSourceSearchSettings.
+ *
+ * Returns: whether to search at word boundaries.
+ * Since: 3.10
+ */
+gboolean
+gtk_source_search_settings_get_at_word_boundaries (GtkSourceSearchSettings *settings)
+{
+ g_return_val_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings), FALSE);
+
+ return settings->priv->at_word_boundaries;
+}
+
+/**
+ * gtk_source_search_settings_set_wrap_around:
+ * @settings: a #GtkSourceSearchSettings.
+ * @wrap_around: the setting.
+ *
+ * Enables or disables the wrap around search. If @wrap_around is %TRUE, the
+ * forward search continues at the beginning of the buffer if no search
+ * occurrences are found. Similarly, the backward search continues to search at
+ * the end of the buffer.
+ *
+ * Since: 3.10
+ */
+void
+gtk_source_search_settings_set_wrap_around (GtkSourceSearchSettings *settings,
+ gboolean wrap_around)
+{
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings));
+
+ wrap_around = wrap_around != FALSE;
+
+ if (settings->priv->wrap_around != wrap_around)
+ {
+ settings->priv->wrap_around = wrap_around;
+ g_object_notify (G_OBJECT (settings), "wrap-around");
+ }
+}
+
+/**
+ * gtk_source_search_settings_get_wrap_around:
+ * @settings: a #GtkSourceSearchSettings.
+ *
+ * Returns: whether to wrap around the search.
+ * Since: 3.10
+ */
+gboolean
+gtk_source_search_settings_get_wrap_around (GtkSourceSearchSettings *settings)
+{
+ g_return_val_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings), FALSE);
+
+ return settings->priv->wrap_around;
+}
+
+/**
+ * gtk_source_search_settings_set_regex_enabled:
+ * @settings: a #GtkSourceSearchSettings.
+ * @regex: the setting.
+ *
+ * Enables or disables whether to search by regular expressions.
+ * If enabled, the #GtkSourceSearchSettings:search-text property contains the
+ * pattern of the regular expression.
+ *
+ * Since: 3.10
+ */
+void
+gtk_source_search_settings_set_regex_enabled (GtkSourceSearchSettings *settings,
+ gboolean regex_enabled)
+{
+ g_return_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings));
+
+ regex_enabled = regex_enabled != FALSE;
+
+ if (settings->priv->regex_enabled != regex_enabled)
+ {
+ settings->priv->regex_enabled = regex_enabled;
+ g_object_notify (G_OBJECT (settings), "regex-enabled");
+ }
+}
+
+/**
+ * gtk_source_search_settings_get_regex_enabled:
+ * @settings: a #GtkSourceSearchSettings.
+ *
+ * Returns: whether to search by regular expressions.
+ * Since: 3.10
+ */
+gboolean
+gtk_source_search_settings_get_regex_enabled (GtkSourceSearchSettings *settings)
+{
+ g_return_val_if_fail (GTK_SOURCE_IS_SEARCH_SETTINGS (settings), FALSE);
+
+ return settings->priv->regex_enabled;
+}
diff --git a/gtksourceview/gtksourcesearchsettings.h b/gtksourceview/gtksourcesearchsettings.h
new file mode 100644
index 0000000..1aed518
--- /dev/null
+++ b/gtksourceview/gtksourcesearchsettings.h
@@ -0,0 +1,83 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
+/* gtksourcesearchsettings.h
+ * This file is part of GtkSourceView
+ *
+ * Copyright (C) 2013 - Sébastien Wilmet <swilmet gnome org>
+ *
+ * GtkSourceView is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __GTK_SOURCE_SEARCH_SETTINGS_H__
+#define __GTK_SOURCE_SEARCH_SETTINGS_H__
+
+#include <glib-object.h>
+#include <gtksourceview/gtksourcetypes.h>
+
+G_BEGIN_DECLS
+
+#define GTK_SOURCE_TYPE_SEARCH_SETTINGS (gtk_source_search_settings_get_type ())
+#define GTK_SOURCE_SEARCH_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GTK_SOURCE_TYPE_SEARCH_SETTINGS, GtkSourceSearchSettings))
+#define GTK_SOURCE_SEARCH_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GTK_SOURCE_TYPE_SEARCH_SETTINGS, GtkSourceSearchSettingsClass))
+#define GTK_SOURCE_IS_SEARCH_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GTK_SOURCE_TYPE_SEARCH_SETTINGS))
+#define GTK_SOURCE_IS_SEARCH_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GTK_SOURCE_TYPE_SEARCH_SETTINGS))
+#define GTK_SOURCE_SEARCH_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GTK_SOURCE_TYPE_SEARCH_SETTINGS, GtkSourceSearchSettingsClass))
+
+typedef struct _GtkSourceSearchSettingsClass GtkSourceSearchSettingsClass;
+typedef struct _GtkSourceSearchSettingsPrivate GtkSourceSearchSettingsPrivate;
+
+struct _GtkSourceSearchSettings
+{
+ GObject parent;
+
+ GtkSourceSearchSettingsPrivate *priv;
+};
+
+struct _GtkSourceSearchSettingsClass
+{
+ GObjectClass parent_class;
+};
+
+GType gtk_source_search_settings_get_type (void) G_GNUC_CONST;
+
+GtkSourceSearchSettings *gtk_source_search_settings_new (void);
+
+void gtk_source_search_settings_set_search_text (GtkSourceSearchSettings
*settings,
+ const gchar
*search_text);
+
+const gchar *gtk_source_search_settings_get_search_text (GtkSourceSearchSettings
*settings);
+
+void gtk_source_search_settings_set_case_sensitive (GtkSourceSearchSettings
*settings,
+ gboolean
case_sensitive);
+
+gboolean gtk_source_search_settings_get_case_sensitive (GtkSourceSearchSettings
*settings);
+
+void gtk_source_search_settings_set_at_word_boundaries (GtkSourceSearchSettings
*settings,
+ gboolean
at_word_boundaries);
+
+gboolean gtk_source_search_settings_get_at_word_boundaries (GtkSourceSearchSettings
*settings);
+
+void gtk_source_search_settings_set_wrap_around (GtkSourceSearchSettings
*settings,
+ gboolean
wrap_around);
+
+gboolean gtk_source_search_settings_get_wrap_around (GtkSourceSearchSettings
*settings);
+
+void gtk_source_search_settings_set_regex_enabled (GtkSourceSearchSettings
*settings,
+ gboolean
regex_enabled);
+
+gboolean gtk_source_search_settings_get_regex_enabled (GtkSourceSearchSettings
*settings);
+
+G_END_DECLS
+
+#endif /* __GTK_SOURCE_SEARCH_SETTINGS_H__ */
diff --git a/gtksourceview/gtksourcetypes.h b/gtksourceview/gtksourcetypes.h
index ddbe654..6442ddd 100644
--- a/gtksourceview/gtksourcetypes.h
+++ b/gtksourceview/gtksourcetypes.h
@@ -43,6 +43,7 @@ typedef struct _GtkSourceMarkAttributes GtkSourceMarkAttributes;
typedef struct _GtkSourceMark GtkSourceMark;
typedef struct _GtkSourcePrintCompositor GtkSourcePrintCompositor;
typedef struct _GtkSourceSearchContext GtkSourceSearchContext;
+typedef struct _GtkSourceSearchSettings GtkSourceSearchSettings;
typedef struct _GtkSourceStyle GtkSourceStyle;
typedef struct _GtkSourceStyleScheme GtkSourceStyleScheme;
typedef struct _GtkSourceStyleSchemeManager GtkSourceStyleSchemeManager;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 08105a7..ec203dc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -132,6 +132,7 @@ gtksourceview/gtksourcemark.c
gtksourceview/gtksourceprintcompositor.c
gtksourceview/gtksourceregex.c
gtksourceview/gtksourcesearchcontext.c
+gtksourceview/gtksourcesearchsettings.c
gtksourceview/gtksourcestyle.c
gtksourceview/gtksourcestylescheme.c
gtksourceview/gtksourcestyleschememanager.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]