GtkSourceView 3 Reference Manual: GtkSourceSearchSettings

## GtkSourceSearchSettings GtkSourceSearchSettings — The settings of a search |

## Synopsis

    #include <gtksourceview/gtksource.h>

                        GtkSourceSearchSettings;
    GtkSourceSearchSettings * gtk_source_search_settings_new
                                                            (void);
    const gchar *       gtk_source_search_settings_get_search_text
                                                            (GtkSourceSearchSettings *settings);
    void                gtk_source_search_settings_set_search_text
                                                            (GtkSourceSearchSettings *settings,
                                                             const gchar *search_text);
    gboolean            gtk_source_search_settings_get_case_sensitive
                                                            (GtkSourceSearchSettings *settings);
    void                gtk_source_search_settings_set_case_sensitive
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean case_sensitive);
    gboolean            gtk_source_search_settings_get_at_word_boundaries
                                                            (GtkSourceSearchSettings *settings);
    void                gtk_source_search_settings_set_at_word_boundaries
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean at_word_boundaries);
    gboolean            gtk_source_search_settings_get_wrap_around
                                                            (GtkSourceSearchSettings *settings);
    void                gtk_source_search_settings_set_wrap_around
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean wrap_around);
    gboolean            gtk_source_search_settings_get_regex_enabled
                                                            (GtkSourceSearchSettings *settings);
    void                gtk_source_search_settings_set_regex_enabled
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean regex_enabled);

## Object Hierarchy

      GObject
       +----GtkSourceSearchSettings

## Properties

      "at-word-boundaries"       gboolean              : Read / Write / Construct
      "case-sensitive"           gboolean              : Read / Write / Construct
      "regex-enabled"            gboolean              : Read / Write / Construct
      "search-text"              gchar*                : Read / Write / Construct
      "wrap-around"              gboolean              : Read / Write / Construct

## Description

A GtkSourceSearchSettings object represents the settings of a search. The search settings can be associated with one or several GtkSourceSearchContexts.

## Details

### GtkSourceSearchSettings

    typedef struct _GtkSourceSearchSettings GtkSourceSearchSettings;

### gtk_source_search_settings_new ()

    GtkSourceSearchSettings * gtk_source_search_settings_new
                                                            (void);

Creates a new search settings object.

Returns : | a new search settings object.

Since 3.10

### gtk_source_search_settings_get_search_text ()

    const gchar *       gtk_source_search_settings_get_search_text
                                                            (GtkSourceSearchSettings *settings);

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.

`settings` : | a GtkSourceSearchSettings.
Returns : | the text to search, or `NULL` if the search is disabled.

Since 3.10

### gtk_source_search_settings_set_search_text ()

    void                gtk_source_search_settings_set_search_text
                                                            (GtkSourceSearchSettings *settings,
                                                             const gchar *search_text);

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.

`settings` : | a GtkSourceSearchSettings.
`search_text` : | the nul-terminated text to search, or `NULL` to disable the search. [allow-none]

Since 3.10

### gtk_source_search_settings_get_case_sensitive ()

    gboolean            gtk_source_search_settings_get_case_sensitive
                                                            (GtkSourceSearchSettings *settings);

`settings` : | a GtkSourceSearchSettings.
Returns : | whether the search is case sensitive.

Since 3.10

### gtk_source_search_settings_set_case_sensitive ()

    void                gtk_source_search_settings_set_case_sensitive
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean case_sensitive);

Enables or disables the case sensitivity for the search.

`settings` : | a GtkSourceSearchSettings.
`case_sensitive` : | the setting.

Since 3.10

### gtk_source_search_settings_get_at_word_boundaries ()

    gboolean            gtk_source_search_settings_get_at_word_boundaries
                                                            (GtkSourceSearchSettings *settings);

`settings` : | a GtkSourceSearchSettings.
Returns : | whether to search at word boundaries.

Since 3.10

### gtk_source_search_settings_set_at_word_boundaries ()

    void                gtk_source_search_settings_set_at_word_boundaries
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean at_word_boundaries);

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()`.

`settings` : | a GtkSourceSearchSettings.
`at_word_boundaries` : | the setting.

Since 3.10

### gtk_source_search_settings_get_wrap_around ()

    gboolean            gtk_source_search_settings_get_wrap_around
                                                            (GtkSourceSearchSettings *settings);

`settings` : | a GtkSourceSearchSettings.
Returns : | whether to wrap around the search.

Since 3.10

### gtk_source_search_settings_set_wrap_around ()

    void                gtk_source_search_settings_set_wrap_around
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean wrap_around);

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.

`settings` : | a GtkSourceSearchSettings.
`wrap_around` : | the setting.

Since 3.10

### gtk_source_search_settings_get_regex_enabled ()

    gboolean            gtk_source_search_settings_get_regex_enabled
                                                            (GtkSourceSearchSettings *settings);

`settings` : | a GtkSourceSearchSettings.
Returns : | whether to search by regular expressions.

Since 3.10

### gtk_source_search_settings_set_regex_enabled ()

    void                gtk_source_search_settings_set_regex_enabled
                                                            (GtkSourceSearchSettings *settings,
                                                             gboolean regex_enabled);

Enables or disables whether to search by regular expressions. If enabled, the "search-text" property contains the pattern of the regular expression.

`settings` : | a GtkSourceSearchSettings.
`regex_enabled` : | the setting.

Since 3.10

## Property Details

### The `"at-word-boundaries"` property

      "at-word-boundaries"       gboolean              : Read / Write / Construct

If `TRUE`, a search match must start and end a word. The match can span multiple words.

Default value: FALSE

Since 3.10

### The `"case-sensitive"` property

      "case-sensitive"           gboolean              : Read / Write / Construct

Whether the search is case sensitive.

Default value: FALSE

Since 3.10

### The `"regex-enabled"` property

      "regex-enabled"            gboolean              : Read / Write / Construct

Search by regular expressions with "search-text" as the pattern.

Default value: FALSE

Since 3.10

### The `"search-text"` property

      "search-text"              gchar*                : Read / Write / Construct

A search string, or `NULL` if the search is disabled. If the regular expression search is enabled, "search-text" is the pattern.

Default value: NULL

Since 3.10

### The `"wrap-around"` property

      "wrap-around"              gboolean              : Read / Write / Construct

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.

Default value: FALSE

Since 3.10

## See Also

GtkSourceSearchContext