Foundry.FileSearchOptions

g Foundry.FileSearchOptions Foundry.FileSearchOptions GObject.Object GObject.Object GObject.Object->Foundry.FileSearchOptions

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_target (file)

copy ()

dup_excluded_patterns ()

dup_required_patterns ()

dup_search_text ()

get_case_sensitive ()

get_context_lines ()

get_match_whole_words ()

get_max_matches ()

get_recursive ()

get_use_regex ()

list_targets ()

remove_target (file)

set_case_sensitive (case_sensitive)

set_context_lines (context_lines)

set_excluded_patterns (excluded_patterns)

set_match_whole_words (match_whole_words)

set_max_matches (max_matches)

set_recursive (recursive)

set_required_patterns (required_patterns)

set_search_text (search_text)

set_use_regex (use_regex)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

case-sensitive

bool

r/w/en

context-lines

int

r/w/en

excluded-patterns

[str]

r/w/en

match-whole-words

bool

r/w/en

max-matches

int

r/w/en

recursive

bool

r/w/en

required-patterns

[str]

r/w/en

search-text

str

r/w/en

targets

Gio.ListModel

r

use-regex

bool

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Foundry.FileSearchOptions(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Foundry.FileSearchOptionsClass

Configuration options for file search operations.

This class provides configuration options for searching text within files. It supports various search modes including case sensitivity, whole word matching, regular expressions, and pattern-based file filtering. You can specify search targets, set maximum match limits, and configure context lines around matches.

New in version 1.1.

classmethod new()
Returns:

a new [class`Foundry`.FileSearchOptions]

Return type:

Foundry.FileSearchOptions

Creates a new [class`Foundry`.FileSearchOptions] instance.

New in version 1.1.

add_target(file)
Parameters:

file (Gio.File) – a [iface`Gio`.File] to add as a search target

Adds a file as a target for searching.

New in version 1.1.

copy()
Returns:

a new [class`Foundry`.FileSearchOptions]

Return type:

Foundry.FileSearchOptions

Creates a new [class`Foundry`.FileSearchOptions] with a copy of all the values from the original.

dup_excluded_patterns()
Returns:

a newly allocated array of excluded file patterns, or None if not set. Free with GLib.strfreev() when no longer needed.

Return type:

[str] or None

Gets a copy of the excluded file patterns.

These patterns define which files should be excluded from the search. Files that match any of these patterns will be skipped during the search. The patterns use shell-style globbing (e.g. “*.o”).

New in version 1.1.

dup_required_patterns()
Returns:

a newly allocated array of required file patterns, or None if not set. Free with GLib.strfreev() when no longer needed.

Return type:

[str] or None

Gets a copy of the required file patterns.

These patterns define which files must match to be included in the search. Files that do not match any of these patterns will be excluded from the search. The patterns use shell-style globbing (e.g. “*.c”, “*.h”).

New in version 1.1.

dup_search_text()
Returns:

a newly allocated copy of the search text, or None if not set

Return type:

str or None

Gets a copy of the search text.

New in version 1.1.

get_case_sensitive()
Returns:

True if the search should be case sensitive

Return type:

bool

Gets whether the search should be case sensitive.

New in version 1.1.

get_context_lines()
Returns:

the number of context lines

Return type:

int

Gets the number of context lines to include with each match. A value of 1 means 1 line before and 1 line after the match.

New in version 1.1.

get_match_whole_words()
Returns:

True if the search should match whole words only

Return type:

bool

Gets whether the search should match whole words only.

New in version 1.1.

get_max_matches()
Returns:

the maximum number of matches

Return type:

int

Gets the maximum number of matches to return.

New in version 1.1.

get_recursive()
Returns:

True if the search should be recursive

Return type:

bool

Gets whether the search should be recursive.

New in version 1.1.

get_use_regex()
Returns:

True if the search should use regular expressions

Return type:

bool

Gets whether the search should use regular expressions.

New in version 1.1.

list_targets()
Returns:

a [iface`Gio`.ListModel] of [iface`Gio`.File] that are targets for searching.

Return type:

Gio.ListModel

Gets the list of files that are targets for searching.

New in version 1.1.

remove_target(file)
Parameters:

file (Gio.File) – a [iface`Gio`.File] to remove from search targets

Removes a file from the search targets.

New in version 1.1.

set_case_sensitive(case_sensitive)
Parameters:

case_sensitive (bool) – whether the search should be case sensitive

Sets whether the search should be case sensitive.

New in version 1.1.

set_context_lines(context_lines)
Parameters:

context_lines (int) – the number of context lines to include with each match

Sets the number of context lines to include with each match. A value of 1 means 1 line before and 1 line after the match.

New in version 1.1.

set_excluded_patterns(excluded_patterns)
Parameters:

excluded_patterns (str or None) – array of excluded file patterns

Sets the excluded file patterns.

These patterns define which files should be excluded from the search. Files that match any of these patterns will be skipped during the search. The patterns use shell-style globbing (e.g. “*.o”).

New in version 1.1.

set_match_whole_words(match_whole_words)
Parameters:

match_whole_words (bool) – whether the search should match whole words only

Sets whether the search should match whole words only.

New in version 1.1.

set_max_matches(max_matches)
Parameters:

max_matches (int) – the maximum number of matches to return

Sets the maximum number of matches to return.

New in version 1.1.

set_recursive(recursive)
Parameters:

recursive (bool) – whether the search should be recursive

Sets whether the search should be recursive.

New in version 1.1.

set_required_patterns(required_patterns)
Parameters:

required_patterns (str or None) – array of required file patterns

Sets the required file patterns.

These patterns define which files must match to be included in the search. Files that do not match any of these patterns will be excluded from the search. The patterns use shell-style globbing (e.g. “*.c”, “*.h”).

New in version 1.1.

set_search_text(search_text)
Parameters:

search_text (str or None) – the text to search for

Sets the search text.

New in version 1.1.

set_use_regex(use_regex)
Parameters:

use_regex (bool) – whether the search should use regular expressions

Sets whether the search should use regular expressions.

New in version 1.1.

Property Details

Foundry.FileSearchOptions.props.case_sensitive
Name:

case-sensitive

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.context_lines
Name:

context-lines

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.excluded_patterns
Name:

excluded-patterns

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.match_whole_words
Name:

match-whole-words

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.max_matches
Name:

max-matches

Type:

int

Default Value:

10000

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.recursive
Name:

recursive

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.required_patterns
Name:

required-patterns

Type:

[str]

Default Value:

[]

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.search_text
Name:

search-text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Foundry.FileSearchOptions.props.targets
Name:

targets

Type:

Gio.ListModel

Default Value:

None

Flags:

READABLE

Foundry.FileSearchOptions.props.use_regex
Name:

use-regex

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY