From 268df921e52673d3344b86b3ed6bbf3db0af227e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 8 Oct 2010 15:34:03 +0200 Subject: [PATCH] keyboard: Fix handling of empty variants Layouts with empty variants give us a NULL variant in the tree iterator, which gives wrong results when being g_strconcat'ed together to form the final variant list. If we encounter a NULL variant, set it to the empty string now. http://bugzilla.xfce.org/show_bug.cgi?id=6727 --- dialogs/keyboard-settings/xfce-keyboard-settings.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/dialogs/keyboard-settings/xfce-keyboard-settings.c b/dialogs/keyboard-settings/xfce-keyboard-settings.c index 2de5f78..bc3c336 100644 --- a/dialogs/keyboard-settings/xfce-keyboard-settings.c +++ b/dialogs/keyboard-settings/xfce-keyboard-settings.c @@ -1029,6 +1029,8 @@ xfce_keyboard_settings_set_layout (XfceKeyboardSettings *settings) gtk_tree_model_get (model, &iter, XKB_TREE_LAYOUTS, &val_layout, XKB_TREE_VARIANTS, &val_variant, -1); + if (val_variant == NULL) + val_variant = g_strdup(""); /* We put the active layout/variant at the beginning of the list so that it gets * picked by xfce4-settings-helper on the next session start. */ @@ -1056,6 +1058,8 @@ xfce_keyboard_settings_set_layout (XfceKeyboardSettings *settings) gtk_tree_model_get (model, &iter, XKB_TREE_LAYOUTS, &val_layout, XKB_TREE_VARIANTS, &val_variant, -1); + if (val_variant == NULL) + val_variant = g_strdup(""); if (gtk_tree_selection_iter_is_selected (selection, &iter)) { -- 1.7.1