diff --git a/include/hexagram/temp.h b/include/hexagram/temp.h index 1f15bf7..03b5f23 100644 --- a/include/hexagram/temp.h +++ b/include/hexagram/temp.h @@ -19,8 +19,9 @@ typedef struct _hexagram_temp { int hexagram_temp_init(hexagram_temp *temp, double x, double y, - hexagram_text_align align, - hexagram_temp_units units); + hexagram_text_align align); + +void hexagram_temp_set_units(hexagram_temp *temp, hexagram_temp_units units); void hexagram_temp_cleanup(hexagram_temp *temp); diff --git a/src/cluster.c b/src/cluster.c index 7195d24..bde7d5a 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -149,8 +149,7 @@ int hexagram_cluster_init(hexagram_cluster *cluster) { if (hexagram_temp_init(&cluster->temp, CLUSTER_WIDTH - 0.8 * CLUSTER_HEIGHT, CLUSTER_HEIGHT - (SECTION_HEIGHT_BOTTOM - HEXAGRAM_TEXT_FONT_SIZE) / 2, - HEXAGRAM_TEXT_RIGHT, - HEXAGRAM_TEMP_CELSIUS) < 0) { + HEXAGRAM_TEXT_RIGHT) < 0) { goto error_temp_init; } diff --git a/src/temp.c b/src/temp.c index f40f178..addc8ba 100644 --- a/src/temp.c +++ b/src/temp.c @@ -5,6 +5,8 @@ #include #include +#define DEFAULT_UNITS HEXAGRAM_TEMP_CELSIUS + #define ICON_ID HEXAGRAM_STATUS_COLD #define ICON_NAME "cold" #define ICON_STYLE "path {stroke: %1$s; stroke-width: 8}" @@ -80,8 +82,7 @@ error_format_text: int hexagram_temp_init(hexagram_temp *temp, double x, double y, - hexagram_text_align align, - hexagram_temp_units units) { + hexagram_text_align align) { if (hexagram_text_init(&temp->text, x, y, @@ -102,7 +103,7 @@ int hexagram_temp_init(hexagram_temp *temp, goto error_icon_init; } - temp->units = units; + temp->units = DEFAULT_UNITS; temp->value = 0; return 0; @@ -112,6 +113,10 @@ error_text_init: return -1; } +void hexagram_temp_set_units(hexagram_temp *temp, hexagram_temp_units units) { + temp->units = units; +} + void hexagram_temp_cleanup(hexagram_temp *temp) { hexagram_icon_cleanup(&temp->icon); }