Index: ChangeLog =================================================================== RCS file: /cvs/gnome/gnome-control-center/ChangeLog,v retrieving revision 1.708 diff -u -p -r1.708 ChangeLog --- ChangeLog 13 Jul 2005 21:51:44 -0000 1.708 +++ ChangeLog 15 Jul 2005 16:21:29 -0000 @@ -0,0 +1,8 @@ +2005-07-15 Mark McLoughlin + + See bug #310513 + + * schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in: + Deprecate the overrideSettings key and make the keys unset + by default (we want to use the XKB settings by default) + Index: capplets/keyboard/ChangeLog =================================================================== RCS file: /cvs/gnome/gnome-control-center/capplets/keyboard/ChangeLog,v retrieving revision 1.133 diff -u -p -r1.133 ChangeLog --- capplets/keyboard/ChangeLog 22 May 2005 16:48:37 -0000 1.133 +++ capplets/keyboard/ChangeLog 15 Jul 2005 16:21:31 -0000 @@ -0,0 +1,26 @@ +2005-07-15 Mark McLoughlin + + Re-work the way some of the XKB GConf keys are handled. + See bug #310513 + + * gnome-keyboard-properties-xkb.c: + (set_model_text), (model_key_changed), (setup_model_entry), + (setup_xkb_tabs): make the "model" entry not be a peditor + to we can correctly display the XKB default if the GConf + key is unset. + (enable_disable_restoring): update for API change. + (reset_to_defaults): reset to defaults by unsetting the + GConf keys rather than setting overrideSettings to true. + + * gnome-keyboard-properties-xkblt.c: + (xkb_layouts_get_selected_list): if the "layouts" key is unset, + use the layouts list from the XKB defaults. + + * gnome-keyboard-properties-xkbot.c: + (xkb_options_get_selected_list): ditto for the "options" key. + + * gnome-keyboard-properties-xkb.h: include gswitchit_config.h, + declare xkb_options_load_options to avoid warnings, make + xkb_(layouts|options)_get_selected_list() functions instead + of macros. + Index: capplets/keyboard/gnome-keyboard-properties-xkb.c =================================================================== RCS file: /cvs/gnome/gnome-control-center/capplets/keyboard/gnome-keyboard-properties-xkb.c,v retrieving revision 1.22 diff -u -p -r1.22 gnome-keyboard-properties-xkb.c --- capplets/keyboard/gnome-keyboard-properties-xkb.c 8 Feb 2005 22:42:10 -0000 1.22 +++ capplets/keyboard/gnome-keyboard-properties-xkb.c 15 Jul 2005 16:21:31 -0000 @@ -40,7 +40,7 @@ #include "gnome-keyboard-properties-xkb.h" -static GSwitchItKbdConfig initialConfig; +GSwitchItKbdConfig initialConfig; GConfClient *xkbGConfClient; @@ -52,50 +52,67 @@ xci_desc_to_utf8 (XklConfigItem * ci) g_locale_to_utf8 (sd, -1, NULL, NULL, NULL); } -static GConfValue * -model_from_widget (GConfPropertyEditor * peditor, GConfValue * value) +static void +set_model_text (GtkWidget * entry, + GConfValue * value) { - GConfValue *new_value; + XklConfigItem ci; + const char * model = NULL; + + if (value != NULL && value->type == GCONF_VALUE_STRING) + { + model = gconf_value_get_string (value); + if (model != NULL && model[0] == '\0') + model = NULL; + } + + if (model == NULL) + model = initialConfig.model; - new_value = gconf_value_new (GCONF_VALUE_STRING); + g_snprintf (ci.name, sizeof (ci.name), "%s", model); - if (value->type == GCONF_VALUE_STRING) + if (XklConfigFindModel (&ci)) { - GObject* widget = gconf_property_editor_get_ui_control(peditor); - gchar* n = g_object_get_data (widget, "xkbModelName"); - gconf_value_set_string (new_value, n); + char * d; + + d = xci_desc_to_utf8 (&ci); + gtk_entry_set_text (GTK_ENTRY (entry), d); + g_free (d); } else - gconf_value_set_string (new_value, _("Unknown")); - - return new_value; + { + gtk_entry_set_text (GTK_ENTRY (entry), _("Unknown")); + } } -static GConfValue * -model_to_widget (GConfPropertyEditor * peditor, GConfValue * value) +static void +model_key_changed (GConfClient * client, + guint cnxn_id, + GConfEntry * entry, + GladeXML * dialog) { - GConfValue *new_value; + set_model_text (WID ("xkb_model"), + gconf_entry_get_value (entry)); - new_value = gconf_value_new (GCONF_VALUE_STRING); + enable_disable_restoring (dialog); +} - if (value->type == GCONF_VALUE_STRING) - { - XklConfigItem ci; - g_snprintf( ci.name, sizeof (ci.name), "%s", gconf_value_get_string( value ) ); - if ( XklConfigFindModel( &ci ) ) - { - GObject* widget = gconf_property_editor_get_ui_control(peditor); - gchar* d = xci_desc_to_utf8 (&ci); - - g_object_set_data_full (widget, "xkbModelName", g_strdup (ci.name), g_free); - gconf_value_set_string (new_value, d); - g_free (d); - } - else - gconf_value_set_string (new_value, _("Unknown")); - } +static void +setup_model_entry (GladeXML * dialog) +{ + GConfValue * value; - return new_value; + value = gconf_client_get (xkbGConfClient, + GSWITCHIT_KBD_CONFIG_KEY_MODEL, + NULL); + set_model_text (WID ("xkb_model"), value); + if (value != NULL) + gconf_value_free (value); + + gconf_client_notify_add (xkbGConfClient, + GSWITCHIT_KBD_CONFIG_KEY_MODEL, + (GConfClientNotifyFunc) model_key_changed, + dialog, NULL, NULL); } static void @@ -112,17 +129,14 @@ cleanup_xkb_tabs (GladeXML * dialog) static void reset_to_defaults (GtkWidget * button, GladeXML * dialog) { - gconf_client_set_bool (xkbGConfClient, - GSWITCHIT_KBD_CONFIG_KEY_OVERRIDE_SETTINGS, - TRUE, NULL); - /* all the rest is g-s-d's business */ -} + GSwitchItKbdConfig emptyKbdConfig; -static void -update_model (GConfClient * client, - guint cnxn_id, GConfEntry * entry, GladeXML * dialog) -{ - enable_disable_restoring (dialog); + GSwitchItKbdConfigInit (&emptyKbdConfig, xkbGConfClient); + GSwitchItKbdConfigSaveToGConfBackup (&emptyKbdConfig); + GSwitchItKbdConfigSaveToGConf (&emptyKbdConfig); + GSwitchItKbdConfigTerm (&emptyKbdConfig); + + /* all the rest is g-s-d's business */ } static void @@ -144,11 +158,10 @@ setup_xkb_tabs (GladeXML * dialog, GConf XklConfigInit (); XklConfigLoadRegistry (); - gconf_peditor_new_string - (changeset, (gchar *) GSWITCHIT_KBD_CONFIG_KEY_MODEL, - WID ("xkb_model"), - "conv-to-widget-cb", model_to_widget, - "conv-from-widget-cb", model_from_widget, NULL); + GSwitchItKbdConfigInit (&initialConfig, xkbGConfClient); + GSwitchItKbdConfigLoadFromXInitial (&initialConfig); + + setup_model_entry (dialog); peditor = gconf_peditor_new_boolean (changeset, (gchar *) GSWITCHIT_CONFIG_KEY_GROUP_PER_WINDOW, @@ -177,14 +190,6 @@ setup_xkb_tabs (GladeXML * dialog, GConf g_signal_connect (G_OBJECT (WID ("keyboard_dialog")), "destroy", G_CALLBACK (cleanup_xkb_tabs), dialog); - gconf_client_notify_add (xkbGConfClient, - GSWITCHIT_KBD_CONFIG_KEY_MODEL, - (GConfClientNotifyFunc) - update_model, dialog, NULL, NULL); - - GSwitchItKbdConfigInit (&initialConfig, xkbGConfClient); - GSwitchItKbdConfigLoadFromXInitial (&initialConfig); - enable_disable_restoring (dialog); xkb_layouts_enable_disable_default (dialog, gconf_client_get_bool (xkbGConfClient, @@ -199,7 +204,7 @@ enable_disable_restoring (GladeXML * dia gboolean enable; GSwitchItKbdConfigInit (&gswic, xkbGConfClient); - GSwitchItKbdConfigLoadFromGConf (&gswic); + GSwitchItKbdConfigLoadFromGConf (&gswic, NULL); enable = !GSwitchItKbdConfigEquals (&gswic, &initialConfig); Index: capplets/keyboard/gnome-keyboard-properties-xkb.h =================================================================== RCS file: /cvs/gnome/gnome-control-center/capplets/keyboard/gnome-keyboard-properties-xkb.h,v retrieving revision 1.13 diff -u -p -r1.13 gnome-keyboard-properties-xkb.h --- capplets/keyboard/gnome-keyboard-properties-xkb.h 2 Jan 2005 01:59:28 -0000 1.13 +++ capplets/keyboard/gnome-keyboard-properties-xkb.h 15 Jul 2005 16:21:31 -0000 @@ -27,6 +27,8 @@ #include #include +#include "libgswitchit/gswitchit_config.h" + G_BEGIN_DECLS #define SEL_LAYOUT_TREE_COL_DESCRIPTION 0 @@ -39,6 +41,7 @@ G_BEGIN_DECLS #define CWID(s) glade_xml_get_widget (chooserDialog, s) extern GConfClient *xkbGConfClient; +extern GSwitchItKbdConfig initialConfig; extern void setup_xkb_tabs (GladeXML * dialog, GConfChangeSet * changeset); @@ -64,6 +67,8 @@ extern void xkb_layouts_prepare_selected extern void xkb_options_prepare_selected_tree (GladeXML * dialog); +extern void xkb_options_load_options (GladeXML * dialog); + extern void clear_xkb_elements_list (GSList * list); extern char *xci_desc_to_utf8 (XklConfigItem * ci); @@ -81,20 +86,13 @@ extern void xkb_layout_choose (GladeXML extern void xkb_layouts_enable_disable_default (GladeXML * dialog, gboolean enable); -#define xkb_layouts_get_selected_list() \ - gconf_client_get_list (gconf_client_get_default (), \ - GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS, \ - GCONF_VALUE_STRING, NULL) +extern GSList *xkb_layouts_get_selected_list (void); +extern GSList *xkb_options_get_selected_list (void); #define xkb_layouts_set_selected_list(list) \ gconf_client_set_list (gconf_client_get_default (), \ GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS, \ GCONF_VALUE_STRING, (list), NULL) - -#define xkb_options_get_selected_list() \ - gconf_client_get_list (gconf_client_get_default (), \ - GSWITCHIT_KBD_CONFIG_KEY_OPTIONS, \ - GCONF_VALUE_STRING, NULL) #define xkb_options_set_selected_list(list) \ gconf_client_set_list (gconf_client_get_default (), \ Index: capplets/keyboard/gnome-keyboard-properties-xkblt.c =================================================================== RCS file: /cvs/gnome/gnome-control-center/capplets/keyboard/gnome-keyboard-properties-xkblt.c,v retrieving revision 1.15 diff -u -p -r1.15 gnome-keyboard-properties-xkblt.c --- capplets/keyboard/gnome-keyboard-properties-xkblt.c 8 Feb 2005 22:42:10 -0000 1.15 +++ capplets/keyboard/gnome-keyboard-properties-xkblt.c 15 Jul 2005 16:21:31 -0000 @@ -65,6 +65,28 @@ clear_xkb_elements_list (GSList * list) } } +GSList * +xkb_layouts_get_selected_list (void) +{ + GSList *retval; + + retval = gconf_client_get_list (xkbGConfClient, + GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS, + GCONF_VALUE_STRING, + NULL); + if (retval == NULL) + { + GSList *curLayout; + + for (curLayout = initialConfig.layouts; curLayout != NULL; curLayout = curLayout->next) + retval = g_slist_prepend (retval, g_strdup (curLayout->data)); + + retval = g_slist_reverse (retval); + } + + return retval; +} + static void save_default_group (int aDefaultGroup) { Index: capplets/keyboard/gnome-keyboard-properties-xkbot.c =================================================================== RCS file: /cvs/gnome/gnome-control-center/capplets/keyboard/gnome-keyboard-properties-xkbot.c,v retrieving revision 1.9 diff -u -p -r1.9 gnome-keyboard-properties-xkbot.c --- capplets/keyboard/gnome-keyboard-properties-xkbot.c 22 May 2005 16:48:37 -0000 1.9 +++ capplets/keyboard/gnome-keyboard-properties-xkbot.c 15 Jul 2005 16:21:31 -0000 @@ -51,6 +51,28 @@ static GSList *currentRadioGroup = NULL; #define GCONFSTATE_PROP "gconfState" #define EXPANDERS_PROP "expandersList" +GSList * +xkb_options_get_selected_list (void) +{ + GSList *retval; + + retval = gconf_client_get_list (xkbGConfClient, + GSWITCHIT_KBD_CONFIG_KEY_OPTIONS, + GCONF_VALUE_STRING, + NULL); + if (retval == NULL) + { + GSList *curOption; + + for (curOption = initialConfig.options; curOption != NULL; curOption = curOption->next) + retval = g_slist_prepend (retval, g_strdup (curOption->data)); + + retval = g_slist_reverse (retval); + } + + return retval; +} + static GtkWidget * xkb_options_get_expander (GtkWidget * option_button) { Index: gnome-settings-daemon/ChangeLog =================================================================== RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/ChangeLog,v retrieving revision 1.185 diff -u -p -r1.185 ChangeLog --- gnome-settings-daemon/ChangeLog 12 Jul 2005 10:23:17 -0000 1.185 +++ gnome-settings-daemon/ChangeLog 15 Jul 2005 16:21:33 -0000 @@ -0,0 +1,22 @@ +2005-07-15 Mark McLoughlin + + Change the way XKB GConf preferences are handled so that: + 1) GConf keys are never written unless the user changes + the preferences + 2) If the keys are unset, the default XKB settings are + used + + See bug #310513 + + * gnome-settings-keyboard-xkb.c: + (apply_xkb_settings): use the default XKB settings for + any unset GConf keys, and only save a copy of the default + XKB config to GConf when we're actually apply a config + that is different from the default. + (gnome_settings_keyboard_xkb_sysconfig_changed_response): + If the user decides to go back to the default XKB settings, + just unset the GConf keys. + (gnome_settings_keyboard_xkb_analyze_sysconfig): ignore + overrideSettings and don't save a back of the XKB defaults + at startup. + Index: gnome-settings-daemon/gnome-settings-keyboard-xkb.c =================================================================== RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/gnome-settings-keyboard-xkb.c,v retrieving revision 1.30 diff -u -p -r1.30 gnome-settings-keyboard-xkb.c --- gnome-settings-daemon/gnome-settings-keyboard-xkb.c 22 May 2005 15:46:43 -0000 1.30 +++ gnome-settings-daemon/gnome-settings-keyboard-xkb.c 15 Jul 2005 16:21:33 -0000 @@ -150,28 +150,22 @@ apply_xkb_settings (void) GSwitchItKbdConfigInit (¤tSysKbdConfig, confClient); g_object_unref (confClient); - GSwitchItKbdConfigLoadFromGConf (¤tKbdConfig); + GSwitchItKbdConfigLoadFromGConf (¤tKbdConfig, &initialSysKbdConfig); - if (currentKbdConfig.overrideSettings) { - /* initialization - from the system settings */ - GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig); - } else { - GSwitchItKbdConfigLoadFromXCurrent (¤tSysKbdConfig); - /* Activate - only if different! */ - if (!GSwitchItKbdConfigEquals (¤tKbdConfig, ¤tSysKbdConfig)) - { - if (GSwitchItKbdConfigActivate (¤tKbdConfig)) { - if (paCallback != NULL) { - (*paCallback) (paCallbackUserData); - } - } else { - g_warning - ("Could not activate the XKB configuration"); - activation_error (); + GSwitchItKbdConfigLoadFromXCurrent (¤tSysKbdConfig); + /* Activate - only if different! */ + if (!GSwitchItKbdConfigEquals (¤tKbdConfig, ¤tSysKbdConfig)) { + if (GSwitchItKbdConfigActivate (¤tKbdConfig)) { + GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig); + if (paCallback != NULL) { + (*paCallback) (paCallbackUserData); } - } else - XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n"); - } + } else { + g_warning ("Could not activate the XKB configuration"); + activation_error (); + } + } else + XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n"); GSwitchItKbdConfigTerm (¤tSysKbdConfig); } @@ -181,25 +175,29 @@ gnome_settings_keyboard_xkb_sysconfig_ch SysConfigChangedMsgResponse what2do) { + GConfClient *confClient; + GSwitchItKbdConfig emptyKbdConfig; gboolean dontShowAgain = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (dialog), "chkDontShowAgain"))); + confClient = gconf_client_get_default (); + switch (what2do) { case RESPONSE_USE_X: - GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig); + GSwitchItKbdConfigInit (&emptyKbdConfig, confClient); + GSwitchItKbdConfigSaveToGConf (&emptyKbdConfig); break; case RESPONSE_USE_GNOME: /* Do absolutely nothing - just keep things the way they are */ break; } - if (dontShowAgain) { - GConfClient *confClient; - confClient = gconf_client_get_default (); + if (dontShowAgain) gconf_client_set_bool (confClient, DISABLE_SYSCONF_CHANGED_WARNING_KEY, TRUE, NULL); - g_object_unref (confClient); - } + gtk_widget_destroy (GTK_WIDGET (dialog)); + + g_object_unref (confClient); } static void @@ -218,7 +216,6 @@ gnome_settings_keyboard_xkb_analyze_sysc g_object_unref (confClient); GSwitchItKbdConfigLoadFromGConfBackup (&backupGConfKbdConfig); GSwitchItKbdConfigLoadFromXInitial (&initialSysKbdConfig); - initialSysKbdConfig.overrideSettings = FALSE; isConfigChanged = g_slist_length (backupGConfKbdConfig.layouts) && !GSwitchItKbdConfigEquals (&initialSysKbdConfig, &backupGConfKbdConfig); @@ -262,7 +259,6 @@ gnome_settings_keyboard_xkb_analyze_sysc gtk_widget_show_all (msg); } } - GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig); GSwitchItKbdConfigTerm (&backupGConfKbdConfig); } Index: libgswitchit/ChangeLog =================================================================== RCS file: /cvs/gnome/libgswitchit/ChangeLog,v retrieving revision 1.23 diff -u -p -r1.23 ChangeLog --- libgswitchit/ChangeLog 17 Mar 2005 00:29:43 -0000 1.23 +++ libgswitchit/ChangeLog 15 Jul 2005 16:21:33 -0000 @@ -0,0 +1,20 @@ +2005-07-15 Mark McLoughlin + + Re-work the way some of the GConf keys are handled. + See bug #310513 + + * gswitchit_config.c: + (_GSwitchItKbdConfigLoadParams): kbdConfig->model can + be NULL. + (_GSwitchItKbdConfigSaveParams): if ->model, ->options or + ->layouts is NULL, unset the appropriate key. + (GSwitchItKbdConfigLoadFromGConf): ignore overrideSettings + and use the XKB default for any unset keys. + (GSwitchItKbdConfigSaveToGConf): ignore overrideSettings. + (GSwitchItKbdConfigModelSet): set ->model to NULL if the + GConf key contains an empty string. + + * gswitchit_config.h: remove the overrideSettings member + from GSwitchItKbdConfig and add a kbdConfigDefault to + parameter to GSwitchItKbdConfigLoadFromGConf() + Index: libgswitchit/gswitchit_config.c =================================================================== RCS file: /cvs/gnome/libgswitchit/gswitchit_config.c,v retrieving revision 1.35 diff -u -p -r1.35 gswitchit_config.c --- libgswitchit/gswitchit_config.c 17 Mar 2005 00:25:23 -0000 1.35 +++ libgswitchit/gswitchit_config.c 15 Jul 2005 16:21:33 -0000 @@ -65,8 +65,6 @@ const char GSWITCHIT_APPLET_CONFIG_KEY_S #define GSWITCHIT_KBD_CONFIG_KEY_PREFIX KEYBOARD_CONFIG_KEY_PREFIX "/kbd" const char GSWITCHIT_KBD_CONFIG_DIR[] = GSWITCHIT_KBD_CONFIG_KEY_PREFIX; -const char GSWITCHIT_KBD_CONFIG_KEY_OVERRIDE_SETTINGS[] = - GSWITCHIT_KBD_CONFIG_KEY_PREFIX "/overrideSettings"; const char GSWITCHIT_KBD_CONFIG_KEY_MODEL[] = GSWITCHIT_KBD_CONFIG_KEY_PREFIX "/model"; const char GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS[] = @@ -426,7 +424,7 @@ _GSwitchItKbdConfigLoadParams (GSwitchIt GSwitchItKbdConfigModelSet (kbdConfig, pc); g_free (pc); } - XklDebug (150, "Loaded Kbd model: [%s]\n", kbdConfig->model); + XklDebug (150, "Loaded Kbd model: [%s]\n", kbdConfig->model ? kbdConfig->model : "(null)"); GSwitchItKbdConfigLayoutsReset (kbdConfig); @@ -479,25 +477,39 @@ _GSwitchItKbdConfigSaveParams (GSwitchIt { GSList *pl; - gconf_change_set_set_string (cs, paramNames[0], kbdConfig->model); - XklDebug (150, "Saved Kbd model: [%s]\n", kbdConfig->model); + if (kbdConfig->model) + gconf_change_set_set_string (cs, paramNames[0], kbdConfig->model); + else + gconf_change_set_unset (cs, paramNames[0]); + XklDebug (150, "Saved Kbd model: [%s]\n", kbdConfig->model ? kbdConfig->model : "(null)"); - pl = kbdConfig->layouts; - while (pl != NULL) { - XklDebug (150, "Saved Kbd layout: [%s]\n", pl->data); - pl = pl->next; + if (kbdConfig->layouts) { + pl = kbdConfig->layouts; + while (pl != NULL) { + XklDebug (150, "Saved Kbd layout: [%s]\n", pl->data); + pl = pl->next; + } + gconf_change_set_set_list (cs, + paramNames[1], + GCONF_VALUE_STRING, kbdConfig->layouts); + } else { + XklDebug (150, "Saved Kbd layouts: []\n"); + gconf_change_set_unset (cs, paramNames[1]); } - gconf_change_set_set_list (cs, - paramNames[1], - GCONF_VALUE_STRING, kbdConfig->layouts); - pl = kbdConfig->options; - while (pl != NULL) { - XklDebug (150, "Saved Kbd option: [%s]\n", pl->data); - pl = pl->next; + + if (kbdConfig->options) { + pl = kbdConfig->options; + while (pl != NULL) { + XklDebug (150, "Saved Kbd option: [%s]\n", pl->data); + pl = pl->next; + } + gconf_change_set_set_list (cs, + paramNames[2], + GCONF_VALUE_STRING, kbdConfig->options); + } else { + XklDebug (150, "Saved Kbd options: []\n"); + gconf_change_set_unset (cs, paramNames[2]); } - gconf_change_set_set_list (cs, - paramNames[2], - GCONF_VALUE_STRING, kbdConfig->options); } /** @@ -708,26 +720,38 @@ GSwitchItKbdConfigTerm (GSwitchItKbdConf } void -GSwitchItKbdConfigLoadFromGConf (GSwitchItKbdConfig * kbdConfig) +GSwitchItKbdConfigLoadFromGConf (GSwitchItKbdConfig * kbdConfig, + GSwitchItKbdConfig * kbdConfigDefault) { - GError *gerror = NULL; - - kbdConfig->overrideSettings = - gconf_client_get_bool (kbdConfig->confClient, - GSWITCHIT_KBD_CONFIG_KEY_OVERRIDE_SETTINGS, - &gerror); - if (gerror != NULL) { - g_warning ("Error reading configuration:%s\n", - gerror->message); - kbdConfig->overrideSettings = FALSE; - g_error_free (gerror); - gerror = NULL; - } - XklDebug (150, "Loaded Kbd override cmd: [%s]\n", - kbdConfig->overrideSettings ? "true" : "false"); - _GSwitchItKbdConfigLoadParams (kbdConfig, GSWITCHIT_KBD_CONFIG_ACTIVE); + + if (kbdConfigDefault != NULL) { + GSList *pl; + + if (kbdConfig->model == NULL) + kbdConfig->model = g_strdup (kbdConfigDefault->model); + + if (kbdConfig->layouts == NULL) { + pl = kbdConfigDefault->layouts; + while (pl != NULL) { + kbdConfig->layouts = + g_slist_append (kbdConfig->layouts, + g_strdup (pl->data)); + pl = pl->next; + } + } + + if (kbdConfig->options == NULL) { + pl = kbdConfigDefault->options; + while (pl != NULL) { + kbdConfig->options = + g_slist_append (kbdConfig->options, + g_strdup (pl->data)); + pl = pl->next; + } + } + } } void @@ -787,11 +811,6 @@ GSwitchItKbdConfigSaveToGConf (GSwitchIt GError *gerror = NULL; cs = gconf_change_set_new (); - gconf_change_set_set_bool (cs, - GSWITCHIT_KBD_CONFIG_KEY_OVERRIDE_SETTINGS, - kbdConfig->overrideSettings); - XklDebug (150, "Saved Kbd override cmd: [%s]\n", - kbdConfig->overrideSettings ? "true" : "false"); _GSwitchItKbdConfigSaveParams (kbdConfig, cs, GSWITCHIT_KBD_CONFIG_ACTIVE); @@ -836,7 +855,7 @@ GSwitchItKbdConfigModelSet (GSwitchItKbd if (kbdConfig->model != NULL) g_free (kbdConfig->model); kbdConfig->model = - (modelName == NULL) ? NULL : g_strdup (modelName); + (modelName == NULL || modelName[0] == '\0') ? NULL : g_strdup (modelName); } void Index: libgswitchit/gswitchit_config.h =================================================================== RCS file: /cvs/gnome/libgswitchit/gswitchit_config.h,v retrieving revision 1.8 diff -u -p -r1.8 gswitchit_config.h --- libgswitchit/gswitchit_config.h 16 Mar 2005 12:53:08 -0000 1.8 +++ libgswitchit/gswitchit_config.h 15 Jul 2005 16:21:33 -0000 @@ -34,7 +34,6 @@ extern const char GSWITCHIT_CONFIG_KEY_H extern const char GSWITCHIT_CONFIG_KEY_LAYOUT_NAMES_AS_GROUP_NAMES[]; extern const char GSWITCHIT_KBD_CONFIG_DIR[]; -extern const char GSWITCHIT_KBD_CONFIG_KEY_OVERRIDE_SETTINGS[]; extern const char GSWITCHIT_KBD_CONFIG_KEY_MODEL[]; extern const char GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS[]; extern const char GSWITCHIT_KBD_CONFIG_KEY_OPTIONS[]; @@ -57,7 +56,6 @@ typedef struct _GSwitchItConfig { * Keyboard Configuration */ typedef struct _GSwitchItKbdConfig { - gboolean overrideSettings; gchar *model; GSList *layouts; GSList *options; @@ -119,7 +117,8 @@ extern void GSwitchItKbdConfigInit (GSwi GConfClient * confClient); extern void GSwitchItKbdConfigTerm (GSwitchItKbdConfig * kbdConfig); -extern void GSwitchItKbdConfigLoadFromGConf (GSwitchItKbdConfig * kbdConfig); +extern void GSwitchItKbdConfigLoadFromGConf (GSwitchItKbdConfig * kbdConfig, + GSwitchItKbdConfig * kbdConfigDefault); extern void GSwitchItKbdConfigSaveToGConf (GSwitchItKbdConfig * kbdConfig); Index: schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in =================================================================== RCS file: /cvs/gnome/gnome-control-center/schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in,v retrieving revision 1.8 diff -u -p -r1.8 desktop_gnome_peripherals_keyboard_xkb.schemas.in --- schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in 6 Feb 2005 03:32:06 -0000 1.8 +++ schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in 15 Jul 2005 16:21:33 -0000 @@ -8,8 +8,10 @@ bool true - Keyboard settings in gconf will be overridden from the system ASAP - Very soon, keyboard settings in gconf will be overridden (from the system configuration) + Keyboard settings in gconf will be overridden from the system ASAP (deprecated) + Very soon, keyboard settings in gconf will be overridden (from the system configuration) + This key has been deprecated since GNOME 2.12, please unset the model, layouts and + options keys to get the default system configuration. @@ -18,7 +20,7 @@ /desktop/gnome/peripherals/keyboard/kbd/model gnome string - pc105 + Keyboard model keyboard model @@ -31,7 +33,7 @@ gnome list string - [us] + [] Keyboard layout keyboard layout