Added reload_directory() to plugin api and modified text editor and sudoku plugins to call it when saving a new file. Fixes B#5360.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10053 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hardeep Sidhu 2006-06-04 16:36:49 +00:00
parent ae4560f388
commit ab3e71cad9
4 changed files with 8 additions and 1 deletions

View file

@ -441,6 +441,7 @@ static const struct plugin_api rockbox_api = {
utf8seek, utf8seek,
set_int, set_int,
reload_directory,
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, void* parameter)

View file

@ -104,7 +104,7 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 21 #define PLUGIN_API_VERSION 22
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
@ -520,6 +520,7 @@ struct plugin_api {
bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
int* variable, void (*function)(int), int step, int min, int* variable, void (*function)(int), int step, int min,
int max, void (*formatter)(char*, int, int, const char*) ); int max, void (*formatter)(char*, int, int, const char*) );
void (*reload_directory)(void);
}; };
/* plugin header */ /* plugin header */

View file

@ -689,6 +689,7 @@ bool save_sudoku(struct sudoku_state_t* state)
/* Add a blank line at end */ /* Add a blank line at end */
rb->write(fd,"\r\n",2); rb->write(fd,"\r\n",2);
rb->close(fd); rb->close(fd);
rb->reload_directory();
/* Save a copy of the saved state - so we can reload without /* Save a copy of the saved state - so we can reload without
using the disk */ using the disk */
rb->memcpy(state->savedboard,state->currentboard,81); rb->memcpy(state->savedboard,state->currentboard,81);

View file

@ -223,6 +223,10 @@ void save_changes(int overwrite)
return; return;
} }
if (!overwrite)
/* current directory may have changed */
rb->reload_directory();
rb->lcd_clear_display(); rb->lcd_clear_display();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(1); rb->cpu_boost(1);