mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Clear statistics and equipment when no dive is selected
This all seems very strange forward. The reason for the check whether the stats_w widget has been populated is that at the very beginning, when the UI is still being assembled, a first call to switch_page() happens as the notebook pages are assembled. At that point the stats_w widget is still empty which tells us that we aren't ready to display anything. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ef55ddccb5
commit
6ce4d29f49
3 changed files with 8 additions and 7 deletions
|
@ -573,6 +573,7 @@ static void show_equipment(struct dive *dive, int max,
|
|||
gtk_widget_set_sensitive(equipment_list->edit, 0);
|
||||
gtk_widget_set_sensitive(equipment_list->del, 0);
|
||||
gtk_widget_set_sensitive(equipment_list->add, 0);
|
||||
clear_equipment_widgets();
|
||||
return;
|
||||
}
|
||||
gtk_list_store_clear(model);
|
||||
|
|
6
main.c
6
main.c
|
@ -247,10 +247,8 @@ void update_dive(struct dive *new_dive)
|
|||
flush_divelist(old_dive);
|
||||
}
|
||||
show_dive_info(new_dive);
|
||||
if (new_dive) {
|
||||
show_dive_equipment(new_dive, W_IDX_PRIMARY);
|
||||
show_dive_stats(new_dive);
|
||||
}
|
||||
show_dive_equipment(new_dive, W_IDX_PRIMARY);
|
||||
show_dive_stats(new_dive);
|
||||
buffered_dive = new_dive;
|
||||
}
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive)
|
|||
* are in chronological order */
|
||||
for (idx = 0; idx < dive_table.nr; idx++) {
|
||||
dp = dive_table.dives[idx];
|
||||
if (dp->when == dive->when) {
|
||||
if (dive && dp->when == dive->when) {
|
||||
/* that's the one we are showing */
|
||||
if (idx > 0)
|
||||
*prev_dive = dive_table.dives[idx-1];
|
||||
|
@ -699,7 +699,7 @@ static void get_selected_dives_text(char *buffer, int size)
|
|||
}
|
||||
}
|
||||
|
||||
static void show_total_dive_stats(struct dive *dive)
|
||||
static void show_total_dive_stats(void)
|
||||
{
|
||||
double value;
|
||||
int decimals, seconds;
|
||||
|
@ -707,6 +707,8 @@ static void show_total_dive_stats(struct dive *dive)
|
|||
char buffer[60];
|
||||
stats_t *stats_ptr;
|
||||
|
||||
if (!stats_w.framelabel)
|
||||
return;
|
||||
stats_ptr = &stats_selection;
|
||||
|
||||
get_selected_dives_text(buffer, sizeof(buffer));
|
||||
|
@ -752,7 +754,7 @@ void show_dive_stats(struct dive *dive)
|
|||
/* they have to be called in this order, as 'total' depends on
|
||||
* calculations done in 'single' */
|
||||
show_single_dive_stats(dive);
|
||||
show_total_dive_stats(dive);
|
||||
show_total_dive_stats();
|
||||
}
|
||||
|
||||
static GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label)
|
||||
|
|
Loading…
Add table
Reference in a new issue