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
|
@ -1,3 +1,14 @@
|
|||
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
|
||||
|
||||
2008-02-15 Kjartan Maraas <kmaraas@gnome.org>
|
||||
|
||||
* appearance-desktop.c: (wp_scale_type_changed),
|
||||
|
|
|
@ -274,31 +274,21 @@ wp_option_menu_set (AppearanceData *data,
|
|||
}
|
||||
else
|
||||
{
|
||||
gint style;
|
||||
|
||||
if (!strcmp (value, "centered"))
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||
GNOME_WP_SCALE_TYPE_CENTERED);
|
||||
}
|
||||
style = GNOME_WP_SCALE_TYPE_CENTERED;
|
||||
else if (!strcmp (value, "stretched"))
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||
GNOME_WP_SCALE_TYPE_STRETCHED);
|
||||
}
|
||||
style = GNOME_WP_SCALE_TYPE_STRETCHED;
|
||||
else if (!strcmp (value, "scaled"))
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||
GNOME_WP_SCALE_TYPE_SCALED);
|
||||
}
|
||||
style = GNOME_WP_SCALE_TYPE_SCALED;
|
||||
else if (!strcmp (value, "zoom"))
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||
GNOME_WP_SCALE_TYPE_ZOOM);
|
||||
}
|
||||
else if (!strcmp (value, "none"))
|
||||
{
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||
GNOME_WP_SCALE_TYPE_TILED);
|
||||
}
|
||||
style = GNOME_WP_SCALE_TYPE_ZOOM;
|
||||
else
|
||||
style = GNOME_WP_SCALE_TYPE_TILED;
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||
style);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,8 +868,8 @@ static gboolean
|
|||
wp_load_stuffs (void *user_data)
|
||||
{
|
||||
AppearanceData *data;
|
||||
gchar * imagepath, * style, * uri;
|
||||
GnomeWPItem * item;
|
||||
gchar *imagepath, *style, *uri;
|
||||
GnomeWPItem *item;
|
||||
|
||||
data = (AppearanceData *) user_data;
|
||||
|
||||
|
@ -887,8 +877,6 @@ wp_load_stuffs (void *user_data)
|
|||
g_hash_table_foreach (data->wp_hash, (GHFunc) wp_props_load_wallpaper,
|
||||
data);
|
||||
|
||||
/*gdk_window_set_cursor (data->window->window, NULL);*/
|
||||
|
||||
style = gconf_client_get_string (data->client,
|
||||
WP_OPTIONS_KEY,
|
||||
NULL);
|
||||
|
@ -910,22 +898,21 @@ wp_load_stuffs (void *user_data)
|
|||
|
||||
item = g_hash_table_lookup (data->wp_hash, imagepath);
|
||||
|
||||
if (item != NULL && strcmp (style, "none") != 0)
|
||||
if (item != NULL)
|
||||
{
|
||||
if (item->deleted == TRUE)
|
||||
/* update with the current gconf settings */
|
||||
gnome_wp_item_update (item);
|
||||
|
||||
if (strcmp (style, "none") != 0)
|
||||
{
|
||||
item->deleted = FALSE;
|
||||
wp_props_load_wallpaper (item->filename, item, data);
|
||||
if (item->deleted == TRUE)
|
||||
{
|
||||
item->deleted = FALSE;
|
||||
wp_props_load_wallpaper (item->filename, item, data);
|
||||
}
|
||||
|
||||
select_item (data, item, FALSE);
|
||||
}
|
||||
|
||||
select_item (data, item, FALSE);
|
||||
|
||||
wp_option_menu_set (data, item->options, FALSE);
|
||||
wp_option_menu_set (data, item->shade_type, TRUE);
|
||||
|
||||
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_pcpicker), item->pcolor);
|
||||
gtk_color_button_set_color (GTK_COLOR_BUTTON (data->wp_scpicker), item->scolor);
|
||||
|
||||
}
|
||||
else if (strcmp (style, "none") != 0)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
|||
void gnome_wp_item_free (GnomeWPItem * item);
|
||||
GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
|
||||
GnomeThumbnailFactory * thumbs);
|
||||
void gnome_wp_item_update (GnomeWPItem * item);
|
||||
void gnome_wp_item_update_description (GnomeWPItem * item);
|
||||
void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item);
|
||||
|
||||
|
|
|
@ -227,13 +227,11 @@ static void gnome_wp_xml_load_xml (AppearanceData *data,
|
|||
|
||||
gnome_wp_item_update_description (wp);
|
||||
g_hash_table_insert (data->wp_hash, wp->filename, wp);
|
||||
gnome_wp_item_ensure_gnome_bg (wp);
|
||||
} else {
|
||||
gnome_wp_item_free (wp);
|
||||
wp = NULL;
|
||||
}
|
||||
|
||||
if (wp)
|
||||
gnome_wp_item_ensure_gnome_bg (wp);
|
||||
}
|
||||
}
|
||||
xmlFreeDoc (wplist);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue