summaryrefslogtreecommitdiff
path: root/apps/gui/option_select.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/option_select.c')
-rw-r--r--apps/gui/option_select.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index 01259c4136..d806a0aa08 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -69,10 +69,11 @@ static const char *unit_strings[] =
69/* these two vars are needed so arbitrary values can be added to the 69/* these two vars are needed so arbitrary values can be added to the
70 TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ 70 TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */
71static int table_setting_oldval = 0, table_setting_array_position = 0; 71static int table_setting_oldval = 0, table_setting_array_position = 0;
72char *option_get_valuestring(const struct settings_list *setting, 72const char *option_get_valuestring(const struct settings_list *setting,
73 char *buffer, int buf_len, 73 char *buffer, int buf_len,
74 intptr_t temp_var) 74 intptr_t temp_var)
75{ 75{
76 const char* str = buffer;
76 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) 77 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
77 { 78 {
78 bool val = (bool)temp_var; 79 bool val = (bool)temp_var;
@@ -93,7 +94,7 @@ char *option_get_valuestring(const struct settings_list *setting,
93 const struct int_setting *int_info = setting->int_setting; 94 const struct int_setting *int_info = setting->int_setting;
94 const struct table_setting *tbl_info = setting->table_setting; 95 const struct table_setting *tbl_info = setting->table_setting;
95 const char *unit; 96 const char *unit;
96 void (*formatter)(char*, size_t, int, const char*); 97 const char* (*formatter)(char*, size_t, int, const char*);
97 if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) 98 if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
98 { 99 {
99 formatter = int_info->formatter; 100 formatter = int_info->formatter;
@@ -105,7 +106,7 @@ char *option_get_valuestring(const struct settings_list *setting,
105 unit = unit_strings[tbl_info->unit]; 106 unit = unit_strings[tbl_info->unit];
106 } 107 }
107 if (formatter) 108 if (formatter)
108 formatter(buffer, buf_len, (int)temp_var, unit); 109 str = formatter(buffer, buf_len, (int)temp_var, unit);
109 else 110 else
110 snprintf(buffer, buf_len, "%d %s", (int)temp_var, unit?unit:""); 111 snprintf(buffer, buf_len, "%d %s", (int)temp_var, unit?unit:"");
111 } 112 }
@@ -152,7 +153,7 @@ char *option_get_valuestring(const struct settings_list *setting,
152 strlcpy(buffer, val, buf_len); 153 strlcpy(buffer, val, buf_len);
153 } 154 }
154 } 155 }
155 return buffer; 156 return str;
156} 157}
157void option_talk_value(const struct settings_list *setting, int value, bool enqueue) 158void option_talk_value(const struct settings_list *setting, int value, bool enqueue)
158{ 159{
@@ -363,10 +364,11 @@ static int selection_to_val(const struct settings_list *setting, int selection)
363 } 364 }
364 return max- (selection * step); 365 return max- (selection * step);
365} 366}
366static char * value_setting_get_name_cb(int selected_item, 367
367 void * data, 368static const char * value_setting_get_name_cb(int selected_item,
368 char *buffer, 369 void * data,
369 size_t buffer_len) 370 char *buffer,
371 size_t buffer_len)
370{ 372{
371 selected_item = selection_to_val(data, selected_item); 373 selected_item = selection_to_val(data, selected_item);
372 return option_get_valuestring(data, buffer, buffer_len, selected_item); 374 return option_get_valuestring(data, buffer, buffer_len, selected_item);