mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: inform model of dive site addition / deletion
Introduce two DiveListNotifier signals which are sent by the undo commands if dives are added to / removed from the core. The signal has the dive site and the index in the global dive site table as payload. Thus, the model has only to remove the appropriate rows. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
84f7179367
commit
59e602447b
9 changed files with 43 additions and 16 deletions
|
|
@ -104,9 +104,9 @@ struct dive_site *get_dive_site_by_gps_proximity(const location_t *loc, int dist
|
|||
return res;
|
||||
}
|
||||
|
||||
void register_dive_site(struct dive_site *ds)
|
||||
int register_dive_site(struct dive_site *ds)
|
||||
{
|
||||
add_dive_site_to_table(ds, &dive_site_table);
|
||||
return add_dive_site_to_table(ds, &dive_site_table);
|
||||
}
|
||||
|
||||
static int compare_sites(const struct dive_site *a, const struct dive_site *b)
|
||||
|
|
@ -127,7 +127,7 @@ static MAKE_GET_IDX(dive_site_table, struct dive_site *, dive_sites)
|
|||
MAKE_SORT(dive_site_table, struct dive_site *, dive_sites, compare_sites)
|
||||
static MAKE_REMOVE(dive_site_table, struct dive_site *, dive_site)
|
||||
|
||||
void add_dive_site_to_table(struct dive_site *ds, struct dive_site_table *ds_table)
|
||||
int add_dive_site_to_table(struct dive_site *ds, struct dive_site_table *ds_table)
|
||||
{
|
||||
/* Take care to never have the same uuid twice. This could happen on
|
||||
* reimport of a log where the dive sites have diverged */
|
||||
|
|
@ -140,6 +140,7 @@ void add_dive_site_to_table(struct dive_site *ds, struct dive_site_table *ds_tab
|
|||
|
||||
int idx = dive_site_table_get_insertion_index(ds_table, ds);
|
||||
add_to_dive_site_table(ds_table, idx, ds);
|
||||
return idx;
|
||||
}
|
||||
|
||||
struct dive_site *alloc_dive_site()
|
||||
|
|
@ -197,9 +198,9 @@ void free_dive_site(struct dive_site *ds)
|
|||
}
|
||||
}
|
||||
|
||||
void unregister_dive_site(struct dive_site *ds)
|
||||
int unregister_dive_site(struct dive_site *ds)
|
||||
{
|
||||
remove_dive_site(ds, &dive_site_table);
|
||||
return remove_dive_site(ds, &dive_site_table);
|
||||
}
|
||||
|
||||
void delete_dive_site(struct dive_site *ds, struct dive_site_table *ds_table)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue