always apply the current GConf settings to the initially selected
2008-02-16 Jens Granseuer <jensgr@gmx.net> * appearance-desktop.c: (wp_option_menu_set), (wp_load_stuffs): * gnome-wp-item.c: (gnome_wp_item_update), (gnome_wp_item_new): * gnome-wp-item.h: always apply the current GConf settings to the initially selected wallpaper so that we don't modify the settings if GConf state and the definition in backgrounds.xml are not identical (bug #516746) * gnome-wp-xml.c: (gnome_wp_xml_load_xml): get rid of redundant if svn path=/trunk/; revision=8489
This commit is contained in:
parent
b695ca96d1
commit
254b98c405
5 changed files with 84 additions and 80 deletions
|
@ -74,17 +74,53 @@ void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item)
|
|||
}
|
||||
}
|
||||
|
||||
GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||
GHashTable * wallpapers,
|
||||
GnomeThumbnailFactory * thumbnails) {
|
||||
GnomeWPItem * item = NULL;
|
||||
void gnome_wp_item_update (GnomeWPItem *item) {
|
||||
GConfClient *client;
|
||||
GdkColor color1 = { 0, 0, 0, 0 }, color2 = { 0, 0, 0, 0 };
|
||||
gchar * col_str;
|
||||
GConfClient * client;
|
||||
gchar *col_str;
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
item = g_new0 (GnomeWPItem, 1);
|
||||
g_free (item->options);
|
||||
item->options = gconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
|
||||
if (item->options == NULL || !strcmp (item->options, "none")) {
|
||||
g_free (item->options);
|
||||
item->options = g_strdup ("scaled");
|
||||
}
|
||||
|
||||
g_free (item->shade_type);
|
||||
item->shade_type = gconf_client_get_string (client, WP_SHADING_KEY, NULL);
|
||||
if (item->shade_type == NULL)
|
||||
item->shade_type = g_strdup ("solid");
|
||||
|
||||
col_str = gconf_client_get_string (client, WP_PCOLOR_KEY, NULL);
|
||||
if (col_str != NULL) {
|
||||
gdk_color_parse (col_str, &color1);
|
||||
g_free (col_str);
|
||||
}
|
||||
|
||||
col_str = gconf_client_get_string (client, WP_SCOLOR_KEY, NULL);
|
||||
if (col_str != NULL) {
|
||||
gdk_color_parse (col_str, &color2);
|
||||
g_free (col_str);
|
||||
}
|
||||
|
||||
g_object_unref (client);
|
||||
|
||||
if (item->pcolor != NULL)
|
||||
gdk_color_free (item->pcolor);
|
||||
|
||||
if (item->scolor != NULL)
|
||||
gdk_color_free (item->scolor);
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
}
|
||||
|
||||
GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||
GHashTable * wallpapers,
|
||||
GnomeThumbnailFactory * thumbnails) {
|
||||
GnomeWPItem *item = g_new0 (GnomeWPItem, 1);
|
||||
|
||||
item->filename = gnome_vfs_unescape_string_for_display (filename);
|
||||
|
||||
|
@ -101,32 +137,9 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
|||
NULL, NULL);
|
||||
}
|
||||
|
||||
item->options = gconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
|
||||
if (item->options == NULL || !strcmp (item->options, "none")) {
|
||||
g_free (item->options);
|
||||
item->options = g_strdup ("scaled");
|
||||
}
|
||||
|
||||
item->shade_type = gconf_client_get_string (client, WP_SHADING_KEY, NULL);
|
||||
if (item->shade_type == NULL)
|
||||
item->shade_type = g_strdup ("solid");
|
||||
|
||||
col_str = gconf_client_get_string (client, WP_PCOLOR_KEY, NULL);
|
||||
if (col_str != NULL) {
|
||||
gdk_color_parse (col_str, &color1);
|
||||
g_free (col_str);
|
||||
}
|
||||
|
||||
col_str = gconf_client_get_string (client, WP_SCOLOR_KEY, NULL);
|
||||
if (col_str != NULL) {
|
||||
gdk_color_parse (col_str, &color2);
|
||||
g_free (col_str);
|
||||
}
|
||||
|
||||
item->pcolor = gdk_color_copy (&color1);
|
||||
item->scolor = gdk_color_copy (&color2);
|
||||
|
||||
gnome_wp_item_update (item);
|
||||
gnome_wp_item_update_description (item);
|
||||
gnome_wp_item_ensure_gnome_bg (item);
|
||||
|
||||
g_hash_table_insert (wallpapers, item->filename, item);
|
||||
} else {
|
||||
|
@ -134,12 +147,6 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
|||
item = NULL;
|
||||
}
|
||||
|
||||
if (item) {
|
||||
gnome_wp_item_ensure_gnome_bg (item);
|
||||
}
|
||||
|
||||
g_object_unref (client);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue