summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_preferences.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/tv_preferences.c')
-rw-r--r--apps/plugins/text_viewer/tv_preferences.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/plugins/text_viewer/tv_preferences.c b/apps/plugins/text_viewer/tv_preferences.c
index 924cedb0d0..7d4fd3c2e3 100644
--- a/apps/plugins/text_viewer/tv_preferences.c
+++ b/apps/plugins/text_viewer/tv_preferences.c
@@ -31,11 +31,12 @@ const struct tv_preferences * const preferences = &prefs;
31static int listner_count = 0; 31static int listner_count = 0;
32 32
33#define TV_MAX_LISTNERS 5 33#define TV_MAX_LISTNERS 5
34static void (*listners[TV_MAX_LISTNERS])(const struct tv_preferences *oldp); 34static int (*listners[TV_MAX_LISTNERS])(const struct tv_preferences *oldp);
35 35
36static void tv_notify_change_preferences(const struct tv_preferences *oldp) 36static bool tv_notify_change_preferences(const struct tv_preferences *oldp)
37{ 37{
38 int i; 38 int i;
39 int res = TV_CALLBACK_OK;
39 40
40 /* 41 /*
41 * the following items do not check. 42 * the following items do not check.
@@ -65,11 +66,13 @@ static void tv_notify_change_preferences(const struct tv_preferences *oldp)
65 { 66 {
66 /* callback functions are called as FILO */ 67 /* callback functions are called as FILO */
67 for (i = listner_count - 1; i >= 0; i--) 68 for (i = listner_count - 1; i >= 0; i--)
68 listners[i](oldp); 69 if ((res = listners[i](oldp)) != TV_CALLBACK_OK)
70 break;
69 } 71 }
72 return (res != TV_CALLBACK_ERROR);
70} 73}
71 74
72void tv_set_preferences(const struct tv_preferences *new_prefs) 75bool tv_set_preferences(const struct tv_preferences *new_prefs)
73{ 76{
74 static struct tv_preferences old_prefs; 77 static struct tv_preferences old_prefs;
75 struct tv_preferences *oldp = NULL; 78 struct tv_preferences *oldp = NULL;
@@ -80,7 +83,7 @@ void tv_set_preferences(const struct tv_preferences *new_prefs)
80 is_initialized = true; 83 is_initialized = true;
81 84
82 rb->memcpy(&prefs, new_prefs, sizeof(struct tv_preferences)); 85 rb->memcpy(&prefs, new_prefs, sizeof(struct tv_preferences));
83 tv_notify_change_preferences(oldp); 86 return tv_notify_change_preferences(oldp);
84} 87}
85 88
86void tv_copy_preferences(struct tv_preferences *copy_prefs) 89void tv_copy_preferences(struct tv_preferences *copy_prefs)
@@ -118,7 +121,7 @@ void tv_set_default_preferences(struct tv_preferences *p)
118 p->file_name[0] = '\0'; 121 p->file_name[0] = '\0';
119} 122}
120 123
121void tv_add_preferences_change_listner(void (*listner)(const struct tv_preferences *oldp)) 124void tv_add_preferences_change_listner(int (*listner)(const struct tv_preferences *oldp))
122{ 125{
123 if (listner_count < TV_MAX_LISTNERS) 126 if (listner_count < TV_MAX_LISTNERS)
124 listners[listner_count++] = listner; 127 listners[listner_count++] = listner;