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){
|
void check_mail(void){
|
||||||
struct stat s;
|
struct stat s;
|
||||||
if(stat(mailpath, &s) == 0){
|
s.st_mtime = 0;
|
||||||
if(s.st_mtime > last){
|
if(stat(mailpath, &s) == 0 || last != 0){
|
||||||
printf("!\n");
|
if((s.st_mtime == 0 && last != 0) || s.st_mtime > last){
|
||||||
|
MwVaApply(image,
|
||||||
|
MwNpixmap, full,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
last = s.st_mtime;
|
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){
|
static void tick(MwWidget handle, void* user, void* client){
|
||||||
|
(void)handle;
|
||||||
(void)user;
|
(void)user;
|
||||||
(void)client;
|
(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() {
|
int main() {
|
||||||
init_mail();
|
init_mail();
|
||||||
|
|
||||||
MwLibraryInit();
|
MwLibraryInit();
|
||||||
|
|
||||||
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 48, 48,
|
window = MwVaCreateWidget(MwWindowClass, "main", NULL, MwDEFAULT, MwDEFAULT, 96, 96,
|
||||||
MwNtitle, "mbiff",
|
MwNtitle, "mbiff",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
empty = MwLoadXPM(window, mailempty);
|
empty = MwLoadXPM(window, mailempty);
|
||||||
full = MwLoadXPM(window, mailfull);
|
full = MwLoadXPM(window, mailfull);
|
||||||
|
|
||||||
image = MwVaCreateWidget(MwImageClass, "image", window, 0, 0, 48, 48,
|
image = MwVaCreateWidget(MwImageClass, "image", window, 0, 0, 96, 96,
|
||||||
MwNpixmap, empty,
|
MwNpixmap, empty,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
MwAddUserHandler(image, MwNmouseUpHandler, mouseUp, NULL);
|
||||||
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
|
MwAddUserHandler(window, MwNtickHandler, tick, NULL);
|
||||||
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
MwAddUserHandler(window, MwNresizeHandler, resize, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _PATH_MAILDIR
|
#ifndef _PATH_MAILDIR
|
||||||
#define _PATH_MAILDIR "/var/mail"
|
#define _PATH_MAILDIR "/var/spool/mail"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* main.c */
|
/* main.c */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue