X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=blobdiff_plain;f=libchimara%2Fstyle.c;fp=libchimara%2Fstyle.c;h=b4aa029367a61443955c413b832235a9caea33b3;hp=67240764ebf33e2b3c9922f6cf16a94cbb657d35;hb=523811df4155ac5a10b206cb16374d1383e108fc;hpb=2b35c5e1633c76219ee5a8295e22947ce2399ef9 diff --git a/libchimara/style.c b/libchimara/style.c index 6724076..b4aa029 100644 --- a/libchimara/style.c +++ b/libchimara/style.c @@ -231,8 +231,6 @@ style_init(ChimaraGlk *glk) GHashTable *default_text_grid_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); GHashTable *default_text_buffer_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); - GHashTable *glk_text_grid_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); - GHashTable *glk_text_buffer_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); GtkTextTag *tag; /* Initialise the default styles for a text grid */ @@ -335,6 +333,21 @@ style_init(ChimaraGlk *glk) priv->styles->text_grid = default_text_grid_styles; priv->styles->text_buffer = default_text_buffer_styles; + style_reset_glk(glk); +} + +/* Reset the style hints set from the Glk program to be blank. Call this when +starting a new game so that style hints from the previous game don't carry +over. */ +void +style_reset_glk(ChimaraGlk *glk) +{ + CHIMARA_GLK_USE_PRIVATE(glk, priv); + + GHashTable *glk_text_grid_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); + GHashTable *glk_text_buffer_styles = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_object_unref); + GtkTextTag *tag; + /* Initialize the GLK styles to empty tags */ int i; for(i=0; i