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, 7 insertions, 6 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 28PLUGIN_HEADER
30 29
31enum plugin_status plugin_start(const void* file) 30enum 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 }