projects
/
rodin
/
chimara.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Iliad port
[rodin/chimara.git]
/
libchimara
/
chimara-glk.c
diff --git
a/libchimara/chimara-glk.c
b/libchimara/chimara-glk.c
index 4f1d39102dd9db62754eb4ecc30a6bfe5a8f3b6c..e585165399415b7f6c6a1a49878b058b0186cc77 100644
(file)
--- a/
libchimara/chimara-glk.c
+++ b/
libchimara/chimara-glk.c
@@
-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->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;
priv->style_initialized = FALSE;
priv->final_message = g_strdup("[ The game has finished ]");
priv->running = FALSE;
@@
-107,10
+108,11
@@
chimara_glk_init(ChimaraGlk *self)
priv->ignore_next_arrange_event = FALSE;
priv->char_input_queue = g_async_queue_new();
priv->line_input_queue = g_async_queue_new();
priv->ignore_next_arrange_event = FALSE;
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->resource_lock = g_mutex_new();
priv->resource_loaded = g_cond_new();
priv->resource_info_available = g_cond_new();
- /* Should be g_async_queue_new_full(g_free); but only in GTK >= 2.16 */
+ priv->image_cache = NULL;
priv->interrupt_handler = NULL;
priv->root_window = NULL;
priv->fileref_list = NULL;
priv->interrupt_handler = NULL;
priv->root_window = NULL;
priv->fileref_list = NULL;
@@
-190,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);
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 */
priv->style_initialized = FALSE;
/* Free the event queue */
@@
-223,6
+226,8
@@
chimara_glk_finalize(GObject *object)
g_cond_free(priv->resource_info_available);
g_mutex_unlock(priv->resource_lock);
g_mutex_free(priv->resource_lock);
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);
/* 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);
@@
-612,9
+617,16
@@
chimara_glk_text_buffer_output(ChimaraGlk *self, guint window_rock, gchar *text)
/* Default signal handler */
}
/* Default signal handler */
}
-/* G_PARAM_STATIC_STRINGS only appeared in GTK 2.13.0 */
+/*
COMPAT:
G_PARAM_STATIC_STRINGS only appeared in GTK 2.13.0 */
#ifndef G_PARAM_STATIC_STRINGS
#ifndef G_PARAM_STATIC_STRINGS
+
+/* COMPAT: G_PARAM_STATIC_NAME and friends only appeared in GTK 2.8 */
+#if GTK_CHECK_VERSION(2,8,0)
#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
#define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
+#else
+#define G_PARAM_STATIC_STRINGS (0)
+#endif
+
#endif
static void
#endif
static void
@@
-837,6
+849,7
@@
chimara_glk_set_interactive(ChimaraGlk *glk, gboolean interactive)
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
priv->interactive = interactive;
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
priv->interactive = interactive;
+ g_object_notify(G_OBJECT(glk), "interactive");
}
/**
}
/**
@@
-873,6
+886,7
@@
chimara_glk_set_protect(ChimaraGlk *glk, gboolean protect)
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
priv->protect = protect;
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
priv->protect = protect;
+ g_object_notify(G_OBJECT(glk), "protect");
}
/**
}
/**
@@
-910,7
+924,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);
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 */
}
/* TODO: Apply the font description to all the windows and recalculate the sizes */
}
@@
-938,6
+952,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;
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 */
}
/* TODO: Apply the font description to all the windows and recalculate the sizes */
}
@@
-977,6
+992,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);
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 */
}
/* TODO: Apply the font description to all the windows and recalculate the sizes */
}
@@
-1005,6
+1021,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;
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 */
}
/* TODO: Apply the font description to all the windows and recalculate the sizes */
}
@@
-1042,6
+1059,7
@@
chimara_glk_set_spacing(ChimaraGlk *glk, guint spacing)
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
priv->spacing = spacing;
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
priv->spacing = spacing;
+ g_object_notify(G_OBJECT(glk), "spacing");
}
/**
}
/**
@@
-1096,7
+1114,9
@@
glk_enter(struct StartupData *startup)
/* Run main function */
glk_main_t glk_main = startup->glk_main;
/* Run main function */
glk_main_t glk_main = startup->glk_main;
- g_slice_free(struct StartupData, startup);
+
+ /* COMPAT: avoid usage of slices */
+ g_free(startup);
g_signal_emit_by_name(startup->glk_data->self, "started");
glk_main();
glk_exit(); /* Run shutdown code in glk_exit() even if glk_main() returns normally */
g_signal_emit_by_name(startup->glk_data->self, "started");
glk_main();
glk_exit(); /* Run shutdown code in glk_exit() even if glk_main() returns normally */
@@
-1135,7
+1155,9
@@
chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GE
}
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
}
ChimaraGlkPrivate *priv = CHIMARA_GLK_PRIVATE(glk);
- struct StartupData *startup = g_slice_new0(struct StartupData);
+
+ /* COMPAT: avoid usage of slices */
+ struct StartupData *startup = g_new0(struct StartupData,1);
/* Open the module to run */
g_assert( g_module_supported() );
/* Open the module to run */
g_assert( g_module_supported() );