diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2009-08-29 15:38:08 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2009-08-29 15:38:08 +0000 |
commit | 2659aa7f924f66d533018dd60bfe33b72bf08e00 (patch) | |
tree | f512ceefaa233d957262f367edcaedc97173b618 /apps/plugins/calendar.c | |
parent | 1dec3e6772877164abbae713ab7fd992e4e37393 (diff) | |
download | rockbox-2659aa7f924f66d533018dd60bfe33b72bf08e00.tar.gz rockbox-2659aa7f924f66d533018dd60bfe33b72bf08e00.zip |
Calendar: change directory to store .memo file from /.rockbox/ to /.rockbox/rocks/apps/ for the consistency with other plugins. move the file manually if you use the calendar plugin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22536 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/calendar.c')
-rw-r--r-- | apps/plugins/calendar.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 20b7fa9226..43a71e908c 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -237,6 +237,9 @@ CONFIG_KEYPAD == SANSA_M200_PAD | |||
237 | #endif | 237 | #endif |
238 | #endif | 238 | #endif |
239 | 239 | ||
240 | #define MEMO_FILE PLUGIN_APPS_DIR "/.memo" | ||
241 | #define TEMP_FILE PLUGIN_APPS_DIR "/~temp" | ||
242 | |||
240 | #define X_OFFSET ((LCD_WIDTH%7)/2) | 243 | #define X_OFFSET ((LCD_WIDTH%7)/2) |
241 | #if LCD_HEIGHT <= 80 | 244 | #if LCD_HEIGHT <= 80 |
242 | #define Y_OFFSET 1 | 245 | #define Y_OFFSET 1 |
@@ -435,7 +438,7 @@ static void load_memo(struct shown *shown) | |||
435 | for (k = 0; k < 7; k++) | 438 | for (k = 0; k < 7; k++) |
436 | wday_has_memo[k] = false; | 439 | wday_has_memo[k] = false; |
437 | memos_in_memory = 0; | 440 | memos_in_memory = 0; |
438 | fp = rb->open(ROCKBOX_DIR "/.memo",O_RDONLY); | 441 | fp = rb->open(MEMO_FILE, O_RDONLY); |
439 | if (fp > -1) | 442 | if (fp > -1) |
440 | { | 443 | { |
441 | rb->lseek(fp, 0, SEEK_SET); | 444 | rb->lseek(fp, 0, SEEK_SET); |
@@ -523,8 +526,8 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) | |||
523 | { | 526 | { |
524 | int fp,fq; | 527 | int fp,fq; |
525 | /* use O_RDWR|O_CREAT so that file is created if it doesn't exist. */ | 528 | /* use O_RDWR|O_CREAT so that file is created if it doesn't exist. */ |
526 | fp = rb->open(ROCKBOX_DIR "/.memo", O_RDWR|O_CREAT); | 529 | fp = rb->open(MEMO_FILE, O_RDWR|O_CREAT); |
527 | fq = rb->creat(ROCKBOX_DIR "/~temp"); | 530 | fq = rb->creat(TEMP_FILE); |
528 | if ( (fq > -1) && (fp > -1) ) | 531 | if ( (fq > -1) && (fp > -1) ) |
529 | { | 532 | { |
530 | int i; | 533 | int i; |
@@ -552,8 +555,8 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) | |||
552 | } | 555 | } |
553 | rb->close(fp); | 556 | rb->close(fp); |
554 | rb->close(fq); | 557 | rb->close(fq); |
555 | rb->remove(ROCKBOX_DIR "/.memo"); | 558 | rb->remove(MEMO_FILE); |
556 | rb->rename(ROCKBOX_DIR "/~temp", ROCKBOX_DIR "/.memo"); | 559 | rb->rename(TEMP_FILE, MEMO_FILE); |
557 | load_memo(shown); | 560 | load_memo(shown); |
558 | return true; | 561 | return true; |
559 | } | 562 | } |
@@ -824,7 +827,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
824 | switch (button) | 827 | switch (button) |
825 | { | 828 | { |
826 | case CALENDAR_QUIT: | 829 | case CALENDAR_QUIT: |
827 | return PLUGIN_OK; | 830 | exit = true; |
831 | break; | ||
828 | 832 | ||
829 | case CALENDAR_NEXT_MONTH: | 833 | case CALENDAR_NEXT_MONTH: |
830 | case CALENDAR_NEXT_MONTH | BUTTON_REPEAT: | 834 | case CALENDAR_NEXT_MONTH | BUTTON_REPEAT: |