diff options
author | Yoshihisa Uchida <uchida@rockbox.org> | 2010-06-29 11:05:36 +0000 |
---|---|---|
committer | Yoshihisa Uchida <uchida@rockbox.org> | 2010-06-29 11:05:36 +0000 |
commit | 07d03729ff537eca8429cea27c1f2d15f04ec54f (patch) | |
tree | 2f72e7d67f3da45710c2dd302f16654b80aa1016 /apps/plugins/text_viewer/tv_display.c | |
parent | 7195f3a30cc73e1540a590c519c9a2ecec137952 (diff) | |
download | rockbox-07d03729ff537eca8429cea27c1f2d15f04ec54f.tar.gz rockbox-07d03729ff537eca8429cea27c1f2d15f04ec54f.zip |
text_viewer: callback functions are changed to the function that returns int value.
And the text viewer quits when the problem occurs by callback functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27172 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/text_viewer/tv_display.c')
-rw-r--r-- | apps/plugins/text_viewer/tv_display.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c index 59b4bdf437..c59765ebbe 100644 --- a/apps/plugins/text_viewer/tv_display.c +++ b/apps/plugins/text_viewer/tv_display.c | |||
@@ -349,7 +349,7 @@ static bool tv_set_font(const unsigned char *font) | |||
349 | } | 349 | } |
350 | #endif | 350 | #endif |
351 | 351 | ||
352 | static void tv_change_preferences(const struct tv_preferences *oldp) | 352 | static int tv_change_preferences(const struct tv_preferences *oldp) |
353 | { | 353 | { |
354 | #ifdef HAVE_LCD_BITMAP | 354 | #ifdef HAVE_LCD_BITMAP |
355 | static bool font_changing = false; | 355 | static bool font_changing = false; |
@@ -363,10 +363,18 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
363 | { | 363 | { |
364 | if (!tv_set_font(preferences->font_name)) | 364 | if (!tv_set_font(preferences->font_name)) |
365 | { | 365 | { |
366 | /* | ||
367 | * tv_set_font(rb->global_settings->font_file) doesn't fail usually. | ||
368 | * if it fails, a fatal problem occurs in Rockbox. | ||
369 | */ | ||
370 | if (!rb->strcmp(preferences->font_name, rb->global_settings->font_file)) | ||
371 | return TV_CALLBACK_ERROR; | ||
372 | |||
366 | font_changing = true; | 373 | font_changing = true; |
367 | tv_copy_preferences(&new_prefs); | 374 | tv_copy_preferences(&new_prefs); |
368 | rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); | 375 | rb->strlcpy(new_prefs.font_name, font_str, MAX_PATH); |
369 | tv_set_preferences(&new_prefs); | 376 | |
377 | return (tv_set_preferences(&new_prefs))? TV_CALLBACK_STOP : TV_CALLBACK_ERROR; | ||
370 | } | 378 | } |
371 | col_width = 2 * rb->font_get_width(preferences->font, ' '); | 379 | col_width = 2 * rb->font_get_width(preferences->font, ' '); |
372 | font_changing = false; | 380 | font_changing = false; |
@@ -375,6 +383,7 @@ static void tv_change_preferences(const struct tv_preferences *oldp) | |||
375 | (void)oldp; | 383 | (void)oldp; |
376 | #endif | 384 | #endif |
377 | tv_change_viewport(); | 385 | tv_change_viewport(); |
386 | return TV_CALLBACK_OK; | ||
378 | } | 387 | } |
379 | 388 | ||
380 | bool tv_init_display(unsigned char **buf, size_t *size) | 389 | bool tv_init_display(unsigned char **buf, size_t *size) |