diff options
Diffstat (limited to 'apps/plugins/text_viewer')
-rw-r--r-- | apps/plugins/text_viewer/text_viewer.c | 13 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_action.c | 4 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_action.h | 5 |
3 files changed, 14 insertions, 8 deletions
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c index 5d06d4b477..eae85213ac 100644 --- a/apps/plugins/text_viewer/text_viewer.c +++ b/apps/plugins/text_viewer/text_viewer.c | |||
@@ -21,12 +21,11 @@ | |||
21 | * | 21 | * |
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | #include "plugin.h" | 23 | #include "plugin.h" |
24 | #include "lib/pluginlib_exit.h" | ||
25 | #include "tv_action.h" | 24 | #include "tv_action.h" |
26 | #include "tv_button.h" | 25 | #include "tv_button.h" |
27 | #include "tv_preferences.h" | 26 | #include "tv_preferences.h" |
28 | 27 | ||
29 | 28 | PLUGIN_HEADER | |
30 | 29 | ||
31 | enum plugin_status plugin_start(const void* file) | 30 | enum plugin_status plugin_start(const void* file) |
32 | { | 31 | { |
@@ -57,7 +56,6 @@ enum plugin_status plugin_start(const void* file) | |||
57 | return PLUGIN_ERROR; | 56 | return PLUGIN_ERROR; |
58 | } | 57 | } |
59 | 58 | ||
60 | atexit(tv_exit); | ||
61 | while (!done) { | 59 | while (!done) { |
62 | #ifdef HAVE_LCD_BITMAP | 60 | #ifdef HAVE_LCD_BITMAP |
63 | if (rb->global_settings->statusbar != STATUSBAR_OFF && preferences->statusbar) | 61 | if (rb->global_settings->statusbar != STATUSBAR_OFF && preferences->statusbar) |
@@ -81,12 +79,12 @@ enum plugin_status plugin_start(const void* file) | |||
81 | 79 | ||
82 | if (res != TV_MENU_RESULT_EXIT_MENU) | 80 | if (res != TV_MENU_RESULT_EXIT_MENU) |
83 | { | 81 | { |
82 | tv_exit(NULL); | ||
83 | done = true; | ||
84 | if (res == TV_MENU_RESULT_ATTACHED_USB) | 84 | if (res == TV_MENU_RESULT_ATTACHED_USB) |
85 | return PLUGIN_USB_CONNECTED; | 85 | return PLUGIN_USB_CONNECTED; |
86 | else if (res == TV_MENU_RESULT_ERROR) | 86 | else if (res == TV_MENU_RESULT_ERROR) |
87 | return PLUGIN_ERROR; | 87 | return PLUGIN_ERROR; |
88 | else | ||
89 | done = true; | ||
90 | } | 88 | } |
91 | } | 89 | } |
92 | break; | 90 | break; |
@@ -197,6 +195,7 @@ enum plugin_status plugin_start(const void* file) | |||
197 | #ifdef TV_QUIT2 | 195 | #ifdef TV_QUIT2 |
198 | case TV_QUIT2: | 196 | case TV_QUIT2: |
199 | #endif | 197 | #endif |
198 | tv_exit(NULL); | ||
200 | done = true; | 199 | done = true; |
201 | break; | 200 | break; |
202 | 201 | ||
@@ -205,7 +204,9 @@ enum plugin_status plugin_start(const void* file) | |||
205 | break; | 204 | break; |
206 | 205 | ||
207 | default: | 206 | default: |
208 | exit_on_usb(button); | 207 | if (rb->default_event_handler_ex(button, tv_exit, NULL) |
208 | == SYS_USB_CONNECTED) | ||
209 | return PLUGIN_USB_CONNECTED; | ||
209 | display_update = false; | 210 | display_update = false; |
210 | break; | 211 | break; |
211 | } | 212 | } |
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c index 1e5473b438..c95ece0649 100644 --- a/apps/plugins/text_viewer/tv_action.c +++ b/apps/plugins/text_viewer/tv_action.c | |||
@@ -47,8 +47,10 @@ static void tv_finalize_action(void) | |||
47 | tv_finalize_window(); | 47 | tv_finalize_window(); |
48 | } | 48 | } |
49 | 49 | ||
50 | void tv_exit(void) | 50 | void tv_exit(void *parameter) |
51 | { | 51 | { |
52 | (void)parameter; | ||
53 | |||
52 | /* save preference and bookmarks */ | 54 | /* save preference and bookmarks */ |
53 | if (!tv_save_settings()) | 55 | if (!tv_save_settings()) |
54 | rb->splash(HZ, "Can't save preferences and bookmarks"); | 56 | rb->splash(HZ, "Can't save preferences and bookmarks"); |
diff --git a/apps/plugins/text_viewer/tv_action.h b/apps/plugins/text_viewer/tv_action.h index 5b3571db30..fba008dbe9 100644 --- a/apps/plugins/text_viewer/tv_action.h +++ b/apps/plugins/text_viewer/tv_action.h | |||
@@ -58,8 +58,11 @@ bool tv_init_action(unsigned char **buf, size_t *bufsize); | |||
58 | 58 | ||
59 | /* | 59 | /* |
60 | * finalize modules | 60 | * finalize modules |
61 | * | ||
62 | * [In] parameter | ||
63 | * this argument does not use | ||
61 | */ | 64 | */ |
62 | void tv_exit(void); | 65 | void tv_exit(void *parameter); |
63 | 66 | ||
64 | /* | 67 | /* |
65 | * load the file | 68 | * load the file |