From f143ec7f230248e3c665318a66ceef772afc7c2f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 8 Jan 2012 15:10:11 +0100 Subject: [PATCH 4/6] Add Xkl prefix to callback types Prefix ConfigItemProcessFunc and TwoConfigItemsProcessFunc with "Xkl", so that the GI scanner can process them properly, and also to make the API more consistant. Add typedef aliases for the old names to avoid breaking the API. --- doc/reference/libxklavier-sections.txt | 4 +- libxklavier/xkl_config_registry.h | 46 +++++++++++++++++-------------- libxklavier/xklavier_config.c | 24 ++++++++-------- libxklavier/xklavier_config_iso.c | 12 ++++---- libxklavier/xklavier_private.h | 4 +- 5 files changed, 47 insertions(+), 43 deletions(-) diff --git a/doc/reference/libxklavier-sections.txt b/doc/reference/libxklavier-sections.txt index cf7ebcb..6108bb7 100644 --- a/doc/reference/libxklavier-sections.txt +++ b/doc/reference/libxklavier-sections.txt @@ -115,8 +115,8 @@ XKL_CONFIG_REC_GET_CLASS XklConfigRegistryPrivate XklConfigRegistry xkl_config_registry_load -ConfigItemProcessFunc -TwoConfigItemsProcessFunc +XklConfigItemProcessFunc +XklTwoConfigItemsProcessFunc xkl_config_registry_foreach_model xkl_config_registry_foreach_layout xkl_config_registry_foreach_layout_variant diff --git a/libxklavier/xkl_config_registry.h b/libxklavier/xkl_config_registry.h index d9b3db4..bce8da3 100644 --- a/libxklavier/xkl_config_registry.h +++ b/libxklavier/xkl_config_registry.h @@ -101,19 +101,19 @@ extern "C" { if_extras_needed); /** - * ConfigItemProcessFunc: + * XklConfigItemProcessFunc: * @config: the config registry * @item: the item from registry * @data: anything which can be stored into the pointer * * Callback type used for enumerating keyboard models, layouts, variants, options */ - typedef void (*ConfigItemProcessFunc) (XklConfigRegistry * config, - const XklConfigItem * item, - gpointer data); + typedef void (*XklConfigItemProcessFunc) (XklConfigRegistry * config, + const XklConfigItem * item, + gpointer data); /** - * TwoConfigItemsProcessFunc: + * XklTwoConfigItemsProcessFunc: * @config: the config registry * @item: the item from registry * @subitem: the item from registry @@ -121,12 +121,16 @@ extern "C" { * * Callback type used for enumerating layouts/variants for countries/languages */ - typedef void (*TwoConfigItemsProcessFunc) (XklConfigRegistry * - config, - const XklConfigItem * - item, - const XklConfigItem * - subitem, gpointer data); + typedef void (*XklTwoConfigItemsProcessFunc) (XklConfigRegistry * + config, + const XklConfigItem * + item, + const XklConfigItem * + subitem, gpointer data); + +/* provide the old names for backwards compatibility */ + typedef XklConfigItemProcessFunc ConfigItemProcessFunc; + typedef XklTwoConfigItemsProcessFunc TwoConfigItemsProcessFunc; /** * xkl_config_registry_foreach_model: @@ -138,7 +142,7 @@ extern "C" { */ extern void xkl_config_registry_foreach_model(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); /** @@ -151,7 +155,7 @@ extern "C" { */ extern void xkl_config_registry_foreach_layout(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); @@ -169,7 +173,7 @@ extern "C" { config, const gchar * layout_name, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); /** @@ -183,7 +187,7 @@ extern "C" { extern void xkl_config_registry_foreach_option_group(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); /** @@ -200,7 +204,7 @@ extern "C" { config, const gchar * option_group_name, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); @@ -299,7 +303,7 @@ extern "C" { */ extern void xkl_config_registry_foreach_country(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); @@ -318,7 +322,7 @@ extern "C" { config, const gchar * country_code, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data); /** @@ -332,7 +336,7 @@ extern "C" { */ extern void xkl_config_registry_foreach_language(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); @@ -351,7 +355,7 @@ extern "C" { config, const gchar * language_code, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data); @@ -371,7 +375,7 @@ extern "C" { extern void xkl_config_registry_search_by_pattern(XklConfigRegistry * config, const gchar * pattern, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data); #ifdef __cplusplus diff --git a/libxklavier/xklavier_config.c b/libxklavier/xklavier_config.c index dd35078..e926bfc 100644 --- a/libxklavier/xklavier_config.c +++ b/libxklavier/xklavier_config.c @@ -50,7 +50,7 @@ enum { typedef struct { gchar **patterns; - TwoConfigItemsProcessFunc func; + XklTwoConfigItemsProcessFunc func; gpointer data; gboolean country_matched; gboolean language_matched; @@ -265,7 +265,7 @@ static void xkl_config_registry_foreach_in_nodeset(XklConfigRegistry * config, GSList ** processed_ids, gint doc_index, xmlNodeSetPtr nodes, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, gpointer data) { gint i; @@ -297,7 +297,7 @@ void xkl_config_registry_foreach_in_xpath(XklConfigRegistry * config, xmlXPathCompExprPtr xpath_comp_expr, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, gpointer data) { xmlXPathObjectPtr xpath_obj; @@ -335,7 +335,7 @@ xkl_config_registry_foreach_in_xpath_with_param(XklConfigRegistry format, const gchar * value, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data) { char xpath_expr[1024]; @@ -607,7 +607,7 @@ xkl_config_registry_free(XklConfigRegistry * config) void xkl_config_registry_foreach_model(XklConfigRegistry * config, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, gpointer data) { xkl_config_registry_foreach_in_xpath(config, models_xpath, @@ -616,7 +616,7 @@ xkl_config_registry_foreach_model(XklConfigRegistry * config, void xkl_config_registry_foreach_layout(XklConfigRegistry * config, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, gpointer data) { xkl_config_registry_foreach_in_xpath(config, layouts_xpath, @@ -628,7 +628,7 @@ xkl_config_registry_foreach_layout_variant(XklConfigRegistry * config, const gchar * layout_name, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data) { xkl_config_registry_foreach_in_xpath_with_param(config, @@ -641,7 +641,7 @@ xkl_config_registry_foreach_layout_variant(XklConfigRegistry * void xkl_config_registry_foreach_option_group(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data) { xmlXPathObjectPtr xpath_obj; @@ -715,7 +715,7 @@ void xkl_config_registry_foreach_option(XklConfigRegistry * config, const gchar * option_group_name, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, gpointer data) { xkl_config_registry_foreach_in_xpath_with_param(config, @@ -885,7 +885,7 @@ xkl_config_registry_search_by_pattern_in_layout(XklConfigRegistry * config, search_param->layout_item = item; xkl_config_registry_foreach_layout_variant(config, item->name, - (ConfigItemProcessFunc) + (XklConfigItemProcessFunc) xkl_config_registry_search_by_pattern_in_variant, search_param); @@ -897,7 +897,7 @@ xkl_config_registry_search_by_pattern(XklConfigRegistry * config, const gchar * pattern, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data) { xkl_debug(200, "Searching by pattern: [%s]\n", pattern); @@ -906,7 +906,7 @@ xkl_config_registry_search_by_pattern(XklConfigRegistry SearchParamType search_param = { patterns, func, data }; - xkl_config_registry_foreach_layout(config, (ConfigItemProcessFunc) + xkl_config_registry_foreach_layout(config, (XklConfigItemProcessFunc) xkl_config_registry_search_by_pattern_in_layout, &search_param); g_strfreev(patterns); diff --git a/libxklavier/xklavier_config_iso.c b/libxklavier/xklavier_config_iso.c index ab8ff5f..d544782 100644 --- a/libxklavier/xklavier_config_iso.c +++ b/libxklavier/xklavier_config_iso.c @@ -200,7 +200,7 @@ xkl_get_country_name(const gchar * code) static void xkl_config_registry_foreach_iso_code(XklConfigRegistry * config, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, const gchar * xpath_exprs[], DescriptionGetterFunc dgf, gboolean to_upper, gpointer data) @@ -282,7 +282,7 @@ xkl_config_registry_foreach_iso_code(XklConfigRegistry * config, void xkl_config_registry_foreach_country(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data) { const gchar *xpath_exprs[] = { @@ -299,7 +299,7 @@ xkl_config_registry_foreach_country(XklConfigRegistry * void xkl_config_registry_foreach_language(XklConfigRegistry * config, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data) { const gchar *xpath_exprs[] = { @@ -318,7 +318,7 @@ xkl_config_registry_foreach_iso_variant(XklConfigRegistry * config, const gchar * iso_code, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data, const gchar * layout_xpath_exprs[], const gboolean @@ -440,7 +440,7 @@ xkl_config_registry_foreach_country_variant(XklConfigRegistry * config, const gchar * country_code, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data) { const gchar *layout_xpath_exprs[] = { @@ -477,7 +477,7 @@ xkl_config_registry_foreach_language_variant(XklConfigRegistry * config, const gchar * language_code, - TwoConfigItemsProcessFunc + XklTwoConfigItemsProcessFunc func, gpointer data) { const gchar *layout_xpath_exprs[] = { diff --git a/libxklavier/xklavier_private.h b/libxklavier/xklavier_private.h index 35fc8a5..47d3a97 100644 --- a/libxklavier/xklavier_private.h +++ b/libxklavier/xklavier_private.h @@ -466,14 +466,14 @@ extern void xkl_config_registry_foreach_in_xpath_with_param(XklConfigRegistry * config, const gchar * format, const gchar * value, - ConfigItemProcessFunc func, + XklConfigItemProcessFunc func, gpointer data); extern void xkl_config_registry_foreach_in_xpath(XklConfigRegistry * config, xmlXPathCompExprPtr xpath_comp_expr, - ConfigItemProcessFunc + XklConfigItemProcessFunc func, gpointer data); extern gboolean xkl_read_config_item(XklConfigRegistry * config, -- 1.7.7.3