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

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