diff -ru ./xkborig/panel-plugin/xfce4-xkb-plugin.c ./xkb/panel-plugin/xfce4-xkb-plugin.c --- ./xkborig/panel-plugin/xfce4-xkb-plugin.c 2011-11-04 20:55:59.000000000 +0600 +++ ./xkb/panel-plugin/xfce4-xkb-plugin.c 2013-02-21 01:26:04.193033554 +0600 @@ -276,6 +276,10 @@ xfce_rc_write_entry (rcfile, "toggle_option", ""); else xfce_rc_write_entry (rcfile, "toggle_option", xkb->settings->kbd_config->toggle_option); + if (xkb->settings->kbd_config->indicator_option == NULL) + xfce_rc_write_entry (rcfile, "indicator_option", ""); + else xfce_rc_write_entry (rcfile, "indicator_option", xkb->settings->kbd_config->indicator_option); + if (xkb->settings->kbd_config->compose_key_position == NULL) xfce_rc_write_entry (rcfile, "compose_key_position", ""); else xfce_rc_write_entry (rcfile, "compose_key_position", xkb->settings->kbd_config->compose_key_position); @@ -312,6 +316,7 @@ xkb->settings->kbd_config->layouts = g_strdup (xfce_rc_read_entry (rcfile, "layouts", NULL)); xkb->settings->kbd_config->variants = g_strdup (xfce_rc_read_entry (rcfile, "variants", NULL)); xkb->settings->kbd_config->toggle_option = g_strdup (xfce_rc_read_entry (rcfile, "toggle_option", NULL)); + xkb->settings->kbd_config->indicator_option = g_strdup (xfce_rc_read_entry (rcfile, "indicator_option", NULL)); xkb->settings->kbd_config->compose_key_position = g_strdup (xfce_rc_read_entry (rcfile, "compose_key_position", NULL)); xfce_rc_close (rcfile); diff -ru ./xkborig/panel-plugin/xfce4-xkb-plugin.h ./xkb/panel-plugin/xfce4-xkb-plugin.h --- ./xkborig/panel-plugin/xfce4-xkb-plugin.h 2011-11-04 20:55:59.000000000 +0600 +++ ./xkb/panel-plugin/xfce4-xkb-plugin.h 2013-02-21 00:52:45.940949333 +0600 @@ -80,6 +80,9 @@ GtkWidget *toggle_options_combo; GtkListStore *toggle_options_store; + GtkWidget *indicator_options_combo; + GtkListStore *indicator_options_store; + GtkWidget *compose_key_options_combo; GtkListStore *compose_key_options_store; diff -ru ./xkborig/panel-plugin/xkb-config.c ./xkb/panel-plugin/xkb-config.c --- ./xkborig/panel-plugin/xkb-config.c 2012-01-07 03:47:37.000000000 +0600 +++ ./xkb/panel-plugin/xkb-config.c 2013-02-21 23:02:52.328330433 +0600 @@ -197,6 +197,7 @@ g_free (kbd_config->layouts); g_free (kbd_config->variants); g_free (kbd_config->toggle_option); + g_free (kbd_config->indicator_option); g_free (kbd_config->compose_key_position); g_free (kbd_config); @@ -356,6 +357,11 @@ options = g_strdup (settings->kbd_config->toggle_option); else options = g_strdup (""); +/* if (settings->kbd_config->indicator_option + && strlen (settings->kbd_config->indicator_option) > 0) + options = g_strdup (settings->kbd_config->indicator_option); + else options = g_strdup ("");*/ + if (settings->kbd_config->compose_key_position && strlen (settings->kbd_config->compose_key_position) > 0) { diff -ru ./xkborig/panel-plugin/xkb-config.h ./xkb/panel-plugin/xkb-config.h --- ./xkborig/panel-plugin/xkb-config.h 2011-10-15 18:41:34.000000000 +0600 +++ ./xkb/panel-plugin/xkb-config.h 2013-02-21 01:19:32.441016969 +0600 @@ -47,6 +47,7 @@ gchar* layouts; gchar* variants; gchar* toggle_option; + gchar* indicator_option; gchar* compose_key_position; } t_xkb_kbd_config; diff -ru ./xkborig/panel-plugin/xkb-settings-dialog.c ./xkb/panel-plugin/xkb-settings-dialog.c --- ./xkborig/panel-plugin/xkb-settings-dialog.c 2011-11-04 20:55:59.000000000 +0600 +++ ./xkb/panel-plugin/xkb-settings-dialog.c 2013-02-21 22:58:14.624329489 +0600 @@ -164,6 +164,32 @@ } static void +xkb_settings_add_indicator_options_to_list (XklConfigRegistry * config_registry, + XklConfigItem * config_item, + t_xkb *xkb) +{ + GtkTreeIter iter; + char *utf_option_name; + + /* add a possibility to set no keyboard indicator for a layout combination */ + if (config_item == NULL) + { + gtk_list_store_append (xkb->indicator_options_store, &iter); + gtk_list_store_set (xkb->indicator_options_store, &iter, + DESC, "-", + NOM, "", -1); + return; + } + + utf_option_name = xci_desc_to_utf8 (config_item); + gtk_list_store_append (xkb->indicator_options_store, &iter); + gtk_list_store_set (xkb->indicator_options_store, &iter, + DESC, utf_option_name, + NOM, config_item->name, -1); + g_free (utf_option_name); +} + +static void xkb_settings_add_compose_key_position_options_to_list (XklConfigRegistry * config_registry, XklConfigItem * config_item, t_xkb *xkb) @@ -248,6 +274,50 @@ } static void +xkb_settings_set_indicator_option_combo_default_value (t_xkb *xkb) +{ + GtkTreeModel *model; + GtkTreeIter iter; + gchar *id; + + t_xkb_kbd_config *config = xkb->settings->kbd_config; + + model = GTK_TREE_MODEL (xkb->indicator_options_store); + if (!gtk_tree_model_get_iter_first (model, &iter)) + return; + + gtk_tree_model_get (model, &iter, NOM, &id, -1); + + if (config->indicator_option == NULL) + { + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (xkb->indicator_options_combo), &iter); + g_free (id); + return; + } + + if (strcmp (id, config->indicator_option) == 0) + { + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (xkb->indicator_options_combo), &iter); + } + else + { + while (gtk_tree_model_iter_next(model, &iter)) + { + g_free (id); + gtk_tree_model_get (model, &iter, NOM, &id, -1); + + if (strcmp (id, config->indicator_option) == 0) + { + gtk_combo_box_set_active_iter (GTK_COMBO_BOX (xkb->indicator_options_combo), &iter); + break; + } + } + } + + g_free (id); +} + +static void xkb_settings_set_compose_key_position_combo_default_value (t_xkb *xkb) { GtkTreeModel *model; @@ -528,6 +598,7 @@ xkb->combo_store = gtk_list_store_new (COMBO_NUM, G_TYPE_STRING, G_TYPE_STRING); xkb->toggle_options_store = gtk_list_store_new (COMBO_NUM, G_TYPE_STRING, G_TYPE_STRING); + xkb->indicator_options_store = gtk_list_store_new (COMBO_NUM, G_TYPE_STRING, G_TYPE_STRING); xkb->compose_key_options_store = gtk_list_store_new (COMBO_NUM, G_TYPE_STRING, G_TYPE_STRING); vbox1 = gtk_vbox_new (FALSE, 5); @@ -584,6 +655,32 @@ g_object_set (G_OBJECT (xkb->toggle_options_combo), "has-tooltip", TRUE, NULL); g_signal_connect (xkb->toggle_options_combo, "query-tooltip", G_CALLBACK (xkb_settings_config_modification_disabled_tooltip), xkb); + /* keyboard indicator option */ + frame = xfce_gtk_frame_box_new (_("Change keyboard indicator option:"), &bin); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); + gtk_widget_show (frame); + gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); + + xkb->indicator_options_combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (xkb->indicator_options_store)); + gtk_widget_set_size_request (xkb->indicator_options_combo, 230, -1); + gtk_container_add (GTK_CONTAINER (bin), xkb->indicator_options_combo); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (xkb->indicator_options_combo), renderer, TRUE); + gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (xkb->indicator_options_combo), renderer, "text", 0); + xkb_settings_add_indicator_options_to_list (NULL, NULL, xkb); + xkl_config_registry_foreach_option (registry, + "grp_led", + (ConfigItemProcessFunc) xkb_settings_add_indicator_options_to_list, + xkb); + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (xkb->indicator_options_store), + 0, GTK_SORT_ASCENDING); + + xkb_settings_set_indicator_option_combo_default_value (xkb); + gtk_widget_show (xkb->indicator_options_combo); + + gtk_widget_set_sensitive (GTK_WIDGET (xkb->indicator_options_combo), !xkb->settings->never_modify_config); + g_object_set (G_OBJECT (xkb->indicator_options_combo), "has-tooltip", TRUE, NULL); + g_signal_connect (xkb->indicator_options_combo, "query-tooltip", G_CALLBACK (xkb_settings_config_modification_disabled_tooltip), xkb); + /* compose key position option */ frame = xfce_gtk_frame_box_new (_("Compose key position:"), &bin); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); @@ -925,7 +1022,7 @@ xkb_settings_update_from_ui (t_xkb *xkb) { GtkTreeModel *model; - gchar *layouts, *variants, *kbdmodel, *toggle_option, + gchar *layouts, *variants, *kbdmodel, *toggle_option, *indicator_option, *compose_key_position; t_xkb_kbd_config *kbd_config = xkb->settings->kbd_config; GtkTreeIter iter; @@ -952,6 +1049,18 @@ g_free (toggle_option); } + model = GTK_TREE_MODEL (xkb->indicator_options_store); + if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (xkb->indicator_options_combo), &iter)) + { + gtk_tree_model_get (model, &iter, NOM, &indicator_option, -1); + g_free (kbd_config->indicator_option); + if (strcmp ("", indicator_option) == 0) + kbd_config->indicator_option = NULL; + else kbd_config->indicator_option = g_strdup (indicator_option); + + g_free (indicator_option); + } + model = GTK_TREE_MODEL (xkb->compose_key_options_store); if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (xkb->compose_key_options_combo), &iter)) { diff -ru ./xkborig/po/ru.po ./xkb/po/ru.po --- ./xkborig/po/ru.po 2012-01-07 03:53:52.000000000 +0600 +++ ./xkb/po/ru.po 2013-02-21 01:31:25.157047029 +0600 @@ -44,6 +44,11 @@ msgid "Change layout option:" msgstr "Переключение раскладки:" +#. keyboard indicator option +#: ../panel-plugin/xkb-settings-dialog.c:587 +msgid "Change keyboard indicator option:" +msgstr "Индикатор раскладки на клавиатуре:" + #. compose key position option #: ../panel-plugin/xkb-settings-dialog.c:588 msgid "Compose key position:"