Pager in place
[rodin/chimara.git] / libchimara / chimara-glk.c
index 8d1e65583c707a5d0d13c206f334d4b42223645f..982b39fa6f1edbd89ef6d7147a27125a818b91c3 100644 (file)
@@ -88,6 +88,7 @@ chimara_glk_init(ChimaraGlk *self)
        priv->css_file = "style.css";
        priv->default_styles = g_new0(StyleSet,1);
        priv->current_styles = g_new0(StyleSet,1);
+       priv->pager_attr_list = pango_attr_list_new();
        priv->style_initialized = FALSE;
        priv->final_message = g_strdup("[ The game has finished ]");
        priv->running = FALSE;
@@ -108,6 +109,10 @@ chimara_glk_init(ChimaraGlk *self)
        priv->char_input_queue = g_async_queue_new();
        priv->line_input_queue = g_async_queue_new();
        /* Should be g_async_queue_new_full(g_free); but only in GTK >= 2.16 */
+       priv->resource_lock = g_mutex_new();
+       priv->resource_loaded = g_cond_new();
+       priv->resource_info_available = g_cond_new();
+       priv->image_cache = NULL;
        priv->interrupt_handler = NULL;
     priv->root_window = NULL;
     priv->fileref_list = NULL;
@@ -187,6 +192,7 @@ chimara_glk_finalize(GObject *object)
        g_hash_table_destroy(priv->default_styles->text_grid);
        g_hash_table_destroy(priv->current_styles->text_buffer);
        g_hash_table_destroy(priv->current_styles->text_grid);
+       pango_attr_list_unref(priv->pager_attr_list);
        priv->style_initialized = FALSE;
        
     /* Free the event queue */
@@ -215,6 +221,13 @@ chimara_glk_finalize(GObject *object)
        g_mutex_unlock(priv->arrange_lock);
        g_mutex_free(priv->arrange_lock);
        priv->arrange_lock = NULL;
+       g_mutex_lock(priv->resource_lock);
+       g_cond_free(priv->resource_loaded);
+       g_cond_free(priv->resource_info_available);
+       g_mutex_unlock(priv->resource_lock);
+       g_mutex_free(priv->resource_lock);
+       g_slist_foreach(priv->image_cache, (GFunc)clear_image_cache, NULL);
+       g_slist_free(priv->image_cache);
        /* Unref input queues (this should destroy them since any Glk thread has stopped by now */
        g_async_queue_unref(priv->char_input_queue);
        g_async_queue_unref(priv->line_input_queue);
@@ -829,6 +842,7 @@ chimara_glk_set_interactive(ChimaraGlk *glk, gboolean interactive)
     
     ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
     priv->interactive = interactive;
+    g_object_notify(G_OBJECT(glk), "interactive");
 }
 
 /**
@@ -865,6 +879,7 @@ chimara_glk_set_protect(ChimaraGlk *glk, gboolean protect)
     
     ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
     priv->protect = protect;
+    g_object_notify(G_OBJECT(glk), "protect");
 }
 
 /**
@@ -902,7 +917,7 @@ chimara_glk_set_default_font_description(ChimaraGlk *glk, PangoFontDescription *
        ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
        pango_font_description_free(priv->default_font_desc);
        priv->default_font_desc = pango_font_description_copy(font);
-       
+       g_object_notify(G_OBJECT(glk), "default-font-description");
        /* TODO: Apply the font description to all the windows and recalculate the sizes */
 }
 
@@ -930,6 +945,7 @@ chimara_glk_set_default_font_string(ChimaraGlk *glk, const gchar *font)
        ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
        pango_font_description_free(priv->default_font_desc);
        priv->default_font_desc = fontdesc;
+       g_object_notify(G_OBJECT(glk), "default-font-description");
        
        /* TODO: Apply the font description to all the windows and recalculate the sizes */
 }
@@ -969,6 +985,7 @@ chimara_glk_set_monospace_font_description(ChimaraGlk *glk, PangoFontDescription
        ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
        pango_font_description_free(priv->monospace_font_desc);
        priv->monospace_font_desc = pango_font_description_copy(font);
+       g_object_notify(G_OBJECT(glk), "monospace-font-description");
        
        /* TODO: Apply the font description to all the windows and recalculate the sizes */
 }
@@ -997,6 +1014,7 @@ chimara_glk_set_monospace_font_string(ChimaraGlk *glk, const gchar *font)
        ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
        pango_font_description_free(priv->monospace_font_desc);
        priv->monospace_font_desc = fontdesc;
+       g_object_notify(G_OBJECT(glk), "monospace-font-description");
        
        /* TODO: Apply the font description to all the windows and recalculate the sizes */
 }
@@ -1034,6 +1052,7 @@ chimara_glk_set_spacing(ChimaraGlk *glk, guint spacing)
        
        ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
        priv->spacing = spacing;
+       g_object_notify(G_OBJECT(glk), "spacing");
 }
 
 /**