[ghex/expand-search-options: 4/5] findrep: Connect GUI checkboxes with search flags.
- From: Logan Rathbone <larathbone src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ghex/expand-search-options: 4/5] findrep: Connect GUI checkboxes with search flags.
- Date: Fri, 15 Apr 2022 04:47:24 +0000 (UTC)
commit bb904ad9a3036e12e703f896c453435476899f1c
Author: Logan Rathbone <poprocks gmail com>
Date: Thu Apr 14 23:59:08 2022 -0400
findrep: Connect GUI checkboxes with search flags.
src/findreplace.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/findreplace.c b/src/findreplace.c
index 1fa067a..62fbd0b 100644
--- a/src/findreplace.c
+++ b/src/findreplace.c
@@ -72,6 +72,7 @@ typedef struct {
GtkWidget *options_btn;
GtkWidget *options_popover;
GtkWidget *options_regex;
+ GtkWidget *options_ignore_case;
gboolean found;
size_t last_found_len;
GCancellable *cancellable;
@@ -289,6 +290,7 @@ find_common (FindDialog *self, enum FindDirection direction,
gint64 offset;
char *str;
HexDocumentFindData *find_data;
+ HexSearchFlags flags;
g_return_if_fail (FIND_IS_DIALOG(self));
@@ -309,6 +311,12 @@ find_common (FindDialog *self, enum FindDirection direction,
return;
}
+ flags = HEX_SEARCH_NONE;
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON(f_priv->options_regex)))
+ flags |= HEX_SEARCH_REGEX;
+ if (gtk_check_button_get_active (GTK_CHECK_BUTTON(f_priv->options_ignore_case)))
+ flags |= HEX_SEARCH_IGNORE_CASE;
+
/* Search for requested string */
find_data = g_new0 (HexDocumentFindData, 1);
@@ -321,27 +329,24 @@ find_common (FindDialog *self, enum FindDirection direction,
if (direction == FIND_FORWARD)
{
- // TEST
-
find_data->start = f_priv->found == FALSE ?
cursor_pos :
cursor_pos + f_priv->last_found_len;
hex_document_find_forward_full_async (doc,
find_data,
- HEX_SEARCH_REGEX, // TEST
+ flags,
f_priv->cancellable,
find_ready_cb,
self);
}
else /* FIND_BACKWARD */
{
- // TEST
find_data->start = cursor_pos;
hex_document_find_backward_full_async (doc,
find_data,
- HEX_SEARCH_REGEX, // TEST
+ flags,
f_priv->cancellable,
find_ready_cb,
self);
@@ -859,6 +864,8 @@ find_dialog_init (FindDialog *self)
gtk_builder_get_object (builder, "find_options_popover"));
f_priv->options_regex = GTK_WIDGET(
gtk_builder_get_object (builder, "find_options_regex"));
+ f_priv->options_ignore_case = GTK_WIDGET(
+ gtk_builder_get_object (builder, "find_options_ignore_case"));
f_priv->options_btn = gtk_menu_button_new ();
gtk_menu_button_set_icon_name (GTK_MENU_BUTTON(f_priv->options_btn),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]