From 720f5023a8f68aaaa54cb6b7bf46efee23b5b4c3 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Mon, 19 Jun 2017 14:38:35 -0500 Subject: Import Upstream version 0.4.1 --- computer.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'computer.c') diff --git a/computer.c b/computer.c index 7ae9ee8d..e2ee3ee6 100644 --- a/computer.c +++ b/computer.c @@ -41,6 +41,7 @@ enum { COMPUTER_SHARES, COMPUTER_DISPLAY, COMPUTER_NETWORK, + COMPUTER_USERS, } Entries; static ModuleEntry hi_entries[] = { @@ -53,6 +54,7 @@ static ModuleEntry hi_entries[] = { {"Shared Directories", "shares.png"}, {"Display", "monitor.png"}, {"Network Interfaces", "network.png"}, + {"Users", "users.png"}, }; #include "computer.h" @@ -69,8 +71,10 @@ static GHashTable *moreinfo = NULL; #include #include #include +#include #include #include +#include static Computer * computer_get_info(void) @@ -108,7 +112,8 @@ computer_get_info(void) scan_filesystems(); shell_status_update("Getting shared directories..."); - scan_shared_directories(); + scan_samba_shared_directories(); + scan_nfs_shared_directories(); shell_status_update("Reading sensors..."); read_sensors(); @@ -116,6 +121,9 @@ computer_get_info(void) shell_status_update("Obtaining network information..."); scan_net_interfaces(); + shell_status_update("Obtaining users information..."); + scan_users(); + computer->date_time = "..."; return computer; } @@ -133,6 +141,9 @@ hi_reload(gint entry) case COMPUTER_SENSORS: read_sensors(); break; + case COMPUTER_USERS: + scan_users(); + break; } } @@ -159,8 +170,6 @@ hi_get_field(gchar * field) tmp = g_strdup_printf("%dMB (%dMB used)", mi->total, mi->used); g_free(mi); - } else if (!strcmp(field, "Random")) { - return g_strdup_printf("%d", rand() % 200); } else if (!strcmp(field, "Uptime")) { tmp = computer_get_formatted_uptime(); } else if (!strcmp(field, "Date/Time")) { @@ -198,13 +207,23 @@ hi_info(gint entry) "ReloadInterval=3000\n" "ViewType=1\n" "%s", network_interfaces); + case COMPUTER_USERS: + return g_strdup_printf("[$ShellParam$]\n" + "ReloadInterval=10000\n" + "ViewType=1\n" + "[Human Users]\n" + "%s\n" + "[System Users]\n" + "%s\n", human_users, sys_users); case COMPUTER_SENSORS: return g_strdup_printf("[$ShellParam$]\n" "ReloadInterval=3000\n" "%s", sensors); case COMPUTER_SHARES: return g_strdup_printf("[SAMBA]\n" - "%s", shares_list); + "%s\n" + "[NFS]\n" + "%s", smb_shares_list, nfs_shares_list); case COMPUTER_FILESYSTEMS: return g_strdup_printf("[$ShellParam$]\n" "ViewType=1\n" -- cgit v1.2.3