summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2011-04-17 17:12:45 +0200
committerJiri Moskovcak <jmoskovc@redhat.com>2011-04-17 17:12:45 +0200
commit66fb696b1d498fdb335d7ed585b39be5d6771723 (patch)
tree8f0b37e9dc37d058c9a61938a9d25f8e7c84146e /src
parent2e1c4aa678a0191c011daef206e72016f94d1dc1 (diff)
downloadabrt-66fb696b1d498fdb335d7ed585b39be5d6771723.tar.gz
abrt-66fb696b1d498fdb335d7ed585b39be5d6771723.tar.xz
abrt-66fb696b1d498fdb335d7ed585b39be5d6771723.zip
wizard: warn user if the plugin configuration is wrong trac#156
Diffstat (limited to 'src')
-rw-r--r--src/gtk-helpers/event_config_dialog.c33
-rw-r--r--src/gtk-helpers/libreport-gtk.h2
-rw-r--r--src/gui-wizard-gtk/wizard.c2
3 files changed, 37 insertions, 0 deletions
diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index 6882ac25..b15c659c 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -22,6 +22,7 @@
static GtkWindow *g_event_list_window;
static GList *option_widget_list;
+GtkWindow *g_parent_window;
enum
{
@@ -416,3 +417,35 @@ void show_events_list_dialog(GtkWindow *parent)
gtk_widget_show_all(event_list_window);
}
+
+void show_event_opt_error_dialog(const char *event_name)
+{
+ event_config_t *ec = get_event_config(event_name);
+ char *message = xasprintf(_("Wrong settings detected for %s, "
+ "reporting will probably fail if you continue "
+ "with the current configuration."),
+ ec->screen_name);
+ char *markup_message = xasprintf(_("Wrong settings detected for <b>%s</b>, "
+ "reporting will probably fail if you continue "
+ "with the current configuration."),
+ ec->screen_name);
+ GtkWidget *wrong_settings = gtk_message_dialog_new(g_parent_window,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ message);
+ gtk_window_set_transient_for(GTK_WINDOW(wrong_settings), g_parent_window);
+ free(message);
+ gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(wrong_settings),
+ markup_message);
+ free(markup_message);
+ gtk_dialog_run(GTK_DIALOG(wrong_settings));
+ gtk_widget_destroy(wrong_settings);
+}
+
+void g_validate_event(const char* event_name)
+{
+ GHashTable *errors = validate_event(event_name);
+ if (errors != NULL)
+ show_event_opt_error_dialog(event_name);
+}
diff --git a/src/gtk-helpers/libreport-gtk.h b/src/gtk-helpers/libreport-gtk.h
index d2105c3a..e7d2a5a6 100644
--- a/src/gtk-helpers/libreport-gtk.h
+++ b/src/gtk-helpers/libreport-gtk.h
@@ -21,3 +21,5 @@ void make_label_autowrap_on_resize(GtkLabel *label);
void abrt_keyring_save_settings(const char *event_name);
void load_event_config_data_from_keyring();
+void g_validate_event(const char* event_name);
+extern GtkWindow *g_parent_window;
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 2ba52705..44dc11bb 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -424,6 +424,7 @@ static void report_tb_was_toggled(GtkButton *button_unused, gpointer user_data_u
(reporters_string->len != 0 ? ", " : ""),
event_gui_data->event_name
);
+ g_validate_event(event_gui_data->event_name);
}
}
@@ -1345,6 +1346,7 @@ void create_assistant()
gtk_assistant_set_forward_page_func(g_assistant, next_page_no, NULL, NULL);
GtkWindow *wnd_assistant = GTK_WINDOW(g_assistant);
+ g_parent_window = wnd_assistant;
gtk_window_set_default_size(wnd_assistant, DEFAULT_WIDTH, DEFAULT_HEIGHT);
/* set_default sets icon for every windows used in this app, so we don't
have to set the icon for those windows manually