From 5d19795077b8327dfa1fdf62c2639247c8643fa4 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 13 Sep 2006 21:32:09 +0000 Subject: Err about failing to load engine only once per module. 2006-09-13 Behdad Esfahbod * pango/modules.c (pango_engine_pair_get_engine): Err about failing to load engine only once per module. --- pango/modules.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'pango') diff --git a/pango/modules.c b/pango/modules.c index 57b13443..2c2b7321 100644 --- a/pango/modules.c +++ b/pango/modules.c @@ -261,7 +261,25 @@ pango_engine_pair_get_engine (PangoEnginePair *pair) } if (!pair->engine) - g_printerr ("Failed to load Pango module for id: '%s'", pair->info.id); + { + /* If a module cannot be used, or doesn't not create an engine + * correctly, we print out an error containing module name and id, + * but to not flood the terminal with zillions of the message, we + * set a flag on the module to only err once per module. + */ + static GQuark warned_quark = 0; + + if (!warned_quark) + warned_quark = g_quark_from_static_string ("pango-module-warned"); + + if (!g_object_get_qdata (G_OBJECT (pair->module), warned_quark)) + { + g_warning ("Failed to load Pango module '%s' for id '%s'", pair->module->path, pair->info.id); + + g_object_set_qdata_full (G_OBJECT (pair->module), warned_quark, + GINT_TO_POINTER (1), NULL); + } + } } return pair->engine; -- cgit v1.2.1