aboutsummaryrefslogtreecommitdiffstats
path: root/equipment.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-18 20:45:26 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-10-18 20:45:26 -0700
commit0fc3a446e9a84b8839ef6f1a4c9a0a8446d3b00a (patch)
tree952a14d9e6812a481d8ee4be3eb4341caacb51cc /equipment.c
parentf4b6e53c4ed04bb56acaed7c06e7a15d92ae8bb1 (diff)
downloadsubsurface-0fc3a446e9a84b8839ef6f1a4c9a0a8446d3b00a.tar.gz
Don't enable equipment notebook buttons if there is no dive
The buttons didn't actually do anything when clicked, but this still was inconsistent behavior. Reported-by: Pierre-Yves Chibon <pingou@pingoured.fr> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'equipment.c')
-rw-r--r--equipment.c14
1 files changed, 14 insertions, 0 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);