When updating theme info from GConf or copying it for customization, we

2007-10-14  Jens Granseuer  <jensgr@gmx.net>

	When updating theme info from GConf or copying it for customization, we
	were ignoring xcursor settings. As a result, saved custom themes always
	had the default theme set. (bug #485709)

	* appearance-themes.c: (get_default_int_from_key),
	(theme_load_from_gconf), (theme_set_custom_from_theme): when setting up
	theme info, take cursor settings into account

svn path=/trunk/; revision=8168
This commit is contained in:
Jens Granseuer 2007-10-14 10:21:57 +00:00 committed by Jens Granseuer
parent afbc8c9ba8
commit c9b09854a9
2 changed files with 53 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2007-10-14 Jens Granseuer <jensgr@gmx.net>
When updating theme info from GConf or copying it for customization, we
were ignoring xcursor settings. As a result, saved custom themes always
had the default theme set. (bug #485709)
* appearance-themes.c: (get_default_int_from_key),
(theme_load_from_gconf), (theme_set_custom_from_theme): when setting up
theme info, take cursor settings into account
2007-10-09 Jens Granseuer <jensgr@gmx.net>
* appearance-desktop.c: (wp_props_wp_set): fix crash if we fail to

View file

@ -211,6 +211,23 @@ get_default_string_from_key (GConfClient *client, const char *key)
return str;
}
static gint
get_default_int_from_key (GConfClient *client, const char *key, gint def)
{
GConfValue *value;
gint val = def;
value = gconf_client_get_default_from_schema (client, key, NULL);
if (value) {
if (value->type == GCONF_VALUE_INT)
val = gconf_value_get_int (value);
gconf_value_free (value);
}
return val;
}
/* Find out if the lockdown key has been set. Currently returns false on error... */
static gboolean
is_locked_down (GConfClient *client)
@ -242,13 +259,15 @@ theme_load_from_gconf (GConfClient *client, GnomeThemeMetaInfo *theme)
theme->icon_theme_name = gconf_client_get_string (client, ICON_THEME_KEY, NULL);
g_free (theme->cursor_theme_name);
#ifdef HAVE_XCURSOR
theme->cursor_theme_name = gconf_client_get_string (client, CURSOR_THEME_KEY, NULL);
theme->cursor_size = gconf_client_get_int (client, CURSOR_SIZE_KEY, NULL);
#else
theme->cursor_theme_name = gconf_client_get_string (client, CURSOR_FONT_KEY, NULL);
#endif
g_free (theme->application_font);
theme->application_font = gconf_client_get_string (client, APPLICATION_FONT_KEY, NULL);
}
static gchar *
@ -360,10 +379,14 @@ theme_set_custom_from_theme (const GnomeThemeMetaInfo *info, AppearanceData *dat
g_free (custom->icon_theme_name);
g_free (custom->metacity_theme_name);
g_free (custom->gtk_color_scheme);
g_free (custom->cursor_theme_name);
g_free (custom->application_font);
custom->gtk_theme_name = NULL;
custom->icon_theme_name = NULL;
custom->metacity_theme_name = NULL;
custom->gtk_color_scheme = NULL;
custom->cursor_theme_name = NULL;
custom->application_font = NULL;
if (info->gtk_theme_name)
custom->gtk_theme_name = g_strdup (info->gtk_theme_name);
@ -384,6 +407,25 @@ theme_set_custom_from_theme (const GnomeThemeMetaInfo *info, AppearanceData *dat
custom->gtk_color_scheme = g_strdup (info->gtk_color_scheme);
else
custom->gtk_color_scheme = get_default_string_from_key (data->client, COLOR_SCHEME_KEY);
if (info->cursor_theme_name) {
custom->cursor_theme_name = g_strdup (info->cursor_theme_name);
#ifdef HAVE_XCURSOR
custom->cursor_size = info->cursor_size;
#endif
} else {
#ifdef HAVE_XCURSOR
custom->cursor_theme_name = get_default_string_from_key (data->client, CURSOR_THEME_KEY);
custom->cursor_size = get_default_int_from_key (data->client, CURSOR_SIZE_KEY, 18);
#else
custom->cursor_theme_name = get_default_string_from_key (data->client, CURSOR_FONT_KEY);
#endif
}
if (info->application_font)
custom->application_font = g_strdup (info->application_font);
else
custom->application_font = get_default_string_from_key (data->client, APPLICATION_FONT_KEY);
}
/* select the custom theme */