From 064e128bc4b3949dfe244b40e79e513f0bf6be53 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Tue, 16 Feb 2021 18:49:18 +0100 Subject: [PATCH 1/9] wip: add find entry in panel to redo query on same selection of files --- src/plugins/grep/gbp-grep-panel.c | 9 +++ src/plugins/grep/gbp-grep-panel.ui | 89 ++++++++++++++++++++++++++---- 2 files changed, 88 insertions(+), 10 deletions(-) diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index 82f6ca243..745ddd19c 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -41,6 +41,10 @@ struct _GbpGrepPanel GtkButton *replace_button; GtkEntry *replace_entry; GtkSpinner *spinner; + + GtkButton *find_button; + GtkEntry *find_entry; + GtkSpinner *find_spinner; }; enum { @@ -416,6 +420,9 @@ gbp_grep_panel_class_init (GbpGrepPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, replace_entry); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, spinner); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, tree_view); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, find_spinner); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, find_entry); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, find_button); } static void @@ -525,6 +532,8 @@ gbp_grep_panel_set_model (GbpGrepPanel *self, gtk_widget_set_sensitive (GTK_WIDGET (self->replace_button), FALSE); else gtk_widget_set_sensitive (GTK_WIDGET (self->replace_button), TRUE); + + gtk_entry_set_text (self->find_entry, gbp_grep_model_get_query (model)); } gtk_tree_view_set_model (self->tree_view, GTK_TREE_MODEL (model)); diff --git a/src/plugins/grep/gbp-grep-panel.ui b/src/plugins/grep/gbp-grep-panel.ui index 075256925..b73d3c241 100644 --- a/src/plugins/grep/gbp-grep-panel.ui +++ b/src/plugins/grep/gbp-grep-panel.ui @@ -30,7 +30,7 @@ horizontal true - + end @@ -48,7 +48,7 @@ true - Replace With + Find 1.0 true + + + + + true + 30 + + + + + Replace + false + true + + + + 1 + end + + + + + Close + true + + + 0 + end + + + + -- GitLab From 158d194899fd5c85430c513522b1a161e68d935b Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sat, 5 Jun 2021 15:08:18 +0200 Subject: [PATCH 2/9] grep: add panel as editor addin --- src/plugins/grep/gbp-grep-editor-addin.c | 89 ++++++++++++++++++++++++ src/plugins/grep/gbp-grep-editor-addin.h | 31 +++++++++ src/plugins/grep/grep-plugin.c | 5 ++ src/plugins/grep/meson.build | 1 + 4 files changed, 126 insertions(+) create mode 100644 src/plugins/grep/gbp-grep-editor-addin.c create mode 100644 src/plugins/grep/gbp-grep-editor-addin.h diff --git a/src/plugins/grep/gbp-grep-editor-addin.c b/src/plugins/grep/gbp-grep-editor-addin.c new file mode 100644 index 000000000..cf41c3901 --- /dev/null +++ b/src/plugins/grep/gbp-grep-editor-addin.c @@ -0,0 +1,89 @@ +/* gbp-grep-editor-addin.c + * + * Copyright 2018-2019 Christian Hergert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define G_LOG_DOMAIN "gbp-grep-editor-addin" + +#include "config.h" + +#include +#include +#include +#include + +#include "gbp-grep-editor-addin.h" +#include "gbp-grep-panel.h" + +struct _GbpGrepEditorAddin +{ + GObject parent_instance; + + GtkWidget *panel; +}; + +static void +gbp_grep_editor_addin_load (IdeEditorAddin *addin, + IdeEditorSurface *editor_surface) +{ + GbpGrepEditorAddin *self = (GbpGrepEditorAddin *)addin; + GtkWidget *utilities; + + g_assert (GBP_IS_GREP_EDITOR_ADDIN (self)); + + utilities = ide_editor_surface_get_utilities (IDE_EDITOR_SURFACE (editor_surface)); + + self->panel = gbp_grep_panel_new (); + gtk_container_add (GTK_CONTAINER (utilities), self->panel); + gtk_widget_show (self->panel); +} + +static void +gbp_grep_editor_addin_unload (IdeEditorAddin *addin, + IdeEditorSurface *editor_surface) +{ + GbpGrepEditorAddin *self = (GbpGrepEditorAddin *)addin; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (GBP_IS_GREP_EDITOR_ADDIN (self)); + + if (self->panel != NULL) + gtk_widget_destroy (GTK_WIDGET (self->panel)); + + g_assert (self->panel == NULL); +} + +static void +editor_addin_iface_init (IdeEditorAddinInterface *iface) +{ + iface->load = gbp_grep_editor_addin_load; + iface->unload = gbp_grep_editor_addin_unload; +} + +G_DEFINE_TYPE_WITH_CODE (GbpGrepEditorAddin, gbp_grep_editor_addin, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_ADDIN, editor_addin_iface_init)) + +static void +gbp_grep_editor_addin_class_init (GbpGrepEditorAddinClass *klass) +{ +} + +static void +gbp_grep_editor_addin_init (GbpGrepEditorAddin *self) +{ +} diff --git a/src/plugins/grep/gbp-grep-editor-addin.h b/src/plugins/grep/gbp-grep-editor-addin.h new file mode 100644 index 000000000..e88d81374 --- /dev/null +++ b/src/plugins/grep/gbp-grep-editor-addin.h @@ -0,0 +1,31 @@ +/* gbp-terminal-editor-addin.h + * + * Copyright 2018-2019 Christian Hergert + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define GBP_TYPE_GREP_EDITOR_ADDIN (gbp_grep_editor_addin_get_type()) + +G_DECLARE_FINAL_TYPE (GbpGrepEditorAddin, gbp_grep_editor_addin, GBP, GREP_EDITOR_ADDIN, GObject) + +G_END_DECLS diff --git a/src/plugins/grep/grep-plugin.c b/src/plugins/grep/grep-plugin.c index 561dc0b1f..71dfcb95f 100644 --- a/src/plugins/grep/grep-plugin.c +++ b/src/plugins/grep/grep-plugin.c @@ -21,9 +21,11 @@ #include "config.h" #include +#include #include #include "gbp-grep-tree-addin.h" +#include "gbp-grep-editor-addin.h" _IDE_EXTERN void _gbp_grep_register_types (PeasObjectModule *module) @@ -31,4 +33,7 @@ _gbp_grep_register_types (PeasObjectModule *module) peas_object_module_register_extension_type (module, IDE_TYPE_TREE_ADDIN, GBP_TYPE_GREP_TREE_ADDIN); + peas_object_module_register_extension_type (module, + IDE_TYPE_EDITOR_ADDIN, + GBP_TYPE_GREP_EDITOR_ADDIN); } diff --git a/src/plugins/grep/meson.build b/src/plugins/grep/meson.build index 0803c6e91..54a1e1f9b 100644 --- a/src/plugins/grep/meson.build +++ b/src/plugins/grep/meson.build @@ -5,6 +5,7 @@ plugins_sources += files([ 'gbp-grep-panel.c', 'gbp-grep-popover.c', 'gbp-grep-tree-addin.c', + 'gbp-grep-editor-addin.c', 'grep-plugin.c', ]) -- GitLab From e012803b45fd22b99719f1318f42cda8d6c31db4 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sat, 5 Jun 2021 15:11:48 +0200 Subject: [PATCH 3/9] grep: remove close button Now that the panel is static we don't want an option to close the panel without a way to get it back --- src/plugins/grep/gbp-grep-panel.c | 8 -------- src/plugins/grep/gbp-grep-panel.ui | 11 ----------- 2 files changed, 19 deletions(-) diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index 745ddd19c..fc13a0a02 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -37,7 +37,6 @@ struct _GbpGrepPanel GtkTreeView *tree_view; GtkTreeViewColumn *toggle_column; GtkCheckButton *check; - GtkButton *close_button; GtkButton *replace_button; GtkEntry *replace_entry; GtkSpinner *spinner; @@ -415,7 +414,6 @@ gbp_grep_panel_class_init (GbpGrepPanelClass *klass) gtk_widget_class_set_css_name (widget_class, "gbpgreppanel"); gtk_widget_class_set_template_from_resource (widget_class, "/plugins/grep/gbp-grep-panel.ui"); - gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, close_button); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, replace_button); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, replace_entry); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, spinner); @@ -433,12 +431,6 @@ gbp_grep_panel_init (GbpGrepPanel *self) gtk_widget_init_template (GTK_WIDGET (self)); - g_signal_connect_object (self->close_button, - "clicked", - G_CALLBACK (gtk_widget_destroy), - self, - G_CONNECT_SWAPPED); - g_signal_connect_object (self->replace_button, "clicked", G_CALLBACK (gbp_grep_panel_replace_clicked_cb), diff --git a/src/plugins/grep/gbp-grep-panel.ui b/src/plugins/grep/gbp-grep-panel.ui index b73d3c241..6b8949d60 100644 --- a/src/plugins/grep/gbp-grep-panel.ui +++ b/src/plugins/grep/gbp-grep-panel.ui @@ -143,16 +143,6 @@ end - - - Close - true - - - 0 - end - - @@ -165,7 +155,6 @@ horizontal - -- GitLab From 86477edf35066541e341f26765eea3bf6b05e852 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 6 Jun 2021 20:45:49 +0200 Subject: [PATCH 4/9] wip: add find options in panel --- src/plugins/grep/gbp-grep-panel.ui | 132 +++++++++++++++-------------- 1 file changed, 70 insertions(+), 62 deletions(-) diff --git a/src/plugins/grep/gbp-grep-panel.ui b/src/plugins/grep/gbp-grep-panel.ui index 6b8949d60..4a3c097a4 100644 --- a/src/plugins/grep/gbp-grep-panel.ui +++ b/src/plugins/grep/gbp-grep-panel.ui @@ -40,22 +40,12 @@ 12 - + 12 false horizontal true - - - Find - 1.0 - true - - - true @@ -65,10 +55,10 @@ Find - false + true true @@ -86,69 +76,86 @@ 6 6 6 - vertical + horizontal true + + + end + + + true + true + start + 12 + + - 6 - 6 - 6 - 6 + 12 + false horizontal true - - - end + + + true + 30 - - true - true - start - 12 - - - - 12 - false - horizontal + + + Replace + false true - - - Replace With - 1.0 - true - - - - - - true - 30 - - - - - Replace - false - true - - - - 1 - end - - + + + 1 + end + + + + 6 + horizontal + true + + + true + Search _recursively through folders + true + true + + + + + Match _case when searching + true + true + true + + + + + Match _whole words + true + true + + + + + Allow regular _expressions + true + true + + + + @@ -159,3 +166,4 @@ + -- GitLab From e794ad6ecdc9e5e13f9a3102c2e65adec3ac136a Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 6 Jun 2021 21:00:05 +0200 Subject: [PATCH 5/9] grep: wire up checkboxes --- src/plugins/grep/gbp-grep-panel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index fc13a0a02..cc397711f 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -44,6 +44,11 @@ struct _GbpGrepPanel GtkButton *find_button; GtkEntry *find_entry; GtkSpinner *find_spinner; + + GtkCheckButton *regex_button; + GtkCheckButton *whole_button; + GtkCheckButton *case_button; + GtkCheckButton *recursive_button; }; enum { @@ -421,6 +426,10 @@ gbp_grep_panel_class_init (GbpGrepPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, find_spinner); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, find_entry); gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, find_button); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, regex_button); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, whole_button); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, case_button); + gtk_widget_class_bind_template_child (widget_class, GbpGrepPanel, recursive_button); } static void -- GitLab From 9072a7d7964484aa988823bd72a38e1684252b11 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 6 Jun 2021 21:00:25 +0200 Subject: [PATCH 6/9] grep: wire up find button click handler --- src/plugins/grep/gbp-grep-panel.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index cc397711f..4c8fcbdfd 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -363,6 +363,17 @@ gbp_grep_panel_replace_clicked_cb (GbpGrepPanel *self, g_object_ref (self)); } +static void +gbp_grep_panel_find_clicked_cb (GbpGrepPanel *self, + GtkButton *button) +{ + GbpGrepModel *model; + + g_assert (GBP_IS_GREP_PANEL (self)); + g_assert (GTK_IS_BUTTON (button)); + + model = GBP_GREP_MODEL (gtk_tree_view_get_model (self->tree_view)); +} static void gbp_grep_panel_get_property (GObject *object, guint prop_id, @@ -446,6 +457,12 @@ gbp_grep_panel_init (GbpGrepPanel *self) self, G_CONNECT_SWAPPED); + g_signal_connect_object (self->find_button, + "clicked", + G_CALLBACK (gbp_grep_panel_find_clicked_cb), + self, + G_CONNECT_SWAPPED); + g_signal_connect_object (self->tree_view, "row-activated", G_CALLBACK (gbp_grep_panel_row_activated_cb), -- GitLab From b36db258986ccdb378aaef19f84fbd3b6adeaede Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 6 Jun 2021 21:12:55 +0200 Subject: [PATCH 7/9] grep: update model when search is refined --- src/plugins/grep/gbp-grep-panel.c | 56 ++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index 4c8fcbdfd..930518a46 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -363,16 +363,70 @@ gbp_grep_panel_replace_clicked_cb (GbpGrepPanel *self, g_object_ref (self)); } +static void +gbp_grep_panel_scan_cb (GObject *object, + GAsyncResult *result, + gpointer user_data) +{ + GbpGrepModel *model = (GbpGrepModel *)object; + g_autoptr(GbpGrepPanel) panel = user_data; + g_autoptr(GError) error = NULL; + + g_assert (GBP_IS_GREP_MODEL (model)); + g_assert (G_IS_ASYNC_RESULT (result)); + g_assert (GBP_IS_GREP_PANEL (panel)); + + if (!gbp_grep_model_scan_finish (model, result, &error)) + g_warning ("Failed to find files: %s", error->message); + else + gbp_grep_panel_set_model (panel, model); + + gtk_widget_grab_focus (GTK_WIDGET (panel)); +} + static void gbp_grep_panel_find_clicked_cb (GbpGrepPanel *self, GtkButton *button) { + IdeContext *context; GbpGrepModel *model; + gboolean use_regex; + gboolean at_word_boundaries; + gboolean case_sensitive; + gboolean recursive; g_assert (GBP_IS_GREP_PANEL (self)); g_assert (GTK_IS_BUTTON (button)); - model = GBP_GREP_MODEL (gtk_tree_view_get_model (self->tree_view)); + context = ide_widget_get_context (GTK_WIDGET (self)); + + use_regex = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->regex_button)); + at_word_boundaries = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->whole_button)); + case_sensitive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->case_button)); + recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->recursive_button)); + + model = gbp_grep_panel_get_model (self); + + if (model == NULL) + { + model = gbp_grep_model_new (context); + } + + gbp_grep_model_set_use_regex (model, use_regex); + gbp_grep_model_set_at_word_boundaries (model, at_word_boundaries); + gbp_grep_model_set_case_sensitive (model, case_sensitive); + gbp_grep_model_set_query (model, gtk_entry_get_text (self->find_entry)); + + if (gtk_widget_get_visible (GTK_WIDGET (self->recursive_button))) + gbp_grep_model_set_recursive (model, recursive); + else + gbp_grep_model_set_recursive (model, FALSE); + + // Refine the search based on the modified model + gbp_grep_model_scan_async (model, + NULL, + gbp_grep_panel_scan_cb, + g_object_ref (self)); } static void gbp_grep_panel_get_property (GObject *object, -- GitLab From 2ee2bad197c07d971db03f2d9f7570e3a6c2babb Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 6 Jun 2021 22:07:02 +0200 Subject: [PATCH 8/9] grep: add method to clone model This seems to make builder crash :( --- src/plugins/grep/gbp-grep-model.c | 22 ++++++++++++++++++++++ src/plugins/grep/gbp-grep-model.h | 2 ++ src/plugins/grep/gbp-grep-panel.c | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/plugins/grep/gbp-grep-model.c b/src/plugins/grep/gbp-grep-model.c index ef0ea9e8a..bdf4950d5 100644 --- a/src/plugins/grep/gbp-grep-model.c +++ b/src/plugins/grep/gbp-grep-model.c @@ -220,6 +220,28 @@ gbp_grep_model_new (IdeContext *context) return g_steal_pointer (&self); } +GbpGrepModel * +gbp_grep_model_from (IdeContext *context, + GbpGrepModel *from) +{ + GbpGrepModel *self; + + g_return_val_if_fail (IDE_IS_CONTEXT (context), NULL); + + self = g_object_new (GBP_TYPE_GREP_MODEL, NULL); + self->context = g_object_ref (context); + + self->use_regex = gbp_grep_model_get_use_regex (from); + self->at_word_boundaries = gbp_grep_model_get_at_word_boundaries (from); + self->case_sensitive = gbp_grep_model_get_case_sensitive (from); + self->recursive = gbp_grep_model_get_recursive (from); + + self->query = gbp_grep_model_get_query (from); + self->directory = gbp_grep_model_get_directory (from); + + return g_steal_pointer (&self); +} + static void gbp_grep_model_dispose (GObject *object) { diff --git a/src/plugins/grep/gbp-grep-model.h b/src/plugins/grep/gbp-grep-model.h index 863934bf6..66a72c50d 100644 --- a/src/plugins/grep/gbp-grep-model.h +++ b/src/plugins/grep/gbp-grep-model.h @@ -46,6 +46,8 @@ typedef struct G_DECLARE_FINAL_TYPE (GbpGrepModel, gbp_grep_model, GBP, GREP_MODEL, IdeObject) GbpGrepModel *gbp_grep_model_new (IdeContext *context); +GbpGrepModel *gbp_grep_model_from (IdeContext *context, + GbpGrepModel *from); GFile *gbp_grep_model_get_directory (GbpGrepModel *self); void gbp_grep_model_set_directory (GbpGrepModel *self, GFile *directory); diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index 930518a46..129208dfe 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -411,6 +411,10 @@ gbp_grep_panel_find_clicked_cb (GbpGrepPanel *self, { model = gbp_grep_model_new (context); } + else + { + model = gbp_grep_model_from (context, model); + } gbp_grep_model_set_use_regex (model, use_regex); gbp_grep_model_set_at_word_boundaries (model, at_word_boundaries); @@ -422,7 +426,6 @@ gbp_grep_panel_find_clicked_cb (GbpGrepPanel *self, else gbp_grep_model_set_recursive (model, FALSE); - // Refine the search based on the modified model gbp_grep_model_scan_async (model, NULL, gbp_grep_panel_scan_cb, -- GitLab From 8173e01375029ec7f50344a3f1f4355e35070392 Mon Sep 17 00:00:00 2001 From: Peter Maatman Date: Sun, 6 Jun 2021 22:16:23 +0200 Subject: [PATCH 9/9] grep: align ui with model state there must be a better way to do this? --- src/plugins/grep/gbp-grep-panel.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/plugins/grep/gbp-grep-panel.c b/src/plugins/grep/gbp-grep-panel.c index 129208dfe..7c2f8b316 100644 --- a/src/plugins/grep/gbp-grep-panel.c +++ b/src/plugins/grep/gbp-grep-panel.c @@ -595,6 +595,11 @@ void gbp_grep_panel_set_model (GbpGrepPanel *self, GbpGrepModel *model) { + gboolean use_regex; + gboolean at_word_boundaries; + gboolean case_sensitive; + gboolean recursive; + g_return_if_fail (GBP_IS_GREP_PANEL (self)); g_return_if_fail (!model || GBP_IS_GREP_MODEL (model)); @@ -612,6 +617,17 @@ gbp_grep_panel_set_model (GbpGrepPanel *self, } gtk_tree_view_set_model (self->tree_view, GTK_TREE_MODEL (model)); + + // Align the UI with the settings on the model + use_regex = gbp_grep_model_get_use_regex (model); + at_word_boundaries = gbp_grep_model_get_at_word_boundaries (model); + case_sensitive = gbp_grep_model_get_case_sensitive (model); + recursive = gbp_grep_model_get_recursive (model); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->regex_button), use_regex); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->whole_button), at_word_boundaries); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->case_button), case_sensitive); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->recursive_button), recursive); } /** -- GitLab