aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2006-12-08 11:04:27 +0000
committerLeandro A. F. Pereira <leandro@hardinfo.org>2006-12-08 11:04:27 +0000
commit38213c90be660649eed6f6a3e8e7f582fc6a3c58 (patch)
tree14c78ea69bc12e7bf865e465260d187fa5ed2d3a /hardinfo2
parent8a9fdae124e2e976c05b190ca83c65e07ca913a4 (diff)
Cleanups and minor details.
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/menu.c2
-rw-r--r--hardinfo2/report.c22
-rw-r--r--hardinfo2/report.h2
-rw-r--r--hardinfo2/uidefs.xml3
4 files changed, 25 insertions, 4 deletions
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 @@
<ui>
<menubar>
- <menu name="FileMenu" action="FileMenuAction">
+ <menu name="InformationMenu" action="InformationMenuAction">
<menuitem name="Copy" action="CopyAction" />
<menuitem name="Report" action="ReportAction" />
<separator/>
<menuitem name="Quit" action="QuitAction" />
- <placeholder name="FileMenuAdditions" />
</menu>
<menu name="ViewMenu" action="ViewMenuAction">
<menuitem name="SidePane" action="SidePaneAction"/>