Blame SOURCES/0044-wizard-introduce-the-searched-words-list.patch

562801
From 54fa01f84b33f8081aa936af71ceea2ae3515d9a Mon Sep 17 00:00:00 2001
562801
From: Jakub Filak <jfilak@redhat.com>
562801
Date: Tue, 25 Mar 2014 16:01:05 +0100
562801
Subject: [LIBREPORT PATCH 44/93] wizard: introduce the searched words list
562801
562801
Replace the navigation arrows by a list consisting of lines containing
562801
the searched words.
562801
562801
Resolves rhbz#1069917
562801
562801
Conflicts:
562801
	src/gui-wizard-gtk/wizard.glade
562801
---
562801
 src/gui-wizard-gtk/wizard.c     | 352 +++++++++++++++++++++++-----------------
562801
 src/gui-wizard-gtk/wizard.glade | 236 ++++++++++++++++++---------
562801
 2 files changed, 366 insertions(+), 222 deletions(-)
562801
562801
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
562801
index f8df31a..197492a 100644
562801
--- a/src/gui-wizard-gtk/wizard.c
562801
+++ b/src/gui-wizard-gtk/wizard.c
562801
@@ -101,10 +101,15 @@ static GtkListStore *g_ls_details;
562801
 
562801
 static GtkBox *g_box_buttons; //TODO: needs not be global
562801
 static GtkNotebook *g_notebook;
562801
+static GtkListStore *g_ls_sensitive_list;
562801
+static GtkTreeView *g_tv_sensitive_list;
562801
+static GtkTreeSelection *g_tv_sensitive_sel;
562801
+static GtkRadioButton *g_rb_forbidden_words;
562801
+static GtkRadioButton *g_rb_custom_search;
562801
+static GtkExpander *g_exp_search;
562801
+static gulong g_tv_sensitive_sel_hndlr;
562801
 static gboolean g_warning_issued;
562801
 
562801
-static GtkEventBox *g_ev_search_up;
562801
-static GtkEventBox *g_ev_search_down;
562801
 static GtkSpinner *g_spinner_event_log;
562801
 static GtkImage *g_img_process_fail;
562801
 
562801
@@ -117,10 +122,6 @@ static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback f
562801
 static void set_auto_event_chain(GtkButton *button, gpointer user_data);
562801
 static void start_event_run(const char *event_name);
562801
 
562801
-static GList *g_search_result_list;
562801
-static guint g_current_highlighted_word;
562801
-static bool g_first_highlight = true;
562801
-
562801
 enum
562801
 {
562801
     /* Note: need to update types in
562801
@@ -136,6 +137,15 @@ enum
562801
 /* Search in bt */
562801
 static guint g_timeout = 0;
562801
 static GtkEntry *g_search_entry_bt;
562801
+static const gchar *g_search_text;
562801
+static search_item_t *g_current_highlighted_word;
562801
+
562801
+enum
562801
+{
562801
+    SEARCH_COLUMN_FILE,
562801
+    SEARCH_COLUMN_TEXT,
562801
+    SEARCH_COLUMN_ITEM,
562801
+};
562801
 
562801
 static GtkBuilder *g_builder;
562801
 static PangoFontDescription *g_monospace_font;
562801
@@ -190,9 +200,11 @@ static const gchar *const page_names[] =
562801
 #define PRIVATE_TICKET_CB "private_ticket_cb"
562801
 
562801
 #define SENSITIVE_DATA_WARN "sensitive_data_warning"
562801
+#define SENSITIVE_LIST "ls_sensitive_words"
562801
 static const gchar *misc_widgets[] =
562801
 {
562801
     SENSITIVE_DATA_WARN,
562801
+    SENSITIVE_LIST,
562801
     NULL
562801
 };
562801
 
562801
@@ -2184,6 +2196,54 @@ static GList *find_words_in_text_buffer(int page,
562801
     return found_words;
562801
 }
562801
 
562801
+static void search_item_to_list_store_item(GtkListStore *store, GtkTreeIter *new_row,
562801
+        const gchar *file_name, search_item_t *word)
562801
+{
562801
+    GtkTextIter *beg = gtk_text_iter_copy(&(word->start));
562801
+    gtk_text_iter_backward_line(beg);
562801
+
562801
+    GtkTextIter *end = gtk_text_iter_copy(&(word->end));
562801
+    /* the first call moves end variable at the end of the current line */
562801
+    if (gtk_text_iter_forward_line(end))
562801
+    {
562801
+        /* the second call moves end variable at the end of the next line */
562801
+        gtk_text_iter_forward_line(end);
562801
+
562801
+        /* don't include the last new which causes an empty line in the GUI list */
562801
+        gtk_text_iter_backward_char(end);
562801
+    }
562801
+
562801
+    gchar *tmp = gtk_text_buffer_get_text(word->buffer, beg, &(word->start),
562801
+            /*don't include hidden chars*/FALSE);
562801
+    gchar *prefix = g_markup_escape_text(tmp, /*NULL terminated string*/-1);
562801
+    g_free(tmp);
562801
+
562801
+    tmp = gtk_text_buffer_get_text(word->buffer, &(word->start), &(word->end),
562801
+            /*don't include hidden chars*/FALSE);
562801
+    gchar *text = g_markup_escape_text(tmp, /*NULL terminated string*/-1);
562801
+    g_free(tmp);
562801
+
562801
+    tmp = gtk_text_buffer_get_text(word->buffer, &(word->end), end,
562801
+            /*don't include hidden chars*/FALSE);
562801
+    gchar *suffix = g_markup_escape_text(tmp, /*NULL terminated string*/-1);
562801
+    g_free(tmp);
562801
+
562801
+    char *content = xasprintf("%s%s%s", prefix, text, suffix);
562801
+
562801
+    g_free(suffix);
562801
+    g_free(text);
562801
+    g_free(prefix);
562801
+
562801
+    gtk_text_iter_free(end);
562801
+    gtk_text_iter_free(beg);
562801
+
562801
+    gtk_list_store_set(store, new_row,
562801
+            SEARCH_COLUMN_FILE, file_name,
562801
+            SEARCH_COLUMN_TEXT, content,
562801
+            SEARCH_COLUMN_ITEM, word,
562801
+            -1);
562801
+}
562801
+
562801
 static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words, GList *ignored_words)
562801
 {
562801
     GtkTextBuffer *buffer = gtk_text_view_get_buffer(tev);
562801
@@ -2193,30 +2253,49 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
562801
     GtkWidget *tab_lbl = gtk_notebook_get_tab_label(g_notebook, notebook_child);
562801
 
562801
     /* Remove old results */
562801
-    int bufferpos = -1;
562801
-    GList *after_buffer = NULL;
562801
-    int allwordspos = 0;
562801
-    int bufferwords = 0;
562801
-    for (GList* item = g_search_result_list; item; ++allwordspos)
562801
+    bool buffer_removing = false;
562801
+
562801
+    GtkTreeIter iter;
562801
+    gboolean valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_sensitive_list), &iter);
562801
+
562801
+    /* Turn off the changed callback during the update */
562801
+    g_signal_handler_block(g_tv_sensitive_sel, g_tv_sensitive_sel_hndlr);
562801
+
562801
+    while (valid)
562801
     {
562801
-         GList* current = item;
562801
-         item = g_list_next(item);
562801
+        char *text = NULL;
562801
+        search_item_t *word = NULL;
562801
+
562801
+        gtk_tree_model_get(GTK_TREE_MODEL(g_ls_sensitive_list), &iter,
562801
+                SEARCH_COLUMN_TEXT, &text,
562801
+                SEARCH_COLUMN_ITEM, &word,
562801
+                -1);
562801
+
562801
+        if (word->buffer == buffer)
562801
+        {
562801
+            buffer_removing = true;
562801
 
562801
-         search_item_t *word = (search_item_t *)current->data;
562801
-         if (word->buffer == buffer)
562801
-         {
562801
-             ++bufferwords;
562801
+            valid = gtk_list_store_remove(g_ls_sensitive_list, &iter);
562801
 
562801
-             if (allwordspos < g_current_highlighted_word)
562801
-                 ++bufferpos;
562801
+            free(text);
562801
 
562801
-             g_search_result_list = g_list_delete_link(g_search_result_list, current);
562801
-             free(word);
562801
-         }
562801
-         else if(after_buffer == NULL && bufferwords != 0)
562801
-             after_buffer = current;
562801
+            if (word == g_current_highlighted_word)
562801
+                g_current_highlighted_word = NULL;
562801
+
562801
+            free(word);
562801
+        }
562801
+        else
562801
+        {
562801
+            if(buffer_removing)
562801
+                break;
562801
+
562801
+            valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(g_ls_sensitive_list), &iter);
562801
+        }
562801
     }
562801
 
562801
+    /* Turn on the changed callback after the update */
562801
+    g_signal_handler_unblock(g_tv_sensitive_sel, g_tv_sensitive_sel_hndlr);
562801
+
562801
     GtkTextIter start_find;
562801
     gtk_text_buffer_get_start_iter(buffer, &start_find);
562801
     GtkTextIter end_find;
562801
@@ -2247,6 +2326,7 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
562801
                                        start_find,
562801
                                        end_find
562801
                                         );
562801
+
562801
     for (GList *w = result; w; w = g_list_next(w))
562801
     {
562801
         search_item_t *item = (search_item_t *)w->data;
562801
@@ -2270,48 +2350,32 @@ static bool highligh_words_in_textview(int page, GtkTextView *tev, GList *words,
562801
          */
562801
         result = g_list_sort(result, (GCompareFunc)sitem_compare);
562801
 
562801
-        /* Put words of the buffer at the correct place */
562801
-        if (after_buffer == g_search_result_list)
562801
+        GList *search_result = result;
562801
+        for ( ; search_result != NULL; search_result = g_list_next(search_result))
562801
         {
562801
-            /*
562801
-             * The original list:
562801
-             *   (buffer, after buffer)
562801
-             */
562801
-            g_search_result_list = g_list_concat(result, after_buffer);
562801
-        }
562801
-        else
562801
-        {
562801
-            /*
562801
-             * The original:
562801
-             *   (before buffer, buffer, after buffer)
562801
-             * After removing buffer's words:
562801
-             *   (before buffer, after buffer)
562801
-             */
562801
-            if (after_buffer && after_buffer->prev)
562801
-            {
562801
-                /* split to two lists (before buffer) and (after buffer) */
562801
-                after_buffer->prev->next = NULL;
562801
-                after_buffer->prev = NULL;
562801
-            }
562801
+            search_item_t *word = (search_item_t *)search_result->data;
562801
 
562801
-            /* create (before buffer, buffer) */
562801
-            g_search_result_list = g_list_concat(g_search_result_list, result);
562801
+            const gchar *file_name = gtk_label_get_text(GTK_LABEL(tab_lbl));
562801
+
562801
+            /* Create a new row */
562801
+            GtkTreeIter new_row;
562801
+            if (valid)
562801
+                /* iter variable is valid GtkTreeIter and it means that the results */
562801
+                /* need to be inserted before this iterator, in this case iter points */
562801
+                /* to the first word of another GtkTextView */
562801
+                gtk_list_store_insert_before(g_ls_sensitive_list, &new_row, &iter);
562801
+            else
562801
+                /* the GtkTextView is the last one or the only one, insert the results */
562801
+                /* at the end of the list store */
562801
+                gtk_list_store_append(g_ls_sensitive_list, &new_row);
562801
 
562801
-            if (after_buffer)
562801
-                /* create (before buffer, buffer, after buffer) */
562801
-                g_search_result_list = g_list_concat(g_search_result_list, after_buffer);
562801
+            /* Assign values to the new row */
562801
+            search_item_to_list_store_item(g_ls_sensitive_list, &new_row, file_name, word);
562801
         }
562801
     }
562801
 
562801
-    /* The bufferpos variable greater than 0 means that current word was in
562801
-     * the buffer or the currently highlighted word was after all buffer's
562801
-     * words, therefore we have to decrease the index of the currently
562801
-     * highlighted word. If any word was found the highlighting process
562801
-     * will start from the beginning of the buffer. If no word was found
562801
-     * the currently highlighted word will be the first word in a next buffer.
562801
-     */
562801
-    if (bufferpos >= 0)
562801
-        g_current_highlighted_word -= (bufferpos + (result == NULL));
562801
+    g_list_free_full(ignored_words_in_buffer, free);
562801
+    g_list_free(result);
562801
 
562801
     return result != NULL;
562801
 }
562801
@@ -2320,11 +2384,6 @@ static gboolean highligh_words_in_tabs(GList *forbidden_words,  GList *allowed_w
562801
 {
562801
     gboolean found = false;
562801
 
562801
-    list_free_with_free(g_search_result_list);
562801
-    g_search_result_list = NULL;
562801
-    g_current_highlighted_word = 0;
562801
-    g_first_highlight = true;
562801
-
562801
     gint n_pages = gtk_notebook_get_n_pages(g_notebook);
562801
     int page = 0;
562801
     for (page = 0; page < n_pages; page++)
562801
@@ -2340,21 +2399,24 @@ static gboolean highligh_words_in_tabs(GList *forbidden_words,  GList *allowed_w
562801
         found |= highligh_words_in_textview(page, tev, forbidden_words, allowed_words);
562801
     }
562801
 
562801
+    GtkTreeIter iter;
562801
+    if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_sensitive_list), &iter))
562801
+        gtk_tree_selection_select_iter(g_tv_sensitive_sel, &iter);
562801
+
562801
     return found;
562801
 }
562801
 
562801
-static void highlight_forbidden(void)
562801
+static gboolean highlight_forbidden(void)
562801
 {
562801
     GList *forbidden_words = load_words_from_file(FORBIDDEN_WORDS_BLACKLLIST);
562801
     GList *allowed_words = load_words_from_file(FORBIDDEN_WORDS_WHITELIST);
562801
 
562801
-    if (highligh_words_in_tabs(forbidden_words, allowed_words)) {
562801
-        add_sensitive_data_warning();
562801
-        show_warnings();
562801
-    }
562801
+    const gboolean result = highligh_words_in_tabs(forbidden_words, allowed_words);
562801
 
562801
     list_free_with_free(forbidden_words);
562801
     list_free_with_free(allowed_words);
562801
+
562801
+    return result;
562801
 }
562801
 
562801
 static gint select_next_page_no(gint current_page_no, gpointer data);
562801
@@ -2492,7 +2554,15 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
562801
 
562801
     if (pages[PAGENO_EDIT_ELEMENTS].page_widget == page)
562801
     {
562801
-        highlight_forbidden();
562801
+        if (highlight_forbidden())
562801
+        {
562801
+            add_sensitive_data_warning();
562801
+            show_warnings();
562801
+            gtk_expander_set_expanded(g_exp_search, TRUE);
562801
+        }
562801
+        else
562801
+            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g_rb_custom_search), TRUE);
562801
+
562801
         show_warnings();
562801
     }
562801
 
562801
@@ -2769,18 +2839,6 @@ static gint select_next_page_no(gint current_page_no, gpointer data)
562801
     return current_page_no;
562801
 }
562801
 
562801
-
562801
-
562801
-static void highlight_widget(GtkWidget *widget, gpointer *user_data)
562801
-{
562801
-    gtk_drag_highlight(widget);
562801
-}
562801
-
562801
-static void unhighlight_widget(GtkWidget *widget, gpointer *user_data)
562801
-{
562801
-    gtk_drag_unhighlight(widget);
562801
-}
562801
-
562801
 static void rehighlight_forbidden_words(int page, GtkTextView *tev)
562801
 {
562801
     GList *forbidden_words = load_words_from_file(FORBIDDEN_WORDS_BLACKLLIST);
562801
@@ -2788,75 +2846,57 @@ static void rehighlight_forbidden_words(int page, GtkTextView *tev)
562801
     highligh_words_in_textview(page, tev, forbidden_words, allowed_words);
562801
     list_free_with_free(forbidden_words);
562801
     list_free_with_free(allowed_words);
562801
-
562801
-    /* Don't increment resp. decrement in search_down() resp. search_up() */
562801
-    g_first_highlight = true;
562801
 }
562801
 
562801
-static void unhighlight_current_word(void)
562801
+static void on_sensitive_word_selection_changed(GtkTreeSelection *sel, gpointer user_data)
562801
 {
562801
-    search_item_t *word = NULL;
562801
-    word = (search_item_t *)g_list_nth_data(g_search_result_list, g_current_highlighted_word);
562801
-    if (word)
562801
-    {
562801
-        if (gtk_text_buffer_get_modified(word->buffer))
562801
-            rehighlight_forbidden_words(word->page, word->tev);
562801
-        else
562801
-            gtk_text_buffer_remove_tag_by_name(word->buffer, "current_result_bg", &(word->start), &(word->end));
562801
-    }
562801
-}
562801
+    search_item_t *old_word = g_current_highlighted_word;
562801
+    g_current_highlighted_word = NULL;
562801
 
562801
-static void highlight_current_word(void)
562801
-{
562801
-    search_item_t *word = NULL;
562801
-    word = (search_item_t *)g_list_nth_data(g_search_result_list, g_current_highlighted_word);
562801
-    if (word)
562801
+    if (old_word && FALSE == gtk_text_buffer_get_modified(old_word->buffer))
562801
+        gtk_text_buffer_remove_tag_by_name(old_word->buffer, "current_result_bg", &(old_word->start), &(old_word->end));
562801
+
562801
+    GtkTreeModel *model;
562801
+    GtkTreeIter iter;
562801
+    if (!gtk_tree_selection_get_selected(sel, &model, &iter))
562801
+        return;
562801
+
562801
+    search_item_t *new_word;
562801
+    gtk_tree_model_get(model, &iter,
562801
+            SEARCH_COLUMN_ITEM, &new_word,
562801
+            -1);
562801
+
562801
+    if (gtk_text_buffer_get_modified(new_word->buffer))
562801
     {
562801
-        if (gtk_text_buffer_get_modified(word->buffer))
562801
+        if (g_search_text == NULL)
562801
+            rehighlight_forbidden_words(new_word->page, new_word->tev);
562801
+        else
562801
         {
562801
-            rehighlight_forbidden_words(word->page, word->tev);
562801
-            highlight_current_word();
562801
-            return;
562801
+            log_notice("searching again: '%s'", g_search_text);
562801
+            GList *searched_words = g_list_append(NULL, (gpointer)g_search_text);
562801
+            highligh_words_in_textview(new_word->page, new_word->tev, searched_words, NULL);
562801
+            g_list_free(searched_words);
562801
         }
562801
 
562801
-        gtk_notebook_set_current_page(g_notebook, word->page);
562801
-        gtk_text_buffer_apply_tag_by_name(word->buffer, "current_result_bg", &(word->start), &(word->end));
562801
-        gtk_text_buffer_place_cursor(word->buffer, &(word->start));
562801
-        gtk_text_view_scroll_to_iter(word->tev, &(word->start), 0.0, false, 0, 0);
562801
+        return;
562801
     }
562801
-}
562801
 
562801
-static void search_down(GtkWidget *widget, gpointer user_data)
562801
-{
562801
-    if (g_current_highlighted_word + !g_first_highlight < g_list_length(g_search_result_list))
562801
-    {
562801
-        unhighlight_current_word();
562801
-        if (!g_first_highlight)
562801
-            g_current_highlighted_word++;
562801
-        g_first_highlight = false;
562801
-        highlight_current_word();
562801
-    }
562801
-}
562801
+    g_current_highlighted_word = new_word;
562801
 
562801
-static void search_up(GtkWidget *widget, gpointer user_data)
562801
-{
562801
-    if (g_current_highlighted_word + g_first_highlight > 0)
562801
-    {
562801
-        unhighlight_current_word();
562801
-        if (!g_first_highlight)
562801
-            g_current_highlighted_word--;
562801
-        g_first_highlight = false;
562801
-        highlight_current_word();
562801
-    }
562801
+    gtk_notebook_set_current_page(g_notebook, new_word->page);
562801
+    gtk_text_buffer_apply_tag_by_name(new_word->buffer, "current_result_bg", &(new_word->start), &(new_word->end));
562801
+    gtk_text_buffer_place_cursor(new_word->buffer, &(new_word->start));
562801
+    gtk_text_view_scroll_to_iter(new_word->tev, &(new_word->start), 0.0, false, 0, 0);
562801
 }
562801
 
562801
 static gboolean highlight_search(gpointer user_data)
562801
 {
562801
     GtkEntry *entry = GTK_ENTRY(user_data);
562801
 
562801
-    log_notice("searching: '%s'", gtk_entry_get_text(entry));
562801
+    g_search_text = gtk_entry_get_text(entry);
562801
 
562801
-    GList *words = g_list_append(NULL, (gpointer)gtk_entry_get_text(entry));
562801
+    log_notice("searching: '%s'", g_search_text);
562801
+    GList *words = g_list_append(NULL, (gpointer)g_search_text);
562801
     highligh_words_in_tabs(words, NULL);
562801
     g_list_free(words);
562801
 
562801
@@ -2876,6 +2916,22 @@ static void search_timeout(GtkEntry *entry)
562801
     g_timeout = g_timeout_add(500, &highlight_search, (gpointer)entry);
562801
 }
562801
 
562801
+static void on_forbidden_words_toggled(GtkToggleButton *btn, gpointer user_data)
562801
+{
562801
+    g_search_text = NULL;
562801
+    log_notice("nothing to search for, highlighting forbidden words instead");
562801
+    highlight_forbidden();
562801
+}
562801
+
562801
+static void on_custom_search_toggled(GtkToggleButton *btn, gpointer user_data)
562801
+{
562801
+    const gboolean custom_search = gtk_toggle_button_get_active(btn);
562801
+    gtk_widget_set_sensitive(GTK_WIDGET(g_search_entry_bt), custom_search);
562801
+
562801
+    if (custom_search)
562801
+        highlight_search(g_search_entry_bt);
562801
+}
562801
+
562801
 static void save_edited_one_liner(GtkCellRendererText *renderer,
562801
                 gchar *tree_path,
562801
                 gchar *new_text,
562801
@@ -3045,7 +3101,6 @@ static gint on_key_press_event_in_item_list(GtkTreeView *treeview, GdkEventKey *
562801
     return FALSE;
562801
 }
562801
 
562801
-
562801
 /* Initialization */
562801
 
562801
 /* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */
562801
@@ -3069,15 +3124,15 @@ static void add_pages(void)
562801
     g_builder = gtk_builder_new();
562801
     if (!g_glade_file)
562801
     {
562801
-        /* Load pages from internal string */
562801
+        /* load additional widgets from glade */
562801
         gtk_builder_add_objects_from_string(g_builder,
562801
                 WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
562801
-                (gchar**)page_names,
562801
+                (gchar**)misc_widgets,
562801
                 &error);
562801
-        /* load additional widgets from glade */
562801
+        /* Load pages from internal string */
562801
         gtk_builder_add_objects_from_string(g_builder,
562801
                 WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
562801
-                (gchar**)misc_widgets,
562801
+                (gchar**)page_names,
562801
                 &error);
562801
         if (error != NULL)
562801
             error_msg_and_die("Error loading glade data: %s", error->message);
562801
@@ -3118,8 +3173,12 @@ static void add_pages(void)
562801
     g_btn_add_file         = GTK_BUTTON(       gtk_builder_get_object(g_builder, "btn_add_file"));
562801
     g_lbl_size             = GTK_LABEL(        gtk_builder_get_object(g_builder, "lbl_size"));
562801
     g_notebook             = GTK_NOTEBOOK(     gtk_builder_get_object(g_builder, "notebook_edit"));
562801
-    g_ev_search_up         = GTK_EVENT_BOX(    gtk_builder_get_object(g_builder, "ev_search_up"));
562801
-    g_ev_search_down       = GTK_EVENT_BOX(    gtk_builder_get_object(g_builder, "ev_search_down"));
562801
+    g_ls_sensitive_list    = GTK_LIST_STORE(   gtk_builder_get_object(g_builder, "ls_sensitive_words"));
562801
+    g_tv_sensitive_list    = GTK_TREE_VIEW(    gtk_builder_get_object(g_builder, "tv_sensitive_words"));
562801
+    g_tv_sensitive_sel     = GTK_TREE_SELECTION( gtk_builder_get_object(g_builder, "tv_sensitive_words_selection"));
562801
+    g_rb_forbidden_words   = GTK_RADIO_BUTTON( gtk_builder_get_object(g_builder, "rb_forbidden_words"));
562801
+    g_rb_custom_search     = GTK_RADIO_BUTTON( gtk_builder_get_object(g_builder, "rb_custom_search"));
562801
+    g_exp_search           = GTK_EXPANDER(     gtk_builder_get_object(g_builder, "expander_search"));
562801
     g_spinner_event_log    = GTK_SPINNER(      gtk_builder_get_object(g_builder, "spinner_event_log"));
562801
     g_img_process_fail     = GTK_IMAGE(      gtk_builder_get_object(g_builder, "img_process_fail"));
562801
     g_btn_startcast        = GTK_BUTTON(    gtk_builder_get_object(g_builder, "btn_startcast"));
562801
@@ -3142,14 +3201,8 @@ static void add_pages(void)
562801
 
562801
     g_signal_connect(g_cb_no_comment, "toggled", G_CALLBACK(on_no_comment_toggled), NULL);
562801
 
562801
-    /* hook up the search arrows */
562801
-    g_signal_connect(G_OBJECT(g_ev_search_up), "enter-notify-event", G_CALLBACK(highlight_widget), NULL);
562801
-    g_signal_connect(G_OBJECT(g_ev_search_up), "leave-notify-event", G_CALLBACK(unhighlight_widget), NULL);
562801
-    g_signal_connect(G_OBJECT(g_ev_search_up), "button-press-event", G_CALLBACK(search_up), NULL);
562801
-
562801
-    g_signal_connect(G_OBJECT(g_ev_search_down), "enter-notify-event", G_CALLBACK(highlight_widget), NULL);
562801
-    g_signal_connect(G_OBJECT(g_ev_search_down), "leave-notify-event", G_CALLBACK(unhighlight_widget), NULL);
562801
-    g_signal_connect(G_OBJECT(g_ev_search_down), "button-press-event", G_CALLBACK(search_down), NULL);
562801
+    g_signal_connect(g_rb_forbidden_words, "toggled", G_CALLBACK(on_forbidden_words_toggled), NULL);
562801
+    g_signal_connect(g_rb_custom_search, "toggled", G_CALLBACK(on_custom_search_toggled), NULL);
562801
 
562801
     /* Set color of the comment evenbox */
562801
     GdkRGBA color;
562801
@@ -3157,6 +3210,7 @@ static void add_pages(void)
562801
     gtk_widget_override_color(GTK_WIDGET(g_eb_comment), GTK_STATE_FLAG_NORMAL, &color;;
562801
 
562801
     g_signal_connect(g_tv_details, "key-press-event", G_CALLBACK(on_key_press_event_in_item_list), NULL);
562801
+    g_tv_sensitive_sel_hndlr = g_signal_connect(g_tv_sensitive_sel, "changed", G_CALLBACK(on_sensitive_word_selection_changed), NULL);
562801
 }
562801
 
562801
 static void create_details_treeview(void)
562801
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
562801
index 9fddf2b..9a179f4 100644
562801
--- a/src/gui-wizard-gtk/wizard.glade
562801
+++ b/src/gui-wizard-gtk/wizard.glade
562801
@@ -6,6 +6,16 @@
562801
     <property name="can_focus">False</property>
562801
     <property name="icon_name">media-record</property>
562801
   </object>
562801
+  <object class="GtkListStore" id="ls_sensitive_words">
562801
+    <columns>
562801
+      
562801
+      <column type="gchararray"/>
562801
+      
562801
+      <column type="gchararray"/>
562801
+      
562801
+      <column type="gpointer"/>
562801
+    </columns>
562801
+  </object>
562801
   <object class="GtkWindow" id="sensitiveDataWarning_w">
562801
     <property name="can_focus">False</property>
562801
     <child>
562801
@@ -36,9 +46,9 @@
562801
                 <property name="visible">True</property>
562801
                 <property name="can_focus">False</property>
562801
                 <property name="margin_left">6</property>
562801
-                <property name="margin_top">6</property>
562801
-                <property name="margin_bottom">6</property>
562801
-                <property name="label" translatable="yes">Possible sensitive data detected</property>
562801
+                <property name="margin_top">3</property>
562801
+                <property name="margin_bottom">3</property>
562801
+                <property name="label" translatable="yes">Possible sensitive data detected, feel free to edit the report and remove them.</property>
562801
                 <attributes>
562801
                   <attribute name="weight" value="bold"/>
562801
                 </attributes>
562801
@@ -469,7 +479,8 @@
562801
       <object class="GtkVBox" id="page_3">
562801
         <property name="visible">True</property>
562801
         <property name="can_focus">False</property>
562801
-        <property name="border_width">10</property>
562801
+        <property name="hexpand">True</property>
562801
+        <property name="vexpand">True</property>
562801
         <property name="spacing">3</property>
562801
         <child>
562801
           <object class="GtkLabel" id="label8">
562801
@@ -487,106 +498,185 @@
562801
           </packing>
562801
         </child>
562801
         <child>
562801
-          <object class="GtkNotebook" id="notebook_edit">
562801
+          <object class="GtkPaned" id="paned1">
562801
             <property name="visible">True</property>
562801
             <property name="can_focus">True</property>
562801
-            <property name="scrollable">True</property>
562801
-            <child>
562801
-              <placeholder/>
562801
-            </child>
562801
-            <child type="tab">
562801
-              <placeholder/>
562801
-            </child>
562801
-            <child>
562801
-              <placeholder/>
562801
-            </child>
562801
-            <child type="tab">
562801
-              <placeholder/>
562801
-            </child>
562801
-            <child>
562801
-              <placeholder/>
562801
-            </child>
562801
-            <child type="tab">
562801
-              <placeholder/>
562801
-            </child>
562801
-          </object>
562801
-          <packing>
562801
-            <property name="expand">True</property>
562801
-            <property name="fill">True</property>
562801
-            <property name="position">1</property>
562801
-          </packing>
562801
-        </child>
562801
-        <child>
562801
-          <object class="GtkHBox" id="search_hbox">
562801
-            <property name="visible">True</property>
562801
-            <property name="can_focus">False</property>
562801
+            <property name="orientation">vertical</property>
562801
             <child>
562801
-              <object class="GtkEntry" id="entry_search_bt">
562801
+              <object class="GtkNotebook" id="notebook_edit">
562801
                 <property name="visible">True</property>
562801
                 <property name="can_focus">True</property>
562801
-                <property name="invisible_char">●</property>
562801
-                <property name="invisible_char_set">True</property>
562801
-                <property name="secondary_icon_name">edit-find</property>
562801
-                <property name="primary_icon_activatable">False</property>
562801
+                <property name="hexpand">True</property>
562801
+                <property name="vexpand">True</property>
562801
+                <property name="scrollable">True</property>
562801
+                <child>
562801
+                  <placeholder/>
562801
+                </child>
562801
+                <child type="tab">
562801
+                  <placeholder/>
562801
+                </child>
562801
+                <child>
562801
+                  <placeholder/>
562801
+                </child>
562801
+                <child type="tab">
562801
+                  <placeholder/>
562801
+                </child>
562801
+                <child>
562801
+                  <placeholder/>
562801
+                </child>
562801
+                <child type="tab">
562801
+                  <placeholder/>
562801
+                </child>
562801
               </object>
562801
               <packing>
562801
-                <property name="expand">True</property>
562801
-                <property name="fill">True</property>
562801
-                <property name="position">0</property>
562801
+                <property name="resize">True</property>
562801
+                <property name="shrink">True</property>
562801
               </packing>
562801
             </child>
562801
             <child>
562801
-              <object class="GtkVBox" id="vbox1">
562801
+              <object class="GtkExpander" id="expander_search">
562801
                 <property name="visible">True</property>
562801
-                <property name="can_focus">False</property>
562801
+                <property name="can_focus">True</property>
562801
+                <property name="border_width">1</property>
562801
                 <child>
562801
-                  <object class="GtkEventBox" id="ev_search_up">
562801
+                  <object class="GtkBox" id="box7">
562801
                     <property name="visible">True</property>
562801
                     <property name="can_focus">False</property>
562801
+                    <property name="orientation">vertical</property>
562801
                     <child>
562801
-                      <object class="GtkArrow" id="arr_search_up">
562801
+                      <object class="GtkBox" id="box8">
562801
                         <property name="visible">True</property>
562801
                         <property name="can_focus">False</property>
562801
-                        <property name="arrow_type">up</property>
562801
+                        <child>
562801
+                          <object class="GtkRadioButton" id="rb_forbidden_words">
562801
+                            <property name="label" translatable="yes">Forbidden words</property>
562801
+                            <property name="visible">True</property>
562801
+                            <property name="can_focus">True</property>
562801
+                            <property name="receives_default">False</property>
562801
+                            <property name="xalign">0</property>
562801
+                            <property name="active">True</property>
562801
+                            <property name="draw_indicator">True</property>
562801
+                          </object>
562801
+                          <packing>
562801
+                            <property name="expand">False</property>
562801
+                            <property name="fill">True</property>
562801
+                            <property name="position">0</property>
562801
+                          </packing>
562801
+                        </child>
562801
+                        <child>
562801
+                          <object class="GtkRadioButton" id="rb_custom_search">
562801
+                            <property name="label" translatable="yes">Custom</property>
562801
+                            <property name="visible">True</property>
562801
+                            <property name="can_focus">True</property>
562801
+                            <property name="receives_default">False</property>
562801
+                            <property name="xalign">0</property>
562801
+                            <property name="draw_indicator">True</property>
562801
+                            <property name="group">rb_forbidden_words</property>
562801
+                          </object>
562801
+                          <packing>
562801
+                            <property name="expand">False</property>
562801
+                            <property name="fill">True</property>
562801
+                            <property name="position">1</property>
562801
+                          </packing>
562801
+                        </child>
562801
+                        <child>
562801
+                          <object class="GtkEntry" id="entry_search_bt">
562801
+                            <property name="visible">True</property>
562801
+                            <property name="sensitive">False</property>
562801
+                            <property name="can_focus">True</property>
562801
+                            <property name="has_tooltip">True</property>
562801
+                            <property name="invisible_char">●</property>
562801
+                            <property name="invisible_char_set">True</property>
562801
+                            <property name="secondary_icon_name">edit-find</property>
562801
+                            <property name="primary_icon_activatable">False</property>
562801
+                            <property name="secondary_icon_tooltip_text" translatable="yes">Clear the search bar to see the list of security sensitive words.</property>
562801
+                            <property name="secondary_icon_tooltip_markup" translatable="yes">Clear the search bar to see the list of security sensitive words.</property>
562801
+                          </object>
562801
+                          <packing>
562801
+                            <property name="expand">True</property>
562801
+                            <property name="fill">True</property>
562801
+                            <property name="position">2</property>
562801
+                          </packing>
562801
+                        </child>
562801
                       </object>
562801
+                      <packing>
562801
+                        <property name="expand">False</property>
562801
+                        <property name="fill">True</property>
562801
+                        <property name="position">0</property>
562801
+                      </packing>
562801
                     </child>
562801
-                  </object>
562801
-                  <packing>
562801
-                    <property name="expand">True</property>
562801
-                    <property name="fill">True</property>
562801
-                    <property name="position">0</property>
562801
-                  </packing>
562801
-                </child>
562801
-                <child>
562801
-                  <object class="GtkEventBox" id="ev_search_down">
562801
-                    <property name="visible">True</property>
562801
-                    <property name="can_focus">False</property>
562801
                     <child>
562801
-                      <object class="GtkArrow" id="arr_search_down">
562801
+                      <object class="GtkScrolledWindow" id="scrolledwindow1">
562801
                         <property name="visible">True</property>
562801
-                        <property name="can_focus">False</property>
562801
-                        <property name="arrow_type">down</property>
562801
+                        <property name="can_focus">True</property>
562801
+                        <property name="shadow_type">in</property>
562801
+                        <child>
562801
+                          <object class="GtkTreeView" id="tv_sensitive_words">
562801
+                            <property name="visible">True</property>
562801
+                            <property name="can_focus">True</property>
562801
+                            <property name="model">ls_sensitive_words</property>
562801
+                            <property name="headers_visible">False</property>
562801
+                            <property name="headers_clickable">False</property>
562801
+                            <property name="enable_search">False</property>
562801
+                            <property name="search_column">0</property>
562801
+                            <property name="enable_grid_lines">both</property>
562801
+                            <property name="enable_tree_lines">True</property>
562801
+                            <child internal-child="selection">
562801
+                              <object class="GtkTreeSelection" id="tv_sensitive_words_selection"/>
562801
+                            </child>
562801
+                            <child>
562801
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn1">
562801
+                                <property name="resizable">True</property>
562801
+                                <property name="title" translatable="yes">file</property>
562801
+                                <child>
562801
+                                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
562801
+                                  <attributes>
562801
+                                    <attribute name="text">0</attribute>
562801
+                                  </attributes>
562801
+                                </child>
562801
+                              </object>
562801
+                            </child>
562801
+                            <child>
562801
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn2">
562801
+                                <property name="resizable">True</property>
562801
+                                <property name="title" translatable="yes">data</property>
562801
+                                <child>
562801
+                                  <object class="GtkCellRendererText" id="crt_sensitive_word_value"/>
562801
+                                  <attributes>
562801
+                                    <attribute name="markup">1</attribute>
562801
+                                  </attributes>
562801
+                                </child>
562801
+                              </object>
562801
+                            </child>
562801
+                          </object>
562801
+                        </child>
562801
                       </object>
562801
+                      <packing>
562801
+                        <property name="expand">True</property>
562801
+                        <property name="fill">True</property>
562801
+                        <property name="position">1</property>
562801
+                      </packing>
562801
                     </child>
562801
                   </object>
562801
-                  <packing>
562801
-                    <property name="expand">True</property>
562801
-                    <property name="fill">True</property>
562801
-                    <property name="position">1</property>
562801
-                  </packing>
562801
+                </child>
562801
+                <child type="label">
562801
+                  <object class="GtkLabel" id="label12">
562801
+                    <property name="visible">True</property>
562801
+                    <property name="can_focus">False</property>
562801
+                    <property name="label" translatable="yes">Search</property>
562801
+                  </object>
562801
                 </child>
562801
               </object>
562801
               <packing>
562801
-                <property name="expand">False</property>
562801
-                <property name="fill">False</property>
562801
-                <property name="position">1</property>
562801
+                <property name="resize">True</property>
562801
+                <property name="shrink">True</property>
562801
               </packing>
562801
             </child>
562801
           </object>
562801
           <packing>
562801
-            <property name="expand">False</property>
562801
-            <property name="fill">False</property>
562801
-            <property name="position">3</property>
562801
+            <property name="expand">True</property>
562801
+            <property name="fill">True</property>
562801
+            <property name="position">1</property>
562801
           </packing>
562801
         </child>
562801
       </object>
562801
-- 
562801
1.8.3.1
562801