diff --git a/ChangeLog b/ChangeLog index 20944e5b3..b3d569877 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,14 @@ * configure.in: use pkg-config to check for xcursor +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) + 2005-07-13 Sebastien Bacher * configure.in: update to 2.11.7. diff --git a/autogen.sh b/autogen.sh index 4dad4ef1d..ffe4521ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,4 +24,4 @@ if ! which gnome-autogen.sh ; then exit 1 fi -REQUIRED_AUTOMAKE_VERSION=1.7 . gnome-autogen.sh +REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index 1044e79aa..b957ebe78 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,29 @@ +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. + 2005-05-22 Sebastien Bacher * gnome-keyboard-properties-xkbot.c: (xkb_options_add_group): diff --git a/capplets/keyboard/gnome-keyboard-properties-xkb.c b/capplets/keyboard/gnome-keyboard-properties-xkb.c index 5fd6caf80..c94c7bee4 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkb.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkb.c @@ -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; - new_value = gconf_value_new (GCONF_VALUE_STRING); - - if (value->type == GCONF_VALUE_STRING) + if (value != NULL && value->type == GCONF_VALUE_STRING) { - GObject* widget = gconf_property_editor_get_ui_control(peditor); - gchar* n = g_object_get_data (widget, "xkbModelName"); - gconf_value_set_string (new_value, n); + model = gconf_value_get_string (value); + if (model != NULL && model[0] == '\0') + model = NULL; + } + + if (model == NULL) + model = initialConfig.model; + + g_snprintf (ci.name, sizeof (ci.name), "%s", model); + + if (XklConfigFindModel (&ci)) + { + 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); +static void +setup_model_entry (GladeXML * dialog) +{ + GConfValue * value; - 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")); - } + 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); - return new_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, GConfChangeSet * changeset) 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, GConfChangeSet * changeset) 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 * dialog) gboolean enable; GSwitchItKbdConfigInit (&gswic, xkbGConfClient); - GSwitchItKbdConfigLoadFromGConf (&gswic); + GSwitchItKbdConfigLoadFromGConf (&gswic, NULL); enable = !GSwitchItKbdConfigEquals (&gswic, &initialConfig); diff --git a/capplets/keyboard/gnome-keyboard-properties-xkb.h b/capplets/keyboard/gnome-keyboard-properties-xkb.h index 3891b95c1..b2641a92e 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkb.h +++ b/capplets/keyboard/gnome-keyboard-properties-xkb.h @@ -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_tree (GladeXML * dialog, 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,21 +86,14 @@ extern void xkb_layout_choose (GladeXML * dialog); 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 (), \ GSWITCHIT_KBD_CONFIG_KEY_OPTIONS, \ diff --git a/capplets/keyboard/gnome-keyboard-properties-xkblt.c b/capplets/keyboard/gnome-keyboard-properties-xkblt.c index 81562030c..0ee37a3d9 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkblt.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkblt.c @@ -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) { diff --git a/capplets/keyboard/gnome-keyboard-properties-xkbot.c b/capplets/keyboard/gnome-keyboard-properties-xkbot.c index f06ef6dce..ebbe621a2 100644 --- a/capplets/keyboard/gnome-keyboard-properties-xkbot.c +++ b/capplets/keyboard/gnome-keyboard-properties-xkbot.c @@ -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) { diff --git a/configure.in b/configure.in index d8e92f7d1..5789cc21e 100644 --- a/configure.in +++ b/configure.in @@ -94,7 +94,7 @@ COMMON_MODULES="gtk+-2.0 >= 2.3.0 dnl libbonoboui-2.0 dnl gnome-desktop-2.0 >= 2.2.0" PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES) -PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.11.1) +PKG_CHECK_MODULES(GNOMECC, $COMMON_MODULES libgnome-menu >= 2.10.1) PKG_CHECK_MODULES(GNOME_SETTINGS_DAEMON, [gtk+-2.0 gconf-2.0 libgnomeui-2.0 esound gnome-desktop-2.0 libglade-2.0]) PKG_CHECK_MODULES(OLD_CAPPLET, libgnomeui-2.0 libglade-2.0) diff --git a/gnome-settings-daemon/ChangeLog b/gnome-settings-daemon/ChangeLog index be4092ad5..6c203fe7f 100644 --- a/gnome-settings-daemon/ChangeLog +++ b/gnome-settings-daemon/ChangeLog @@ -1,3 +1,31 @@ +2005-07-20 Rodrigo Moya + + * gnome-settings-screensaver.c (gnome_settings_screensaver_load): + * gnome-settings-multimedia-keys.c (do_action): try to run + gnome-screensaver, and if that fails, run xscreensaver. + +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. + 2005-07-25 Sebastien Bacher * gnome-settings-accessibility-keyboard.c: (warning_dialog_post): @@ -6,12 +34,6 @@ set windows' icons, patch by Jaap A. Haitsma (Closes: #305096). -2005-07-20 Rodrigo Moya - - * gnome-settings-screensaver.c (gnome_settings_screensaver_load): - * gnome-settings-multimedia-keys.c (do_action): try to run - gnome-screensaver, and if that fails, run xscreensaver. - 2005-07-12 Sebastien Bacher * modmap-dialog.glade: fix a label form (Closes: #167739). diff --git a/gnome-settings-daemon/gnome-settings-keyboard-xkb.c b/gnome-settings-daemon/gnome-settings-keyboard-xkb.c index d54348d2c..7e2a73cc0 100644 --- a/gnome-settings-daemon/gnome-settings-keyboard-xkb.c +++ b/gnome-settings-daemon/gnome-settings-keyboard-xkb.c @@ -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_changed_response (GtkDialog * dialog, 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_sysconfig (void) g_object_unref (confClient); GSwitchItKbdConfigLoadFromGConfBackup (&backupGConfKbdConfig); GSwitchItKbdConfigLoadFromXInitial (&initialSysKbdConfig); - initialSysKbdConfig.overrideSettings = FALSE; isConfigChanged = g_slist_length (backupGConfKbdConfig.layouts) && !GSwitchItKbdConfigEquals (&initialSysKbdConfig, &backupGConfKbdConfig); @@ -265,7 +262,6 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void) gtk_widget_show_all (msg); } } - GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig); GSwitchItKbdConfigTerm (&backupGConfKbdConfig); } diff --git a/schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in b/schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in index 180f7a584..888fd85e3 100644 --- a/schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in +++ b/schemas/desktop_gnome_peripherals_keyboard_xkb.schemas.in @@ -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