Remove .xvpics directories (gimp thumbnails).
[dockapps.git] / wmjmail / src / wmjmail.jet
blob75d6ad6271d5753cb06307502ad6ce2d8aa334ae
1 #include "jDockApp/jDockApp.h"
2 #include "jDockApp/colors.h"
3 #include <getopt.h>
4 #include "jenglish.h"
6 int dontread = 0;
8 void show_help() {
9     printf("-s <sec>:  Seconds between executions of mailchk\n");
10     printf("-r      :  Don't show the read mail stat.\n");
12     exit(0);
15 void setup(int argc, char** argv) {
16     char c;
17     int  i;
18     while( -1 != (c = getopt(argc, argv, "hrs:"))) {
19         switch(c) {
20             case '?': exit(1);
21             case 'h': show_help();
23             case 'r': dontread = 1;   break;
24             case 's': i=atoi(optarg); break;
25         }
26     }
27     set_update_delay((i) ? i : 15); /* seconds */
28     set_loop_delay(1000); /* mu seconds */
31 void do_update() {
32     int i, new, tot, read;
34     FILE *f = popen("mailchk", "r");
35     fscanf(f, "%i - %i - %i", &new, &tot, &read);
36     pclose(f);
38     clear_window();
40     jpprintf(0, 0, YELLOW, "    J-mail");
42     jpprintf(1, 2, BLUE, "New", new);
43     jprintf(GREEN, ":");
44     if(new) {
45         jpprintf(7, 2, RED,  "%i", new);
46     } else {
47         jpprintf(7, 2, CYAN, "%i", new);
48     }
50     if(!dontread) {
51         jpprintf(1, 3, BLUE, "Read", read);
52         jprintf(GREEN, ":");
53         jpprintf(7, 3, CYAN, "%i", read);
54     }
56     jpprintf(1, 4, BLUE, "Total", tot);
57     jprintf(GREEN, ":");
58     jpprintf(7, 4, CYAN, "%i", tot);
61 void do_expose() {
62     do_update();
65 void do_button_release() {
66     do_update();