mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-19 10:02:45 -05:00
FS#11399 by me: fix r26998 for text_viewer
Restore the old behaviour: - preferences must be read-write for tv_preferences.c , read-only for all other modules -> use pointer to const struct - init functions must get the plugin buffer + its size as arguments for easily adding new functions -> use pointer to buffer pointer and size to make allocation easier - preferences meaning is private to each file and must not be known by tv_preferences.c -> move tv_check_header_and_footer() back in tv_window.c; also avoid chaining 3 times the callbacks by calling tv_set_preferences() only once if more than one preference needs changing git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27089 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cf9bba7102
commit
59fd2b24bd
13 changed files with 115 additions and 52 deletions
|
|
@ -23,9 +23,10 @@
|
|||
#include "plugin.h"
|
||||
#include "tv_preferences.h"
|
||||
|
||||
/* global preferences */
|
||||
|
||||
static struct tv_preferences prefs;
|
||||
struct tv_preferences *preferences = &prefs;
|
||||
/* read-only preferences pointer, for access by other files */
|
||||
const struct tv_preferences * const preferences = &prefs;
|
||||
|
||||
static int listner_count = 0;
|
||||
|
||||
|
|
@ -66,24 +67,6 @@ static void tv_notify_change_preferences(const struct tv_preferences *oldp)
|
|||
}
|
||||
}
|
||||
|
||||
static void tv_check_header_and_footer(void)
|
||||
{
|
||||
if (rb->global_settings->statusbar != STATUSBAR_TOP)
|
||||
{
|
||||
if (preferences->header_mode == HD_SBAR)
|
||||
preferences->header_mode = HD_NONE;
|
||||
else if (preferences->header_mode == HD_BOTH)
|
||||
preferences->header_mode = HD_PATH;
|
||||
}
|
||||
if (rb->global_settings->statusbar != STATUSBAR_BOTTOM)
|
||||
{
|
||||
if (preferences->footer_mode == FT_SBAR)
|
||||
preferences->footer_mode = FT_NONE;
|
||||
else if (preferences->footer_mode == FT_BOTH)
|
||||
preferences->footer_mode = FT_PAGE;
|
||||
}
|
||||
}
|
||||
|
||||
void tv_set_preferences(const struct tv_preferences *new_prefs)
|
||||
{
|
||||
static struct tv_preferences old_prefs;
|
||||
|
|
@ -94,8 +77,7 @@ void tv_set_preferences(const struct tv_preferences *new_prefs)
|
|||
tv_copy_preferences((oldp = &old_prefs));
|
||||
is_initialized = true;
|
||||
|
||||
rb->memcpy(preferences, new_prefs, sizeof(struct tv_preferences));
|
||||
tv_check_header_and_footer();
|
||||
rb->memcpy(&prefs, new_prefs, sizeof(struct tv_preferences));
|
||||
tv_notify_change_preferences(oldp);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue