GtkSourceSearchSettings

GtkSourceSearchSettings — Search settings

Functions

Properties

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

Types and Values

Object Hierarchy

    GObject
    ╰── GtkSourceSearchSettings

Includes

#include <gtksourceview/gtksource.h>

Description

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

Functions

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.

Parameters

settings

a GtkSourceSearchSettings.

 

Returns

the text to search, or NULL if the search is disabled.

[nullable]

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 search_text is NULL or is empty, the search will be disabled. A copy of search_text will be made, so you can safely free search_text after a call to this function.

You may be interested to call gtk_source_utils_unescape_search_text() before this function.

Parameters

settings

a GtkSourceSearchSettings.

 

search_text

the nul-terminated text to search, or NULL to disable the search.

[nullable]

Since: 3.10


gtk_source_search_settings_get_case_sensitive ()

gboolean
gtk_source_search_settings_get_case_sensitive
                               (GtkSourceSearchSettings *settings);

Parameters

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.

Parameters

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);

Parameters

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

Parameters

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);

Parameters

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.

Parameters

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);

Parameters

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.

GtkSourceSearchContext uses GRegex when regex search is enabled. See the Regular expression syntax page in the GLib reference manual.

Parameters

settings

a GtkSourceSearchSettings.

 

regex_enabled

the setting.

 

Since: 3.10

Types and Values

GtkSourceSearchSettings

typedef struct _GtkSourceSearchSettings GtkSourceSearchSettings;

Property Details

The “at-word-boundaries” property

  “at-word-boundaries”       gboolean

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

Owner: GtkSourceSearchSettings

Flags: Read / Write / Construct

Default value: FALSE

Since: 3.10


The “case-sensitive” property

  “case-sensitive”           gboolean

Whether the search is case sensitive.

Owner: GtkSourceSearchSettings

Flags: Read / Write / Construct

Default value: FALSE

Since: 3.10


The “regex-enabled” property

  “regex-enabled”            gboolean

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

Owner: GtkSourceSearchSettings

Flags: Read / Write / Construct

Default value: FALSE

Since: 3.10


The “search-text” property

  “search-text”              char *

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

Owner: GtkSourceSearchSettings

Flags: Read / Write / Construct

Default value: NULL

Since: 3.10


The “wrap-around” property

  “wrap-around”              gboolean

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.

Owner: GtkSourceSearchSettings

Flags: Read / Write / Construct

Default value: FALSE

Since: 3.10

See Also

GtkSourceSearchContext