diff options
Diffstat (limited to 'apps/plugins/lastfm_scrobbler.c')
-rw-r--r-- | apps/plugins/lastfm_scrobbler.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/apps/plugins/lastfm_scrobbler.c b/apps/plugins/lastfm_scrobbler.c index 5565eed4c5..dce6be0d1e 100644 --- a/apps/plugins/lastfm_scrobbler.c +++ b/apps/plugins/lastfm_scrobbler.c | |||
@@ -98,7 +98,7 @@ static struct | |||
98 | bool force_flush; | 98 | bool force_flush; |
99 | } gCache; | 99 | } gCache; |
100 | 100 | ||
101 | static struct | 101 | static struct lastfm_config |
102 | { | 102 | { |
103 | int savepct; | 103 | int savepct; |
104 | int beeplvl; | 104 | int beeplvl; |
@@ -528,7 +528,7 @@ void thread_quit(void) | |||
528 | } | 528 | } |
529 | 529 | ||
530 | /* callback to end the TSR plugin, called before a new one gets loaded */ | 530 | /* callback to end the TSR plugin, called before a new one gets loaded */ |
531 | static bool exit_tsr(bool reenter) | 531 | static int exit_tsr(bool reenter) |
532 | { | 532 | { |
533 | MENUITEM_STRINGLIST(menu, ID2P(LANG_AUDIOSCROBBLER), NULL, ID2P(LANG_SETTINGS), | 533 | MENUITEM_STRINGLIST(menu, ID2P(LANG_AUDIOSCROBBLER), NULL, ID2P(LANG_SETTINGS), |
534 | "Flush Cache", "Exit Plugin", ID2P(LANG_BACK)); | 534 | "Flush Cache", "Exit Plugin", ID2P(LANG_BACK)); |
@@ -556,19 +556,13 @@ static bool exit_tsr(bool reenter) | |||
556 | case 2: /* exit plugin - quit */ | 556 | case 2: /* exit plugin - quit */ |
557 | if(rb->gui_syncyesno_run(&quit_prompt, NULL, NULL) == YESNO_YES) | 557 | if(rb->gui_syncyesno_run(&quit_prompt, NULL, NULL) == YESNO_YES) |
558 | { | 558 | { |
559 | scrobbler_flush_cache(); | ||
559 | thread_quit(); | 560 | thread_quit(); |
560 | if (reenter) | 561 | return (reenter ? PLUGIN_TSR_TERMINATE : PLUGIN_TSR_SUSPEND); |
561 | rb->plugin_tsr(NULL); /* remove TSR cb */ | ||
562 | return !reenter; | ||
563 | } | 562 | } |
564 | 563 | /* Fall Through */ | |
565 | if(!reenter) | ||
566 | return false; | ||
567 | |||
568 | break; | ||
569 | |||
570 | case 3: /* back to menu */ | 564 | case 3: /* back to menu */ |
571 | return false; | 565 | return PLUGIN_TSR_CONTINUE; |
572 | } | 566 | } |
573 | } | 567 | } |
574 | } | 568 | } |
@@ -576,7 +570,17 @@ static bool exit_tsr(bool reenter) | |||
576 | /****************** main ******************/ | 570 | /****************** main ******************/ |
577 | static int plugin_main(const void* parameter) | 571 | static int plugin_main(const void* parameter) |
578 | { | 572 | { |
579 | (void)parameter; | 573 | struct lastfm_config cfg; |
574 | rb->memcpy(&cfg, & gConfig, sizeof(struct lastfm_config)); | ||
575 | |||
576 | /* Resume plugin ? */ | ||
577 | if (parameter == rb->plugin_tsr) | ||
578 | { | ||
579 | |||
580 | gConfig.beeplvl = 0; | ||
581 | gConfig.playback = false; | ||
582 | gConfig.verbose = false; | ||
583 | } | ||
580 | 584 | ||
581 | rb->memset(&gThread, 0, sizeof(gThread)); | 585 | rb->memset(&gThread, 0, sizeof(gThread)); |
582 | if (gConfig.verbose) | 586 | if (gConfig.verbose) |
@@ -586,9 +590,11 @@ static int plugin_main(const void* parameter) | |||
586 | rb->plugin_tsr(exit_tsr); /* stay resident */ | 590 | rb->plugin_tsr(exit_tsr); /* stay resident */ |
587 | 591 | ||
588 | thread_create(); | 592 | thread_create(); |
593 | rb->memcpy(&gConfig, &cfg, sizeof(struct lastfm_config)); | ||
589 | 594 | ||
590 | if (gConfig.playback) | 595 | if (gConfig.playback) |
591 | return PLUGIN_GOTO_WPS; | 596 | return PLUGIN_GOTO_WPS; |
597 | |||
592 | return PLUGIN_OK; | 598 | return PLUGIN_OK; |
593 | } | 599 | } |
594 | 600 | ||