This commit is contained in:
Sergey V. Udaltsov 2005-07-26 20:38:25 +00:00
parent 30347dd0e1
commit 25ac663f39
11 changed files with 207 additions and 106 deletions

View file

@ -15,6 +15,14 @@
* configure.in: use pkg-config to check for xcursor
2005-07-15 Mark McLoughlin <mark@skynet.ie>
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 <seb128@debian.org>
* configure.in: update to 2.11.7.

View file

@ -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

View file

@ -1,3 +1,29 @@
2005-07-15 Mark McLoughlin <mark@skynet.ie>
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 <seb128@debian.org>
* gnome-keyboard-properties-xkbot.c: (xkb_options_add_group):

View file

@ -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)
{
GConfValue *new_value;
new_value = gconf_value_new (GCONF_VALUE_STRING);
if (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);
}
else
gconf_value_set_string (new_value, _("Unknown"));
return new_value;
}
static GConfValue *
model_to_widget (GConfPropertyEditor * peditor, GConfValue * value)
{
GConfValue *new_value;
new_value = gconf_value_new (GCONF_VALUE_STRING);
if (value->type == GCONF_VALUE_STRING)
static void
set_model_text (GtkWidget * entry,
GConfValue * value)
{
XklConfigItem ci;
g_snprintf( ci.name, sizeof (ci.name), "%s", gconf_value_get_string( value ) );
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;
g_snprintf (ci.name, sizeof (ci.name), "%s", model);
if (XklConfigFindModel (&ci))
{
GObject* widget = gconf_property_editor_get_ui_control(peditor);
gchar* d = xci_desc_to_utf8 (&ci);
char * d;
g_object_set_data_full (widget, "xkbModelName", g_strdup (ci.name), g_free);
gconf_value_set_string (new_value, 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"));
{
gtk_entry_set_text (GTK_ENTRY (entry), _("Unknown"));
}
}
return new_value;
static void
model_key_changed (GConfClient * client,
guint cnxn_id,
GConfEntry * entry,
GladeXML * dialog)
{
set_model_text (WID ("xkb_model"),
gconf_entry_get_value (entry));
enable_disable_restoring (dialog);
}
static void
setup_model_entry (GladeXML * dialog)
{
GConfValue * 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, 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);

View file

@ -27,6 +27,8 @@
#include <libxklavier/xklavier_config.h>
#include <gconf/gconf-client.h>
#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, \

View file

@ -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)
{

View file

@ -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)
{

View file

@ -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)

View file

@ -1,3 +1,31 @@
2005-07-20 Rodrigo Moya <rodrigo@novell.com>
* 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 <mark@skynet.ie>
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 <seb128@debian.org>
* gnome-settings-accessibility-keyboard.c: (warning_dialog_post):
@ -6,12 +34,6 @@
set windows' icons, patch by Jaap A. Haitsma <jaap@haitsma.org>
(Closes: #305096).
2005-07-20 Rodrigo Moya <rodrigo@novell.com>
* 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 <seb128@debian.org>
* modmap-dialog.glade: fix a label form (Closes: #167739).

View file

@ -150,28 +150,22 @@ apply_xkb_settings (void)
GSwitchItKbdConfigInit (&currentSysKbdConfig, confClient);
g_object_unref (confClient);
GSwitchItKbdConfigLoadFromGConf (&currentKbdConfig);
GSwitchItKbdConfigLoadFromGConf (&currentKbdConfig, &initialSysKbdConfig);
if (currentKbdConfig.overrideSettings) {
/* initialization - from the system settings */
GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig);
} else {
GSwitchItKbdConfigLoadFromXCurrent (&currentSysKbdConfig);
/* Activate - only if different! */
if (!GSwitchItKbdConfigEquals (&currentKbdConfig, &currentSysKbdConfig))
{
if (!GSwitchItKbdConfigEquals (&currentKbdConfig, &currentSysKbdConfig)) {
if (GSwitchItKbdConfigActivate (&currentKbdConfig)) {
GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig);
if (paCallback != NULL) {
(*paCallback) (paCallbackUserData);
}
} else {
g_warning
("Could not activate the XKB configuration");
g_warning ("Could not activate the XKB configuration");
activation_error ();
}
} else
XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n");
}
GSwitchItKbdConfigTerm (&currentSysKbdConfig);
}
@ -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);
}

View file

@ -8,8 +8,10 @@
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Keyboard settings in gconf will be overridden from the system ASAP</short>
<long>Very soon, keyboard settings in gconf will be overridden (from the system configuration)</long>
<short>Keyboard settings in gconf will be overridden from the system ASAP (deprecated)</short>
<long>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.</long>
</locale>
</schema>
@ -18,7 +20,7 @@
<applyto>/desktop/gnome/peripherals/keyboard/kbd/model</applyto>
<owner>gnome</owner>
<type>string</type>
<default>pc105</default>
<default></default>
<locale name="C">
<short>Keyboard model</short>
<long>keyboard model</long>
@ -31,7 +33,7 @@
<owner>gnome</owner>
<type>list</type>
<list_type>string</list_type>
<default>[us]</default>
<default>[]</default>
<locale name="C">
<short>Keyboard layout</short>
<long>keyboard layout</long>