Commit 47b2f256 authored by Olivier Fourdan's avatar Olivier Fourdan

Add keyboard layout selector

(Old svn revision: 28152)
parent a6aa24e8
2008-10-11 olivier
* dialogs/keyboard-settings/xfce-keyboard-settings.c,
dialogs/keyboard-settings/keyboard-dialog.glade,
dialogs/keyboard-settings/Makefile.am,
xfce4-settings-helper/keyboard-layout.c,
xfce4-settings-helper/keyboard-layout.h,
xfce4-settings-helper/keyboards.c,
xfce4-settings-helper/main.c,
xfce4-settings-helper/Makefile.am,
configure.ac.in: Add keyboard layout selector
2008-10-10 olivier
* dialogs/keyboard-settings/keyboard-dialog.glade:
......
......@@ -97,6 +97,13 @@ dnl ************************************
XDT_CHECK_OPTIONAL_PACKAGE([XCURSOR], [xcursor], [1.1.0],
[xcursor], [Cursor themes support])
dnl ****************************************
dnl *** Optional support for Libxklavier ***
dnl ****************************************
XDT_CHECK_OPTIONAL_PACKAGE([LIBXKLAVIER], [libxklavier], [0.3.0],
[libxklavier], [Keyboard layout selection])
dnl make xsettings daemon optional
AC_ARG_ENABLE([xsettings-daemon],
[AC_HELP_STRING([--disable-xsettings-daemon],
......@@ -256,6 +263,11 @@ echo "* Sounds settings support yes"
else
echo "* Sounds settings support no"
fi
if test x"$LIBXKLAVIER_FOUND" = x"yes"; then
echo "* Libxklavier support: yes"
else
echo "* Libxklavier support: no"
fi
echo
......@@ -31,6 +31,7 @@ xfce4_keyboard_settings_CFLAGS = \
$(GLIB_CFLAGS) \
$(GLADE_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBXKLAVIER_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(EXO_CFLAGS) \
......@@ -45,6 +46,7 @@ xfce4_keyboard_settings_LDADD = \
$(GLIB_LIBS) \
$(GLADE_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBXKLAVIER_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(LIBXFCEGUI4_LIBS) \
$(EXO_LIBS) \
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Fri Oct 10 18:09:12 2008 -->
<!--Generated with glade3 3.4.4 on Sat Oct 11 22:46:55 2008 -->
<glade-interface>
<requires lib="xfce4"/>
<widget class="XfceTitledDialog" id="keyboard-settings-dialog">
......@@ -395,22 +395,8 @@
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">False</property>
<child>
<widget class="GtkCheckButton" id="xkb_xconfig_check_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use default system configuration</property>
<property name="use_underline">True</property>
<property name="response_id">0</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">6</property>
</packing>
</child>
<widget class="GtkVBox" id="xkb_tab_layout_vbox">
<property name="border_width">12</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
......@@ -470,15 +456,25 @@
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<widget class="GtkTreeView" id="xkb_layout_view">
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="search_column">0</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<child>
<widget class="GtkTreeView" id="xkb_layout_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="search_column">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkVBox" id="vbox10">
<property name="visible">True</property>
<property name="border_width">6</property>
<child>
<widget class="GtkButton" id="xkb_layout_add_button">
<property name="visible">True</property>
......@@ -619,4 +615,72 @@
</widget>
</child>
</widget>
<widget class="XfceTitledDialog" id="keyboard-layout-selection-dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Keyboard layout selection</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="default_height">300</property>
<property name="icon_name">preferences-desktop-keyboard</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="has_separator">False</property>
<property name="subtitle" translatable="yes">Keyboard layout and variant</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<child>
<widget class="GtkTreeView" id="layout_selection_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="search_column">0</property>
</widget>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="layout_selection_ok_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-ok</property>
<property name="use_stock">True</property>
<property name="response_id">1</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="layout_selection_cancel_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="label" translatable="yes">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="response_id">0</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
/* vi:set sw=2 sts=2 ts=2 et ai: */
/*-
* Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>.
* Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
* 2008 Olivier Fourdan <olivier@xfce.org>
* Portions based on xfkc
* Copyright (c) 2007 Gauvain Pocentek <gauvainpocentek@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
......@@ -40,7 +43,9 @@
#include "frap-shortcuts-dialog.h"
#include "frap-shortcuts-provider.h"
#ifdef HAVE_LIBXKLAVIER
#include <libxklavier/xklavier.h>
#endif /* HAVE_LIBXKLAVIER */
#define DEFAULT_BASE_PROPERTY "/commands/default"
#define CUSTOM_BASE_PROPERTY "/commands/custom"
......@@ -64,6 +69,28 @@ enum
};
enum
{
DESC = 0,
NOM,
COMBO_NUM
};
enum
{
LAYOUTS = 0,
VARIANTS,
TREE_NUM
};
enum
{
AVAIL_LAYOUT_TREE_COL_DESCRIPTION = 0,
AVAIL_LAYOUT_TREE_COL_ID,
NUM
};
typedef struct _XfceKeyboardShortcutInfo XfceKeyboardShortcutInfo;
......@@ -111,6 +138,40 @@ static void xfce_keyboard_settings_add_button_clicked (X
static void xfce_keyboard_settings_delete_button_clicked (XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_reset_button_clicked (XfceKeyboardSettings *settings);
#ifdef HAVE_LIBXKLAVIER
static gchar * xfce_keyboard_settings_model_description (XklConfigItem *config_item);
static void xfce_keyboard_settings_set_layout (XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_init_layout (XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_add_model_to_combo (XklConfigRegistry *config_registry,
XklConfigItem *config_item,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_init_model (XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_cb_model_changed (GtkComboBox *combo,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_update_layout_buttons (XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_update_edit_button (GtkTreeView *tree_view,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_del_layout_button_cb (GtkWidget *widget,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_update_edit_button (GtkTreeView *tree_view,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_edit_layout_button_cb (GtkWidget *widget,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_add_layout_button_cb (GtkWidget *widget,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_del_layout_button_cb (GtkWidget *widget,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_add_variant_to_list (XklConfigRegistry *config_registry,
XklConfigItem *config_item,
XfceKeyboardSettings *settings);
static void xfce_keyboard_settings_add_layout_to_list (XklConfigRegistry *config_registry,
XklConfigItem *config_item,
XfceKeyboardSettings *settings);
static gchar * xfce_keyboard_settings_layout_selection (XfceKeyboardSettings *settings);
#endif /* HAVE_LIBXKLAVIER */
struct _XfceKeyboardSettingsPrivate
......@@ -119,7 +180,16 @@ struct _XfceKeyboardSettingsPrivate
FrapShortcutsProvider *provider;
#ifdef HAVE_LIBXKLAVIER
XklEngine *xkl_engine;
XklConfigRegistry *xkl_registry;
XklConfigRec *xkl_rec_config;
GtkTreeIter layout_selection_iter;
GtkTreeStore *layout_selection_treestore;
#endif
XfconfChannel *keyboards_channel;
XfconfChannel *keyboard_layout_channel;
XfconfChannel *xsettings_channel;
};
......@@ -176,7 +246,7 @@ xfce_keyboard_settings_class_init (XfceKeyboardSettingsClass *klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->constructed = xfce_keyboard_settings_constructed;
gobject_class->finalize = xfce_keyboard_settings_finalize;
gobject_class->finalize = xfce_keyboard_settings_finalize;
gobject_class->get_property = xfce_keyboard_settings_get_property;
gobject_class->set_property = xfce_keyboard_settings_set_property;
......@@ -186,7 +256,7 @@ xfce_keyboard_settings_class_init (XfceKeyboardSettingsClass *klass)
"glade-xml",
"glade-xml",
GLADE_TYPE_XML,
G_PARAM_READWRITE |
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
......@@ -199,12 +269,13 @@ xfce_keyboard_settings_init (XfceKeyboardSettings *settings)
settings->priv->glade_xml = NULL;
settings->priv->keyboards_channel = xfconf_channel_new ("keyboards");
settings->priv->keyboard_layout_channel = xfconf_channel_new ("keyboard-layout");
settings->priv->xsettings_channel = xfconf_channel_new ("xsettings");
settings->priv->provider = frap_shortcuts_provider_new ("commands");
g_signal_connect (settings->priv->provider, "shortcut-added",
g_signal_connect (settings->priv->provider, "shortcut-added",
G_CALLBACK (xfce_keyboard_settings_shortcut_added), settings);
g_signal_connect (settings->priv->provider, "shortcut-removed",
g_signal_connect (settings->priv->provider, "shortcut-removed",
G_CALLBACK (xfce_keyboard_settings_shortcut_removed), settings);
}
......@@ -226,6 +297,14 @@ xfce_keyboard_settings_constructed (GObject *object)
GtkWidget *net_cursor_blink_box;
GtkWidget *kbd_shortcuts_view;
GtkWidget *button;
#ifdef HAVE_LIBXKLAVIER
GtkWidget *xkb_tab_layout_vbox;
GtkWidget *xkb_model_combo;
GtkWidget *xkb_layout_view;
GtkWidget *xkb_layout_add_button;
GtkWidget *xkb_layout_edit_button;
GtkWidget *xkb_layout_delete_button;
#endif /* HAVE_LIBXKLAVIER */
/* XKB settings */
xkb_key_repeat_check = glade_xml_get_widget (settings->priv->glade_xml, "xkb_key_repeat_check");
......@@ -252,7 +331,7 @@ xfce_keyboard_settings_constructed (GObject *object)
kbd_shortcuts_view = glade_xml_get_widget (settings->priv->glade_xml, "kbd_shortcuts_view");
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (kbd_shortcuts_view)), GTK_SELECTION_MULTIPLE);
g_signal_connect (kbd_shortcuts_view, "row-activated", G_CALLBACK (xfce_keyboard_settings_row_activated), settings);
/* Create list store for keyboard shortcuts */
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store), COMMAND_COLUMN, GTK_SORT_ASCENDING);
......@@ -285,6 +364,60 @@ xfce_keyboard_settings_constructed (GObject *object)
/* TODO: Handle property-changed signal */
/* TODO: Handle 'Add' and 'Remove' buttons */
#ifdef HAVE_LIBXKLAVIER
/* Init engine */
settings->priv->xkl_engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
settings->priv->xkl_rec_config = xkl_config_rec_new ();
settings->priv->xkl_registry = xkl_config_registry_get_instance (settings->priv->xkl_engine);
xkl_config_registry_load (settings->priv->xkl_registry);
xkl_config_rec_get_from_server (settings->priv->xkl_rec_config, settings->priv->xkl_engine);
/* Tab */
xkb_tab_layout_vbox = glade_xml_get_widget (settings->priv->glade_xml, "xkb_tab_layout_vbox");
gtk_widget_show (GTK_WIDGET(xkb_tab_layout_vbox));
/* Keyboard model combo */
xkb_model_combo = glade_xml_get_widget (settings->priv->glade_xml, "xkb_model_combo");
gtk_cell_layout_clear (GTK_CELL_LAYOUT (xkb_model_combo));
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (xkb_model_combo), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (xkb_model_combo), renderer, "text", 0);
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_combo_box_set_model (GTK_COMBO_BOX (xkb_model_combo), GTK_TREE_MODEL (list_store));
xkl_config_registry_foreach_model (settings->priv->xkl_registry,
(ConfigItemProcessFunc) xfce_keyboard_settings_add_model_to_combo,
settings);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store), 0, GTK_SORT_ASCENDING);
xfce_keyboard_settings_init_model (settings);
g_signal_connect (G_OBJECT (xkb_model_combo),
"changed",
G_CALLBACK (xfce_keyboard_settings_cb_model_changed),
settings);
/* Keyboard layout/variant treeview */
settings->priv->layout_selection_treestore = NULL;
xkb_layout_view = glade_xml_get_widget (settings->priv->glade_xml, "xkb_layout_view");
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (xkb_layout_view), -1, _("Layout"), renderer, "text", LAYOUTS, NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (xkb_layout_view), -1, _("Variant"), renderer, "text", VARIANTS, NULL);
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model (GTK_TREE_VIEW (xkb_layout_view), GTK_TREE_MODEL (list_store));
xfce_keyboard_settings_init_layout (settings);
g_signal_connect (G_OBJECT (xkb_layout_view), "cursor-changed", G_CALLBACK (xfce_keyboard_settings_update_edit_button), settings);
/* Layout buttons */
xkb_layout_add_button = glade_xml_get_widget (settings->priv->glade_xml, "xkb_layout_add_button");
xkb_layout_edit_button = glade_xml_get_widget (settings->priv->glade_xml, "xkb_layout_edit_button");
xkb_layout_delete_button = glade_xml_get_widget (settings->priv->glade_xml, "xkb_layout_delete_button");
g_signal_connect (G_OBJECT (xkb_layout_add_button), "clicked", G_CALLBACK (xfce_keyboard_settings_add_layout_button_cb), settings);
g_signal_connect (G_OBJECT (xkb_layout_edit_button), "clicked", G_CALLBACK (xfce_keyboard_settings_edit_layout_button_cb), settings);
g_signal_connect (G_OBJECT (xkb_layout_delete_button), "clicked", G_CALLBACK (xfce_keyboard_settings_del_layout_button_cb), settings);
xfce_keyboard_settings_update_edit_button (GTK_TREE_VIEW (xkb_layout_view), settings);
xfce_keyboard_settings_update_layout_buttons (settings);
#endif /* HAVE_LIBXKLAVIER */
}
......@@ -646,7 +779,7 @@ xfce_keyboard_settings_get_shortcut_info (XfceKeyboardSettings *settings,
}
frap_shortcuts_provider_free_providers (providers);
return info;
}
......@@ -709,7 +842,7 @@ _xfce_keyboard_settings_remove_shortcut (GtkTreeModel *model,
}
g_free (row_shortcut);
return finished;
}
......@@ -755,7 +888,7 @@ xfce_keyboard_settings_add_button_clicked (XfceKeyboardSettings *settings,
{
response = command_dialog_run (COMMAND_DIALOG (command_dialog), GTK_WIDGET (button));
if (G_UNLIKELY (response == GTK_RESPONSE_OK &&
if (G_UNLIKELY (response == GTK_RESPONSE_OK &&
g_utf8_strlen (command_dialog_get_command (COMMAND_DIALOG (command_dialog)), -1) == 0))
xfce_err (_("Shortcut command may not be empty."));
else
......@@ -862,3 +995,443 @@ xfce_keyboard_settings_reset_button_clicked (XfceKeyboardSettings *settings)
g_return_if_fail (XFCE_IS_KEYBOARD_SETTINGS (settings));
frap_shortcuts_provider_reset_to_defaults (settings->priv->provider);
}
#ifdef HAVE_LIBXKLAVIER
// ########################################################################################################
static gchar *
xfce_keyboard_settings_xkb_description (XklConfigItem *config_item)
{
gchar *ci_description,
*description;
ci_description = g_strstrip (config_item->description);
if (ci_description[0] == 0)
{
description = g_strdup (config_item->name);
}
else
{
description = g_locale_to_utf8 (ci_description, -1, NULL, NULL, NULL);
}
return description;
}
static void
xfce_keyboard_settings_set_layout (XfceKeyboardSettings *settings)
{
GtkWidget *view;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *val_layout,
*val_variant,
*variants,
*layouts,
*tmp;
view = glade_xml_get_widget (settings->priv->glade_xml, "xkb_layout_view");
model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
gtk_tree_model_get_iter_first (model, &iter);
gtk_tree_model_get (model, &iter, LAYOUTS, &val_layout, VARIANTS, &val_variant, -1);
layouts = g_strdup (val_layout);
g_free (val_layout);
if (val_variant)
{
variants = g_strdup (val_variant);
g_free (val_variant);
}
else
{
variants = g_strdup ("");
}
while (gtk_tree_model_iter_next (model, &iter))
{
gtk_tree_model_get (model, &iter, LAYOUTS, &val_layout, VARIANTS, &val_variant, -1);
tmp = g_strconcat(layouts, ",", val_layout, NULL);
g_free (val_layout);
g_free (layouts);
layouts = tmp;
if (val_variant)
{
tmp = g_strconcat(variants, ",", val_variant, NULL);
g_free (val_variant);
g_free (variants);
}
else
{
tmp = g_strconcat (variants, ",", NULL);
g_free (variants);
}
variants = tmp;
}
xfconf_channel_set_string (settings->priv->keyboard_layout_channel, "/Default/XkbLayout", layouts);
xfconf_channel_set_string (settings->priv->keyboard_layout_channel, "/Default/XkbVariant", variants);
g_free(layouts);
g_free(variants);
}
static void
xfce_keyboard_settings_init_layout (XfceKeyboardSettings *settings)
{
GtkWidget *view;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *val_layout,
*val_variant,
*default_layouts,
*default_variants,
**layouts,
**layout,
**variants,
**variant;
default_layouts = g_strjoinv(",", settings->priv->xkl_rec_config->layouts);
default_variants = g_strjoinv(",", settings->priv->xkl_rec_config->variants);
val_layout = xfconf_channel_get_string (settings->priv->keyboard_layout_channel, "/Default/XkbLayout", default_layouts);
val_variant = xfconf_channel_get_string (settings->priv->keyboard_layout_channel, "/Default/XkbVariant", default_variants);
layouts = g_strsplit (val_layout, ",", 0);
variants = g_strsplit (val_variant, ",", 0);
view = glade_xml_get_widget (settings->priv->glade_xml, "xkb_layout_view");
model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
layout = layouts, variant = variants;
while (*layout && *variant)
{
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, LAYOUTS, *layout, VARIANTS, *variant, -1);
layout++;
variant++;
}
g_strfreev(layouts);
g_strfreev(variants);
g_free (default_layouts);
g_free (default_variants);
}
static void
xfce_keyboard_settings_add_model_to_combo (XklConfigRegistry *config_registry, XklConfigItem *config_item, XfceKeyboardSettings *settings)
{
GtkWidget *view;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *model_name;
model_name = xfce_keyboard_settings_xkb_description (config_item);
view = glade_xml_get_widget (settings->priv->glade_xml, "xkb_model_combo");
model = gtk_combo_box_get_model (GTK_COMBO_BOX(view));
gtk_list_store_append(GTK_LIST_STORE (model), &iter );
gtk_list_store_set(GTK_LIST_STORE (model), &iter, DESC, model_name, NOM, config_item->name, -1 );
g_free (model_name);
}
static void
xfce_keyboard_settings_init_model (XfceKeyboardSettings *settings)
{
GtkWidget *view;
GtkTreeModel *model;
GtkTreeIter iter;
gchar *id,
*xkbmodel;
gboolean item,
found;
view = glade_xml_get_widget (settings->priv->glade_xml, "xkb_model_combo");
model = gtk_combo_box_get_model (GTK_COMBO_BOX(view));
xkbmodel = xfconf_channel_get_string (settings->priv->keyboard_layout_channel, "/Default/XkbModel", settings->priv->xkl_rec_config->model);
found = FALSE;
item = gtk_tree_model_get_iter_first (model, &iter);