diff --git a/mbiff/mail.c b/mbiff/mail.c index aeb66b4..7479bd5 100644 --- a/mbiff/mail.c +++ b/mbiff/mail.c @@ -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; diff --git a/mbiff/main.c b/mbiff/main.c index 466ec44..4185ac7 100644 --- a/mbiff/main.c +++ b/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); diff --git a/mbiff/mbiff.h b/mbiff/mbiff.h index 717f428..da3393a 100644 --- a/mbiff/mbiff.h +++ b/mbiff/mbiff.h @@ -21,7 +21,7 @@ #endif #ifndef _PATH_MAILDIR -#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAILDIR "/var/spool/mail" #endif /* main.c */