From 52748412fff0974fbc76b3f0a72cd0ba58b37771 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 7 Dec 2011 20:49:22 -0800 Subject: [PATCH] Fix some issues with star rating code To waste less space in the tree view heading we simply put a star in the heading instead of "Rating". We now treat "zero stars" to mean "not rated" and don't store that value in the XML file. Rating is no longer a top level tag in the dive entry but instead a property of the dive tag. Signed-off-by: Dirk Hohndel --- divelist.c | 2 +- save-xml.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/divelist.c b/divelist.c index 3976382..de2d35d 100644 --- a/divelist.c +++ b/divelist.c @@ -593,7 +593,7 @@ GtkWidget *dive_list_create(void) dive_list.nr = divelist_column(&dive_list, DIVE_NR, "#", NULL, PANGO_ALIGN_RIGHT, TRUE); gtk_tree_view_column_set_sort_column_id(dive_list.nr, -1); dive_list.date = divelist_column(&dive_list, DIVE_DATE, "Date", date_data_func, PANGO_ALIGN_LEFT, TRUE); - dive_list.stars = divelist_column(&dive_list, DIVE_RATING, "Rating", star_data_func, PANGO_ALIGN_LEFT, TRUE); + dive_list.stars = divelist_column(&dive_list, DIVE_RATING, UTF8_BLACKSTAR, star_data_func, PANGO_ALIGN_LEFT, TRUE); dive_list.depth = divelist_column(&dive_list, DIVE_DEPTH, "ft", depth_data_func, PANGO_ALIGN_RIGHT, TRUE); dive_list.duration = divelist_column(&dive_list, DIVE_DURATION, "min", duration_data_func, PANGO_ALIGN_RIGHT, TRUE); dive_list.temperature = divelist_column(&dive_list, DIVE_TEMPERATURE, UTF8_DEGREE "F", temperature_data_func, PANGO_ALIGN_RIGHT, visible_cols.temperature); diff --git a/save-xml.c b/save-xml.c index 80c26b8..c9085db 100644 --- a/save-xml.c +++ b/save-xml.c @@ -182,7 +182,6 @@ static void save_overview(FILE *f, struct dive *dive) show_location(f, dive); show_utf8(f, dive->divemaster, " ","\n"); show_utf8(f, dive->buddy, " ","\n"); - fprintf(f, " %d\n", dive->rating); show_utf8(f, dive->notes, " ","\n"); } @@ -263,6 +262,8 @@ static void save_dive(FILE *f, struct dive *dive) fputs("number) fprintf(f, " number='%d'", dive->number); + if (dive->rating) + fprintf(f, " rating='%d'", dive->rating); fprintf(f, " date='%04u-%02u-%02u'", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday); fprintf(f, " time='%02u:%02u:%02u'", -- 2.43.0