aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/computer.c6
-rw-r--r--hardinfo2/report.c51
2 files changed, 31 insertions, 26 deletions
diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c
index 40c006b9..d31f22c3 100644
--- a/hardinfo2/computer.c
+++ b/hardinfo2/computer.c
@@ -364,14 +364,16 @@ gchar *callback_display()
gchar *callback_network()
{
return g_strdup_printf("%s\n"
- "[$ShellParam$]\n"
+ "[$ShellParam$]\n"
"ReloadInterval=3000\n"
"ViewType=1\n"
"ColumnTitle$TextValue=Device\n"
"ColumnTitle$Value=IP Address\n"
"ColumnTitle$Extra1=Statistics\n"
"ShowColumnHeaders=true\n"
- "%s", network_interfaces, network_icons);
+ "%s",
+ network_interfaces,
+ network_icons);
}
gchar *callback_users()
diff --git a/hardinfo2/report.c b/hardinfo2/report.c
index d69a1604..97f7cf0a 100644
--- a/hardinfo2/report.c
+++ b/hardinfo2/report.c
@@ -73,7 +73,7 @@ gint report_get_visible_columns(ReportContext *ctx)
columns = 2;
/* Either the Progress column or the Value column is available at
- the same time. */
+ the same time. So we don't count them. */
if (ctx->columns & REPORT_COL_EXTRA1)
columns++;
@@ -81,9 +81,6 @@ gint report_get_visible_columns(ReportContext *ctx)
if (ctx->columns & REPORT_COL_EXTRA2)
columns++;
- if (ctx->columns & REPORT_COL_TEXTVALUE)
- columns++;
-
return columns;
}
@@ -103,9 +100,6 @@ void report_context_configure(ReportContext * ctx, GKeyFile * keyfile)
"ViewType",
NULL) == SHELL_VIEW_PROGRESS);
- /* make only "Value" column visible ("Key" column is always visible) */
- ctx->columns = REPORT_COL_VALUE;
- ctx->show_column_headers = FALSE;
keys = g_key_file_get_keys(keyfile, group, NULL, NULL);
if (keys) {
@@ -154,8 +148,19 @@ void report_table(ReportContext * ctx, gchar * text)
gchar **groups;
gint i;
+ /* make only "Value" column visible ("Key" column is always visible) */
+ ctx->columns = REPORT_COL_VALUE;
+ ctx->show_column_headers = FALSE;
+
g_key_file_load_from_data(key_file, text, strlen(text), 0, NULL);
groups = g_key_file_get_groups(key_file, NULL);
+
+ for (i = 0; groups[i]; i++) {
+ if (groups[i][0] == '$') {
+ report_context_configure(ctx, key_file);
+ break;
+ }
+ }
for (i = 0; groups[i]; i++) {
gchar *group, *tmpgroup;
@@ -163,7 +168,6 @@ void report_table(ReportContext * ctx, gchar * text)
gint j;
if (groups[i][0] == '$') {
- report_context_configure(ctx, key_file);
continue;
}
@@ -289,27 +293,26 @@ report_html_key_value(ReportContext * ctx, gchar * key, gchar * value)
gchar **values;
gint i;
- if (columns == 1) {
+ if (columns == 2) {
ctx->output = h_strdup_cprintf("<tr><td class=\"field\">%s</td>"
"<td class=\"value\">%s</td></tr>\n",
ctx->output,
key, value);
- return;
- }
-
- values = g_strsplit(value, "|", 0);
-
- ctx->output = h_strdup_cprintf("\n<tr>\n<td class=\"field\">%s</td>", ctx->output, key);
-
- for (i = 0; values[i]; i++) {
- ctx->output = h_strdup_cprintf("<td class=\"value\">%s</td>",
- ctx->output,
- values[i]);
+ } else {
+ values = g_strsplit(value, "|", columns);
+
+ ctx->output = h_strdup_cprintf("\n<tr>\n<td class=\"field\">%s</td>", ctx->output, key);
+
+ for (i = columns - 2; i >= 0; i--) {
+ ctx->output = h_strdup_cprintf("<td class=\"value\">%s</td>",
+ ctx->output,
+ values[i]);
+ }
+
+ ctx->output = h_strdup_cprintf("</tr>\n", ctx->output);
+
+ g_strfreev(values);
}
-
- g_strfreev(values);
-
- ctx->output = h_strdup_cprintf("</tr>\n", ctx->output);
}
static void report_text_header(ReportContext * ctx)