diff options
author | Sergey Udaltsov <svu@gnome.org> | 2006-03-02 00:13:51 +0000 |
---|---|---|
committer | Sergey Udaltsov <svu@gnome.org> | 2006-03-02 00:13:51 +0000 |
commit | 316ea82d3fa3f7904c9ba5221c702de204152fe0 (patch) | |
tree | 623a2da66a4ff6927434760853e2c57711c22144 | |
parent | 7c13f1f1c5d34582a40cbde6d9e6f8a1e61e0637 (diff) | |
download | libxklavier-316ea82d3fa3f7904c9ba5221c702de204152fe0.tar.gz |
now all functions should be resolved
-rw-r--r-- | libxklavier/xklavier_config.c | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/libxklavier/xklavier_config.c b/libxklavier/xklavier_config.c index 3850a8b..6fb572c 100644 --- a/libxklavier/xklavier_config.c +++ b/libxklavier/xklavier_config.c @@ -8,6 +8,8 @@ #include "xklavier_private.h" +static GObjectClass *g_object_class = NULL; + static XklConfig *the_config = NULL; static xmlXPathCompExprPtr models_xpath; @@ -340,23 +342,6 @@ xkl_config_get_instance(XklEngine * engine) return the_config; } -void -xkl_config_term(void) -{ - if (models_xpath != NULL) { - xmlXPathFreeCompExpr(models_xpath); - models_xpath = NULL; - } - if (layouts_xpath != NULL) { - xmlXPathFreeCompExpr(layouts_xpath); - layouts_xpath = NULL; - } - if (option_groups_xpath != NULL) { - xmlXPathFreeCompExpr(option_groups_xpath); - option_groups_xpath = NULL; - } -} - gboolean xkl_config_load_registry_from_file(XklConfig * config, const gchar * file_name) @@ -590,3 +575,44 @@ xkl_config_dump(FILE * file, XklConfigRec * data) OUTPUT_ARRZ(options); } + +G_DEFINE_TYPE(XklConfig, xkl_config, G_TYPE_OBJECT) + +static void +xkl_config_init(XklConfig * config) +{ + config->priv = g_new0(XklConfigPrivate, 1); +} + +static void +xkl_config_finalize(GObject * obj) +{ + XklConfig *config = (XklConfig *) obj; + + if (models_xpath != NULL) { + xmlXPathFreeCompExpr(models_xpath); + models_xpath = NULL; + } + if (layouts_xpath != NULL) { + xmlXPathFreeCompExpr(layouts_xpath); + layouts_xpath = NULL; + } + if (option_groups_xpath != NULL) { + xmlXPathFreeCompExpr(option_groups_xpath); + option_groups_xpath = NULL; + } + + g_free(config->priv); + + G_OBJECT_CLASS(g_object_class)->finalize(obj); +} + +static void +xkl_config_class_init(XklConfigClass * klass) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) klass; + g_object_class = g_type_class_peek_parent(object_class); + object_class->finalize = xkl_config_finalize; +} |