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>
|
2008-02-15 Kjartan Maraas <kmaraas@gnome.org>
|
||||||
|
|
||||||
* appearance-desktop.c: (wp_scale_type_changed),
|
* appearance-desktop.c: (wp_scale_type_changed),
|
||||||
|
|
|
@ -274,31 +274,21 @@ wp_option_menu_set (AppearanceData *data,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gint style;
|
||||||
|
|
||||||
if (!strcmp (value, "centered"))
|
if (!strcmp (value, "centered"))
|
||||||
{
|
style = GNOME_WP_SCALE_TYPE_CENTERED;
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
|
||||||
GNOME_WP_SCALE_TYPE_CENTERED);
|
|
||||||
}
|
|
||||||
else if (!strcmp (value, "stretched"))
|
else if (!strcmp (value, "stretched"))
|
||||||
{
|
style = GNOME_WP_SCALE_TYPE_STRETCHED;
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
|
||||||
GNOME_WP_SCALE_TYPE_STRETCHED);
|
|
||||||
}
|
|
||||||
else if (!strcmp (value, "scaled"))
|
else if (!strcmp (value, "scaled"))
|
||||||
{
|
style = GNOME_WP_SCALE_TYPE_SCALED;
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
|
||||||
GNOME_WP_SCALE_TYPE_SCALED);
|
|
||||||
}
|
|
||||||
else if (!strcmp (value, "zoom"))
|
else if (!strcmp (value, "zoom"))
|
||||||
{
|
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),
|
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
||||||
GNOME_WP_SCALE_TYPE_ZOOM);
|
style);
|
||||||
}
|
|
||||||
else if (!strcmp (value, "none"))
|
|
||||||
{
|
|
||||||
gtk_combo_box_set_active (GTK_COMBO_BOX (data->wp_style_menu),
|
|
||||||
GNOME_WP_SCALE_TYPE_TILED);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,8 +877,6 @@ wp_load_stuffs (void *user_data)
|
||||||
g_hash_table_foreach (data->wp_hash, (GHFunc) wp_props_load_wallpaper,
|
g_hash_table_foreach (data->wp_hash, (GHFunc) wp_props_load_wallpaper,
|
||||||
data);
|
data);
|
||||||
|
|
||||||
/*gdk_window_set_cursor (data->window->window, NULL);*/
|
|
||||||
|
|
||||||
style = gconf_client_get_string (data->client,
|
style = gconf_client_get_string (data->client,
|
||||||
WP_OPTIONS_KEY,
|
WP_OPTIONS_KEY,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -910,7 +898,12 @@ wp_load_stuffs (void *user_data)
|
||||||
|
|
||||||
item = g_hash_table_lookup (data->wp_hash, imagepath);
|
item = g_hash_table_lookup (data->wp_hash, imagepath);
|
||||||
|
|
||||||
if (item != NULL && strcmp (style, "none") != 0)
|
if (item != NULL)
|
||||||
|
{
|
||||||
|
/* update with the current gconf settings */
|
||||||
|
gnome_wp_item_update (item);
|
||||||
|
|
||||||
|
if (strcmp (style, "none") != 0)
|
||||||
{
|
{
|
||||||
if (item->deleted == TRUE)
|
if (item->deleted == TRUE)
|
||||||
{
|
{
|
||||||
|
@ -919,13 +912,7 @@ wp_load_stuffs (void *user_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)
|
else if (strcmp (style, "none") != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,39 +74,21 @@ void gnome_wp_item_ensure_gnome_bg (GnomeWPItem *item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
void gnome_wp_item_update (GnomeWPItem *item) {
|
||||||
GHashTable * wallpapers,
|
GConfClient *client;
|
||||||
GnomeThumbnailFactory * thumbnails) {
|
|
||||||
GnomeWPItem * item = NULL;
|
|
||||||
GdkColor color1 = { 0, 0, 0, 0 }, color2 = { 0, 0, 0, 0 };
|
GdkColor color1 = { 0, 0, 0, 0 }, color2 = { 0, 0, 0, 0 };
|
||||||
gchar *col_str;
|
gchar *col_str;
|
||||||
GConfClient * client;
|
|
||||||
|
|
||||||
client = gconf_client_get_default ();
|
client = gconf_client_get_default ();
|
||||||
|
|
||||||
item = g_new0 (GnomeWPItem, 1);
|
g_free (item->options);
|
||||||
|
|
||||||
item->filename = gnome_vfs_unescape_string_for_display (filename);
|
|
||||||
|
|
||||||
item->fileinfo = gnome_wp_info_new (item->filename, thumbnails);
|
|
||||||
|
|
||||||
if (item->fileinfo != NULL &&
|
|
||||||
(g_str_has_prefix (item->fileinfo->mime_type, "image/") ||
|
|
||||||
strcmp (item->fileinfo->mime_type, "application/xml") == 0)) {
|
|
||||||
if (item->name == NULL) {
|
|
||||||
if (g_utf8_validate (item->fileinfo->name, -1, NULL))
|
|
||||||
item->name = g_strdup (item->fileinfo->name);
|
|
||||||
else
|
|
||||||
item->name = g_filename_to_utf8 (item->fileinfo->name, -1, NULL,
|
|
||||||
NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
item->options = gconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
|
item->options = gconf_client_get_string (client, WP_OPTIONS_KEY, NULL);
|
||||||
if (item->options == NULL || !strcmp (item->options, "none")) {
|
if (item->options == NULL || !strcmp (item->options, "none")) {
|
||||||
g_free (item->options);
|
g_free (item->options);
|
||||||
item->options = g_strdup ("scaled");
|
item->options = g_strdup ("scaled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (item->shade_type);
|
||||||
item->shade_type = gconf_client_get_string (client, WP_SHADING_KEY, NULL);
|
item->shade_type = gconf_client_get_string (client, WP_SHADING_KEY, NULL);
|
||||||
if (item->shade_type == NULL)
|
if (item->shade_type == NULL)
|
||||||
item->shade_type = g_strdup ("solid");
|
item->shade_type = g_strdup ("solid");
|
||||||
|
@ -123,10 +105,41 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||||
g_free (col_str);
|
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->pcolor = gdk_color_copy (&color1);
|
||||||
item->scolor = gdk_color_copy (&color2);
|
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);
|
||||||
|
|
||||||
|
item->fileinfo = gnome_wp_info_new (item->filename, thumbnails);
|
||||||
|
|
||||||
|
if (item->fileinfo != NULL &&
|
||||||
|
(g_str_has_prefix (item->fileinfo->mime_type, "image/") ||
|
||||||
|
strcmp (item->fileinfo->mime_type, "application/xml") == 0)) {
|
||||||
|
if (item->name == NULL) {
|
||||||
|
if (g_utf8_validate (item->fileinfo->name, -1, NULL))
|
||||||
|
item->name = g_strdup (item->fileinfo->name);
|
||||||
|
else
|
||||||
|
item->name = g_filename_to_utf8 (item->fileinfo->name, -1, NULL,
|
||||||
|
NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
gnome_wp_item_update (item);
|
||||||
gnome_wp_item_update_description (item);
|
gnome_wp_item_update_description (item);
|
||||||
|
gnome_wp_item_ensure_gnome_bg (item);
|
||||||
|
|
||||||
g_hash_table_insert (wallpapers, item->filename, item);
|
g_hash_table_insert (wallpapers, item->filename, item);
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,12 +147,6 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||||
item = NULL;
|
item = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item) {
|
|
||||||
gnome_wp_item_ensure_gnome_bg (item);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (client);
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ GnomeWPItem * gnome_wp_item_new (const gchar * filename,
|
||||||
void gnome_wp_item_free (GnomeWPItem * item);
|
void gnome_wp_item_free (GnomeWPItem * item);
|
||||||
GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
|
GdkPixbuf * gnome_wp_item_get_thumbnail (GnomeWPItem * item,
|
||||||
GnomeThumbnailFactory * thumbs);
|
GnomeThumbnailFactory * thumbs);
|
||||||
|
void gnome_wp_item_update (GnomeWPItem * item);
|
||||||
void gnome_wp_item_update_description (GnomeWPItem * item);
|
void gnome_wp_item_update_description (GnomeWPItem * item);
|
||||||
void gnome_wp_item_ensure_gnome_bg (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);
|
gnome_wp_item_update_description (wp);
|
||||||
g_hash_table_insert (data->wp_hash, wp->filename, wp);
|
g_hash_table_insert (data->wp_hash, wp->filename, wp);
|
||||||
|
gnome_wp_item_ensure_gnome_bg (wp);
|
||||||
} else {
|
} else {
|
||||||
gnome_wp_item_free (wp);
|
gnome_wp_item_free (wp);
|
||||||
wp = NULL;
|
wp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp)
|
|
||||||
gnome_wp_item_ensure_gnome_bg (wp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xmlFreeDoc (wplist);
|
xmlFreeDoc (wplist);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue