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

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