diff options
author | Sergey Udaltsov <svu@gnome.org> | 2006-03-02 00:06:41 +0000 |
---|---|---|
committer | Sergey Udaltsov <svu@gnome.org> | 2006-03-02 00:06:41 +0000 |
commit | 7c13f1f1c5d34582a40cbde6d9e6f8a1e61e0637 (patch) | |
tree | 0558879f3b766c09c77b1ab86e449b85f3013869 /libxklavier/xklavier.c | |
parent | 4a2c685b5f471b9db8c51d24ea57a453b9b78636 (diff) | |
download | libxklavier-7c13f1f1c5d34582a40cbde6d9e6f8a1e61e0637.tar.gz |
xklengine type kinda defined
Diffstat (limited to 'libxklavier/xklavier.c')
-rw-r--r-- | libxklavier/xklavier.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/libxklavier/xklavier.c b/libxklavier/xklavier.c index 7b818c8..9bbde12 100644 --- a/libxklavier/xklavier.c +++ b/libxklavier/xklavier.c @@ -7,6 +7,8 @@ #include "xklavier_private.h" +static GObjectClass *g_object_class = NULL; + static XklEngine *the_engine = NULL; gint xkl_debug_level = 0; @@ -176,7 +178,6 @@ xkl_engine_get_instance(Display * display) the_engine = XKL_ENGINE(g_object_new(xkl_engine_get_type(), NULL)); - the_engine->priv->display = display; const gchar *sdl = g_getenv("XKL_DEBUG"); @@ -243,17 +244,6 @@ xkl_engine_get_instance(Display * display) return the_engine; } -gint -xkl_term(XklEngine * engine) -{ - XSetErrorHandler((XErrorHandler) engine->priv-> - default_error_handler); - - xkl_engine_free_all_info(engine); - - return 0; -} - gboolean xkl_engine_grab_key(XklEngine * engine, gint keycode, guint modifiers) { @@ -629,3 +619,36 @@ xkl_get_the_engine() { return the_engine; } + +G_DEFINE_TYPE(XklEngine, xkl_engine, G_TYPE_OBJECT) + +static void +xkl_engine_init(XklEngine * engine) +{ + engine->priv = g_new0(XklEnginePrivate, 1); +} + +static void +xkl_engine_finalize(GObject * obj) +{ + XklEngine *engine = (XklEngine *) obj; + + XSetErrorHandler((XErrorHandler) engine->priv-> + default_error_handler); + + xkl_engine_free_all_info(engine); + + g_free(engine->priv); + + G_OBJECT_CLASS(g_object_class)->finalize(obj); +} + +static void +xkl_engine_class_init(XklEngineClass * klass) +{ + GObjectClass *object_class; + + object_class = (GObjectClass *) klass; + g_object_class = g_type_class_peek_parent(object_class); + object_class->finalize = xkl_engine_finalize; +} |