X-Git-Url: http://git.tdb.fi/?p=ext%2Fsubsurface.git;a=blobdiff_plain;f=info.c;h=d9379ac68b200976f08c9afada59bd87f88bb736;hp=66e4f0adce92047a4de98bf2091604ce18d236d5;hb=e4955f9be116cd413e8ee3986d737e9e1b95e348;hpb=df1f506b4e874a9c5afad8d31989a2389bbcdf2d diff --git a/info.c b/info.c index 66e4f0a..d9379ac 100644 --- a/info.c +++ b/info.c @@ -1,7 +1,7 @@ /* info.c */ -/* creates the UI for the info frame - +/* creates the UI for the info frame - * controlled through the following interfaces: - * + * * void show_dive_info(struct dive *dive) * * called from gtk-ui: @@ -166,7 +166,7 @@ static int delete_dive_info(struct dive *dive) static void info_menu_edit_cb(GtkMenuItem *menuitem, gpointer user_data) { - edit_multi_dive_info(-1); + edit_multi_dive_info(NULL); } static void info_menu_delete_cb(GtkMenuItem *menuitem, gpointer user_data) @@ -482,7 +482,7 @@ void update_equipment_data(struct dive *dive, struct dive *master) if ( ! cylinders_equal(remember_cyl, master->cylinder) && (no_cylinders(dive->cylinder) || cylinders_equal(dive->cylinder, remember_cyl))) - memcpy(dive->cylinder, master->cylinder, CYL_BYTES); + copy_cylinders(master->cylinder, dive->cylinder); if (! weightsystems_equal(remember_ws, master->weightsystem) && (no_weightsystems(dive->weightsystem) || weightsystems_equal(dive->weightsystem, remember_ws))) @@ -490,7 +490,7 @@ void update_equipment_data(struct dive *dive, struct dive *master) } /* A negative index means "all selected" */ -int edit_multi_dive_info(int index) +int edit_multi_dive_info(struct dive *single_dive) { int success; GtkWidget *dialog, *vbox; @@ -506,18 +506,17 @@ int edit_multi_dive_info(int index) NULL); vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - master = get_dive(index); + master = single_dive; if (!master) master = current_dive; /* See if we should use multi dive mode */ multi = FALSE; - if (index < 0) - { + if (!single_dive) { int i; struct dive *dive; - for (i = 0; (dive = get_dive(i)) != NULL; i++) { + for_each_dive(i, dive) { if (dive != master && dive->selected) { multi = TRUE; break; @@ -532,11 +531,11 @@ int edit_multi_dive_info(int index) success = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT; if (success) { /* Update the non-current selected dives first */ - if (index < 0) { + if (!single_dive) { int i; struct dive *dive; - for (i = 0; (dive = get_dive(i)) != NULL; i++) { + for_each_dive(i, dive) { if (dive == master || !dive->selected) continue; /* copy all "info" fields */ @@ -561,12 +560,9 @@ int edit_multi_dive_info(int index) int edit_dive_info(struct dive *dive) { - int idx; - if (!dive) return 0; - idx = dive->number; - return edit_multi_dive_info(idx); + return edit_multi_dive_info(dive); } static GtkWidget *frame_box(GtkWidget *vbox, const char *fmt, ...)