From 3e1cef334960780cbea2aa8be8ce23eb7e8068fe Mon Sep 17 00:00:00 2001 From: Jiri Moskovcak Date: Sun, 13 Feb 2011 23:00:40 +0100 Subject: gtk wizard --- src/Makefile.am | 2 +- src/gtk-wizard/Makefile.am | 35 ++++ src/gtk-wizard/main.c | 18 ++ src/gtk-wizard/wizard.c | 122 ++++++++++++ src/gtk-wizard/wizard.glade | 455 ++++++++++++++++++++++++++++++++++++++++++++ src/gtk-wizard/wizard.h | 1 + 6 files changed, 632 insertions(+), 1 deletion(-) create mode 100644 src/gtk-wizard/Makefile.am create mode 100644 src/gtk-wizard/main.c create mode 100644 src/gtk-wizard/wizard.c create mode 100644 src/gtk-wizard/wizard.glade create mode 100644 src/gtk-wizard/wizard.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 638d91ce..61410d6d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1 +1 @@ -SUBDIRS = include lib report-python hooks btparser daemon applet gui gui-gtk cli plugins +SUBDIRS = include lib report-python hooks btparser daemon applet gui gui-gtk cli plugins gtk-wizard diff --git a/src/gtk-wizard/Makefile.am b/src/gtk-wizard/Makefile.am new file mode 100644 index 00000000..c199ad01 --- /dev/null +++ b/src/gtk-wizard/Makefile.am @@ -0,0 +1,35 @@ +bin_PROGRAMS = bug-reporting-wizard + +bug_reporting_wizard_SOURCES = \ + wizard.h wizard.c \ + main.c + +#-Wl,--export-dynamic and lgmodule-2.0 +#is required for gtk_builder_connect_signals() to work correctly +bug_reporting_wizard_CFLAGS = \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ + -I$(srcdir)/../lib \ + -DBIN_DIR=\"$(bindir)\" \ + -DVAR_RUN=\"$(VAR_RUN)\" \ + -DCONF_DIR=\"$(CONF_DIR)\" \ + -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ + -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ + -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ + -DICON_DIR=\"${datadir}/abrt/icons/hicolor/48x48/status\" \ + $(GTK_CFLAGS) \ + -D_GNU_SOURCE \ + -g \ + -Wl,--export-dynamic \ + -Wall -Werror + +bug_reporting_wizard_LDADD = \ + ../lib/libreport.la \ + ../lib/libabrt_dbus.la \ + -lglib-2.0 \ + -lgthread-2.0 \ + -lgmodule-2.0 \ + $(GTK_LIBS) + +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + +@INTLTOOL_DESKTOP_RULE@ diff --git a/src/gtk-wizard/main.c b/src/gtk-wizard/main.c new file mode 100644 index 00000000..0206d020 --- /dev/null +++ b/src/gtk-wizard/main.c @@ -0,0 +1,18 @@ +#include +#include "abrtlib.h" +#include "parse_options.h" +#include "wizard.h" + +int main(int argc, char **argv) +{ + //GtkWidget *assistant; + + gtk_init(&argc, &argv); + + GtkWidget *assistant = create_assistant(); + gtk_widget_show_all(assistant); + + /* Enter main loop */ + gtk_main(); + return 0; +} \ No newline at end of file diff --git a/src/gtk-wizard/wizard.c b/src/gtk-wizard/wizard.c new file mode 100644 index 00000000..2f04ea65 --- /dev/null +++ b/src/gtk-wizard/wizard.c @@ -0,0 +1,122 @@ +#include +#include "abrtlib.h" + +/* THE PAGE FLOW + * page_1: analyze action selection + * page_2: analyze progress + * page_3: reporter selection + * page_4: backtrace editor + * page_5: how to + user comments + * page_6: summary + * page_7: reporting progress + */ + +#define PAGE_ANALYZE_ACTION_SELECTOR "page_1" +#define PAGE_ANALYZE_PROGRESS "page_2" +#define PAGE_REPORTER_SELECTOR "page_3" +#define PAGE_BACKTRACE_APPROVAL "page_4" +#define PAGE_HOWTO "page_5" +#define PAGE_SUMMARY "page_6" +#define PAGE_REPORT "page_7" + + +#define DEFAULT_WIDTH 800 +#define DEFAULT_HEIGHT 500 + +gchar *pages[] = + { "page_1", + "page_2", + "page_3", + "page_4", + "page_5", + "page_6", + "page_7", + NULL + }; + +GtkBuilder *builder; +GtkWidget *assistant; + +void on_b_refresh_clicked(GtkButton *button) +{ + g_print("Refresh clicked!\n"); +} + +void add_pages() +{ + + GError *error = NULL; + gtk_builder_add_objects_from_file(builder, "wizard.glade", pages, &error); + if(error != NULL) + { + g_print(error->message); + g_free(error); + } + + GtkWidget *page; + gchar **page_names; + for(page_names = pages; *page_names != NULL; page_names++) + { + page = GTK_WIDGET(gtk_builder_get_object(builder, *page_names)); + if(page == NULL) + continue; + + gtk_assistant_append_page(GTK_ASSISTANT(assistant), page); + //FIXME: shouldn't be complete until something is selected! + gtk_assistant_set_page_complete(GTK_ASSISTANT(assistant), page, true); + if(strcmp(PAGE_ANALYZE_ACTION_SELECTOR, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Select analyzer"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_INTRO); + + } + if(strcmp(PAGE_ANALYZE_PROGRESS, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Analyzing problem"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_PROGRESS); + } + if(strcmp(PAGE_REPORTER_SELECTOR, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Select reporter"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_CONTENT); + } + if(strcmp(PAGE_BACKTRACE_APPROVAL, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Approve the backtrace"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_CONTENT); + } + + if(strcmp(PAGE_HOWTO, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Provide additional information"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_CONTENT); + } + + if(strcmp(PAGE_SUMMARY, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Confirm and send the report"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_CONFIRM); + } + + if(strcmp(PAGE_REPORT, *page_names) == 0) + { + gtk_assistant_set_page_title(GTK_ASSISTANT(assistant), page, "Approve the backtrace"); + gtk_assistant_set_page_type(GTK_ASSISTANT(assistant), page, GTK_ASSISTANT_PAGE_SUMMARY); + } + g_print("added page: %s\n", *page_names); + } +} + +GtkWidget *create_assistant() +{ + assistant = gtk_assistant_new(); + gtk_window_set_default_size(GTK_WINDOW(assistant), DEFAULT_WIDTH,DEFAULT_HEIGHT); + g_signal_connect(G_OBJECT(assistant), "cancel", G_CALLBACK(gtk_main_quit), NULL); + g_signal_connect(G_OBJECT(assistant), "close", G_CALLBACK(gtk_main_quit), NULL); + builder = gtk_builder_new(); + add_pages(); + gtk_builder_connect_signals(builder, NULL); + + + return assistant; +} \ No newline at end of file diff --git a/src/gtk-wizard/wizard.glade b/src/gtk-wizard/wizard.glade new file mode 100644 index 00000000..ed81cb5d --- /dev/null +++ b/src/gtk-wizard/wizard.glade @@ -0,0 +1,455 @@ + + + + + + 750 + 400 + + + True + vertical + + + True + 0.05000000074505806 + 0.05000000074505806 + It looks like an application from the package <b>APPLICATION</b> has crashed on your system. It is a good idea to send a bug report about this issue. The report will provide software maintainers with information essential in figuring out how to provide a bug fix for you. + +Please review the information that follows and modify it as needed to ensure your bug report does not contain any sensitive data you would rather not share. + +Select where you would like to analyze the bug, and press 'Forward' to continue. + True + 80 + + + 0 + + + + + True + vertical + + + Analyzer 1 + True + True + False + True + True + + + False + False + 0 + + + + + Analyzer 2 + True + True + False + True + True + radiobutton1 + + + False + False + 1 + + + + + Analyzer 3 + True + True + False + True + True + radiobutton1 + + + False + False + 2 + + + + + 1 + + + + + + + 750 + 400 + + + True + vertical + + + True + 0.05000000074505806 + 0.05000000074505806 + Please wait while ABRT is analyzing the problem... + + + 0 + + + + + True + True + automatic + automatic + + + True + True + False + False + + + + + 1 + + + + + True + True + + + False + 2 + + + + + + + 750 + 400 + + + True + vertical + + + True + 0.05000000074505806 + 0.05000000074505806 + +Select where you would like to report the bug, and press 'Forward' to continue. + True + 80 + + + 0 + + + + + True + vertical + + + reporter_1 + True + True + False + True + + + False + 0 + + + + + Reporter 2 + True + True + False + True + + + False + 1 + + + + + Reporter 3 + True + True + False + True + + + False + 2 + + + + + 1 + + + + + + + 750 + 400 + + + True + vertical + + + True + 0.05000000074505806 + 0.05000000074505806 + Below is the backtrace associated with your crash. A crash backtrace provides developers with details about how the crash happened, helping them track down the source of the problem. +Please review the backtrace below and modify it as needed to ensure your bug report does not contain any sensitive data you would rather not share: + + + 0 + + + + + True + True + automatic + automatic + + + True + True + + + + + 1 + + + + + True + + + True + + + + + + 0 + + + + + True + + + True + True + + gtk-find + + + False + 0 + + + + + True + vertical + + + True + up + + + 0 + + + + + True + down + + + 1 + + + + + False + False + 1 + + + + + False + False + 1 + + + + + False + False + 2 + + + + + True + + + True + + + + + + 0 + + + + + True + + + Refresh + True + True + True + + + + 0 + + + + + Copy + True + True + True + + + 1 + + + + + 1 + + + + + False + 3 + + + + + I agree with submitting the backtrace + True + True + False + True + + + False + False + 4 + + + + + + + + + True + vertical + + + + + + True + Page 5 + + + 1 + + + + + + + + + + + + True + vertical + + + + + + True + Page 6 + + + 1 + + + + + + + + + + + + True + vertical + + + + + + True + Page 7 + + + 1 + + + + + + + + + diff --git a/src/gtk-wizard/wizard.h b/src/gtk-wizard/wizard.h new file mode 100644 index 00000000..daa25eeb --- /dev/null +++ b/src/gtk-wizard/wizard.h @@ -0,0 +1 @@ +GtkWidget *create_assistant(void); -- cgit