summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/text_viewer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/text_viewer.c')
-rw-r--r--apps/plugins/text_viewer/text_viewer.c13
1 files changed, 6 insertions, 7 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 }