diff options
| author | Leandro Augusto Fogolin Pereira <leandro@zorg.(none)> | 2008-12-29 13:13:05 -0200 | 
|---|---|---|
| committer | Leandro Augusto Fogolin Pereira <leandro@zorg.(none)> | 2008-12-29 13:13:05 -0200 | 
| commit | c764b60a237b611e0a4d4a89aca7ebcd829a593a (patch) | |
| tree | 93978555bd7319c28fbb61d2e34942d99a6d947a | |
| parent | 642578af10a0e18c6af78a704b6626fd367bb41b (diff) | |
More report work (now on text-only reports).
The report stuff must be refactored properly...
| -rw-r--r-- | hardinfo2/report.c | 30 | 
1 files changed, 25 insertions, 5 deletions
| diff --git a/hardinfo2/report.c b/hardinfo2/report.c index 97f7cf0a..5f492af3 100644 --- a/hardinfo2/report.c +++ b/hardinfo2/report.c @@ -152,6 +152,7 @@ void report_table(ReportContext * ctx, gchar * text)      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); @@ -361,11 +362,30 @@ static void report_text_subsubtitle(ReportContext * ctx, gchar * text)  static void  report_text_key_value(ReportContext * ctx, gchar * key, gchar * value)  { -    if (strlen(value)) -	ctx->output = -	    h_strdup_cprintf("%s\t\t: %s\n", ctx->output, key, value); -    else -	ctx->output = h_strdup_cprintf("%s\n", ctx->output, key); +    gint columns = report_get_visible_columns(ctx); +    gchar **values; +    gint i; +     +    if (columns == 2) { +      if (strlen(value)) +          ctx->output = h_strdup_cprintf("%s\t\t: %s\n", ctx->output, key, value); +      else +          ctx->output = h_strdup_cprintf("%s\n", ctx->output, key); +    } else { +      values = g_strsplit(value, "|", columns); +       +      ctx->output = h_strdup_cprintf("%s\t", ctx->output, key); +       +      for (i = columns - 2; i >= 0; i--) { +        ctx->output = h_strdup_cprintf("%s\t", +                                       ctx->output, +                                       values[i]); +      } + +      ctx->output = h_strdup_cprintf("\n", ctx->output); +       +      g_strfreev(values); +    }  }  static GSList *report_create_module_list_from_dialog(ReportDialog * rd) | 
