working
This commit is contained in:
parent
f91f5042cb
commit
75fde75982
3 changed files with 21 additions and 6 deletions
|
|
@ -22,9 +22,12 @@ void init_mail(void){
|
|||
|
||||
void check_mail(void){
|
||||
struct stat s;
|
||||
if(stat(mailpath, &s) == 0){
|
||||
if(s.st_mtime > last){
|
||||
printf("!\n");
|
||||
s.st_mtime = 0;
|
||||
if(stat(mailpath, &s) == 0 || last != 0){
|
||||
if((s.st_mtime == 0 && last != 0) || s.st_mtime > last){
|
||||
MwVaApply(image,
|
||||
MwNpixmap, full,
|
||||
NULL);
|
||||
}
|
||||
|
||||
last = s.st_mtime;
|
||||
|
|
|
|||
16
mbiff/main.c
16
mbiff/main.c
|
|
@ -24,6 +24,7 @@ static void resize(MwWidget handle, void* user, void* client){
|
|||
}
|
||||
|
||||
static void tick(MwWidget handle, void* user, void* client){
|
||||
(void)handle;
|
||||
(void)user;
|
||||
(void)client;
|
||||
|
||||
|
|
@ -35,22 +36,33 @@ static void tick(MwWidget handle, void* user, void* client){
|
|||
}
|
||||
}
|
||||
|
||||
static void mouseUp(MwWidget handle, void* user, void* client){
|
||||
(void)handle;
|
||||
(void)user;
|
||||
(void)client;
|
||||
|
||||
MwVaApply(image,
|
||||
MwNpixmap, empty,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int main() {
|
||||
init_mail();
|
||||
|
||||
MwLibraryInit();
|
||||
|
||||
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 48, 48,
|
||||
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 96, 96,
|
||||
MwNtitle, "mbiff",
|
||||
NULL);
|
||||
|
||||
empty = MwLoadXPM(window, mailempty);
|
||||
full = MwLoadXPM(window, mailfull);
|
||||
|
||||
image = MwVaCreateWidget(MwImageClass, "image", window, 0, 0, 48, 48,
|
||||
image = MwVaCreateWidget(MwImageClass, "image", window, 0, 0, 96, 96,
|
||||
MwNpixmap, empty,
|
||||
NULL);
|
||||
|
||||
MwAddUserHandler(image, MwNmouseUpHandler, mouseUp, NULL);
|
||||
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
|
||||
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef _PATH_MAILDIR
|
||||
#define _PATH_MAILDIR "/var/mail"
|
||||
#define _PATH_MAILDIR "/var/spool/mail"
|
||||
#endif
|
||||
|
||||
/* main.c */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue