Database: Fix FS#13368 – use separate selected item history
Database and File Browser were sharing each other’s selected item history before. Since the database isn’t browsed recursively, it’s probably unnecessary to include its own history in the tree context and its backups, saving.a little bit of memory. Change-Id: I87c9aed6f7056bc481b8b7299089851ef28f9bc5
This commit is contained in:
parent
59f3f43d10
commit
ca908d6336
3 changed files with 13 additions and 9 deletions
|
@ -122,7 +122,7 @@ static int browser(void* param)
|
||||||
static char last_folder[MAX_PATH] = "/";
|
static char last_folder[MAX_PATH] = "/";
|
||||||
/* and stuff for the database browser */
|
/* and stuff for the database browser */
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
static int last_db_dirlevel = 0, last_db_selection = 0;
|
static int last_db_dirlevel = 0, last_db_selection = 0, last_ft_dirlevel = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch ((intptr_t)param)
|
switch ((intptr_t)param)
|
||||||
|
@ -266,6 +266,7 @@ static int browser(void* param)
|
||||||
if (!tagcache_is_usable())
|
if (!tagcache_is_usable())
|
||||||
return GO_TO_PREVIOUS;
|
return GO_TO_PREVIOUS;
|
||||||
filter = SHOW_ID3DB;
|
filter = SHOW_ID3DB;
|
||||||
|
last_ft_dirlevel = tc->dirlevel;
|
||||||
tc->dirlevel = last_db_dirlevel;
|
tc->dirlevel = last_db_dirlevel;
|
||||||
tc->selected_item = last_db_selection;
|
tc->selected_item = last_db_selection;
|
||||||
push_current_activity(ACTIVITY_DATABASEBROWSER);
|
push_current_activity(ACTIVITY_DATABASEBROWSER);
|
||||||
|
@ -291,6 +292,7 @@ static int browser(void* param)
|
||||||
case GO_TO_DBBROWSER:
|
case GO_TO_DBBROWSER:
|
||||||
last_db_dirlevel = tc->dirlevel;
|
last_db_dirlevel = tc->dirlevel;
|
||||||
last_db_selection = tc->selected_item;
|
last_db_selection = tc->selected_item;
|
||||||
|
tc->dirlevel = last_ft_dirlevel;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,10 @@ static int current_entry_count;
|
||||||
|
|
||||||
static struct tree_context *tc;
|
static struct tree_context *tc;
|
||||||
|
|
||||||
|
static int selected_item_history[MAX_DIR_LEVELS];
|
||||||
|
static int table_history[MAX_DIR_LEVELS];
|
||||||
|
static int extra_history[MAX_DIR_LEVELS];
|
||||||
|
|
||||||
/* a few memory alloc helper */
|
/* a few memory alloc helper */
|
||||||
static int tagtree_handle;
|
static int tagtree_handle;
|
||||||
static size_t tagtree_bufsize, tagtree_buf_used;
|
static size_t tagtree_bufsize, tagtree_buf_used;
|
||||||
|
@ -1840,9 +1844,9 @@ int tagtree_enter(struct tree_context* c)
|
||||||
if (c->dirlevel >= MAX_DIR_LEVELS)
|
if (c->dirlevel >= MAX_DIR_LEVELS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
c->selected_item_history[c->dirlevel]=c->selected_item;
|
selected_item_history[c->dirlevel]=c->selected_item;
|
||||||
c->table_history[c->dirlevel] = c->currtable;
|
table_history[c->dirlevel] = c->currtable;
|
||||||
c->extra_history[c->dirlevel] = c->currextra;
|
extra_history[c->dirlevel] = c->currextra;
|
||||||
c->pos_history[c->dirlevel] = c->firstpos;
|
c->pos_history[c->dirlevel] = c->firstpos;
|
||||||
c->dirlevel++;
|
c->dirlevel++;
|
||||||
|
|
||||||
|
@ -1987,10 +1991,10 @@ void tagtree_exit(struct tree_context* c)
|
||||||
c->dirfull = false;
|
c->dirfull = false;
|
||||||
if (c->dirlevel > 0)
|
if (c->dirlevel > 0)
|
||||||
c->dirlevel--;
|
c->dirlevel--;
|
||||||
c->selected_item=c->selected_item_history[c->dirlevel];
|
c->selected_item=selected_item_history[c->dirlevel];
|
||||||
gui_synclist_select_item(&tree_lists, c->selected_item);
|
gui_synclist_select_item(&tree_lists, c->selected_item);
|
||||||
c->currtable = c->table_history[c->dirlevel];
|
c->currtable = table_history[c->dirlevel];
|
||||||
c->currextra = c->extra_history[c->dirlevel];
|
c->currextra = extra_history[c->dirlevel];
|
||||||
c->firstpos = c->pos_history[c->dirlevel];
|
c->firstpos = c->pos_history[c->dirlevel];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,6 @@ struct tree_context {
|
||||||
int dirsindir; /* file use */
|
int dirsindir; /* file use */
|
||||||
int dirlength; /* total number of entries in dir, incl. those not loaded */
|
int dirlength; /* total number of entries in dir, incl. those not loaded */
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
int table_history[MAX_DIR_LEVELS]; /* db use */
|
|
||||||
int extra_history[MAX_DIR_LEVELS]; /* db use */
|
|
||||||
int currtable; /* db use */
|
int currtable; /* db use */
|
||||||
int currextra; /* db use */
|
int currextra; /* db use */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue