diff options
author | 05356787 <05356787@localhost.localdomain> | 2008-10-30 08:48:41 -0200 |
---|---|---|
committer | 05356787 <05356787@localhost.localdomain> | 2008-10-30 08:48:41 -0200 |
commit | 437e43308bc69e6d40d8252bd932276e2ba68a8e (patch) | |
tree | f705e05f28f8c0f7b89b4ee822bf7c13bebe0269 | |
parent | f42545bb0b1e7faf33e4bababff28ddd54017181 (diff) |
Allow adding more information per column
-rw-r--r-- | hardinfo2/arch/linux/common/net.h | 10 | ||||
-rw-r--r-- | hardinfo2/benchmark.c | 2 | ||||
-rw-r--r-- | hardinfo2/computer.c | 3 | ||||
-rw-r--r-- | hardinfo2/shell.c | 28 |
4 files changed, 30 insertions, 13 deletions
diff --git a/hardinfo2/arch/linux/common/net.h b/hardinfo2/arch/linux/common/net.h index de978ee1..23cfa9da 100644 --- a/hardinfo2/arch/linux/common/net.h +++ b/hardinfo2/arch/linux/common/net.h @@ -314,7 +314,7 @@ static void scan_net_interfaces_24(void) gint trash; gchar ifacename[16]; gchar *buf = buffer; - gchar *iface_type, *iface_icon, *ip; + gchar *iface_type, *iface_icon; gint i; buf = g_strstrip(buf); @@ -340,13 +340,11 @@ static void scan_net_interfaces_24(void) devid = g_strdup_printf("NET%s", ifacename); - ip = g_strdup_printf(" (%s)", ni.ip); network_interfaces = h_strdup_cprintf - ("$%s$%s=Sent %.2lfMiB, received %.2lfMiB%s\n", - network_interfaces, devid, ifacename, trans_mb, recv_mb, - ni.ip[0] ? ip : ""); - g_free(ip); + ("$%s$%s=%s|Sent %.2lfMiB, received %.2lfMiB|%s\n", + network_interfaces, devid, ifacename, ni.ip[0] ? ni.ip : "", + trans_mb, recv_mb); net_get_iface_type(ifacename, &iface_type, &iface_icon, &ni); diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c index f9d7926b..b1438fce 100644 --- a/hardinfo2/benchmark.c +++ b/hardinfo2/benchmark.c @@ -190,7 +190,7 @@ static gchar *__benchmark_include_results(gdouble result, "ColumnTitle$TextValue=CPU\n" "ShowColumnHeaders=true\n" "[%s]\n" - "<big><b>This Machine</b></big>=%.3f\n" + "<big><b>This Machine</b></big>=%.3f|extra1|extra2\n" "%s", order_type, benchmark, result, results); } diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c index 84e87610..379a091c 100644 --- a/hardinfo2/computer.c +++ b/hardinfo2/computer.c @@ -363,7 +363,8 @@ gchar *callback_network() "ReloadInterval=3000\n" "ViewType=1\n" "ColumnTitle$TextValue=Device\n" - "ColumnTitle$Value=Statistics\n" + "ColumnTitle$Value=IP Address\n" + "ColumnTitle$Extra1=Statistics\n" "ShowColumnHeaders=true\n" "%s", network_interfaces, network_icons); } diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 7487bf13..01b56fa5 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -907,16 +907,28 @@ group_handle_normal(GKeyFile * key_file, ShellModuleEntry * entry, value = entry->fieldfunc(key); } - if ((key && value) && - g_utf8_validate(key, -1, NULL) - && g_utf8_validate(value, -1, NULL)) { + if ((key && value) && g_utf8_validate(key, -1, NULL) && g_utf8_validate(value, -1, NULL)) { if (ngroups == 1) { gtk_tree_store_append(store, &child, NULL); } else { gtk_tree_store_append(store, &child, &parent); } - gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, value, - -1); + + if (strchr(value, '|')) { + gchar **columns = g_strsplit(value, "|", 0); + + gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, columns[0], -1); + if (columns[1]) { + gtk_tree_store_set(store, &child, INFO_TREE_COL_EXTRA1, columns[1], -1); + if (columns[2]) { + gtk_tree_store_set(store, &child, INFO_TREE_COL_EXTRA2, columns[2], -1); + } + } + + g_strfreev(columns); + } else { + gtk_tree_store_set(store, &child, INFO_TREE_COL_VALUE, value, -1); + } strend(key, '#'); @@ -1094,6 +1106,10 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload) } store = GTK_TREE_STORE(shell->info->model); + + g_object_ref(shell->info->model); + gtk_tree_view_set_model(GTK_TREE_VIEW(shell->info->view), NULL); + gtk_tree_store_clear(store); g_key_file_load_from_data(key_file, key_data, strlen(key_data), 0, @@ -1117,6 +1133,8 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload) g_strfreev(keys); } + g_object_unref(shell->info->model); + gtk_tree_view_set_model(GTK_TREE_VIEW(shell->info->view), shell->info->model); gtk_tree_view_expand_all(GTK_TREE_VIEW(shell->info->view)); if (shell->view_type == SHELL_VIEW_PROGRESS) { |