static void xfce_keyboard_layout_helper_init (XfceKeyboardLayoutHelper *helper) { /* init */ helper->channel = NULL; /* open the channel */ helper->channel = xfconf_channel_get ("keyboard-layout"); helper->xkb_disable_settings = xfconf_channel_get_bool (helper->channel, "/Default/XkbDisable", TRUE); #ifdef HAVE_LIBXKLAVIER /* monitor channel changes */ g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_keyboard_layout_helper_channel_property_changed), helper); helper->engine = xkl_engine_get_instance (GDK_DISPLAY ()); helper->config = xkl_config_rec_new (); xkl_config_rec_get_from_server (helper->config, helper->engine); helper->system_keyboard_model = g_strdup (helper->config->model); gdk_window_add_filter (NULL, (GdkFilterFunc) handle_xevent, helper); g_signal_connect (helper->engine, "X-new-device", G_CALLBACK (xfce_keyboard_layout_reset_xkl_config), helper); xkl_engine_start_listen (helper->engine, XKLL_TRACK_KEYBOARD_STATE); /* load settings */ xfce_keyboard_layout_helper_set_model (helper); xfce_keyboard_layout_helper_set_layout (helper); xfce_keyboard_layout_helper_set_variant (helper); xfce_keyboard_layout_helper_set_grpkey (helper); xfce_keyboard_layout_helper_set_composekey (helper); #endif /* HAVE_LIBXKLAVIER */ xfce_keyboard_layout_helper_process_xmodmap (); }
void csd_keyboard_xkb_init (CsdKeyboardManager * kbd_manager) { Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); sagarmatha_settings_profile_start (NULL); gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), DATADIR G_DIR_SEPARATOR_S "icons"); manager = kbd_manager; sagarmatha_settings_profile_start ("xkl_engine_get_instance"); xkl_engine = xkl_engine_get_instance (display); sagarmatha_settings_profile_end ("xkl_engine_get_instance"); if (xkl_engine) { inited_ok = TRUE; gkbd_desktop_config_init (¤t_config, xkl_engine); gkbd_keyboard_config_init (¤t_kbd_config, xkl_engine); xkl_engine_backup_names_prop (xkl_engine); csd_keyboard_xkb_analyze_sysconfig (); settings_desktop = g_settings_new (GKBD_DESKTOP_SCHEMA); settings_keyboard = g_settings_new (GKBD_KEYBOARD_SCHEMA); g_signal_connect (settings_desktop, "changed", (GCallback) apply_desktop_settings, NULL); g_signal_connect (settings_keyboard, "changed", (GCallback) apply_xkb_settings, NULL); gdk_window_add_filter (NULL, (GdkFilterFunc) csd_keyboard_xkb_evt_filter, NULL); if (xkl_engine_get_features (xkl_engine) & XKLF_DEVICE_DISCOVERY) g_signal_connect (xkl_engine, "X-new-device", G_CALLBACK (csd_keyboard_new_device), NULL); sagarmatha_settings_profile_start ("xkl_engine_start_listen"); xkl_engine_start_listen (xkl_engine, XKLL_MANAGE_LAYOUTS | XKLL_MANAGE_WINDOW_STATES); sagarmatha_settings_profile_end ("xkl_engine_start_listen"); sagarmatha_settings_profile_start ("apply_desktop_settings"); apply_desktop_settings (); sagarmatha_settings_profile_end ("apply_desktop_settings"); sagarmatha_settings_profile_start ("apply_xkb_settings"); apply_xkb_settings (); sagarmatha_settings_profile_end ("apply_xkb_settings"); } preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); sagarmatha_settings_profile_end (NULL); }
void cd_xkbd_init (Display *pDisplay) { myData.pEngine = xkl_engine_get_instance (pDisplay); g_return_if_fail (myData.pEngine != NULL); g_signal_connect (myData.pEngine, "X-state-changed", G_CALLBACK(_state_changed), NULL); // notification for the group, we receive nothing for the indicators... gdk_window_add_filter (NULL, (GdkFilterFunc) _filter_xevent, NULL); // should connect to all type of windows /// gdk_window_add_filter (gdk_get_default_root_window (), (GdkFilterFunc) _filter_xevent, NULL); xkl_engine_start_listen (myData.pEngine, XKLL_TRACK_KEYBOARD_STATE); cd_xkbd_force_redraw (); }
static void init_xkl (void) { if (config_registry == NULL) { engine = xkl_engine_get_instance (GDK_DISPLAY ()); config_registry = xkl_config_registry_get_instance (engine); xkl_config_registry_load (config_registry, FALSE); initial_config = xkl_config_rec_new (); if (!xkl_config_rec_get_from_server (initial_config, engine)) { g_warning ("failed to load XKB configuration"); initial_config->model = g_strdup ("pc105"); } } }
static void popup_menu_show_layout () { GtkWidget *dialog; XklEngine *engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); XklState *xkl_state = xkl_engine_get_current_state (engine); gchar **group_names = gkbd_status_get_group_names (); gpointer p = g_hash_table_lookup (preview_dialogs, GINT_TO_POINTER (xkl_state->group)); if (xkl_state->group < 0 || xkl_state->group >= g_strv_length (group_names)) { return; } if (p != NULL) { /* existing window */ gtk_window_present (GTK_WINDOW (p)); return; } if (!ensure_xkl_registry ()) return; dialog = gkbd_keyboard_drawing_dialog_new (); gkbd_keyboard_drawing_dialog_set_group (dialog, xkl_registry, xkl_state->group); g_signal_connect (dialog, "destroy", G_CALLBACK (show_layout_destroy), GINT_TO_POINTER (xkl_state->group)); g_hash_table_insert (preview_dialogs, GINT_TO_POINTER (xkl_state->group), dialog); gtk_widget_show_all (dialog); }
void gsd_keyboard_xkb_init (GConfClient * client) { gnome_settings_profile_start (NULL); #ifdef GSDKX xkl_set_debug_level (200); logfile = fopen ("/tmp/gsdkx.log", "a"); xkl_set_log_appender (gsd_keyboard_log_appender); #endif gnome_settings_profile_start ("xkl_engine_get_instance"); xkl_engine = xkl_engine_get_instance (GDK_DISPLAY ()); gnome_settings_profile_end ("xkl_engine_get_instance"); if (xkl_engine) { inited_ok = TRUE; gdm_keyboard_layout = g_getenv ("GDM_KEYBOARD_LAYOUT"); gkbd_desktop_config_init (¤t_config, client, xkl_engine); gkbd_keyboard_config_init (¤t_kbd_config, client, xkl_engine); xkl_engine_backup_names_prop (xkl_engine); gsd_keyboard_xkb_analyze_sysconfig (); gnome_settings_profile_start ("gsd_keyboard_xkb_chk_lcl_xmm"); gsd_keyboard_xkb_chk_lcl_xmm (); gnome_settings_profile_end ("gsd_keyboard_xkb_chk_lcl_xmm"); notify_desktop = register_config_callback (client, GKBD_DESKTOP_CONFIG_DIR, (GConfClientNotifyFunc) apply_desktop_settings); notify_keyboard = register_config_callback (client, GKBD_KEYBOARD_CONFIG_DIR, (GConfClientNotifyFunc) apply_xkb_settings); gdk_window_add_filter (NULL, (GdkFilterFunc) gsd_keyboard_xkb_evt_filter, NULL); if (xkl_engine_get_features (xkl_engine) & XKLF_DEVICE_DISCOVERY) g_signal_connect (xkl_engine, "X-new-device", G_CALLBACK (gsd_keyboard_new_device), NULL); gnome_settings_profile_start ("xkl_engine_start_listen"); xkl_engine_start_listen (xkl_engine, XKLL_MANAGE_LAYOUTS | XKLL_MANAGE_WINDOW_STATES); gnome_settings_profile_end ("xkl_engine_start_listen"); gnome_settings_profile_start ("apply_desktop_settings"); apply_desktop_settings (); gnome_settings_profile_end ("apply_desktop_settings"); gnome_settings_profile_start ("apply_xkb_settings"); apply_xkb_settings (); gnome_settings_profile_end ("apply_xkb_settings"); } preview_dialogs = g_hash_table_new (g_direct_hash, g_direct_equal); gnome_settings_profile_end (NULL); }
static void popup_menu_show_layout () { static GkbdKeyboardDrawingGroupLevel groupsLevels[] = { { 0, 1}, { 0, 3}, { 0, 0}, { 0, 2} }; static GkbdKeyboardDrawingGroupLevel *pGroupsLevels[] = { groupsLevels, groupsLevels + 1, groupsLevels + 2, groupsLevels + 3 }; GtkBuilder *builder; GtkWidget *dialog, *kbdraw; XkbComponentNamesRec component_names; XklConfigRec *xkl_data; GdkRectangle *rect; GError *error = NULL; XklEngine *engine = xkl_engine_get_instance (GDK_DISPLAY ()); XklState *xkl_state = xkl_engine_get_current_state (engine); gchar **group_names = gkbd_status_get_group_names (); gpointer p = g_hash_table_lookup (preview_dialogs, GINT_TO_POINTER (xkl_state->group)); if (p != NULL) { /* existing window */ gtk_window_present (GTK_WINDOW (p)); return; } builder = gtk_builder_new (); gtk_builder_add_from_file (builder, DATADIR "/show-layout.ui", &error); if (error) { g_error ("building ui from %s failed: %s", DATADIR "/show-layout.ui", error->message); g_clear_error (&error); } dialog = GTK_WIDGET (gtk_builder_get_object (builder, "gswitchit_layout_view")); kbdraw = gkbd_keyboard_drawing_new (); if (xkl_state->group >= 0 && xkl_state->group < g_strv_length (group_names)) { char title[128] = ""; snprintf (title, sizeof (title), _("Keyboard Layout \"%s\""), group_names[xkl_state->group]); gtk_window_set_title (GTK_WINDOW (dialog), title); g_object_set_data_full (G_OBJECT (dialog), "group_name", g_strdup (group_names [xkl_state->group]), g_free); } gkbd_keyboard_drawing_set_groups_levels (GKBD_KEYBOARD_DRAWING (kbdraw), pGroupsLevels); xkl_data = xkl_config_rec_new (); if (xkl_config_rec_get_from_server (xkl_data, engine)) { int num_layouts = g_strv_length (xkl_data->layouts); int num_variants = g_strv_length (xkl_data->variants); if (xkl_state->group >= 0 && xkl_state->group < num_layouts && xkl_state->group < num_variants) { char *l = g_strdup (xkl_data->layouts[xkl_state->group]); char *v = g_strdup (xkl_data->variants [xkl_state->group]); char **p; int i; if ((p = xkl_data->layouts) != NULL) for (i = num_layouts; --i >= 0;) g_free (*p++); if ((p = xkl_data->variants) != NULL) for (i = num_variants; --i >= 0;) g_free (*p++); xkl_data->layouts = g_realloc (xkl_data->layouts, sizeof (char *) * 2); xkl_data->variants = g_realloc (xkl_data->variants, sizeof (char *) * 2); xkl_data->layouts[0] = l; xkl_data->variants[0] = v; xkl_data->layouts[1] = xkl_data->variants[1] = NULL; } if (xkl_xkb_config_native_prepare (engine, xkl_data, &component_names)) { gkbd_keyboard_drawing_set_keyboard (GKBD_KEYBOARD_DRAWING (kbdraw), &component_names); xkl_xkb_config_native_cleanup (engine, &component_names); } } g_object_unref (G_OBJECT (xkl_data)); g_object_set_data (G_OBJECT (dialog), "builderData", builder); g_signal_connect (GTK_OBJECT (dialog), "destroy", G_CALLBACK (show_layout_destroy), GINT_TO_POINTER (xkl_state->group)); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (show_layout_response), NULL); rect = gkbd_preview_load_position (); if (rect != NULL) { gtk_window_move (GTK_WINDOW (dialog), rect->x, rect->y); gtk_window_resize (GTK_WINDOW (dialog), rect->width, rect->height); g_free (rect); } else gtk_window_resize (GTK_WINDOW (dialog), 700, 400); gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (builder, "preview_vbox")), kbdraw); g_object_set_data (G_OBJECT (dialog), "kbdraw", kbdraw); g_hash_table_insert (preview_dialogs, GINT_TO_POINTER (xkl_state->group), dialog); gtk_widget_show_all (GTK_WIDGET (dialog)); }
//\___________ Define here the action to be taken when the user left-clicks on your icon or on its subdock or your desklet. The icon and the container that were clicked are available through the macros CD_APPLET_CLICKED_ICON and CD_APPLET_CLICKED_CONTAINER. CD_APPLET_CLICKED_ICON may be NULL if the user clicked in the container but out of icons. CD_APPLET_ON_CLICK_BEGIN cd_xkbd_set_prev_next_group (+1); CD_APPLET_ON_CLICK_END //\___________ Define here the entries you want to add to the menu when the user right-clicks on your icon or on its subdock or your desklet. The icon and the container that were clicked are available through the macros CD_APPLET_CLICKED_ICON and CD_APPLET_CLICKED_CONTAINER. CD_APPLET_CLICKED_ICON may be NULL if the user clicked in the container but out of icons. The menu where you can add your entries is available throught the macro CD_APPLET_MY_MENU; you can add sub-menu to it if you want. static void _select_group (GtkMenuItem *menu_item, gpointer *data) { int iNumGroup = GPOINTER_TO_INT (data); cd_xkbd_set_group (iNumGroup); } CD_APPLET_ON_BUILD_MENU_BEGIN GtkWidget *pSubMenu = CD_APPLET_CREATE_MY_SUB_MENU (); CD_APPLET_ADD_ABOUT_IN_MENU (pSubMenu); const XklEngine *pEngine = xkl_engine_get_instance (cairo_dock_get_Xdisplay ()); const gchar **pGroupNames = xkl_engine_get_groups_names (pEngine); int i; for (i = 0; pGroupNames[i] != NULL && *pGroupNames[i] != '-'; i ++) { CD_APPLET_ADD_IN_MENU_WITH_DATA (pGroupNames[i], _select_group, pSubMenu, GINT_TO_POINTER (i)); } CD_APPLET_ON_BUILD_MENU_END CD_APPLET_ON_SCROLL_BEGIN cd_xkbd_set_prev_next_group (CD_APPLET_SCROLL_UP ? +1 : -1); CD_APPLET_ON_SCROLL_END
void setup_xkb_tabs (GtkBuilder * dialog) { GtkWidget *chk_new_windows_inherit_layout = WID ("chk_new_windows_inherit_layout"); xkb_general_settings = g_settings_new (XKB_GENERAL_SCHEMA); xkb_kbd_settings = g_settings_new (XKB_KBD_SCHEMA); engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); config_registry = xkl_config_registry_get_instance (engine); matekbd_desktop_config_init (&desktop_config, engine); matekbd_desktop_config_load_from_gsettings (&desktop_config); xkl_config_registry_load (config_registry, desktop_config.load_extra_items); matekbd_keyboard_config_init (&initial_config, engine); matekbd_keyboard_config_load_from_x_initial (&initial_config, NULL); setup_model_entry (dialog); g_settings_bind (xkb_general_settings, "group-per-window", WID ("chk_separate_group_per_window"), "active", G_SETTINGS_BIND_DEFAULT); g_signal_connect (xkb_general_settings, "changed::group-per-window", G_CALLBACK (chk_separate_group_per_window_toggled), dialog); #ifdef HAVE_X11_EXTENSIONS_XKB_H if (strcmp (xkl_engine_get_backend_name (engine), "XKB")) #endif gtk_widget_hide (WID ("xkb_layouts_print")); xkb_layouts_prepare_selected_tree (dialog); xkb_layouts_fill_selected_tree (dialog); gtk_widget_set_sensitive (chk_new_windows_inherit_layout, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("chk_separate_group_per_window")))); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_new_windows_inherit_layout), xkb_get_default_group () < 0); xkb_layouts_register_buttons_handlers (dialog); g_signal_connect (G_OBJECT (WID ("xkb_reset_to_defaults")), "clicked", G_CALLBACK (reset_to_defaults), dialog); g_signal_connect (G_OBJECT (chk_new_windows_inherit_layout), "toggled", (GCallback) chk_new_windows_inherit_layout_toggled, dialog); g_signal_connect_swapped (G_OBJECT (WID ("xkb_layout_options")), "clicked", G_CALLBACK (xkb_options_popup_dialog), dialog); g_signal_connect_swapped (G_OBJECT (WID ("xkb_model_pick")), "clicked", G_CALLBACK (choose_model), dialog); xkb_layouts_register_gsettings_listener (dialog); xkb_options_register_gsettings_listener (dialog); g_signal_connect (G_OBJECT (WID ("keyboard_dialog")), "destroy", G_CALLBACK (cleanup_xkb_tabs), dialog); enable_disable_restoring (dialog); }
void setup_xkb_tabs (GtkBuilder * dialog) { GtkWidget *widget; GtkStyleContext *context; GtkWidget *chk_new_windows_inherit_layout; chk_new_windows_inherit_layout = WID ("chk_new_windows_inherit_layout"); xkb_desktop_settings = g_settings_new (GKBD_DESKTOP_SCHEMA); xkb_keyboard_settings = g_settings_new (GKBD_KEYBOARD_SCHEMA); engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); config_registry = xkl_config_registry_get_instance (engine); gkbd_desktop_config_init (&desktop_config, engine); gkbd_desktop_config_load (&desktop_config); xkl_config_registry_load (config_registry, desktop_config.load_extra_items); gkbd_keyboard_config_init (&initial_config, engine); gkbd_keyboard_config_load_from_x_initial (&initial_config, NULL); /* Set initial state */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("chk_separate_group_per_window")), g_settings_get_boolean (xkb_desktop_settings, GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_new_windows_inherit_layout), xkb_get_default_group () < 0); g_settings_bind (xkb_desktop_settings, GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, WID ("chk_separate_group_per_window"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (xkb_desktop_settings, GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, WID ("chk_new_windows_inherit_layout"), "sensitive", G_SETTINGS_BIND_DEFAULT); g_settings_bind (xkb_desktop_settings, GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, WID ("chk_new_windows_default_layout"), "sensitive", G_SETTINGS_BIND_DEFAULT); xkb_layouts_prepare_selected_tree (dialog); xkb_layouts_fill_selected_tree (dialog); xkb_layouts_register_buttons_handlers (dialog); g_signal_connect (G_OBJECT (WID ("xkb_reset_to_defaults")), "clicked", G_CALLBACK (reset_to_defaults), dialog); g_signal_connect (G_OBJECT (chk_new_windows_inherit_layout), "toggled", G_CALLBACK (chk_new_windows_inherit_layout_toggled), dialog); g_signal_connect_swapped (G_OBJECT (WID ("xkb_layout_options")), "clicked", G_CALLBACK (xkb_options_popup_dialog), dialog); xkb_layouts_register_conf_listener (dialog); xkb_options_register_conf_listener (dialog); g_object_weak_ref (G_OBJECT (WID ("region_notebook")), (GWeakNotify) cleanup_xkb_tabs, dialog); enable_disable_restoring (dialog); /* Setup junction between toolbar and treeview */ widget = WID ("xkb_layouts_swindow"); context = gtk_widget_get_style_context (widget); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM); widget = WID ("layouts-toolbar"); context = gtk_widget_get_style_context (widget); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); }
int main (int argc, char **argv) { MatekbdIndicatorPluginsCapplet gipc; GError *mateconf_error = NULL; MateConfClient *confClient; bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); memset (&gipc, 0, sizeof (gipc)); gtk_init_with_args (&argc, &argv, "matekbd", NULL, NULL, NULL); if (!mateconf_init (argc, argv, &mateconf_error)) { g_warning (_("Failed to init MateConf: %s\n"), mateconf_error->message); g_error_free (mateconf_error); return 1; } mateconf_error = NULL; /*MatekbdIndicatorInstallGlibLogAppender( ); */ gipc.engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); gipc.config_registry = xkl_config_registry_get_instance (gipc.engine); confClient = mateconf_client_get_default (); matekbd_indicator_plugin_container_init (&gipc.plugin_container, confClient); g_object_unref (confClient); matekbd_keyboard_config_init (&gipc.kbd_cfg, confClient, gipc.engine); matekbd_keyboard_config_init (&initialSysKbdConfig, confClient, gipc.engine); matekbd_indicator_config_init (&gipc.applet_cfg, confClient, gipc.engine); matekbd_indicator_plugin_manager_init (&gipc.plugin_manager); matekbd_keyboard_config_load_from_x_initial (&initialSysKbdConfig, NULL); matekbd_keyboard_config_load_from_mateconf (&gipc.kbd_cfg, &initialSysKbdConfig); matekbd_indicator_config_load_from_mateconf (&gipc.applet_cfg); loop = g_main_loop_new (NULL, TRUE); CappletSetup (&gipc); g_main_loop_run (loop); matekbd_indicator_plugin_manager_term (&gipc.plugin_manager); matekbd_indicator_config_term (&gipc.applet_cfg); matekbd_keyboard_config_term (&gipc.kbd_cfg); matekbd_keyboard_config_term (&initialSysKbdConfig); matekbd_indicator_plugin_container_term (&gipc.plugin_container); g_object_unref (G_OBJECT (gipc.config_registry)); g_object_unref (G_OBJECT (gipc.engine)); return 0; }
void setup_xkb_tabs (GtkBuilder * dialog, MateConfChangeSet * changeset) { GObject *peditor; GtkWidget *chk_new_windows_inherit_layout = WID ("chk_new_windows_inherit_layout"); xkb_mateconf_client = mateconf_client_get_default (); engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY(gdk_display_get_default())); config_registry = xkl_config_registry_get_instance (engine); matekbd_desktop_config_init (&desktop_config, xkb_mateconf_client, engine); matekbd_desktop_config_load_from_mateconf (&desktop_config); xkl_config_registry_load (config_registry, desktop_config.load_extra_items); matekbd_keyboard_config_init (&initial_config, xkb_mateconf_client, engine); matekbd_keyboard_config_load_from_x_initial (&initial_config, NULL); setup_model_entry (dialog); peditor = mateconf_peditor_new_boolean (changeset, (gchar *) MATEKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, WID ("chk_separate_group_per_window"), NULL); g_signal_connect (peditor, "value-changed", (GCallback) chk_separate_group_per_window_toggled, dialog); #ifdef HAVE_X11_EXTENSIONS_XKB_H if (strcmp (xkl_engine_get_backend_name (engine), "XKB")) #endif gtk_widget_hide (WID ("xkb_layouts_print")); xkb_layouts_prepare_selected_tree (dialog, changeset); xkb_layouts_fill_selected_tree (dialog); gtk_widget_set_sensitive (chk_new_windows_inherit_layout, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("chk_separate_group_per_window")))); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (chk_new_windows_inherit_layout), xkb_get_default_group () < 0); xkb_layouts_register_buttons_handlers (dialog); g_signal_connect (G_OBJECT (WID ("xkb_reset_to_defaults")), "clicked", G_CALLBACK (reset_to_defaults), dialog); g_signal_connect (G_OBJECT (chk_new_windows_inherit_layout), "toggled", (GCallback) chk_new_windows_inherit_layout_toggled, dialog); g_signal_connect_swapped (G_OBJECT (WID ("xkb_layout_options")), "clicked", G_CALLBACK (xkb_options_popup_dialog), dialog); g_signal_connect_swapped (G_OBJECT (WID ("xkb_model_pick")), "clicked", G_CALLBACK (choose_model), dialog); xkb_layouts_register_mateconf_listener (dialog); xkb_options_register_mateconf_listener (dialog); g_signal_connect (G_OBJECT (WID ("keyboard_dialog")), "destroy", G_CALLBACK (cleanup_xkb_tabs), dialog); enable_disable_restoring (dialog); }