Store the tag names instead of an opaque number

And as we need the names for that, simplify the way we show the tags in the
Dive Info tab (and mark them for translation while we are at it).

In the process I renamed the constants to DTAG_ from DTYPE_ (and made
their nature as being just bits more obvious).

Also mark the box on the Info tab "Dive Tags", not "Dive Type".

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-04-09 13:06:30 -07:00
parent ed3f67bc33
commit 9e4f9fad19
6 changed files with 100 additions and 68 deletions

View file

@ -716,7 +716,7 @@ static void fill_dive_list(void)
while (--i >= 0) {
struct dive *dive = get_dive(i);
dive_trip_t *trip;
if ((dive->dive_tags & DTYPE_INVALID) && !prefs.display_invalid_dives)
if ((dive->dive_tags & DTAG_INVALID) && !prefs.display_invalid_dives)
continue;
trip = dive->divetrip;
@ -1082,14 +1082,14 @@ static void invalid_dives_cb(GtkWidget *menuitem, GtkTreePath *path)
/* now swap the invalid tag if just 1 dive was selected
* otherwise set all to invalid */
if(amount_selected == 1) {
if (dive->dive_tags & DTYPE_INVALID)
dive->dive_tags &= ~DTYPE_INVALID;
if (dive->dive_tags & DTAG_INVALID)
dive->dive_tags &= ~DTAG_INVALID;
else
dive->dive_tags |= DTYPE_INVALID;
dive->dive_tags |= DTAG_INVALID;
changed = 1;
} else {
if (! dive->dive_tags & DTYPE_INVALID) {
dive->dive_tags |= DTYPE_INVALID;
if (! dive->dive_tags & DTAG_INVALID) {
dive->dive_tags |= DTAG_INVALID;
changed = 1;
}
}
@ -1682,7 +1682,7 @@ static void popup_divelist_menu(GtkTreeView *tree_view, GtkTreeModel *model, int
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
if (amount_selected == 1) {
if (dive->dive_tags & DTYPE_INVALID)
if (dive->dive_tags & DTAG_INVALID)
menuitem = gtk_menu_item_new_with_label(_("Mark valid"));
else
menuitem = gtk_menu_item_new_with_label(_("Mark invalid"));