Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gui-wizard-gtk/wizard.c | 109 ++++++++++++++++++++++++------------------
1 files changed, 62 insertions(+), 47 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 30c25ee..38d20f2 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -62,8 +62,6 @@ static GtkTextView *g_tv_event_log;
/* List of event_gui_data's */
/* List of event_gui_data's */
-static GList *g_list_selected_reporters;
-
static GtkContainer *g_container_details1;
static GtkContainer *g_container_details2;
@@ -192,6 +190,8 @@ static struct strbuf *cmd_output = NULL;
/* Utility functions */
+static bool check_minimal_bt_rating(const char *event_name);
+
static void wrap_fixer(GtkWidget *widget, gpointer data_unused)
{
if (GTK_IS_CONTAINER(widget))
@@ -705,6 +705,7 @@ static void event_rb_was_toggled(GtkButton *button, gpointer
user_data)
free(g_event_selected);
g_event_selected = xstrdup(evdata->event_name);
check_event_config(evdata->event_name);
+ gtk_widget_set_sensitive(g_btn_next,
check_minimal_bt_rating(g_event_selected));
}
}
}
@@ -1693,10 +1694,20 @@ static void clear_warnings(void)
gtk_container_foreach(GTK_CONTAINER(g_box_warning_labels), &remove_child_widget,
NULL);
}
-static void check_bt_rating_and_allow_send(void)
+static bool check_minimal_bt_rating(const char *event_name)
{
- int minimal_rating = 0;
bool send = true;
+ event_config_t *event_cfg = NULL;
+
+ if (!event_name)
+ perror_msg("Cannot check backtrace rating because of invalid event
name");
+ else
+ {
+ event_cfg = get_event_config(event_name);
+
+ if (!event_cfg)
+ perror_msg("Cannot check backtrace rating because of invalid event
config for '%s'", event_name);
+ }
/*
* FIXME: this should be bind to a reporter not to a compoment
@@ -1705,7 +1716,7 @@ static void check_bt_rating_and_allow_send(void)
*/
const char *analyzer = get_problem_item_content_or_NULL(g_cd, FILENAME_ANALYZER);
//FIXME: say "no" to special casing!
- if (analyzer && strcmp(analyzer, "Kerneloops") != 0)
+ if (event_cfg && analyzer && strcmp(analyzer, "Kerneloops")
!= 0)
{
const char *rating_str = get_problem_item_content_or_NULL(g_cd,
FILENAME_RATING);
//COMPAT, remove after 2.1 release
@@ -1722,38 +1733,25 @@ static void check_bt_rating_and_allow_send(void)
add_warning(_("Reporting disabled because the rating does not
contain a number '%s'."));
send = false;
}
-
- GList *li = g_list_selected_reporters;
- while (li != NULL)
+ else
{
- /* need to obey the highest minimal rating of all selected reporters
- * FIXME: check this when selecting the reporter and allow select
- * only usable ones
- */
- event_config_t *cfg = get_event_config((const char *)li->data);
- if (cfg->ec_minimal_rating > minimal_rating)
+ VERB1 log("Checking current rating %ld to required rating
%ld.", rating, event_cfg->ec_minimal_rating);
+ if (rating == event_cfg->ec_minimal_rating) /* bt is usable, but not
complete, so show a warning */
+ add_warning(_("The backtrace is incomplete, please make sure you
provide the steps to reproduce."));
+ else if (rating < event_cfg->ec_minimal_rating)
{
- minimal_rating = cfg->ec_minimal_rating;
- VERB1 log("%s reporter sets the minimal rating to: %i",
(const char *)li->data, minimal_rating);
+ //FIXME: see CreporterAssistant: 394 for ideas
+ add_warning(_("Reporting disabled because the backtrace is
unusable."));
+ send = false;
}
-
- li = g_list_next(li);
- };
-
- if (rating == minimal_rating) /* bt is usable, but not complete, so show a
warning */
- {
- add_warning(_("The backtrace is incomplete, please make sure you
provide the steps to reproduce."));
- }
-
- if (rating < minimal_rating)
- {
- //FIXME: see CreporterAssistant: 394 for ideas
- add_warning(_("Reporting disabled because the backtrace is
unusable."));
- send = false;
}
}
+ else
+ {
+ VERB1 log("Problem doesn't have backtrace rating.");
+ }
}
- gtk_widget_set_sensitive(g_btn_next, send);
+ return send;
}
static void on_bt_approve_toggle(GtkToggleButton *togglebutton, gpointer user_data)
@@ -1928,6 +1926,24 @@ static void highlight_forbidden(void)
static gint select_next_page_no(gint current_page_no, gpointer data);
+static GList *get_next_processed_event(GList **events_list)
+{
+ GList *event = *events_list;
+
+ while (event)
+ {
+ if (check_minimal_bt_rating((const char *)event->data))
+ break;
+
+ event = g_list_next(event);
+ }
+
+ if (event)
+ *events_list = g_list_next(event);
+
+ return event;
+}
+
static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer user_data)
{
//int page_no = gtk_assistant_get_current_page(g_assistant);
@@ -1960,7 +1976,6 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page,
gpointer us
if (pages[PAGENO_EDIT_ELEMENTS].page_widget == page)
{
clear_warnings();
- check_bt_rating_and_allow_send();
highlight_forbidden();
show_warnings();
}
@@ -2006,19 +2021,13 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget
*page, gpointer us
&& g_event_selected[0]
) {
start_event_run(g_event_selected,
- pages[PAGENO_EVENT_PROGRESS].page_widget,
- g_tv_event_log,
- g_lbl_event_log,
- _("Processing..."),
- _("Processing failed. You can try another operation if
available."),
- _("Processing finished, please proceed to the next step.")
+ pages[PAGENO_EVENT_PROGRESS].page_widget,
+ g_tv_event_log,
+ g_lbl_event_log,
+ _("Processing..."),
+ _("Processing failed. You can try another operation if
available."),
+ _("Processing finished, please proceed to the next step.")
);
-
- if (g_auto_event_list)
- {
- g_auto_event_list = g_auto_event_list->next;
- VERB1 log("next -e EVENT:%s", g_auto_event_list ?
(char*)g_auto_event_list->data : "NULL");
- }
}
}
}
@@ -2048,9 +2057,16 @@ static gint select_next_page_no(gint current_page_no, gpointer
data)
{
if (!g_expert_mode)
{
- VERB1 log("selected -e EVENT:%s on page: %d",
(char*)g_auto_event_list->data, current_page_no);
+ GList *event = get_next_processed_event(&g_auto_event_list);
+ if (!event)
+ {
+ current_page_no = pages[PAGENO_NOT_SHOWN].page_no -1;
+ goto again;
+ }
+
+ VERB1 log("selected -e EVENT:%s on page: %d",
(char*)event->data, current_page_no);
free(g_event_selected);
- g_event_selected = xstrdup((char*)g_auto_event_list->data);
+ g_event_selected = xstrdup((char*)event->data);
/*
* We don't remove the list element, because GTK calls
select_next_page_no()
* spuriously (for example, it calls it twice for first page).
@@ -2063,7 +2079,6 @@ static gint select_next_page_no(gint current_page_no, gpointer
data)
current_page_no = pages[PAGENO_EVENT_SELECTOR].page_no + 1;
goto event_was_selected;
-
}
}
--
1.7.7.6