aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorLeandro A. F. Pereira <leandro@hardinfo.org>2006-11-24 21:18:47 +0000
committerLeandro A. F. Pereira <leandro@hardinfo.org>2006-11-24 21:18:47 +0000
commitccd5ecd04700586b66f68753c8a3bf2f1e19aa39 (patch)
tree78a5847c4764d113a1e4c049824c9808c474b0e9 /hardinfo2
parenta20d38574df43287123bc1e685c0fe3f11f81cc7 (diff)
Pretty colours :)
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/report.c4
-rw-r--r--hardinfo2/shell.c30
2 files changed, 19 insertions, 15 deletions
diff --git a/hardinfo2/report.c b/hardinfo2/report.c
index a5885b26..3752df46 100644
--- a/hardinfo2/report.c
+++ b/hardinfo2/report.c
@@ -307,7 +307,7 @@ report_create_inner_from_module_list(ReportContext *ctx, GSList *modules)
GSList *entries;
if (!params.gui_running)
- fprintf(stderr, "%s\n", module->name);
+ fprintf(stderr, "\033[40;32m%s\033[0m\n", module->name);
report_title(ctx, module->name);
@@ -315,7 +315,7 @@ report_create_inner_from_module_list(ReportContext *ctx, GSList *modules)
ShellModuleEntry *entry = (ShellModuleEntry *) entries->data;
if (!params.gui_running)
- fprintf(stderr, " * %s\n", entry->name);
+ fprintf(stderr, "\033[2K\033[40;32;1m %s\033[0m\n", entry->name);
ctx->entry = entry;
report_subtitle(ctx, entry->name);
diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c
index 84b7f3f2..d18ecdba 100644
--- a/hardinfo2/shell.c
+++ b/hardinfo2/shell.c
@@ -202,7 +202,8 @@ shell_status_pulse(void)
} else {
static gint counter = 0;
- fprintf(stderr, "\r%c\r", "|/-\\"[counter++ % 4]);
+ fprintf(stderr, "\033[2K\033[40;37;1m %c\033[0m\r",
+ "|/-\\"[counter++ % 4]);
}
}
@@ -215,16 +216,18 @@ shell_status_set_percentage(gint percentage)
while (gtk_events_pending())
gtk_main_iteration();
} else {
- gint i, j = percentage / 10;
+ gchar i, j = percentage / 10;
- if (j < 10) {
+ if (percentage < 1 || j >= 10) {
+ fprintf(stderr, "\033[2K");
+ } else {
gchar bar[] = "----------";
+
for (i = 0; i < j; i++)
bar[i] = '#';
- fprintf(stderr, "\r%3d%% %s\r", percentage, bar);
- } else {
- fprintf(stderr, "\033[2K");
+ fprintf(stderr, "\r\033[40;37;1m%3d%% \033[40;34;1m"
+ "%s\033[0m\r", percentage, bar);
}
}
}
@@ -291,13 +294,14 @@ shell_do_reload(void)
void
shell_status_update(const gchar *message)
{
- if (!params.gui_running)
- return;
-
- gtk_label_set_markup(GTK_LABEL(shell->status), message);
- gtk_progress_bar_pulse(GTK_PROGRESS_BAR(shell->progress));
- while (gtk_events_pending())
- gtk_main_iteration();
+ if (params.gui_running) {
+ gtk_label_set_markup(GTK_LABEL(shell->status), message);
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(shell->progress));
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ } else {
+ fprintf(stderr, "\033[2K\033[40;37;1m %s\033[0m\r", message);
+ }
}
static void