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 * 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> 2005-07-13 Sebastien Bacher <seb128@debian.org>
* configure.in: update to 2.11.7. * configure.in: update to 2.11.7.

View file

@ -24,4 +24,4 @@ if ! which gnome-autogen.sh ; then
exit 1 exit 1
fi 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> 2005-05-22 Sebastien Bacher <seb128@debian.org>
* gnome-keyboard-properties-xkbot.c: (xkb_options_add_group): * gnome-keyboard-properties-xkbot.c: (xkb_options_add_group):

View file

@ -40,7 +40,7 @@
#include "gnome-keyboard-properties-xkb.h" #include "gnome-keyboard-properties-xkb.h"
static GSwitchItKbdConfig initialConfig; GSwitchItKbdConfig initialConfig;
GConfClient *xkbGConfClient; GConfClient *xkbGConfClient;
@ -52,50 +52,67 @@ xci_desc_to_utf8 (XklConfigItem * ci)
g_locale_to_utf8 (sd, -1, NULL, NULL, NULL); g_locale_to_utf8 (sd, -1, NULL, NULL, NULL);
} }
static GConfValue * static void
model_from_widget (GConfPropertyEditor * peditor, GConfValue * value) 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 != NULL && value->type == GCONF_VALUE_STRING)
if (value->type == GCONF_VALUE_STRING)
{ {
GObject* widget = gconf_property_editor_get_ui_control(peditor); model = gconf_value_get_string (value);
gchar* n = g_object_get_data (widget, "xkbModelName"); if (model != NULL && model[0] == '\0')
gconf_value_set_string (new_value, n); 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 else
gconf_value_set_string (new_value, _("Unknown")); {
gtk_entry_set_text (GTK_ENTRY (entry), _("Unknown"));
return new_value; }
} }
static GConfValue * static void
model_to_widget (GConfPropertyEditor * peditor, GConfValue * value) 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) static void
{ setup_model_entry (GladeXML * dialog)
XklConfigItem ci; {
g_snprintf( ci.name, sizeof (ci.name), "%s", gconf_value_get_string( value ) ); GConfValue * 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); value = gconf_client_get (xkbGConfClient,
gconf_value_set_string (new_value, d); GSWITCHIT_KBD_CONFIG_KEY_MODEL,
g_free (d); NULL);
} set_model_text (WID ("xkb_model"), value);
else if (value != NULL)
gconf_value_set_string (new_value, _("Unknown")); 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 static void
@ -112,17 +129,14 @@ cleanup_xkb_tabs (GladeXML * dialog)
static void static void
reset_to_defaults (GtkWidget * button, GladeXML * dialog) reset_to_defaults (GtkWidget * button, GladeXML * dialog)
{ {
gconf_client_set_bool (xkbGConfClient, GSwitchItKbdConfig emptyKbdConfig;
GSWITCHIT_KBD_CONFIG_KEY_OVERRIDE_SETTINGS,
TRUE, NULL);
/* all the rest is g-s-d's business */
}
static void GSwitchItKbdConfigInit (&emptyKbdConfig, xkbGConfClient);
update_model (GConfClient * client, GSwitchItKbdConfigSaveToGConfBackup (&emptyKbdConfig);
guint cnxn_id, GConfEntry * entry, GladeXML * dialog) GSwitchItKbdConfigSaveToGConf (&emptyKbdConfig);
{ GSwitchItKbdConfigTerm (&emptyKbdConfig);
enable_disable_restoring (dialog);
/* all the rest is g-s-d's business */
} }
static void static void
@ -144,11 +158,10 @@ setup_xkb_tabs (GladeXML * dialog, GConfChangeSet * changeset)
XklConfigInit (); XklConfigInit ();
XklConfigLoadRegistry (); XklConfigLoadRegistry ();
gconf_peditor_new_string GSwitchItKbdConfigInit (&initialConfig, xkbGConfClient);
(changeset, (gchar *) GSWITCHIT_KBD_CONFIG_KEY_MODEL, GSwitchItKbdConfigLoadFromXInitial (&initialConfig);
WID ("xkb_model"),
"conv-to-widget-cb", model_to_widget, setup_model_entry (dialog);
"conv-from-widget-cb", model_from_widget, NULL);
peditor = gconf_peditor_new_boolean peditor = gconf_peditor_new_boolean
(changeset, (gchar *) GSWITCHIT_CONFIG_KEY_GROUP_PER_WINDOW, (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")), g_signal_connect (G_OBJECT (WID ("keyboard_dialog")),
"destroy", G_CALLBACK (cleanup_xkb_tabs), 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); enable_disable_restoring (dialog);
xkb_layouts_enable_disable_default (dialog, xkb_layouts_enable_disable_default (dialog,
gconf_client_get_bool (xkbGConfClient, gconf_client_get_bool (xkbGConfClient,
@ -199,7 +204,7 @@ enable_disable_restoring (GladeXML * dialog)
gboolean enable; gboolean enable;
GSwitchItKbdConfigInit (&gswic, xkbGConfClient); GSwitchItKbdConfigInit (&gswic, xkbGConfClient);
GSwitchItKbdConfigLoadFromGConf (&gswic); GSwitchItKbdConfigLoadFromGConf (&gswic, NULL);
enable = !GSwitchItKbdConfigEquals (&gswic, &initialConfig); enable = !GSwitchItKbdConfigEquals (&gswic, &initialConfig);

View file

@ -27,6 +27,8 @@
#include <libxklavier/xklavier_config.h> #include <libxklavier/xklavier_config.h>
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#include "libgswitchit/gswitchit_config.h"
G_BEGIN_DECLS G_BEGIN_DECLS
#define SEL_LAYOUT_TREE_COL_DESCRIPTION 0 #define SEL_LAYOUT_TREE_COL_DESCRIPTION 0
@ -39,6 +41,7 @@ G_BEGIN_DECLS
#define CWID(s) glade_xml_get_widget (chooserDialog, s) #define CWID(s) glade_xml_get_widget (chooserDialog, s)
extern GConfClient *xkbGConfClient; extern GConfClient *xkbGConfClient;
extern GSwitchItKbdConfig initialConfig;
extern void setup_xkb_tabs (GladeXML * dialog, extern void setup_xkb_tabs (GladeXML * dialog,
GConfChangeSet * changeset); 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_prepare_selected_tree (GladeXML * dialog);
extern void xkb_options_load_options (GladeXML * dialog);
extern void clear_xkb_elements_list (GSList * list); extern void clear_xkb_elements_list (GSList * list);
extern char *xci_desc_to_utf8 (XklConfigItem * ci); 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, extern void xkb_layouts_enable_disable_default (GladeXML * dialog,
gboolean enable); gboolean enable);
#define xkb_layouts_get_selected_list() \ extern GSList *xkb_layouts_get_selected_list (void);
gconf_client_get_list (gconf_client_get_default (), \ extern GSList *xkb_options_get_selected_list (void);
GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS, \
GCONF_VALUE_STRING, NULL)
#define xkb_layouts_set_selected_list(list) \ #define xkb_layouts_set_selected_list(list) \
gconf_client_set_list (gconf_client_get_default (), \ gconf_client_set_list (gconf_client_get_default (), \
GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS, \ GSWITCHIT_KBD_CONFIG_KEY_LAYOUTS, \
GCONF_VALUE_STRING, (list), NULL) 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) \ #define xkb_options_set_selected_list(list) \
gconf_client_set_list (gconf_client_get_default (), \ gconf_client_set_list (gconf_client_get_default (), \
GSWITCHIT_KBD_CONFIG_KEY_OPTIONS, \ 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 static void
save_default_group (int aDefaultGroup) save_default_group (int aDefaultGroup)
{ {

View file

@ -51,6 +51,28 @@ static GSList *currentRadioGroup = NULL;
#define GCONFSTATE_PROP "gconfState" #define GCONFSTATE_PROP "gconfState"
#define EXPANDERS_PROP "expandersList" #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 * static GtkWidget *
xkb_options_get_expander (GtkWidget * option_button) 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 libbonoboui-2.0 dnl
gnome-desktop-2.0 >= 2.2.0" gnome-desktop-2.0 >= 2.2.0"
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES) 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, PKG_CHECK_MODULES(GNOME_SETTINGS_DAEMON,
[gtk+-2.0 gconf-2.0 libgnomeui-2.0 esound gnome-desktop-2.0 libglade-2.0]) [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) 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> 2005-07-25 Sebastien Bacher <seb128@debian.org>
* gnome-settings-accessibility-keyboard.c: (warning_dialog_post): * gnome-settings-accessibility-keyboard.c: (warning_dialog_post):
@ -6,12 +34,6 @@
set windows' icons, patch by Jaap A. Haitsma <jaap@haitsma.org> set windows' icons, patch by Jaap A. Haitsma <jaap@haitsma.org>
(Closes: #305096). (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> 2005-07-12 Sebastien Bacher <seb128@debian.org>
* modmap-dialog.glade: fix a label form (Closes: #167739). * modmap-dialog.glade: fix a label form (Closes: #167739).

View file

@ -150,28 +150,22 @@ apply_xkb_settings (void)
GSwitchItKbdConfigInit (&currentSysKbdConfig, confClient); GSwitchItKbdConfigInit (&currentSysKbdConfig, confClient);
g_object_unref (confClient); g_object_unref (confClient);
GSwitchItKbdConfigLoadFromGConf (&currentKbdConfig); GSwitchItKbdConfigLoadFromGConf (&currentKbdConfig, &initialSysKbdConfig);
if (currentKbdConfig.overrideSettings) { GSwitchItKbdConfigLoadFromXCurrent (&currentSysKbdConfig);
/* initialization - from the system settings */ /* Activate - only if different! */
GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig); if (!GSwitchItKbdConfigEquals (&currentKbdConfig, &currentSysKbdConfig)) {
} else { if (GSwitchItKbdConfigActivate (&currentKbdConfig)) {
GSwitchItKbdConfigLoadFromXCurrent (&currentSysKbdConfig); GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig);
/* Activate - only if different! */ if (paCallback != NULL) {
if (!GSwitchItKbdConfigEquals (&currentKbdConfig, &currentSysKbdConfig)) (*paCallback) (paCallbackUserData);
{
if (GSwitchItKbdConfigActivate (&currentKbdConfig)) {
if (paCallback != NULL) {
(*paCallback) (paCallbackUserData);
}
} else {
g_warning
("Could not activate the XKB configuration");
activation_error ();
} }
} else } else {
XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n"); g_warning ("Could not activate the XKB configuration");
} activation_error ();
}
} else
XklDebug (100, "Actual KBD configuration was not changed: redundant notification\n");
GSwitchItKbdConfigTerm (&currentSysKbdConfig); GSwitchItKbdConfigTerm (&currentSysKbdConfig);
} }
@ -181,25 +175,29 @@ gnome_settings_keyboard_xkb_sysconfig_changed_response (GtkDialog * dialog,
SysConfigChangedMsgResponse SysConfigChangedMsgResponse
what2do) what2do)
{ {
GConfClient *confClient;
GSwitchItKbdConfig emptyKbdConfig;
gboolean dontShowAgain = gtk_toggle_button_get_active ( gboolean dontShowAgain = gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (dialog), "chkDontShowAgain"))); GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (dialog), "chkDontShowAgain")));
confClient = gconf_client_get_default ();
switch (what2do) { switch (what2do) {
case RESPONSE_USE_X: case RESPONSE_USE_X:
GSwitchItKbdConfigSaveToGConf (&initialSysKbdConfig); GSwitchItKbdConfigInit (&emptyKbdConfig, confClient);
GSwitchItKbdConfigSaveToGConf (&emptyKbdConfig);
break; break;
case RESPONSE_USE_GNOME: case RESPONSE_USE_GNOME:
/* Do absolutely nothing - just keep things the way they are */ /* Do absolutely nothing - just keep things the way they are */
break; break;
} }
if (dontShowAgain) { if (dontShowAgain)
GConfClient *confClient;
confClient = gconf_client_get_default ();
gconf_client_set_bool (confClient, DISABLE_SYSCONF_CHANGED_WARNING_KEY, TRUE, NULL); gconf_client_set_bool (confClient, DISABLE_SYSCONF_CHANGED_WARNING_KEY, TRUE, NULL);
g_object_unref (confClient);
}
gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (confClient);
} }
static void static void
@ -218,7 +216,6 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void)
g_object_unref (confClient); g_object_unref (confClient);
GSwitchItKbdConfigLoadFromGConfBackup (&backupGConfKbdConfig); GSwitchItKbdConfigLoadFromGConfBackup (&backupGConfKbdConfig);
GSwitchItKbdConfigLoadFromXInitial (&initialSysKbdConfig); GSwitchItKbdConfigLoadFromXInitial (&initialSysKbdConfig);
initialSysKbdConfig.overrideSettings = FALSE;
isConfigChanged = g_slist_length (backupGConfKbdConfig.layouts) && isConfigChanged = g_slist_length (backupGConfKbdConfig.layouts) &&
!GSwitchItKbdConfigEquals (&initialSysKbdConfig, &backupGConfKbdConfig); !GSwitchItKbdConfigEquals (&initialSysKbdConfig, &backupGConfKbdConfig);
@ -265,7 +262,6 @@ gnome_settings_keyboard_xkb_analyze_sysconfig (void)
gtk_widget_show_all (msg); gtk_widget_show_all (msg);
} }
} }
GSwitchItKbdConfigSaveToGConfBackup (&initialSysKbdConfig);
GSwitchItKbdConfigTerm (&backupGConfKbdConfig); GSwitchItKbdConfigTerm (&backupGConfKbdConfig);
} }

View file

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