From 72a31a2a391e6c37255ed08b3bdbf1c38f20d753 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 22 Feb 2011 18:17:13 +0100 Subject: gui-wizard-gtk: add forward_page_func which skips analyze step when it is missing Signed-off-by: Denys Vlasenko --- src/daemon/CommLayerServerDBus.cpp | 2 +- src/daemon/abrt_event.conf | 2 +- src/gui-wizard-gtk/wizard.c | 44 ++++++++++++++++++++++++++++++++++--- src/hooks/abrt-hook-ccpp.c | 2 +- src/include/report/run_event.h | 2 +- src/lib/spawn.c | 2 +- src/plugins/abrt-action-analyze-c.c | 2 +- 7 files changed, 47 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/daemon/CommLayerServerDBus.cpp b/src/daemon/CommLayerServerDBus.cpp index 2a02b051..133feb7b 100644 --- a/src/daemon/CommLayerServerDBus.cpp +++ b/src/daemon/CommLayerServerDBus.cpp @@ -488,7 +488,7 @@ int init_dbus() // // dbus-daemon drops connections if it recvs a malformed message // (we actually observed this when we sent bad UTF-8 string). - // Currently, in this case abrtd just exits with exitcode 1. + // Currently, in this case abrtd just exits with exit code 1. // (symptom: last two log messages are "abrtd: remove_watch()") // If we want to have better logging or other nontrivial handling, // here we need to do: diff --git a/src/daemon/abrt_event.conf b/src/daemon/abrt_event.conf index 22a22bdc..34aba290 100644 --- a/src/daemon/abrt_event.conf +++ b/src/daemon/abrt_event.conf @@ -30,7 +30,7 @@ # All stdout and stderr output is captured and passed to abrt # and possibly to abrt's frontends and shown to the user. # -# If the program terminates with nonzero exitcode, +# If the program terminates with nonzero exit code, # the event processing is considered unsuccessful and is stopped. # Last captured output line, if any, is considered to be # the error message indicating the reason of the failure, diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index a8a39a16..66711af6 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -74,7 +74,8 @@ static page_obj_t pages[] = { PAGE_BACKTRACE_APPROVAL , "Review the backtrace" , GTK_ASSISTANT_PAGE_CONTENT }, { PAGE_HOWTO , "Provide additional information", GTK_ASSISTANT_PAGE_CONTENT }, { PAGE_REPORT , "Confirm data to report", GTK_ASSISTANT_PAGE_CONFIRM }, - { PAGE_REPORT_PROGRESS , "Reporting" , GTK_ASSISTANT_PAGE_PROGRESS }, + /* Was GTK_ASSISTANT_PAGE_PROGRESS */ + { PAGE_REPORT_PROGRESS , "Reporting" , GTK_ASSISTANT_PAGE_SUMMARY }, { NULL } }; @@ -85,6 +86,41 @@ void on_b_refresh_clicked(GtkButton *button) } +static gint next_page_no(gint current_page_no, gpointer data) +{ + switch (current_page_no) + { + case PAGENO_SUMMARY: + if (!g_analyze_events[0]) + { + //TODO: if (!g_reporter_events[0]) /* no reporters available */ then what? + return PAGENO_REPORTER_SELECTOR; /* skip analyze pages */ + } + break; + + case PAGENO_REPORTER_SELECTOR: + if (get_crash_item_content_or_NULL(g_cd, FILENAME_BACKTRACE)) + break; + current_page_no++; /* no backtrace, skip next page */ + /* fall through */ + +#if 0 + case PAGENO_BACKTRACE_APPROVAL: + if (get_crash_item_content_or_NULL(g_cd, FILENAME_COMMENT) + || get_crash_item_content_or_NULL(g_cd, FILENAME_REPRODUCE) + ) { + break; + } + current_page_no++; /* no comment, skip next page */ + /* fall through */ +#endif + + } + + return current_page_no + 1; +} + + /* "Next page" button handler. So far it only starts analyze event run */ struct analyze_event_data { @@ -129,7 +165,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g if (WIFSIGNALED(status)) retval = WTERMSIG(status) + 128; - /* Stop if exitcode is not 0, or no more commands */ + /* Stop if exit code is not 0, or no more commands */ if (retval != 0 || spawn_next_command(evd->run_state, g_dump_dir_name, /*event:*/ g_analyze_label_selected) < 0 ) { @@ -138,7 +174,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g close(evd->fd); free_run_event_state(evd->run_state); free(evd); - char *msg = xasprintf(_("Analyze finished with exitcode %d"), retval); + char *msg = xasprintf(_("Analyze finished with exit code %d"), retval); gtk_label_set_text(g_lbl_analyze_log, msg); free(msg); reload_dump_dir(); @@ -298,6 +334,8 @@ void create_assistant() { g_assistant = GTK_ASSISTANT(gtk_assistant_new()); + gtk_assistant_set_forward_page_func(g_assistant, next_page_no, NULL, NULL); + GtkWindow *wnd_assistant = GTK_WINDOW(g_assistant); gtk_window_set_default_size(wnd_assistant, DEFAULT_WIDTH, DEFAULT_HEIGHT); gtk_window_set_title(wnd_assistant, g_dump_dir_name); diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c index 19d29845..6014f099 100644 --- a/src/hooks/abrt-hook-ccpp.c +++ b/src/hooks/abrt-hook-ccpp.c @@ -419,7 +419,7 @@ int main(int argc, char** argv) if (!daemon_is_ok()) { - /* not an error, exit with exitcode 0 */ + /* not an error, exit with exit code 0 */ log("abrt daemon is not running. If it crashed, " "/proc/sys/kernel/core_pattern contains a stale value, " "consider resetting it to 'core'" diff --git a/src/include/report/run_event.h b/src/include/report/run_event.h index 8730eea8..3fd3d7d1 100644 --- a/src/include/report/run_event.h +++ b/src/include/report/run_event.h @@ -61,7 +61,7 @@ void free_commands(struct run_event_state *state); /* Syncronous command execution */ -/* Returns exitcode of first failed action, or first nonzero return value +/* Returns exit code of first failed action, or first nonzero return value * of post_run_callback. If all actions are successful, returns 0. */ int run_event_on_dir_name(struct run_event_state *state, const char *dump_dir_name, const char *event); diff --git a/src/lib/spawn.c b/src/lib/spawn.c index 068f4ac7..f6b7263c 100644 --- a/src/lib/spawn.c +++ b/src/lib/spawn.c @@ -108,7 +108,7 @@ pid_t fork_execv_on_steroids(int flags, execvp(argv[0], argv); if (!(flags & EXECFLG_QUIET)) perror_msg("Can't execute '%s'", argv[0]); - exit(127); /* shell uses this exitcode in this case */ + exit(127); /* shell uses this exit code in this case */ } if (flags & EXECFLG_INPUT) { diff --git a/src/plugins/abrt-action-analyze-c.c b/src/plugins/abrt-action-analyze-c.c index a736c4f8..5def9aa1 100644 --- a/src/plugins/abrt-action-analyze-c.c +++ b/src/plugins/abrt-action-analyze-c.c @@ -104,7 +104,7 @@ static char *run_unstrip_n(const char *dump_dir_name, unsigned timeout_sec) if (status != 0) { - /* unstrip didnt exit with exitcode 0 */ + /* unstrip didnt exit with exit code 0 */ strbuf_free(buf_out); return NULL; } -- cgit