From 38213c90be660649eed6f6a3e8e7f582fc6a3c58 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Fri, 8 Dec 2006 11:04:27 +0000 Subject: Cleanups and minor details. --- hardinfo2/menu.c | 2 +- hardinfo2/report.c | 22 +++++++++++++++++++++- hardinfo2/report.h | 2 ++ hardinfo2/uidefs.xml | 3 +-- 4 files changed, 25 insertions(+), 4 deletions(-) (limited to 'hardinfo2') diff --git a/hardinfo2/menu.c b/hardinfo2/menu.c index 9a301700..9dff3502 100644 --- a/hardinfo2/menu.c +++ b/hardinfo2/menu.c @@ -30,7 +30,7 @@ static GtkActionEntry entries[] = { - { "FileMenuAction", NULL, "_File" }, /* name, stock id, label */ + { "InformationMenuAction", NULL, "_Information" }, /* name, stock id, label */ { "ViewMenuAction", NULL, "_View" }, { "HelpMenuAction", NULL, "_Help" }, { "MainMenuBarAction", NULL, "" }, diff --git a/hardinfo2/report.c b/hardinfo2/report.c index 3752df46..0e17a852 100644 --- a/hardinfo2/report.c +++ b/hardinfo2/report.c @@ -378,6 +378,7 @@ report_context_html_new() ctx->keyvalue = report_html_key_value; ctx->output = g_strdup(""); + ctx->format = REPORT_FORMAT_HTML; return ctx; } @@ -396,6 +397,7 @@ report_context_text_new() ctx->keyvalue = report_text_key_value; ctx->output = g_strdup(""); + ctx->format = REPORT_FORMAT_TEXT; return ctx; } @@ -460,10 +462,10 @@ report_generate(ReportDialog *rd) } create_context = file_types_get_data_by_name(file_types, file); - g_free(file); if (!create_context) { g_warning("Cannot create ReportContext. Programming bug?"); + g_free(file); return FALSE; } @@ -474,7 +476,25 @@ report_generate(ReportDialog *rd) fputs(ctx->output, stream); fclose(stream); + if (ctx->format == REPORT_FORMAT_HTML) { + GtkWidget *dialog; + dialog = gtk_message_dialog_new(NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_NONE, + "Open the report with your web browser?"); + gtk_dialog_add_buttons(GTK_DIALOG(dialog), + GTK_STOCK_NO, GTK_RESPONSE_REJECT, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) + open_url(file); + + gtk_widget_destroy(dialog); + } + report_context_free(ctx); + g_free(file); return TRUE; } diff --git a/hardinfo2/report.h b/hardinfo2/report.h index b7203c43..e4de9235 100644 --- a/hardinfo2/report.h +++ b/hardinfo2/report.h @@ -40,6 +40,8 @@ struct _ReportContext { void (*subtitle) (ReportContext *ctx, gchar *text); void (*subsubtitle) (ReportContext *ctx, gchar *text); void (*keyvalue) (ReportContext *ctx, gchar *key, gchar *value); + + ReportFormat format; }; struct _ReportDialog { diff --git a/hardinfo2/uidefs.xml b/hardinfo2/uidefs.xml index ba742061..779479c1 100644 --- a/hardinfo2/uidefs.xml +++ b/hardinfo2/uidefs.xml @@ -1,11 +1,10 @@ - + - -- cgit v1.2.3