summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--equipment.c14
-rw-r--r--info.c1
-rw-r--r--main.c2
3 files changed, 16 insertions, 1 deletions
diff --git a/equipment.c b/equipment.c
index dfeef9d5f..c709207ee 100644
--- a/equipment.c
+++ b/equipment.c
@@ -571,6 +571,14 @@ static void show_equipment(struct dive *dive, int max,
GtkTreeIter iter;
GtkListStore *model = equipment_list->model;
+ if (! model)
+ return;
+ if (! dive) {
+ gtk_widget_set_sensitive(equipment_list->edit, 0);
+ gtk_widget_set_sensitive(equipment_list->del, 0);
+ gtk_widget_set_sensitive(equipment_list->add, 0);
+ return;
+ }
gtk_list_store_clear(model);
used = max;
do {
@@ -1586,6 +1594,9 @@ GtkWidget *equipment_widget(int w_idx)
edit = gtk_button_new_from_stock(GTK_STOCK_EDIT);
add = gtk_button_new_from_stock(GTK_STOCK_ADD);
del = gtk_button_new_from_stock(GTK_STOCK_DELETE);
+ gtk_widget_set_sensitive(edit, FALSE);
+ gtk_widget_set_sensitive(add, FALSE);
+ gtk_widget_set_sensitive(del, FALSE);
gtk_box_pack_start(GTK_BOX(hbox), edit, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), del, FALSE, FALSE, 0);
@@ -1623,6 +1634,9 @@ GtkWidget *equipment_widget(int w_idx)
edit = gtk_button_new_from_stock(GTK_STOCK_EDIT);
add = gtk_button_new_from_stock(GTK_STOCK_ADD);
del = gtk_button_new_from_stock(GTK_STOCK_DELETE);
+ gtk_widget_set_sensitive(edit, FALSE);
+ gtk_widget_set_sensitive(add, FALSE);
+ gtk_widget_set_sensitive(del, FALSE);
gtk_box_pack_start(GTK_BOX(hbox), edit, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), add, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox), del, FALSE, FALSE, 0);
diff --git a/info.c b/info.c
index 687f83db1..f6905dcd1 100644
--- a/info.c
+++ b/info.c
@@ -143,6 +143,7 @@ void show_dive_info(struct dive *dive)
SET_TEXT_VALUE(suit);
gtk_entry_set_text(rating, star_strings[0]);
gtk_text_buffer_set_text(gtk_text_view_get_buffer(notes), "", -1);
+ show_dive_equipment(NULL, W_IDX_PRIMARY);
return;
}
diff --git a/main.c b/main.c
index 880f5f5cc..20f3fb97e 100644
--- a/main.c
+++ b/main.c
@@ -201,8 +201,8 @@ void update_dive(struct dive *new_dive)
if (old_dive) {
flush_divelist(old_dive);
}
+ show_dive_info(new_dive);
if (new_dive) {
- show_dive_info(new_dive);
show_dive_equipment(new_dive, W_IDX_PRIMARY);
show_dive_stats(new_dive);
}