diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-11-30 15:17:54 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-12-17 13:36:38 +0000 |
commit | 6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9 (patch) | |
tree | 9d51172c8860a72e5081dc2706dd30f4dd295427 /apps | |
parent | 701e262d3d622898279167ba909da631ac460bc1 (diff) | |
download | rockbox-6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9.tar.gz rockbox-6c52fa139c5ad8f78ed4fdb306a6074228dbf4c9.zip |
Remove browse_context_init()
Prefer to use designated initializers to avoid having to specify
unneeded parameters. Non-initialized members are zero-initialized
by the compiler.
Change-Id: Ia6a03c45cb3ef0b30f458d7d0ae1604a350c737c
Diffstat (limited to 'apps')
-rw-r--r-- | apps/menus/plugin_menu.c | 9 | ||||
-rw-r--r-- | apps/menus/theme_menu.c | 9 | ||||
-rw-r--r-- | apps/open_plugin.c | 16 | ||||
-rw-r--r-- | apps/playlist_catalog.c | 19 | ||||
-rw-r--r-- | apps/plugin.c | 1 | ||||
-rw-r--r-- | apps/plugin.h | 8 | ||||
-rw-r--r-- | apps/plugins/keyremap.c | 15 | ||||
-rw-r--r-- | apps/plugins/open_plugins.c | 30 | ||||
-rw-r--r-- | apps/plugins/otp.c | 17 | ||||
-rw-r--r-- | apps/plugins/rockpaint.c | 18 | ||||
-rw-r--r-- | apps/plugins/speedread.c | 17 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_menu.c | 17 | ||||
-rw-r--r-- | apps/radio/presets.c | 13 | ||||
-rw-r--r-- | apps/root_menu.c | 8 | ||||
-rw-r--r-- | apps/shortcuts.c | 8 | ||||
-rw-r--r-- | apps/tree.c | 16 | ||||
-rw-r--r-- | apps/tree.h | 4 |
17 files changed, 117 insertions, 108 deletions
diff --git a/apps/menus/plugin_menu.c b/apps/menus/plugin_menu.c index cbc1ce03f2..fa0d721c05 100644 --- a/apps/menus/plugin_menu.c +++ b/apps/menus/plugin_menu.c | |||
@@ -54,11 +54,14 @@ static void pm_handler(unsigned short id, void *data) | |||
54 | static int plugins_menu(void* param) | 54 | static int plugins_menu(void* param) |
55 | { | 55 | { |
56 | intptr_t item = (intptr_t)param; | 56 | intptr_t item = (intptr_t)param; |
57 | struct browse_context browse; | ||
58 | int ret; | 57 | int ret; |
59 | 58 | ||
60 | browse_context_init(&browse, SHOW_PLUGINS, 0, str(items[item].id), | 59 | struct browse_context browse = { |
61 | Icon_Plugin, items[item].path, NULL); | 60 | .dirfilter = SHOW_PLUGINS, |
61 | .title = str(items[item].id), | ||
62 | .icon = Icon_Plugin, | ||
63 | .root = items[item].path, | ||
64 | }; | ||
62 | 65 | ||
63 | ret = rockbox_browse(&browse); | 66 | ret = rockbox_browse(&browse); |
64 | 67 | ||
diff --git a/apps/menus/theme_menu.c b/apps/menus/theme_menu.c index 60a2a27ef4..1b501452d0 100644 --- a/apps/menus/theme_menu.c +++ b/apps/menus/theme_menu.c | |||
@@ -249,9 +249,12 @@ int browse_folder(void *param) | |||
249 | char selected[MAX_FILENAME+10]; | 249 | char selected[MAX_FILENAME+10]; |
250 | const struct browse_folder_info *info = | 250 | const struct browse_folder_info *info = |
251 | (const struct browse_folder_info*)param; | 251 | (const struct browse_folder_info*)param; |
252 | struct browse_context browse; | 252 | |
253 | browse_context_init(&browse, info->show_options, 0, | 253 | struct browse_context browse = { |
254 | NULL, NOICON, info->dir, NULL); | 254 | .dirfilter = info->show_options, |
255 | .icon = Icon_NOICON, | ||
256 | .root = info->dir, | ||
257 | }; | ||
255 | 258 | ||
256 | /* if we are in a special settings folder, center the current setting */ | 259 | /* if we are in a special settings folder, center the current setting */ |
257 | switch(info->show_options) | 260 | switch(info->show_options) |
diff --git a/apps/open_plugin.c b/apps/open_plugin.c index 49d727b4c9..c36a72f30e 100644 --- a/apps/open_plugin.c +++ b/apps/open_plugin.c | |||
@@ -352,7 +352,7 @@ retnhash: | |||
352 | void open_plugin_browse(const char *key) | 352 | void open_plugin_browse(const char *key) |
353 | { | 353 | { |
354 | logf("%s", __func__); | 354 | logf("%s", __func__); |
355 | struct browse_context browse; | 355 | |
356 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; | 356 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; |
357 | open_plugin_load_entry(key); | 357 | open_plugin_load_entry(key); |
358 | struct open_plugin_entry_t *op_entry = open_plugin_get_entry(); | 358 | struct open_plugin_entry_t *op_entry = open_plugin_get_entry(); |
@@ -364,11 +364,15 @@ void open_plugin_browse(const char *key) | |||
364 | if (op_entry->path[0] == '\0') | 364 | if (op_entry->path[0] == '\0') |
365 | strcpy(op_entry->path, PLUGIN_DIR"/"); | 365 | strcpy(op_entry->path, PLUGIN_DIR"/"); |
366 | 366 | ||
367 | browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "", | 367 | struct browse_context browse = { |
368 | Icon_Plugin, op_entry->path, NULL); | 368 | .dirfilter = SHOW_ALL, |
369 | 369 | .flags = BROWSE_SELECTONLY, | |
370 | browse.buf = tmp_buf; | 370 | .title = str(LANG_OPEN_PLUGIN), |
371 | browse.bufsize = OPEN_PLUGIN_BUFSZ; | 371 | .icon = Icon_Plugin, |
372 | .root = op_entry->path, | ||
373 | .buf = tmp_buf, | ||
374 | .bufsize = sizeof(tmp_buf), | ||
375 | }; | ||
372 | 376 | ||
373 | if (rockbox_browse(&browse) == GO_TO_PREVIOUS) | 377 | if (rockbox_browse(&browse) == GO_TO_PREVIOUS) |
374 | open_plugin_add_path(key, tmp_buf, NULL); | 378 | open_plugin_add_path(key, tmp_buf, NULL); |
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 56a90052da..c3cbc93a20 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -150,7 +150,6 @@ static int display_playlists(char* playlist, enum catbrowse_status_flags status) | |||
150 | { | 150 | { |
151 | static bool reopen_last_playlist = false; | 151 | static bool reopen_last_playlist = false; |
152 | static int most_recent_selection = 0; | 152 | static int most_recent_selection = 0; |
153 | struct browse_context browse; | ||
154 | int result = -1; | 153 | int result = -1; |
155 | char selected_playlist[MAX_PATH]; | 154 | char selected_playlist[MAX_PATH]; |
156 | selected_playlist[0] = '\0'; | 155 | selected_playlist[0] = '\0'; |
@@ -158,14 +157,16 @@ static int display_playlists(char* playlist, enum catbrowse_status_flags status) | |||
158 | browser_status |= status; | 157 | browser_status |= status; |
159 | bool view = (status == CATBROWSE_CATVIEW); | 158 | bool view = (status == CATBROWSE_CATVIEW); |
160 | 159 | ||
161 | browse_context_init(&browse, SHOW_M3U, | 160 | struct browse_context browse = { |
162 | BROWSE_SELECTONLY|(view? 0: BROWSE_NO_CONTEXT_MENU), | 161 | .dirfilter = SHOW_M3U, |
163 | str(LANG_CATALOG), NOICON, | 162 | .flags = BROWSE_SELECTONLY | (view ? 0 : BROWSE_NO_CONTEXT_MENU), |
164 | selected_playlist, | 163 | .title = str(LANG_CATALOG), |
165 | playlist_dir_length + 1 + most_recent_playlist); | 164 | .icon = Icon_NOICON, |
166 | 165 | .root = selected_playlist, | |
167 | browse.buf = selected_playlist; | 166 | .selected = &most_recent_playlist[playlist_dir_length + 1], |
168 | browse.bufsize = sizeof(selected_playlist); | 167 | .buf = selected_playlist, |
168 | .bufsize = sizeof(selected_playlist), | ||
169 | }; | ||
169 | 170 | ||
170 | restart: | 171 | restart: |
171 | /* set / restore the root directory for the browser */ | 172 | /* set / restore the root directory for the browser */ |
diff --git a/apps/plugin.c b/apps/plugin.c index feba0f2cfc..1cf4d37b2b 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -429,7 +429,6 @@ static const struct plugin_api rockbox_api = { | |||
429 | dir_get_info, | 429 | dir_get_info, |
430 | 430 | ||
431 | /* browsing */ | 431 | /* browsing */ |
432 | browse_context_init, | ||
433 | rockbox_browse, | 432 | rockbox_browse, |
434 | tree_get_context, | 433 | tree_get_context, |
435 | tree_get_entries, | 434 | tree_get_entries, |
diff --git a/apps/plugin.h b/apps/plugin.h index 62d8371e7d..cbdbdee7cf 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -157,12 +157,12 @@ int plugin_open(const char *plugin, const char *parameter); | |||
157 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 157 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
158 | 158 | ||
159 | /* increase this every time the api struct changes */ | 159 | /* increase this every time the api struct changes */ |
160 | #define PLUGIN_API_VERSION 257 | 160 | #define PLUGIN_API_VERSION 258 |
161 | 161 | ||
162 | /* update this to latest version if a change to the api struct breaks | 162 | /* update this to latest version if a change to the api struct breaks |
163 | backwards compatibility (and please take the opportunity to sort in any | 163 | backwards compatibility (and please take the opportunity to sort in any |
164 | new function which are "waiting" at the end of the function table) */ | 164 | new function which are "waiting" at the end of the function table) */ |
165 | #define PLUGIN_MIN_API_VERSION 257 | 165 | #define PLUGIN_MIN_API_VERSION 258 |
166 | 166 | ||
167 | /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ | 167 | /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ |
168 | 168 | ||
@@ -479,10 +479,6 @@ struct plugin_api { | |||
479 | struct dirinfo (*dir_get_info)(DIR *dirp, struct dirent *entry); | 479 | struct dirinfo (*dir_get_info)(DIR *dirp, struct dirent *entry); |
480 | 480 | ||
481 | /* browsing */ | 481 | /* browsing */ |
482 | void (*browse_context_init)(struct browse_context *browse, | ||
483 | int dirfilter, unsigned flags, | ||
484 | char *title, enum themable_icons icon, | ||
485 | const char *root, const char *selected); | ||
486 | int (*rockbox_browse)(struct browse_context *browse); | 482 | int (*rockbox_browse)(struct browse_context *browse); |
487 | struct tree_context* (*tree_get_context)(void); | 483 | struct tree_context* (*tree_get_context)(void); |
488 | struct entry* (*tree_get_entries)(struct tree_context* t); | 484 | struct entry* (*tree_get_entries)(struct tree_context* t); |
diff --git a/apps/plugins/keyremap.c b/apps/plugins/keyremap.c index 4fd792646e..3923cc40d0 100644 --- a/apps/plugins/keyremap.c +++ b/apps/plugins/keyremap.c | |||
@@ -613,13 +613,14 @@ static void keyremap_export_user_keys(void) | |||
613 | static void keyremap_import_user_keys(void) | 613 | static void keyremap_import_user_keys(void) |
614 | { | 614 | { |
615 | char buf[MAX_PATH]; | 615 | char buf[MAX_PATH]; |
616 | struct browse_context browse; | 616 | struct browse_context browse = { |
617 | 617 | .dirfilter = SHOW_ALL, | |
618 | rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "Select Keymap", | 618 | .flags = BROWSE_SELECTONLY, |
619 | Icon_Plugin, "/", NULL); | 619 | .title = "Select Keymap", |
620 | 620 | .icon = Icon_Plugin, | |
621 | browse.buf = buf; | 621 | .buf = buf, |
622 | browse.bufsize = sizeof(buf); | 622 | .bufsize = sizeof(buf), |
623 | }; | ||
623 | 624 | ||
624 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) | 625 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) |
625 | { | 626 | { |
diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index 6deaf80f7d..9a2fa3593f 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c | |||
@@ -189,17 +189,20 @@ static void op_entry_set_name(void) | |||
189 | static int op_entry_set_path(void) | 189 | static int op_entry_set_path(void) |
190 | { | 190 | { |
191 | int ret = 0; | 191 | int ret = 0; |
192 | struct browse_context browse; | ||
193 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; | 192 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; |
194 | 193 | ||
195 | if (op_entry.path[0] == '\0') | 194 | if (op_entry.path[0] == '\0') |
196 | rb->strcpy(op_entry.path, PLUGIN_DIR"/"); | 195 | rb->strcpy(op_entry.path, PLUGIN_DIR"/"); |
197 | 196 | ||
198 | rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, rb->str(LANG_ADD), | 197 | struct browse_context browse = { |
199 | Icon_Plugin, op_entry.path, NULL); | 198 | .dirfilter = SHOW_ALL, |
200 | 199 | .flags = BROWSE_SELECTONLY, | |
201 | browse.buf = tmp_buf; | 200 | .title = rb->str(LANG_ADD), |
202 | browse.bufsize = OPEN_PLUGIN_BUFSZ; | 201 | .icon = Icon_Plugin, |
202 | .root = op_entry.path, | ||
203 | .buf = tmp_buf, | ||
204 | .bufsize = sizeof(tmp_buf), | ||
205 | }; | ||
203 | 206 | ||
204 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) | 207 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) |
205 | { | 208 | { |
@@ -213,7 +216,6 @@ static int op_entry_set_path(void) | |||
213 | static int op_entry_set_param_path(void) | 216 | static int op_entry_set_param_path(void) |
214 | { | 217 | { |
215 | int ret = 0; | 218 | int ret = 0; |
216 | struct browse_context browse; | ||
217 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; | 219 | char tmp_buf[OPEN_PLUGIN_BUFSZ+1]; |
218 | 220 | ||
219 | if (op_entry.param[0] == '\0') | 221 | if (op_entry.param[0] == '\0') |
@@ -221,11 +223,15 @@ static int op_entry_set_param_path(void) | |||
221 | else | 223 | else |
222 | rb->strcpy(tmp_buf, op_entry.param); | 224 | rb->strcpy(tmp_buf, op_entry.param); |
223 | 225 | ||
224 | rb->browse_context_init(&browse, SHOW_ALL, BROWSE_SELECTONLY, "", | 226 | struct browse_context browse = { |
225 | Icon_Plugin, tmp_buf, NULL); | 227 | .dirfilter = SHOW_ALL, |
226 | 228 | .flags = BROWSE_SELECTONLY, | |
227 | browse.buf = tmp_buf; | 229 | .title = rb->str(LANG_PARAMETER), |
228 | browse.bufsize = OPEN_PLUGIN_BUFSZ; | 230 | .icon = Icon_Plugin, |
231 | .root = tmp_buf, | ||
232 | .buf = tmp_buf, | ||
233 | .bufsize = sizeof(tmp_buf), | ||
234 | }; | ||
229 | 235 | ||
230 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) | 236 | if (rb->rockbox_browse(&browse) == GO_TO_PREVIOUS) |
231 | { | 237 | { |
diff --git a/apps/plugins/otp.c b/apps/plugins/otp.c index 4d302563fb..356e1e5eb6 100644 --- a/apps/plugins/otp.c +++ b/apps/plugins/otp.c | |||
@@ -208,17 +208,16 @@ static int base32_encode(const uint8_t *data, int length, uint8_t *result, | |||
208 | 208 | ||
209 | static bool browse( char *dst, int dst_size, const char *start ) | 209 | static bool browse( char *dst, int dst_size, const char *start ) |
210 | { | 210 | { |
211 | struct browse_context browse; | 211 | struct browse_context browse = { |
212 | 212 | .dirfilter = SHOW_ALL, | |
213 | rb->browse_context_init(&browse, SHOW_ALL, | 213 | .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, |
214 | BROWSE_SELECTONLY|BROWSE_NO_CONTEXT_MENU, | 214 | .icon = Icon_NOICON, |
215 | NULL, NOICON, start, NULL); | 215 | .root = start, |
216 | 216 | .buf = dst, | |
217 | browse.buf = dst; | 217 | .bufsize = dst_size, |
218 | browse.bufsize = dst_size; | 218 | }; |
219 | 219 | ||
220 | rb->rockbox_browse(&browse); | 220 | rb->rockbox_browse(&browse); |
221 | |||
222 | return (browse.flags & BROWSE_SELECTED); | 221 | return (browse.flags & BROWSE_SELECTED); |
223 | } | 222 | } |
224 | 223 | ||
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 09fa2c8c5f..cba1701eb6 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -1084,15 +1084,15 @@ static bool callback_show_item(char *name, int attr, struct tree_context *tc) | |||
1084 | 1084 | ||
1085 | static bool browse( char *dst, int dst_size, const char *start ) | 1085 | static bool browse( char *dst, int dst_size, const char *start ) |
1086 | { | 1086 | { |
1087 | struct browse_context browse; | 1087 | struct browse_context browse = { |
1088 | 1088 | .dirfilter = SHOW_ALL, | |
1089 | rb->browse_context_init(&browse, SHOW_ALL, | 1089 | .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, |
1090 | BROWSE_SELECTONLY|BROWSE_NO_CONTEXT_MENU, | 1090 | .icon = Icon_NOICON, |
1091 | NULL, NOICON, start, NULL); | 1091 | .root = start, |
1092 | 1092 | .buf = dst, | |
1093 | browse.callback_show_item = callback_show_item; | 1093 | .bufsize = dst_size, |
1094 | browse.buf = dst; | 1094 | .callback_show_item = callback_show_item, |
1095 | browse.bufsize = dst_size; | 1095 | }; |
1096 | 1096 | ||
1097 | rb->rockbox_browse(&browse); | 1097 | rb->rockbox_browse(&browse); |
1098 | 1098 | ||
diff --git a/apps/plugins/speedread.c b/apps/plugins/speedread.c index 55d8fd58e5..7a9ab61e7c 100644 --- a/apps/plugins/speedread.c +++ b/apps/plugins/speedread.c | |||
@@ -482,16 +482,19 @@ static void load_font(void) | |||
482 | static void font_menu(void) | 482 | static void font_menu(void) |
483 | { | 483 | { |
484 | /* taken from text_viewer */ | 484 | /* taken from text_viewer */ |
485 | struct browse_context browse; | ||
486 | char font[MAX_PATH], name[MAX_FILENAME+10]; | 485 | char font[MAX_PATH], name[MAX_FILENAME+10]; |
487 | |||
488 | rb->snprintf(name, sizeof(name), "%s.fnt", rb->global_settings->font_file); | 486 | rb->snprintf(name, sizeof(name), "%s.fnt", rb->global_settings->font_file); |
489 | rb->browse_context_init(&browse, SHOW_FONT, | ||
490 | BROWSE_SELECTONLY|BROWSE_NO_CONTEXT_MENU, | ||
491 | "Font", Icon_Menu_setting, FONT_DIR, name); | ||
492 | 487 | ||
493 | browse.buf = font; | 488 | struct browse_context browse = { |
494 | browse.bufsize = sizeof(font); | 489 | .dirfilter = SHOW_FONT, |
490 | .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, | ||
491 | .title = rb->str(LANG_CUSTOM_FONT), | ||
492 | .icon = Icon_Menu_setting, | ||
493 | .root = FONT_DIR, | ||
494 | .selected = name, | ||
495 | .buf = font, | ||
496 | .bufsize = sizeof(font), | ||
497 | }; | ||
495 | 498 | ||
496 | rb->rockbox_browse(&browse); | 499 | rb->rockbox_browse(&browse); |
497 | 500 | ||
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c index 3d22794f62..1cc471e207 100644 --- a/apps/plugins/text_viewer/tv_menu.c +++ b/apps/plugins/text_viewer/tv_menu.c | |||
@@ -200,16 +200,19 @@ static bool tv_statusbar_setting(void) | |||
200 | 200 | ||
201 | static bool tv_font_setting(void) | 201 | static bool tv_font_setting(void) |
202 | { | 202 | { |
203 | struct browse_context browse; | ||
204 | char font[MAX_PATH], name[MAX_FILENAME+10]; | 203 | char font[MAX_PATH], name[MAX_FILENAME+10]; |
205 | |||
206 | rb->snprintf(name, sizeof(name), "%s.fnt", new_prefs.font_name); | 204 | rb->snprintf(name, sizeof(name), "%s.fnt", new_prefs.font_name); |
207 | rb->browse_context_init(&browse, SHOW_FONT, | ||
208 | BROWSE_SELECTONLY|BROWSE_NO_CONTEXT_MENU, | ||
209 | "Font", Icon_Menu_setting, FONT_DIR, name); | ||
210 | 205 | ||
211 | browse.buf = font; | 206 | struct browse_context browse = { |
212 | browse.bufsize = sizeof(font); | 207 | .dirfilter = SHOW_FONT, |
208 | .flags = BROWSE_SELECTONLY | BROWSE_NO_CONTEXT_MENU, | ||
209 | .title = "Font", /* XXX: Translate? */ | ||
210 | .icon = Icon_Menu_setting, | ||
211 | .root = FONT_DIR, | ||
212 | .selected = name, | ||
213 | .buf = font, | ||
214 | .bufsize = sizeof(font), | ||
215 | }; | ||
213 | 216 | ||
214 | rb->rockbox_browse(&browse); | 217 | rb->rockbox_browse(&browse); |
215 | 218 | ||
diff --git a/apps/radio/presets.c b/apps/radio/presets.c index d90f54ed99..046525c3b6 100644 --- a/apps/radio/presets.c +++ b/apps/radio/presets.c | |||
@@ -351,11 +351,16 @@ static int radio_delete_preset(void) | |||
351 | int preset_list_load(void) | 351 | int preset_list_load(void) |
352 | { | 352 | { |
353 | char selected[MAX_PATH]; | 353 | char selected[MAX_PATH]; |
354 | struct browse_context browse; | ||
355 | snprintf(selected, sizeof(selected), "%s.%s", global_settings.fmr_file, "fmr"); | 354 | snprintf(selected, sizeof(selected), "%s.%s", global_settings.fmr_file, "fmr"); |
356 | browse_context_init(&browse, SHOW_FMR, 0, | 355 | |
357 | str(LANG_FM_PRESET_LOAD), NOICON, | 356 | struct browse_context browse = { |
358 | FMPRESET_PATH, selected); | 357 | .dirfilter = SHOW_FMR, |
358 | .title = str(LANG_FM_PRESET_LOAD), | ||
359 | .icon = Icon_NOICON, | ||
360 | .root = FMPRESET_PATH, | ||
361 | .selected = selected, | ||
362 | }; | ||
363 | |||
359 | return !rockbox_browse(&browse); | 364 | return !rockbox_browse(&browse); |
360 | } | 365 | } |
361 | 366 | ||
diff --git a/apps/root_menu.c b/apps/root_menu.c index 49e579903f..71753f27c4 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c | |||
@@ -115,7 +115,6 @@ static int browser(void* param) | |||
115 | #ifdef HAVE_TAGCACHE | 115 | #ifdef HAVE_TAGCACHE |
116 | struct tree_context* tc = tree_get_context(); | 116 | struct tree_context* tc = tree_get_context(); |
117 | #endif | 117 | #endif |
118 | struct browse_context browse; | ||
119 | int filter = SHOW_SUPPORTED; | 118 | int filter = SHOW_SUPPORTED; |
120 | char folder[MAX_PATH] = "/"; | 119 | char folder[MAX_PATH] = "/"; |
121 | /* stuff needed to remember position in file browser */ | 120 | /* stuff needed to remember position in file browser */ |
@@ -274,7 +273,12 @@ static int browser(void* param) | |||
274 | #endif /*HAVE_TAGCACHE*/ | 273 | #endif /*HAVE_TAGCACHE*/ |
275 | } | 274 | } |
276 | 275 | ||
277 | browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL); | 276 | struct browse_context browse = { |
277 | .dirfilter = filter, | ||
278 | .icon = Icon_NOICON, | ||
279 | .root = folder, | ||
280 | }; | ||
281 | |||
278 | ret_val = rockbox_browse(&browse); | 282 | ret_val = rockbox_browse(&browse); |
279 | 283 | ||
280 | if (ret_val == GO_TO_WPS | 284 | if (ret_val == GO_TO_WPS |
diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 82e4a359bf..3f13d0c1b3 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c | |||
@@ -660,9 +660,11 @@ int do_shortcut_menu(void *ignored) | |||
660 | done = GO_TO_PLUGIN; | 660 | done = GO_TO_PLUGIN; |
661 | break; | 661 | break; |
662 | } | 662 | } |
663 | struct browse_context browse; | 663 | struct browse_context browse = { |
664 | browse_context_init(&browse, global_settings.dirfilter, 0, | 664 | .dirfilter = global_settings.dirfilter, |
665 | NULL, NOICON, sc->u.path, NULL); | 665 | .icon = Icon_NOICON, |
666 | .root = sc->u.path, | ||
667 | }; | ||
666 | if (sc->type == SHORTCUT_FILE) | 668 | if (sc->type == SHORTCUT_FILE) |
667 | browse.flags |= BROWSE_RUNFILE; | 669 | browse.flags |= BROWSE_RUNFILE; |
668 | done = rockbox_browse(&browse); | 670 | done = rockbox_browse(&browse); |
diff --git a/apps/tree.c b/apps/tree.c index 4df2c4e327..22199710ae 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -962,22 +962,6 @@ int create_playlist(void) | |||
962 | return (ret) ? 1 : 0; | 962 | return (ret) ? 1 : 0; |
963 | } | 963 | } |
964 | 964 | ||
965 | void browse_context_init(struct browse_context *browse, | ||
966 | int dirfilter, unsigned flags, | ||
967 | char *title, enum themable_icons icon, | ||
968 | const char *root, const char *selected) | ||
969 | { | ||
970 | browse->dirfilter = dirfilter; | ||
971 | browse->flags = flags; | ||
972 | browse->callback_show_item = NULL; | ||
973 | browse->title = title; | ||
974 | browse->icon = icon; | ||
975 | browse->root = root; | ||
976 | browse->selected = selected; | ||
977 | browse->buf = NULL; | ||
978 | browse->bufsize = 0; | ||
979 | } | ||
980 | |||
981 | #define NUM_TC_BACKUP 3 | 965 | #define NUM_TC_BACKUP 3 |
982 | static struct tree_context backups[NUM_TC_BACKUP]; | 966 | static struct tree_context backups[NUM_TC_BACKUP]; |
983 | /* do not make backup if it is not recursive call */ | 967 | /* do not make backup if it is not recursive call */ |
diff --git a/apps/tree.h b/apps/tree.h index bb9ff87163..77da18d666 100644 --- a/apps/tree.h +++ b/apps/tree.h | |||
@@ -106,10 +106,6 @@ void tree_init(void) INIT_ATTR; | |||
106 | char* get_current_file(char* buffer, size_t buffer_len); | 106 | char* get_current_file(char* buffer, size_t buffer_len); |
107 | void set_dirfilter(int l_dirfilter); | 107 | void set_dirfilter(int l_dirfilter); |
108 | void set_current_file(const char *path); | 108 | void set_current_file(const char *path); |
109 | void browse_context_init(struct browse_context *browse, | ||
110 | int dirfilter, unsigned flags, | ||
111 | char *title, enum themable_icons icon, | ||
112 | const char *root, const char *selected); | ||
113 | int rockbox_browse(struct browse_context *browse); | 109 | int rockbox_browse(struct browse_context *browse); |
114 | int create_playlist(void); | 110 | int create_playlist(void); |
115 | void resume_directory(const char *dir); | 111 | void resume_directory(const char *dir); |