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