diff options
Diffstat (limited to 'apps/plugins/text_viewer/tv_preferences.c')
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/apps/plugins/text_viewer/tv_preferences.c b/apps/plugins/text_viewer/tv_preferences.c index b1045fba7d..ec59dd89a8 100644 --- a/apps/plugins/text_viewer/tv_preferences.c +++ b/apps/plugins/text_viewer/tv_preferences.c | |||
@@ -23,9 +23,10 @@ | |||
23 | #include "plugin.h" | 23 | #include "plugin.h" |
24 | #include "tv_preferences.h" | 24 | #include "tv_preferences.h" |
25 | 25 | ||
26 | /* global preferences */ | 26 | |
27 | static struct tv_preferences prefs; | 27 | static struct tv_preferences prefs; |
28 | struct tv_preferences *preferences = &prefs; | 28 | /* read-only preferences pointer, for access by other files */ |
29 | const struct tv_preferences * const preferences = &prefs; | ||
29 | 30 | ||
30 | static int listner_count = 0; | 31 | static int listner_count = 0; |
31 | 32 | ||
@@ -66,24 +67,6 @@ static void tv_notify_change_preferences(const struct tv_preferences *oldp) | |||
66 | } | 67 | } |
67 | } | 68 | } |
68 | 69 | ||
69 | static void tv_check_header_and_footer(void) | ||
70 | { | ||
71 | if (rb->global_settings->statusbar != STATUSBAR_TOP) | ||
72 | { | ||
73 | if (preferences->header_mode == HD_SBAR) | ||
74 | preferences->header_mode = HD_NONE; | ||
75 | else if (preferences->header_mode == HD_BOTH) | ||
76 | preferences->header_mode = HD_PATH; | ||
77 | } | ||
78 | if (rb->global_settings->statusbar != STATUSBAR_BOTTOM) | ||
79 | { | ||
80 | if (preferences->footer_mode == FT_SBAR) | ||
81 | preferences->footer_mode = FT_NONE; | ||
82 | else if (preferences->footer_mode == FT_BOTH) | ||
83 | preferences->footer_mode = FT_PAGE; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | void tv_set_preferences(const struct tv_preferences *new_prefs) | 70 | void tv_set_preferences(const struct tv_preferences *new_prefs) |
88 | { | 71 | { |
89 | static struct tv_preferences old_prefs; | 72 | static struct tv_preferences old_prefs; |
@@ -94,8 +77,7 @@ void tv_set_preferences(const struct tv_preferences *new_prefs) | |||
94 | tv_copy_preferences((oldp = &old_prefs)); | 77 | tv_copy_preferences((oldp = &old_prefs)); |
95 | is_initialized = true; | 78 | is_initialized = true; |
96 | 79 | ||
97 | rb->memcpy(preferences, new_prefs, sizeof(struct tv_preferences)); | 80 | rb->memcpy(&prefs, new_prefs, sizeof(struct tv_preferences)); |
98 | tv_check_header_and_footer(); | ||
99 | tv_notify_change_preferences(oldp); | 81 | tv_notify_change_preferences(oldp); |
100 | } | 82 | } |
101 | 83 | ||