38 |
char *time_string; |
char *time_string; |
39 |
time_t time_date; |
time_t time_date; |
40 |
double load[3]; |
double load[3]; |
|
|
|
|
getloadavg(load, 3); |
|
|
(void)time(&time_date); |
|
|
time_string=ctime(&time_date); |
|
|
time_string[strlen(time_string)-1]=' '; |
|
|
asprintf(&clockload_label_string, " %s %d%%", time_string, |
|
|
(int)(load[1]*100)); |
|
|
antiright_label_string(iterator->widget, clockload_label_string); |
|
|
free(clockload_label_string); |
|
|
|
|
|
} |
|
|
else if(iterator->widget == arshell.gui.clockload.mailuser) |
|
|
{ |
|
41 |
char *user=getenv("USER"); |
char *user=getenv("USER"); |
42 |
char *maildir="/var/mail"; |
char *maildir="/var/mail"; |
43 |
char *mailfile; |
char *mailfile; |
|
Boolean have_mail; |
|
44 |
struct stat mailfile_stat; |
struct stat mailfile_stat; |
45 |
|
char *mail_string; |
|
asprintf(&mailfile, "%s/%s", maildir, user); |
|
46 |
|
|
47 |
|
asprintf(&mailfile, "%s/%s", maildir, user); |
48 |
stat(mailfile, &mailfile_stat); |
stat(mailfile, &mailfile_stat); |
49 |
free(mailfile); |
free(mailfile); |
|
fflush(stdout); |
|
|
if(mailfile_stat.st_size > 0) |
|
|
have_mail=True; |
|
|
else |
|
|
have_mail=False; |
|
|
|
|
50 |
|
|
51 |
if(have_mail) |
if(mailfile_stat.st_size > 0) |
52 |
{ |
mail_string="Mail"; |
|
char *icon; |
|
|
asprintf(&icon, "%s/havemail.xbm", (char*)ICONDIR); |
|
|
antiright_set_bitmap_from_file(iterator->widget, icon); |
|
|
free(icon); |
|
|
} |
|
53 |
else |
else |
54 |
{ |
mail_string=""; |
55 |
ARCLARG; |
|
56 |
antiright_set(XmNlabelType, XmSTRING); |
getloadavg(load, 3); |
57 |
antiright_set_values(iterator->widget); |
(void)time(&time_date); |
58 |
antiright_label_string(iterator->widget, ""); |
time_string=ctime(&time_date); |
59 |
} |
time_string[strlen(time_string)-1]=' '; |
60 |
|
asprintf(&clockload_label_string, " %s %d%% %s", time_string, |
61 |
|
(int)(load[1]*100), mail_string); |
62 |
|
/* free(time_string); */ |
63 |
|
antiright_label_string(iterator->widget, clockload_label_string); |
64 |
|
free(clockload_label_string); |
65 |
|
|
66 |
} |
} |
67 |
else if(XmIsLabel(iterator->widget)) |
else if(XmIsLabel(iterator->widget)) |