From 3a922c3c1acd08bc59ffec419aa555cbecb1f3da Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 5 Jul 2015 15:57:53 +0200 Subject: degesch: start using "on_change" notifications Terminal attributes can be changed on the fly now. --- common.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'common.c') diff --git a/common.c b/common.c index b116266..95590f5 100644 --- a/common.c +++ b/common.c @@ -1911,8 +1911,6 @@ config_schema_initialize_item (struct config_schema *schema, item->schema = schema; item->user_data = user_data; - if (schema->on_change) - schema->on_change (item); } static void @@ -1924,6 +1922,22 @@ config_schema_apply_to_object (struct config_schema *schema_array, config_schema_initialize_item (schema_array++, object, user_data); } +static void +config_schema_call_changed (struct config_item_ *item) +{ + if (item->type == CONFIG_ITEM_OBJECT) + { + struct str_map_iter iter; + str_map_iter_init (&iter, &item->value.object); + + struct config_item_ *child; + while ((child = str_map_iter_next (&iter))) + config_schema_call_changed (child); + } + else if (item->schema && item->schema->on_change) + item->schema->on_change (item); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // XXX: this doesn't necessarily have to be well designed at all -- cgit v1.2.3-70-g09d2