aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2010-01-03 13:55:23 -0200
committerLeandro Pereira <leandro@hardinfo.org>2010-01-03 13:55:23 -0200
commitb9f109c744fbc8a14efb958fb39c9641cb6745f2 (patch)
treeb32b63a9a640ed7ec24ebadd6bf09b51bd685786 /hardinfo2
parentf3cee43c6eaf76672f67507aa82a70406df1a0e0 (diff)
Warn when the help viewer was unable to find/parse the help file.
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/help-viewer.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/hardinfo2/help-viewer.c b/hardinfo2/help-viewer.c
index da29756d..de9e61dd 100644
--- a/hardinfo2/help-viewer.c
+++ b/hardinfo2/help-viewer.c
@@ -273,13 +273,31 @@ static void home_clicked(GtkWidget *button, gpointer data)
void help_viewer_open_page(HelpViewer *hv, const gchar *page)
{
- /* adds the current file to the back stack (before loading the new file */
- hv->back_stack = g_slist_prepend(hv->back_stack, g_strdup(hv->current_file));
- gtk_widget_set_sensitive(hv->btn_back, TRUE);
-
- markdown_textview_load_file(MARKDOWN_TEXTVIEW(hv->text_view), page);
+ gchar *temp;
- gtk_window_present(GTK_WINDOW(hv->window));
+ temp = g_strdup(hv->current_file);
+
+ if (!markdown_textview_load_file(MARKDOWN_TEXTVIEW(hv->text_view), page)) {
+ GtkWidget *dialog;
+ Shell *shell;
+
+ shell = shell_get_main_shell();
+ dialog = gtk_message_dialog_new(GTK_WINDOW(shell->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "Cannot open help file (%s).",
+ page);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+
+ g_free(temp);
+ } else {
+ /* adds the current file to the back stack (before loading the new file */
+ hv->back_stack = g_slist_prepend(hv->back_stack, temp);
+ gtk_widget_set_sensitive(hv->btn_back, TRUE);
+ gtk_window_present(GTK_WINDOW(hv->window));
+ }
}
void help_viewer_destroy(HelpViewer *hv)