[Xfce4-commits] <xfce4-settings:master> Destroy keyboard-layout objects on exit (i.e., add finalize())

Igor Slepchin noreply at xfce.org
Wed Aug 22 23:14:04 CEST 2012


Updating branch refs/heads/master
         to 4a35ad448784876b321dfc5384b13a48d7133105 (commit)
       from c21744e30093a58c7f29bd6541075988526d60ce (commit)

commit 4a35ad448784876b321dfc5384b13a48d7133105
Author: Igor Slepchin <igor.slepchin at gmail.com>
Date:   Wed Jul 18 23:48:13 2012 -0400

    Destroy keyboard-layout objects on exit (i.e., add finalize())

 xfsettingsd/keyboard-layout.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/xfsettingsd/keyboard-layout.c b/xfsettingsd/keyboard-layout.c
index 8a8471d..9f3cfba 100644
--- a/xfsettingsd/keyboard-layout.c
+++ b/xfsettingsd/keyboard-layout.c
@@ -44,6 +44,7 @@
 #include "debug.h"
 #include "keyboard-layout.h"
 
+static void xfce_keyboard_layout_helper_finalize                  (GObject                       *object);
 static void xfce_keyboard_layout_helper_process_xmodmap           (void);
 static void xfce_keyboard_layout_helper_set_model                 (XfceKeyboardLayoutHelper      *helper);
 static void xfce_keyboard_layout_helper_set_layout                (XfceKeyboardLayoutHelper      *helper);
@@ -89,7 +90,10 @@ G_DEFINE_TYPE (XfceKeyboardLayoutHelper, xfce_keyboard_layout_helper, G_TYPE_OBJ
 static void
 xfce_keyboard_layout_helper_class_init (XfceKeyboardLayoutHelperClass *klass)
 {
+    GObjectClass *gobject_class;
 
+    gobject_class = G_OBJECT_CLASS (klass);
+    gobject_class->finalize = xfce_keyboard_layout_helper_finalize;
 }
 
 static void
@@ -125,6 +129,20 @@ xfce_keyboard_layout_helper_init (XfceKeyboardLayoutHelper *helper)
     xfce_keyboard_layout_helper_process_xmodmap ();
 }
 
+static void
+xfce_keyboard_layout_helper_finalize (GObject *object)
+{
+    XfceKeyboardLayoutHelper *helper = XFCE_KEYBOARD_LAYOUT_HELPER (object);
+
+#ifdef HAVE_LIBXKLAVIER
+    xkl_engine_stop_listen (helper->engine, XKLL_TRACK_KEYBOARD_STATE);
+    gdk_window_remove_filter (NULL, (GdkFilterFunc) handle_xevent, helper);
+    g_object_unref (helper->config);
+    g_object_unref (helper->engine);
+#endif /* HAVE_LIBXKLAVIER */
+
+    G_OBJECT_CLASS (xfce_keyboard_layout_helper_parent_class)->finalize (object);
+}
 
 
 static void
@@ -228,9 +246,9 @@ xfce_keyboard_layout_helper_set_variant (XfceKeyboardLayoutHelper *helper)
  *         or NULL if not found
  */
 static gchar*
-xfce_keyboard_layout_get_option(gchar **options,
-                                gchar *option_name,
-                                gchar **_other_options)
+xfce_keyboard_layout_get_option (gchar **options,
+                                 gchar *option_name,
+                                 gchar **_other_options)
 {
     gchar **iter;
     gchar  *option_value  = NULL;


More information about the Xfce4-commits mailing list