This set of patches attempts to make report-gtk fluent and user friendly.
The first patch replaces the 'Forward' button by the 'Close' button when click on the 'Forward' button will close the report-gtk.
The second patch terminates event chain when user canceled stealing of a directory.
The third patch attempts to make processing of event chain as fast as it is possible. Hence next events are started automatically when the previous one was successfull and the next event doesn't require reviewing of problem data.
Run, tested. Please review.
Jakub Filak (3): trac#640 : report-gtk replaces 'Forward' button with 'Close' button on finished reporting trac#641 : don't allow event chain to continue, if user don't want to steal a directory trac#642 : run the next event if the current one finished without errors
src/gui-wizard-gtk/wizard.c | 190 ++++++++++++++++++++++++++++++++----------- 1 file changed, 143 insertions(+), 47 deletions(-)
* 'Forward' button is replace by 'Close' button because it looks more natural and users won't be confused * status messages were enhanced to be more specific
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/gui-wizard-gtk/wizard.c | 68 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 14 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 4a2c874..34a60c5 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -1261,6 +1261,29 @@ static void on_btn_cancel_event(GtkButton *button) kill(- g_event_child_pid, SIGTERM); }
+static bool is_reporting_finished() +{ + return !g_expert_mode && !g_auto_event_list; +} + +static void update_gui_on_finished_reporting() +{ + /* replace 'Forward' with 'Close' button */ + /* 1. hide next button */ + gtk_widget_hide(g_btn_next); + /* 2. move close button to the last position */ + gtk_box_reorder_child(g_box_buttons, g_btn_close, 3); +} + +static void terminate_event_chain() +{ + if (g_expert_mode) + return; + + g_auto_event_list = NULL; + update_gui_on_finished_reporting(); +} + static void update_command_run_log(const char* message, struct analyze_event_data *evd) { gtk_label_set_text(g_lbl_event_log, message); @@ -1278,12 +1301,15 @@ static void run_event_gtk_error(const char *error_line, void *param)
static char *run_event_gtk_logging(char *log_line, void *param) { - update_command_run_log(log_line, (struct analyze_event_data *)param); + struct analyze_event_data *evd = (struct analyze_event_data *)param; + update_command_run_log(log_line, evd);
if (strcmp(log_line, "THANKYOU") == 0) { VERB1 log("Received a request for termination of processing of event chain. (Request: '%s')", log_line); - g_auto_event_list = NULL; + terminate_event_chain(); + if (!g_expert_mode) + evd->success_msg = _("Reporting finished. Thank you!"); }
return log_line; @@ -1440,12 +1466,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g } }
- if (retval != 0) - { - /* If we were running -e EV1 -e EV2, stop if EV1 failed: */ - g_auto_event_list = NULL; - } - /* Stop if exit code is not 0, or no more commands */ if (retval != 0 || spawn_next_command_in_evd(evd) < 0 @@ -1454,7 +1474,11 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g append_to_textview(evd->tv_log, "\n");
if (retval) + { gtk_label_set_text(evd->status_label, evd->error_msg); + /* If we were running -e EV1 -e EV2, stop if EV1 failed: */ + terminate_event_chain(); + } else gtk_label_set_text(evd->status_label, evd->success_msg);
@@ -1481,6 +1505,10 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g /* Inform abrt-gui that it is a good idea to rescan the directory */ kill(getppid(), SIGCHLD);
+ /* this event was the last event from the chain */ + if (is_reporting_finished()) + update_gui_on_finished_reporting(); + return FALSE; /* "please remove this event" */ }
@@ -1525,9 +1553,15 @@ static void start_event_run(const char *event_name, free_run_event_state(state); //TODO: better msg? char *msg = xasprintf(_("No processing for event '%s' is defined"), event_name); - gtk_label_set_text(status_label, msg); + if (g_expert_mode) + gtk_label_set_text(status_label, msg); + else + { + gtk_label_set_text(status_label, error_msg); + append_to_textview(tv_log, msg); + terminate_event_chain(); + } free(msg); - g_auto_event_list = NULL; return; }
@@ -1923,12 +1957,13 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us 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.") + g_expert_mode ? _("Processing failed. You can try another operation if available.") + : _("Processing failed. Nothing more can be done. Thank you!"), + /* this event is the last event from the chain */ + is_reporting_finished() ? _("Reporting finished. Thank you!") + : _("Processing finished, please proceed to the next step.") ); } - else - gtk_label_set_text(g_lbl_event_log, _("Thank you!")); } }
@@ -1951,7 +1986,10 @@ static gint select_next_page_no(gint current_page_no, gpointer data) if (!event) { g_event_selected = NULL; + /* No next event, go to progress page and finish */ current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1; + gtk_label_set_text(g_lbl_event_log, "Reporting finished. Thank you!"); + update_gui_on_finished_reporting(); goto again; }
@@ -2469,6 +2507,7 @@ void create_assistant(void) g_btn_stop = gtk_button_new_from_stock(GTK_STOCK_STOP); gtk_widget_set_no_show_all(g_btn_stop, true); /* else gtk_widget_hide won't work */ g_btn_next = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD); + gtk_widget_set_no_show_all(g_btn_next, true); /* else gtk_widget_hide won't work */
g_box_buttons = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); gtk_box_pack_start(g_box_buttons, g_btn_close, false, false, 5); @@ -2512,6 +2551,7 @@ void create_assistant(void)
gtk_widget_show_all(GTK_WIDGET(g_box_buttons)); gtk_widget_hide(g_btn_stop); + gtk_widget_show(g_btn_next);
g_wnd_assistant = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); gtk_container_add(GTK_CONTAINER(g_wnd_assistant), GTK_WIDGET(g_box_assistant));
- ack
On 08/02/2012 05:02 PM, Jakub Filak wrote:
- 'Forward' button is replace by 'Close' button because it looks more natural and users won't be confused
- status messages were enhanced to be more specific
Signed-off-by: Jakub Filak jfilak@redhat.com
src/gui-wizard-gtk/wizard.c | 68 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 14 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 4a2c874..34a60c5 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -1261,6 +1261,29 @@ static void on_btn_cancel_event(GtkButton *button) kill(- g_event_child_pid, SIGTERM); }
+static bool is_reporting_finished() +{
- return !g_expert_mode && !g_auto_event_list;
+}
+static void update_gui_on_finished_reporting() +{
- /* replace 'Forward' with 'Close' button */
- /* 1. hide next button */
- gtk_widget_hide(g_btn_next);
- /* 2. move close button to the last position */
- gtk_box_reorder_child(g_box_buttons, g_btn_close, 3);
+}
+static void terminate_event_chain() +{
- if (g_expert_mode)
return;
- g_auto_event_list = NULL;
- update_gui_on_finished_reporting();
+}
- static void update_command_run_log(const char* message, struct analyze_event_data *evd) { gtk_label_set_text(g_lbl_event_log, message);
@@ -1278,12 +1301,15 @@ static void run_event_gtk_error(const char *error_line, void *param)
static char *run_event_gtk_logging(char *log_line, void *param) {
- update_command_run_log(log_line, (struct analyze_event_data *)param);
struct analyze_event_data *evd = (struct analyze_event_data *)param;
update_command_run_log(log_line, evd);
if (strcmp(log_line, "THANKYOU") == 0) { VERB1 log("Received a request for termination of processing of event chain. (Request: '%s')", log_line);
g_auto_event_list = NULL;
terminate_event_chain();
if (!g_expert_mode)
evd->success_msg = _("Reporting finished. Thank you!"); } return log_line;
@@ -1440,12 +1466,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g } }
- if (retval != 0)
- {
- /* If we were running -e EV1 -e EV2, stop if EV1 failed: */
- g_auto_event_list = NULL;
- }
/* Stop if exit code is not 0, or no more commands */ if (retval != 0 || spawn_next_command_in_evd(evd) < 0
@@ -1454,7 +1474,11 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g append_to_textview(evd->tv_log, "\n");
if (retval)
{ gtk_label_set_text(evd->status_label, evd->error_msg);
/* If we were running -e EV1 -e EV2, stop if EV1 failed: */
terminate_event_chain();
} else gtk_label_set_text(evd->status_label, evd->success_msg);
@@ -1481,6 +1505,10 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g /* Inform abrt-gui that it is a good idea to rescan the directory */ kill(getppid(), SIGCHLD);
/* this event was the last event from the chain */
if (is_reporting_finished())
update_gui_on_finished_reporting();
return FALSE; /* "please remove this event" */ }
@@ -1525,9 +1553,15 @@ static void start_event_run(const char *event_name, free_run_event_state(state); //TODO: better msg? char *msg = xasprintf(_("No processing for event '%s' is defined"), event_name);
gtk_label_set_text(status_label, msg);
if (g_expert_mode)
gtk_label_set_text(status_label, msg);
else
{
gtk_label_set_text(status_label, error_msg);
append_to_textview(tv_log, msg);
terminate_event_chain();
} free(msg);
g_auto_event_list = NULL; return; }
@@ -1923,12 +1957,13 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us 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.")
g_expert_mode ? _("Processing failed. You can try another operation if available.")
: _("Processing failed. Nothing more can be done. Thank you!"),
/* this event is the last event from the chain */
is_reporting_finished() ? _("Reporting finished. Thank you!")
: _("Processing finished, please proceed to the next step.") ); }
else
}gtk_label_set_text(g_lbl_event_log, _("Thank you!")); }
@@ -1951,7 +1986,10 @@ static gint select_next_page_no(gint current_page_no, gpointer data) if (!event) { g_event_selected = NULL;
/* No next event, go to progress page and finish */ current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1;
gtk_label_set_text(g_lbl_event_log, "Reporting finished. Thank you!");
update_gui_on_finished_reporting(); goto again; }
@@ -2469,6 +2507,7 @@ void create_assistant(void) g_btn_stop = gtk_button_new_from_stock(GTK_STOCK_STOP); gtk_widget_set_no_show_all(g_btn_stop, true); /* else gtk_widget_hide won't work */ g_btn_next = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD);
gtk_widget_set_no_show_all(g_btn_next, true); /* else gtk_widget_hide won't work */
g_box_buttons = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); gtk_box_pack_start(g_box_buttons, g_btn_close, false, false, 5);
@@ -2512,6 +2551,7 @@ void create_assistant(void)
gtk_widget_show_all(GTK_WIDGET(g_box_buttons)); gtk_widget_hide(g_btn_stop);
gtk_widget_show(g_btn_next);
g_wnd_assistant = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)); gtk_container_add(GTK_CONTAINER(g_wnd_assistant), GTK_WIDGET(g_box_assistant));
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/gui-wizard-gtk/wizard.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 34a60c5..205d85a 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -1570,6 +1570,13 @@ static void start_event_run(const char *event_name, if (!dd) { free_run_event_state(state); + if (!g_expert_mode) + { + char *msg = xasprintf(_("Reporting was interrupted. Can't contiue without writable directory. Thank you!")); + gtk_label_set_text(status_label, msg); + free(msg); + terminate_event_chain(); + } return; /* user refused to steal, or write error, etc... */ }
- ack
On 08/02/2012 05:02 PM, Jakub Filak wrote:
Signed-off-by: Jakub Filak jfilak@redhat.com
src/gui-wizard-gtk/wizard.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 34a60c5..205d85a 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -1570,6 +1570,13 @@ static void start_event_run(const char *event_name, if (!dd) { free_run_event_state(state);
if (!g_expert_mode)
{
char *msg = xasprintf(_("Reporting was interrupted. Can't contiue without writable directory. Thank you!"));
gtk_label_set_text(status_label, msg);
free(msg);
terminate_event_chain();
} return; /* user refused to steal, or write error, etc... */ }
* the next event is run if the previous one was susccessful and we the next event doesn't require reivew of data
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/gui-wizard-gtk/wizard.c | 139 +++++++++++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 45 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 205d85a..34ca39f 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -194,6 +194,9 @@ static void clear_warnings(void); static void show_warnings(void); static void add_warning(const char *warning); static bool check_minimal_bt_rating(const char *event_name); +static const char *get_next_processed_event(GList **events_list); +static const char *setup_next_processed_event(GList **events_list); +static void setup_and_start_even_run(const char *event_name);
static void wrap_fixer(GtkWidget *widget, gpointer data_unused) { @@ -1411,6 +1414,20 @@ static char *run_event_gtk_ask_password(const char *msg, void *args) return ask_helper(msg, args, true); }
+static bool do_event_need_review(const char *event_name) +{ + event_config_t *event_cfg = get_event_config(event_name); + return !event_cfg || !event_cfg->ec_skip_review; +} + +static void start_event_run(const char *event_name, + GtkWidget *page, + GtkTextView *tv_log, + GtkLabel *status_label, + const char *start_msg, + const char *error_msg, + const char *success_msg); + static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, gpointer data) { struct analyze_event_data *evd = data; @@ -1473,15 +1490,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g VERB1 log("done running event on '%s': %d", g_dump_dir_name, retval); append_to_textview(evd->tv_log, "\n");
- if (retval) - { - gtk_label_set_text(evd->status_label, evd->error_msg); - /* If we were running -e EV1 -e EV2, stop if EV1 failed: */ - terminate_event_chain(); - } - else - gtk_label_set_text(evd->status_label, evd->success_msg); - /* Free child output buffer */ strbuf_free(cmd_output); cmd_output = NULL; @@ -1493,17 +1501,48 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g gtk_widget_set_sensitive(g_btn_close, true); gtk_widget_set_sensitive(g_btn_next, true);
- /*g_source_remove(evd->event_source_id);*/ - close(evd->fd); - free_run_event_state(evd->run_state); - strbuf_free(evd->event_log); - free(evd); - problem_data_reload_from_dump_dir(); update_gui_state_from_problem_data();
- /* Inform abrt-gui that it is a good idea to rescan the directory */ - kill(getppid(), SIGCHLD); + if (retval) + { + gtk_label_set_text(evd->status_label, evd->error_msg); + /* If we were running -e EV1 -e EV2, stop if EV1 failed: */ + terminate_event_chain(); + } + else + { + gtk_label_set_text(evd->status_label, evd->success_msg); + + if (!g_expert_mode) + { + const char *event = setup_next_processed_event(&g_auto_event_list); + if (event) + { + if (do_event_need_review(event)) + /* do not forward user directly to review page because */ + /* we want to show to user the results of finished events and we */ + /* don't have Back button */ + /* push back event to the begining of the chain */ + g_auto_event_list = g_list_prepend(g_auto_event_list, (gpointer)event); + else + { + free(g_event_selected); + g_event_selected = xstrdup(event); + setup_and_start_even_run(g_event_selected); + } + } + } + + /*g_source_remove(evd->event_source_id);*/ + close(evd->fd); + free_run_event_state(evd->run_state); + strbuf_free(evd->event_log); + free(evd); + + /* Inform abrt-gui that it is a good idea to rescan the directory */ + kill(getppid(), SIGCHLD); + }
/* this event was the last event from the chain */ if (is_reporting_finished()) @@ -1860,9 +1899,24 @@ static void highlight_forbidden(void)
static gint select_next_page_no(gint current_page_no, gpointer data);
+static void setup_and_start_even_run(const char *event_name) +{ + start_event_run(event_name, + pages[PAGENO_EVENT_PROGRESS].page_widget, + g_tv_event_log, + g_lbl_event_log, + _("Processing..."), + g_expert_mode ? _("Processing failed. You can try another operation if available.") + : _("Processing failed. Nothing more can be done. Thank you!"), + /* this event is the last event from the chain */ + is_reporting_finished() ? _("Reporting finished. Thank you!") + : _("Processing finished, please proceed to the next step.") + ); +} + static const char *get_next_processed_event(GList **events_list) { - if (!events_list) + if (!events_list || !*events_list) return NULL;
const char *event_name = (const char *)(*events_list)->data; @@ -1881,6 +1935,23 @@ static const char *get_next_processed_event(GList **events_list) return event_name; }
+static const char *setup_next_processed_event(GList **events_list) +{ + const char *event = get_next_processed_event(&g_auto_event_list); + if (!event) + { + free(g_event_selected); + g_event_selected = NULL; + /* No next event, go to progress page and finish */ + gtk_label_set_text(g_lbl_event_log, "Reporting finished. Thank you!"); + update_gui_on_finished_reporting(); + return NULL; + } + + VERB1 log("selected -e EVENT:%s", 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); @@ -1958,18 +2029,7 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us && g_event_selected[0] ) { clear_warnings(); - - start_event_run(g_event_selected, - pages[PAGENO_EVENT_PROGRESS].page_widget, - g_tv_event_log, - g_lbl_event_log, - _("Processing..."), - g_expert_mode ? _("Processing failed. You can try another operation if available.") - : _("Processing failed. Nothing more can be done. Thank you!"), - /* this event is the last event from the chain */ - is_reporting_finished() ? _("Reporting finished. Thank you!") - : _("Processing finished, please proceed to the next step.") - ); + setup_and_start_even_run(g_event_selected); } } } @@ -1987,25 +2047,15 @@ static gint select_next_page_no(gint current_page_no, gpointer data) { if (!g_expert_mode) { - free(g_event_selected); - - const char *event = get_next_processed_event(&g_auto_event_list); + const char *event = setup_next_processed_event(&g_auto_event_list); if (!event) { - g_event_selected = NULL; - /* No next event, go to progress page and finish */ current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1; - gtk_label_set_text(g_lbl_event_log, "Reporting finished. Thank you!"); - update_gui_on_finished_reporting(); goto again; }
- VERB1 log("selected -e EVENT:%s on page: %d", event, current_page_no); - g_event_selected = xstrdup((char*)event); - /* - * We don't remove the list element, because GTK calls select_next_page_no() - * spuriously (for example, it calls it twice for first page). - */ + free(g_event_selected); + g_event_selected = xstrdup(event);
if (check_event_config(g_event_selected) != 0) { @@ -2027,8 +2077,7 @@ static gint select_next_page_no(gint current_page_no, gpointer data) goto again; }
- event_config_t *cfg = get_event_config(g_event_selected); - if (cfg && cfg->ec_skip_review) + if (!do_event_need_review(g_event_selected)) { current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1; goto again;
On 08/02/2012 05:02 PM, Jakub Filak wrote:
- the next event is run if the previous one was susccessful and we the next event doesn't require reivew of data
Signed-off-by: Jakub Filak jfilak@redhat.com
src/gui-wizard-gtk/wizard.c | 139 +++++++++++++++++++++++++++++-------------- 1 file changed, 94 insertions(+), 45 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 205d85a..34ca39f 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -194,6 +194,9 @@ static void clear_warnings(void); static void show_warnings(void); static void add_warning(const char *warning); static bool check_minimal_bt_rating(const char *event_name); +static const char *get_next_processed_event(GList **events_list); +static const char *setup_next_processed_event(GList **events_list); +static void setup_and_start_even_run(const char *event_name);
static void wrap_fixer(GtkWidget *widget, gpointer data_unused) { @@ -1411,6 +1414,20 @@ static char *run_event_gtk_ask_password(const char *msg, void *args) return ask_helper(msg, args, true); }
+static bool do_event_need_review(const char *event_name) +{
- the name sounds weird, please use just "event_needs_review"
- event_config_t *event_cfg = get_event_config(event_name);
- return !event_cfg || !event_cfg->ec_skip_review;
+}
+static void start_event_run(const char *event_name,
GtkWidget *page,
GtkTextView *tv_log,
GtkLabel *status_label,
const char *start_msg,
const char *error_msg,
const char *success_msg);
- static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, gpointer data) { struct analyze_event_data *evd = data;
@@ -1473,15 +1490,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g VERB1 log("done running event on '%s': %d", g_dump_dir_name, retval); append_to_textview(evd->tv_log, "\n");
if (retval)
{
gtk_label_set_text(evd->status_label, evd->error_msg);
/* If we were running -e EV1 -e EV2, stop if EV1 failed: */
terminate_event_chain();
}
else
gtk_label_set_text(evd->status_label, evd->success_msg);
/* Free child output buffer */ strbuf_free(cmd_output); cmd_output = NULL;
@@ -1493,17 +1501,48 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g gtk_widget_set_sensitive(g_btn_close, true); gtk_widget_set_sensitive(g_btn_next, true);
/*g_source_remove(evd->event_source_id);*/
close(evd->fd);
free_run_event_state(evd->run_state);
strbuf_free(evd->event_log);
free(evd);
problem_data_reload_from_dump_dir(); update_gui_state_from_problem_data();
/* Inform abrt-gui that it is a good idea to rescan the directory */
kill(getppid(), SIGCHLD);
if (retval)
{
gtk_label_set_text(evd->status_label, evd->error_msg);
/* If we were running -e EV1 -e EV2, stop if EV1 failed: */
terminate_event_chain();
}
else
{
gtk_label_set_text(evd->status_label, evd->success_msg);
if (!g_expert_mode)
{
const char *event = setup_next_processed_event(&g_auto_event_list);
if (event)
{
if (do_event_need_review(event))
/* do not forward user directly to review page because */
/* we want to show to user the results of finished events and we */
/* don't have Back button */
- no, we don't want to show the logs if everything was OK, it just bother users and takes time - please make it so that if there is not -v specified on cmdline it will automatically step to the next page when processing finished with 0
/* push back event to the begining of the chain */
g_auto_event_list = g_list_prepend(g_auto_event_list, (gpointer)event);
else
{
free(g_event_selected);
g_event_selected = xstrdup(event);
setup_and_start_even_run(g_event_selected);
}
}
}
/*g_source_remove(evd->event_source_id);*/
close(evd->fd);
free_run_event_state(evd->run_state);
strbuf_free(evd->event_log);
free(evd);
/* Inform abrt-gui that it is a good idea to rescan the directory */
kill(getppid(), SIGCHLD);
} /* this event was the last event from the chain */ if (is_reporting_finished())
@@ -1860,9 +1899,24 @@ static void highlight_forbidden(void)
static gint select_next_page_no(gint current_page_no, gpointer data);
+static void setup_and_start_even_run(const char *event_name) +{
- start_event_run(event_name,
pages[PAGENO_EVENT_PROGRESS].page_widget,
g_tv_event_log,
g_lbl_event_log,
_("Processing..."),
g_expert_mode ? _("Processing failed. You can try another operation if available.")
: _("Processing failed. Nothing more can be done. Thank you!"),
/* this event is the last event from the chain */
is_reporting_finished() ? _("Reporting finished. Thank you!")
: _("Processing finished, please proceed to the next step.")
- );
+}
- static const char *get_next_processed_event(GList **events_list) {
- if (!events_list)
if (!events_list || !*events_list) return NULL;
const char *event_name = (const char *)(*events_list)->data;
@@ -1881,6 +1935,23 @@ static const char *get_next_processed_event(GList **events_list) return event_name; }
+static const char *setup_next_processed_event(GList **events_list) +{
- const char *event = get_next_processed_event(&g_auto_event_list);
- if (!event)
- {
free(g_event_selected);
g_event_selected = NULL;
/* No next event, go to progress page and finish */
gtk_label_set_text(g_lbl_event_log, "Reporting finished. Thank you!");
- this message is not translatable ^^^^^^^^^^^^^^^^^^^^^^
update_gui_on_finished_reporting();
return NULL;
- }
- VERB1 log("selected -e EVENT:%s", 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);
@@ -1958,18 +2029,7 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us && g_event_selected[0] ) { clear_warnings();
start_event_run(g_event_selected,
pages[PAGENO_EVENT_PROGRESS].page_widget,
g_tv_event_log,
g_lbl_event_log,
_("Processing..."),
g_expert_mode ? _("Processing failed. You can try another operation if available.")
: _("Processing failed. Nothing more can be done. Thank you!"),
/* this event is the last event from the chain */
is_reporting_finished() ? _("Reporting finished. Thank you!")
: _("Processing finished, please proceed to the next step.")
);
}setup_and_start_even_run(g_event_selected); } }
@@ -1987,25 +2047,15 @@ static gint select_next_page_no(gint current_page_no, gpointer data) { if (!g_expert_mode) {
free(g_event_selected);
const char *event = get_next_processed_event(&g_auto_event_list);
const char *event = setup_next_processed_event(&g_auto_event_list); if (!event) {
g_event_selected = NULL;
/* No next event, go to progress page and finish */ current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1;
gtk_label_set_text(g_lbl_event_log, "Reporting finished. Thank you!");
update_gui_on_finished_reporting(); goto again; }
VERB1 log("selected -e EVENT:%s on page: %d", event, current_page_no);
g_event_selected = xstrdup((char*)event);
/*
* We don't remove the list element, because GTK calls select_next_page_no()
* spuriously (for example, it calls it twice for first page).
*/
free(g_event_selected);
g_event_selected = xstrdup(event); if (check_event_config(g_event_selected) != 0) {
@@ -2027,8 +2077,7 @@ static gint select_next_page_no(gint current_page_no, gpointer data) goto again; }
event_config_t *cfg = get_event_config(g_event_selected);
if (cfg && cfg->ec_skip_review)
if (!do_event_need_review(g_event_selected)) { current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1; goto again;
crash-catcher@lists.fedorahosted.org