summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2011-05-19 11:58:39 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2011-05-19 11:58:39 +0200
commit9db9c8de91981886a8ac9678b36390e6346bf335 (patch)
tree24fb8f03cc86e3918eaf07544a3c19a7345d3bf6 /src
parent3ca62f220eeb8c84a5536333117694d1c5a4fa0f (diff)
downloadabrt-9db9c8de91981886a8ac9678b36390e6346bf335.tar.gz
abrt-9db9c8de91981886a8ac9678b36390e6346bf335.tar.xz
abrt-9db9c8de91981886a8ac9678b36390e6346bf335.zip
wizard: allow user to return to reporting at the end
Also replaces "cancel" button with "close". The name was bad: we do not cancel anything. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui-wizard-gtk/wizard.c94
-rw-r--r--src/gui-wizard-gtk/wizard.glade74
2 files changed, 113 insertions, 55 deletions
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 426dfb8a..cc93df7e 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -72,7 +72,6 @@ enum
{
DETAIL_COLUMN_NAME,
DETAIL_COLUMN_VALUE,
- //COLUMN_PATH,
DETAIL_NUM_COLUMNS,
};
@@ -102,6 +101,8 @@ enum {
PAGENO_BACKTRACE_APPROVAL,
PAGENO_REPORT,
PAGENO_REPORT_PROGRESS,
+ PAGENO_REPORT_DONE,
+ PAGENO_NOT_SHOWN,
};
/* Use of arrays (instead of, say, #defines to C strings)
@@ -116,6 +117,8 @@ static const gchar PAGE_REPORTER_SELECTOR[] = "page_4_report";
static const gchar PAGE_BACKTRACE_APPROVAL[] = "page_5";
static const gchar PAGE_REPORT[] = "page_6_report";
static const gchar PAGE_REPORT_PROGRESS[] = "page_7_report";
+static const gchar PAGE_REPORT_DONE[] = "page_8_report";
+static const gchar PAGE_NOT_SHOWN[] = "page_9_report";
static const gchar *const page_names[] =
{
@@ -127,6 +130,8 @@ static const gchar *const page_names[] =
PAGE_BACKTRACE_APPROVAL,
PAGE_REPORT,
PAGE_REPORT_PROGRESS,
+ PAGE_REPORT_DONE,
+ PAGE_NOT_SHOWN,
NULL
};
@@ -159,7 +164,11 @@ static page_obj_t pages[] =
{ PAGE_BACKTRACE_APPROVAL , "Review the backtrace" , GTK_ASSISTANT_PAGE_CONTENT },
{ PAGE_REPORT , "Confirm data to report", GTK_ASSISTANT_PAGE_CONFIRM },
/* Was GTK_ASSISTANT_PAGE_PROGRESS */
- { PAGE_REPORT_PROGRESS , "Reporting" , GTK_ASSISTANT_PAGE_SUMMARY },
+ { PAGE_REPORT_PROGRESS , "Reporting" , GTK_ASSISTANT_PAGE_CONTENT },
+ { PAGE_REPORT_DONE , "Reporting done" , GTK_ASSISTANT_PAGE_CONTENT },
+ /* We prevent user from reaching this page, as it can't be navigated away,
+ * and we don't want that */
+ { PAGE_NOT_SHOWN , "" , GTK_ASSISTANT_PAGE_SUMMARY },
{ NULL }
};
@@ -390,7 +399,6 @@ static void tv_details_cursor_changed(
*/
g_object_set(G_OBJECT(g_tv_details_col2),
"editable", editable,
- // "editable-set", editable,
NULL);
}
@@ -575,9 +583,6 @@ static event_gui_data_t *add_event_buttons(GtkBox *box,
event_gui_data->toggle_button = GTK_TOGGLE_BUTTON(button);
*p_event_list = g_list_append(*p_event_list, event_gui_data);
- //if (!first_button)
- // first_button = event_gui_data;
-
if (!active_button)
{
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), true);
@@ -614,7 +619,6 @@ static void append_item_to_ls_details(gpointer name, gpointer value, gpointer da
gtk_list_store_set(g_ls_details, &iter,
DETAIL_COLUMN_NAME, (char *)name,
DETAIL_COLUMN_VALUE, item->content,
- //DETAIL_COLUMN_PATH, xasprintf("%s%s", g_dump_dir_name, name),
-1);
}
else
@@ -622,9 +626,7 @@ static void append_item_to_ls_details(gpointer name, gpointer value, gpointer da
gtk_list_store_set(g_ls_details, &iter,
DETAIL_COLUMN_NAME, (char *)name,
DETAIL_COLUMN_VALUE, _("(click here to view/edit)"),
- //DETAIL_COLUMN_PATH, xasprintf("%s%s", g_dump_dir_name, name),
-1);
- //WARNING: will leak xasprintf results above if uncommented
}
}
else if (item->flags & CD_FLAG_BIN)
@@ -637,7 +639,6 @@ static void append_item_to_ls_details(gpointer name, gpointer value, gpointer da
gtk_list_store_set(g_ls_details, &iter,
DETAIL_COLUMN_NAME, (char *)name,
DETAIL_COLUMN_VALUE, msg,
- //DETAIL_COLUMN_PATH, xasprintf("%s%s", g_dump_dir_name, name),
-1);
free(msg);
}
@@ -900,7 +901,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
|| spawn_next_command_in_evd(evd) < 0
) {
VERB1 log("done running event on '%s': %d", g_dump_dir_name, retval);
-//append_to_textview(evd->tv_log, msg);
/* Inform abrt-gui that it is a good idea to rescan the directory */
kill(getppid(), SIGCHLD);
@@ -912,15 +912,9 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
char *msg = xasprintf(evd->end_msg, retval);
gtk_label_set_text(evd->status_label, msg);
free(msg);
- /* Unfreeze assistant
- * we can't allow user to continue if analyze action fails
- * i.e: if gdb fails to generate backtrace
-//TODO: generic solution instead of special-casing on event name!
- */
- if (retval == 0 || (strncmp(evd->event_name, "analyze", strlen("analyze")) != 0))
- {
- gtk_assistant_set_page_complete(g_assistant, evd->page_widget, true);
- }
+
+ /* Hide "Back" button */
+ gtk_assistant_commit(g_assistant);
/* Enable (un-gray out) navigation buttons */
gtk_widget_set_sensitive(GTK_WIDGET(g_assistant), true);
@@ -946,8 +940,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
break;
}
/* No commands needed?! (This is untypical) */
-//TODO: msg?
-//append_to_textview(evd->tv_log, msg);
}
}
@@ -1029,8 +1021,6 @@ static void start_event_run(const char *event_name,
gtk_label_set_text(status_label, start_msg);
//TODO: save_to_event_log(evd, "message that we run event foo")?
- /* Freeze assistant so it can't move away from the page until event run is done */
- gtk_assistant_set_page_complete(g_assistant, page, false);
/* Disable (gray out) navigation buttons */
gtk_widget_set_sensitive(GTK_WIDGET(g_assistant), false);
}
@@ -1051,7 +1041,7 @@ static void add_warning(const char *warning)
gtk_widget_show(warning_lbl);
}
-static void check_backtrace_and_allow_send(void) //TODO: rename, this checks rating, not backtrace
+static void check_bt_rating_and_allow_send(void)
{
bool send = true;
bool warn = false;
@@ -1062,18 +1052,19 @@ static void check_backtrace_and_allow_send(void) //TODO: rename, this checks rat
/*
* FIXME: this should be bind to a reporter not to a compoment
- * but so far only oopses doesn't have rating, so for now we
+ * but so far only oopses don't have rating, so for now we
* skip the "kernel" manually
*/
const char *component = get_problem_item_content_or_NULL(g_cd, FILENAME_COMPONENT);
+//FIXME: say "no" to special casing!
if (strcmp(component, "kernel") != 0)
{
const char *rating = get_problem_item_content_or_NULL(g_cd, FILENAME_RATING);
if (rating) switch (*rating)
{
- case '4': //bt is ok - no warning here
+ case '4': /* bt is ok - no warning here */
break;
- case '3': //bt is usable, but not complete, so show a warning
+ case '3': /* 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."));
warn = true;
break;
@@ -1103,7 +1094,7 @@ static void check_backtrace_and_allow_send(void) //TODO: rename, this checks rat
static void on_bt_approve_toggle(GtkToggleButton *togglebutton, gpointer user_data)
{
- check_backtrace_and_allow_send();
+ check_bt_rating_and_allow_send();
}
static void on_comment_changed(GtkTextBuffer *buffer, gpointer user_data)
@@ -1204,7 +1195,7 @@ static void on_page_prepare(GtkAssistant *assistant, GtkWidget *page, gpointer u
{
if (pages[PAGENO_BACKTRACE_APPROVAL].page_widget == page)
{
- check_backtrace_and_allow_send();
+ check_bt_rating_and_allow_send();
}
/* Save text fields if changed */
@@ -1226,6 +1217,9 @@ static void on_page_prepare(GtkAssistant *assistant, GtkWidget *page, gpointer u
if (pages[PAGENO_COMMENT].page_widget == page)
on_comment_changed(gtk_text_view_get_buffer(g_tv_comment), NULL);
+
+ if (pages[PAGENO_REPORT_DONE].page_widget == page)
+ gtk_assistant_commit(g_assistant);
}
static gint select_next_page_no(gint current_page_no, gpointer data)
@@ -1283,6 +1277,11 @@ static gint select_next_page_no(gint current_page_no, gpointer data)
goto again;
}
break;
+ case PAGENO_NOT_SHOWN:
+ /* No! this would SEGV (infinitely recurse into select_next_page_no) */
+ /*gtk_assistant_commit(g_assistant);*/
+ current_page_no = PAGENO_ANALYZE_SELECTOR-1;
+ goto again;
}
VERB2 log("%s: selected page #%d", __func__, current_page_no);
@@ -1314,7 +1313,7 @@ static gboolean highlight_search(gpointer user_data)
gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
}
- //returning false will make glib to remove this event
+ /* returning false will make glib to remove this event */
return false;
}
@@ -1395,17 +1394,15 @@ static void add_pages()
for (i = 0; page_names[i] != NULL; i++)
{
char *delim = strrchr(page_names[i], '_');
- if(delim != NULL)
+ if (delim != NULL)
{
- if (g_report_only && (strncmp(delim+1, "report", strlen("report"))) != 0)
+ if (g_report_only && (strncmp(delim + 1, "report", strlen("report"))) != 0)
{
pages[i].page_widget = NULL;
continue;
}
}
GtkWidget *page = GTK_WIDGET(gtk_builder_get_object(builder, page_names[i]));
- if (page == NULL)
- continue;
pages[i].page_widget = page;
added_pages[page_no++] = &pages[i];
@@ -1423,6 +1420,7 @@ static void add_pages()
VERB1 log("added page: %s", page_names[i]);
}
+
/* Set pointers to objects we might need to work with */
g_lbl_cd_reason = GTK_LABEL( gtk_builder_get_object(builder, "lbl_cd_reason"));
g_box_analyzers = GTK_BOX( gtk_builder_get_object(builder, "vb_analyzers"));
@@ -1448,27 +1446,31 @@ static void add_pages()
gtk_widget_modify_font(GTK_WIDGET(g_tv_analyze_log), monospace_font);
gtk_widget_modify_font(GTK_WIDGET(g_tv_report_log), monospace_font);
gtk_widget_modify_font(GTK_WIDGET(g_tv_backtrace), monospace_font);
- //make_label_autowrap_on_resize(g_lbl_cd_reason);
fix_all_wrapped_labels(GTK_WIDGET(g_assistant));
- ///* hide the warnings by default */
- //gtk_widget_hide(g_widget_warnings_area);
-
- //gtk_assistant_set_page_complete(g_assistant, pages[PAGENO_REPORTER_SELECTOR].page_widget, false);
if (pages[PAGENO_BACKTRACE_APPROVAL].page_widget != NULL)
gtk_assistant_set_page_complete(g_assistant, pages[PAGENO_BACKTRACE_APPROVAL].page_widget,
gtk_toggle_button_get_active(g_tb_approve_bt));
- /* configure btn on select analyzers page */
+ /* Configure btn on select analyzers page */
GtkWidget *config_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button_cfg1"));
if (config_btn)
g_signal_connect(G_OBJECT(config_btn), "clicked", G_CALLBACK(on_show_event_list_cb), NULL);
- /* configure btn on select reporters page */
+ /* Configure btn on select reporters page */
config_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button_cfg2"));
if (config_btn)
g_signal_connect(G_OBJECT(config_btn), "clicked", G_CALLBACK(on_show_event_list_cb), NULL);
+ /* Add "Close" button */
+ GtkWidget *w;
+ w = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+ g_signal_connect(w, "clicked", G_CALLBACK(gtk_main_quit), NULL);
+ gtk_widget_show(w);
+ gtk_assistant_add_action_widget(g_assistant, w);
+ /* and hide "Cancel" button - "Close" is a better name for what we want */
+ gtk_assistant_commit(g_assistant);
+
/* Set color of the comment evenbox */
GdkColor color;
gdk_color_parse("#CC3333", &color);
@@ -1505,8 +1507,6 @@ void create_assistant(void)
g_ls_details = gtk_list_store_new(DETAIL_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model(g_tv_details, GTK_TREE_MODEL(g_ls_details));
-// gtk_builder_connect_signals(builder, NULL);
-
g_signal_connect(g_tb_approve_bt, "toggled", G_CALLBACK(on_bt_approve_toggle), NULL);
g_signal_connect(g_btn_refresh, "clicked", G_CALLBACK(on_btn_refresh_clicked), NULL);
g_signal_connect(gtk_text_view_get_buffer(g_tv_comment), "changed", G_CALLBACK(on_comment_changed), NULL);
@@ -1519,10 +1519,4 @@ void create_assistant(void)
/* found items background */
gtk_text_buffer_create_tag(backtrace_buf, "search_result_bg", "background", "red", NULL);
g_signal_connect(g_search_entry_bt, "changed", G_CALLBACK(search_timeout), NULL);
-
- if (pages[PAGENO_BACKTRACE_APPROVAL].page_widget != NULL)
- gtk_assistant_set_page_complete(g_assistant,
- pages[PAGENO_BACKTRACE_APPROVAL].page_widget,
- gtk_toggle_button_get_active(g_tb_approve_bt)
- );
}
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
index f79950ee..49acd67d 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -51,7 +51,7 @@
<object class="GtkScrolledWindow" id="container_details1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">out</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<object class="GtkTreeView" id="tv_details">
<property name="visible">True</property>
@@ -275,7 +275,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">out</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<object class="GtkTextView" id="tv_analyze_log">
<property name="visible">True</property>
@@ -404,7 +404,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">out</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<object class="GtkTextView" id="tv_backtrace">
<property name="visible">True</property>
@@ -674,7 +674,7 @@
<object class="GtkScrolledWindow" id="container_details2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">out</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<placeholder/>
</child>
@@ -715,7 +715,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow6">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="shadow_type">out</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<object class="GtkTextView" id="tv_report_log">
<property name="visible">True</property>
@@ -734,4 +734,68 @@
</object>
</child>
</object>
+ <object class="GtkWindow" id="window8">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="page_8_report">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Reporting has finished. You can close this window now.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">If you want to report the problem to a different destination, collect additional information, or provide a better problem description and repeat reporting process, press 'Forward'.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="window9">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="page_9_report">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <property name="spacing">3</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
</interface>