From 7608bb025507f0beb235abb5e1ef7ad84148892c Mon Sep 17 00:00:00 2001 From: 05356787 <05356787@localhost.localdomain> Date: Fri, 31 Oct 2008 13:10:02 -0200 Subject: Add filesystem usage bars --- hardinfo2/arch/linux/common/filesystem.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'hardinfo2/arch/linux/common/filesystem.h') diff --git a/hardinfo2/arch/linux/common/filesystem.h b/hardinfo2/arch/linux/common/filesystem.h index b3008387..48dd2160 100644 --- a/hardinfo2/arch/linux/common/filesystem.h +++ b/hardinfo2/arch/linux/common/filesystem.h @@ -51,10 +51,18 @@ scan_filesystems(void) tmp = g_strsplit(buf, " ", 0); if (!statfs(tmp[1], &sfs)) { + gfloat use_ratio; + size = (float) sfs.f_bsize * (float) sfs.f_blocks; avail = (float) sfs.f_bsize * (float) sfs.f_bavail; used = size - avail; + if (avail == 0.0f) { + use_ratio = 0.0f; + } else { + use_ratio = 100.0f * (used / size); + } + gchar *strsize = size_human_readable(size), *stravail = size_human_readable(avail), *strused = size_human_readable(used); @@ -81,9 +89,9 @@ scan_filesystems(void) stravail); g_hash_table_insert(moreinfo, g_strdup_printf("FS%d", ++count), strhash); - fs_list = h_strdup_cprintf("$FS%d$%s=%s|%s\n", + fs_list = h_strdup_cprintf("$FS%d$%s=%.2f|%s|%s\n", fs_list, - count, tmp[0], stravail, strsize); + count, tmp[0], use_ratio, strsize, stravail); g_free(strsize); g_free(stravail); -- cgit v1.2.3 From 84e4dc6b1776abccc6167c7f037ddca5b5a53244 Mon Sep 17 00:00:00 2001 From: 05356787 <05356787@localhost.localdomain> Date: Fri, 31 Oct 2008 16:32:48 -0200 Subject: Make headers clickable --- hardinfo2/arch/linux/common/boots.h | 1 - hardinfo2/arch/linux/common/filesystem.h | 2 +- hardinfo2/shell.c | 6 ++++++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'hardinfo2/arch/linux/common/filesystem.h') diff --git a/hardinfo2/arch/linux/common/boots.h b/hardinfo2/arch/linux/common/boots.h index 388e72a4..8a3c11fa 100644 --- a/hardinfo2/arch/linux/common/boots.h +++ b/hardinfo2/arch/linux/common/boots.h @@ -48,7 +48,6 @@ scan_boots_real(void) } tmp = g_strsplit(buffer, " ", 0); - computer->os->boots = h_strdup_cprintf("\n%s %s %s %s=%s|%s", computer->os->boots, tmp[4], tmp[5], tmp[6], tmp[7], tmp[3], tmp[8]); diff --git a/hardinfo2/arch/linux/common/filesystem.h b/hardinfo2/arch/linux/common/filesystem.h index 48dd2160..f5b932b8 100644 --- a/hardinfo2/arch/linux/common/filesystem.h +++ b/hardinfo2/arch/linux/common/filesystem.h @@ -58,7 +58,7 @@ scan_filesystems(void) used = size - avail; if (avail == 0.0f) { - use_ratio = 0.0f; + use_ratio = 100.0f; } else { use_ratio = 100.0f * (used / size); } diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 3c5a5198..1883c7bc 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -1326,10 +1326,12 @@ static ShellInfoTree *info_tree_new(gboolean extra) model = GTK_TREE_MODEL(store); treeview = gtk_tree_view_new_with_model(model); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); + gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(treeview), TRUE); info->col_progress = column = gtk_tree_view_column_new(); gtk_tree_view_column_set_visible(column, FALSE); gtk_tree_view_column_set_min_width(column, 240); + gtk_tree_view_column_set_clickable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); cr_progress = gtk_cell_renderer_progress_new(); @@ -1342,6 +1344,7 @@ static ShellInfoTree *info_tree_new(gboolean extra) info->col_textvalue = column = gtk_tree_view_column_new(); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + gtk_tree_view_column_set_clickable(column, TRUE); cr_pbuf = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(column, cr_pbuf, FALSE); @@ -1356,6 +1359,7 @@ static ShellInfoTree *info_tree_new(gboolean extra) info->col_extra1 = column = gtk_tree_view_column_new(); gtk_tree_view_column_set_visible(column, FALSE); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + gtk_tree_view_column_set_clickable(column, TRUE); cr_text = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cr_text, FALSE); @@ -1365,6 +1369,7 @@ static ShellInfoTree *info_tree_new(gboolean extra) info->col_extra2 = column = gtk_tree_view_column_new(); gtk_tree_view_column_set_visible(column, FALSE); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + gtk_tree_view_column_set_clickable(column, TRUE); cr_text = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cr_text, FALSE); @@ -1373,6 +1378,7 @@ static ShellInfoTree *info_tree_new(gboolean extra) info->col_value = column = gtk_tree_view_column_new(); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + gtk_tree_view_column_set_clickable(column, TRUE); cr_text = gtk_cell_renderer_text_new(); gtk_tree_view_column_pack_start(column, cr_text, FALSE); -- cgit v1.2.3 From cafe9d5b63c93d7d0c20154bb8ffa510dd50cbef Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Fri, 31 Oct 2008 16:40:00 -0200 Subject: Only show filesystems with total_size > 0bytes --- hardinfo2/arch/linux/common/filesystem.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'hardinfo2/arch/linux/common/filesystem.h') diff --git a/hardinfo2/arch/linux/common/filesystem.h b/hardinfo2/arch/linux/common/filesystem.h index f5b932b8..0224e962 100644 --- a/hardinfo2/arch/linux/common/filesystem.h +++ b/hardinfo2/arch/linux/common/filesystem.h @@ -57,6 +57,10 @@ scan_filesystems(void) avail = (float) sfs.f_bsize * (float) sfs.f_bavail; used = size - avail; + if (size == 0.0f) { + continue; + } + if (avail == 0.0f) { use_ratio = 100.0f; } else { -- cgit v1.2.3