summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_action.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/tv_action.c')
-rw-r--r--apps/plugins/text_viewer/tv_action.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c
index 54cec38f72..3a0d895331 100644
--- a/apps/plugins/text_viewer/tv_action.c
+++ b/apps/plugins/text_viewer/tv_action.c
@@ -28,6 +28,9 @@
28#include "tv_settings.h" 28#include "tv_settings.h"
29#include "tv_window.h" 29#include "tv_window.h"
30 30
31bool bookmarks_changed = false;
32bool scrolled = false;
33
31bool tv_init_action(unsigned char **buf, size_t *size) 34bool tv_init_action(unsigned char **buf, size_t *size)
32{ 35{
33 /* initialize bookmarks and window modules */ 36 /* initialize bookmarks and window modules */
@@ -36,10 +39,6 @@ bool tv_init_action(unsigned char **buf, size_t *size)
36 39
37static void tv_finalize_action(void) 40static void tv_finalize_action(void)
38{ 41{
39 /* save preference and bookmarks */
40 if (!tv_save_settings())
41 rb->splash(HZ, "Can't save preferences and bookmarks");
42
43 /* finalize bookmark modules */ 42 /* finalize bookmark modules */
44 tv_finalize_bookmark(); 43 tv_finalize_bookmark();
45 44
@@ -50,8 +49,19 @@ static void tv_finalize_action(void)
50void tv_exit(void) 49void tv_exit(void)
51{ 50{
52 /* save preference and bookmarks */ 51 /* save preference and bookmarks */
53 if (!tv_save_settings()) 52 DEBUGF("preferences_changed=%d\tbookmarks_changed=%d\tscrolled=%d\n",preferences_changed,bookmarks_changed,scrolled);
54 rb->splash(HZ, "Can't save preferences and bookmarks"); 53 if ( preferences_changed || bookmarks_changed
54#ifndef HAVE_DISK_STORAGE
55 || scrolled
56#endif
57 )
58 {
59 DEBUGF("Saving settings\n");
60 if (!tv_save_settings())
61 rb->splash(HZ, "Can't save preferences and bookmarks");
62 }
63 else
64 DEBUGF("Skip saving settings\n");
55 65
56 /* finalize modules */ 66 /* finalize modules */
57 tv_finalize_action(); 67 tv_finalize_action();
@@ -95,6 +105,7 @@ void tv_scroll_up(unsigned mode)
95#endif 105#endif
96 } 106 }
97 tv_move_screen(offset_page, offset_line, SEEK_CUR); 107 tv_move_screen(offset_page, offset_line, SEEK_CUR);
108 scrolled = true;
98} 109}
99 110
100void tv_scroll_down(unsigned mode) 111void tv_scroll_down(unsigned mode)
@@ -111,6 +122,7 @@ void tv_scroll_down(unsigned mode)
111#endif 122#endif
112 } 123 }
113 tv_move_screen(offset_page, offset_line, SEEK_CUR); 124 tv_move_screen(offset_page, offset_line, SEEK_CUR);
125 scrolled = true;
114} 126}
115 127
116void tv_scroll_left(unsigned mode) 128void tv_scroll_left(unsigned mode)
@@ -130,6 +142,7 @@ void tv_scroll_left(unsigned mode)
130 offset_window--; 142 offset_window--;
131 } 143 }
132 tv_move_window(offset_window, offset_column); 144 tv_move_window(offset_window, offset_column);
145 scrolled = true;
133} 146}
134 147
135void tv_scroll_right(unsigned mode) 148void tv_scroll_right(unsigned mode)
@@ -149,6 +162,7 @@ void tv_scroll_right(unsigned mode)
149 offset_window++; 162 offset_window++;
150 } 163 }
151 tv_move_window(offset_window, offset_column); 164 tv_move_window(offset_window, offset_column);
165 scrolled = true;
152} 166}
153 167
154void tv_top(void) 168void tv_top(void)
@@ -186,4 +200,5 @@ unsigned tv_menu(void)
186void tv_add_or_remove_bookmark(void) 200void tv_add_or_remove_bookmark(void)
187{ 201{
188 tv_toggle_bookmark(); 202 tv_toggle_bookmark();
203 bookmarks_changed = true;
189} 204}