From bec10a9eccf5fd2231e14638e2b5cd7ec587a831 Mon Sep 17 00:00:00 2001 From: Eric Koegel Date: Mon, 7 Oct 2013 14:03:46 +0300 Subject: [PATCH] Migrate backdrop settings from previous versions (Bug 10380) This patch allows for migrating from previous versions (before 4.11). Continuing to use the older format should make it easier for distribution maintainers to apply their own backdrop settings since the newer format uses monitor names rather than numbers. Xfdesktop will search for backdrop settings in the new location, then the old location, and finally fall back to the built-in defaults (DEFAULT_BACKDROP, stretched image style, solid color style, etc). --- common/xfdesktop-common.c | 15 +++++ common/xfdesktop-common.h | 2 + settings/main.c | 164 +++++++++++++++++++++++++++++++++++++++------- src/xfce-backdrop.c | 22 +++++-- src/xfce-backdrop.h | 2 + src/xfce-workspace.c | 150 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 325 insertions(+), 30 deletions(-) diff --git a/common/xfdesktop-common.c b/common/xfdesktop-common.c index 65f0214..b2fb406 100644 --- a/common/xfdesktop-common.c +++ b/common/xfdesktop-common.c @@ -51,6 +51,7 @@ #include #include "xfdesktop-common.h" +#include "xfce-backdrop.h" /* for XfceBackdropImageStyle */ #ifndef O_BINARY #define O_BINARY 0 @@ -301,6 +302,20 @@ xfdesktop_send_client_message(Window xid, const gchar *msg) gtk_widget_destroy(win); } +/* The image styles changed from versions prior to 4.11. + * Auto isn't an option anymore, additionally we should handle invalid + * values. Set them to the default of stretched. */ +gint +xfce_translate_image_styles(gint input) +{ + gint style = input; + + if(style <= 0 || style > XFCE_BACKDROP_IMAGE_SPANNING_SCREENS) + style = XFCE_BACKDROP_IMAGE_STRETCHED; + + return style; +} + guint xfce_grab_cursor(GtkWidget *w, GdkEventButton *evt) diff --git a/common/xfdesktop-common.h b/common/xfdesktop-common.h index 1d6db85..725da4f 100644 --- a/common/xfdesktop-common.h +++ b/common/xfdesktop-common.h @@ -86,6 +86,8 @@ gchar *xfdesktop_get_file_mimetype(const gchar *file); gboolean xfdesktop_check_is_running(Window *xid); void xfdesktop_send_client_message(Window xid, const gchar *msg); +gint xfce_translate_image_styles(gint input); + guint xfce_grab_cursor(GtkWidget *w, GdkEventButton *evt); gboolean xfdesktop_popup_grab_available(GdkWindow *win, guint32 timestamp); diff --git a/settings/main.c b/settings/main.c index e132506..c68cceb 100644 --- a/settings/main.c +++ b/settings/main.c @@ -53,6 +53,8 @@ #include "xfdesktop-thumbnailer.h" #include "xfdesktop-settings-ui.h" #include "xfdesktop-settings-appearance-frame-ui.h" +/* for XfceBackdropImageStyle && XfceBackdropColorStyle */ +#include "xfce-backdrop.h" #define PREVIEW_HEIGHT 96 #define MAX_ASPECT_RATIO 1.5f @@ -77,9 +79,6 @@ #define DESKTOP_ICONS_SHOW_FILESYSTEM "/desktop-icons/file-icons/show-filesystem" #define DESKTOP_ICONS_SHOW_REMOVABLE "/desktop-icons/file-icons/show-removable" -#define XFCE_BACKDROP_IMAGE_NONE 0 -#define XFCE_BACKDROP_IMAGE_SCALED 4 -#define XFCE_BACKDROP_IMAGE_SPANNING_SCREENS 6 typedef struct { @@ -158,7 +157,7 @@ static void cb_xfdesktop_chk_apply_to_all(GtkCheckButton *button, gpointer user_data); static gchar *xfdesktop_settings_generate_per_workspace_binding_string(AppearancePanel *panel, const gchar* property); - +static gchar *xfdesktop_settings_get_backdrop_image(AppearancePanel *panel); static void xfdesktop_settings_do_single_preview(GtkTreeModel *model, @@ -615,7 +614,6 @@ xfdesktop_image_list_add_dir(GObject *source_object, gpointer user_data) { AppearancePanel *panel = user_data; - gchar *property; AddDirData *dir_data = g_new0(AddDirData, 1); TRACE("entering"); @@ -627,9 +625,7 @@ xfdesktop_image_list_add_dir(GObject *source_object, /* Get the last image/current image displayed so we can select it in the * icon view */ - property = xfdesktop_settings_generate_per_workspace_binding_string(panel, "last-image"); - - dir_data->last_image = xfconf_channel_get_string(panel->channel, property, DEFAULT_BACKDROP); + dir_data->last_image = xfdesktop_settings_get_backdrop_image(panel); dir_data->file_path = g_file_get_path(panel->selected_folder); @@ -643,8 +639,6 @@ xfdesktop_image_list_add_dir(GObject *source_object, xfdesktop_image_list_add_item, dir_data, cb_destroy_add_dir_enumeration); - - g_free(property); } static void @@ -723,6 +717,51 @@ xfdesktop_settings_generate_per_workspace_binding_string(AppearancePanel *panel, return buf; } +static gchar* +xfdesktop_settings_generate_old_binding_string(AppearancePanel *panel, + const gchar* property) +{ + gchar *buf = NULL; + + buf = g_strdup_printf("/backdrop/screen%d/monitor%d/%s", + panel->screen, panel->monitor, property); + + DBG("name %s", buf); + + return buf; +} + +/* Attempts to load the backdrop from the current location followed by using + * how previous versions of xfdesktop (before 4.11) did. This matches how + * xfdesktop searches for backdrops. + * Free the returned string when done using it. */ +static gchar * +xfdesktop_settings_get_backdrop_image(AppearancePanel *panel) +{ + gchar *last_image; + gchar *property, *old_property = NULL; + + /* Get the last image/current image displayed, if available */ + property = xfdesktop_settings_generate_per_workspace_binding_string(panel, "last-image"); + + last_image = xfconf_channel_get_string(panel->channel, property, NULL); + + /* Try the previous version or fall back to our provided default */ + if(last_image == NULL) { + old_property = xfdesktop_settings_generate_old_binding_string(panel, + "image-path"); + last_image = xfconf_channel_get_string(panel->channel, + old_property, + DEFAULT_BACKDROP); + } + + g_free(property); + if(old_property) + g_free(old_property); + + return last_image; +} + static void cb_image_selection_changed(GtkIconView *icon_view, gpointer user_data) @@ -732,7 +771,7 @@ cb_image_selection_changed(GtkIconView *icon_view, GtkTreeIter iter; GList *selected_items = NULL; gchar *filename = NULL, *current_filename = NULL; - gchar *buf; + gchar *buf = NULL; TRACE("entering"); @@ -751,9 +790,8 @@ cb_image_selection_changed(GtkIconView *icon_view, gtk_tree_model_get(model, &iter, COL_FILENAME, &filename, -1); - buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "last-image"); - - current_filename = xfconf_channel_get_string(panel->channel, buf, ""); + /* Get the current/last image, handles migrating from old versions */ + current_filename = xfdesktop_settings_get_backdrop_image(panel); /* check to see if the selection actually did change */ if(g_strcmp0(current_filename, filename) != 0) { @@ -765,13 +803,19 @@ cb_image_selection_changed(GtkIconView *icon_view, panel->screen, panel->monitor_name, panel->workspace); } + /* Get the property location to save our changes, always save to new + * location */ + buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, + "last-image"); + xfconf_channel_set_string(panel->channel, buf, filename); } g_list_foreach (selected_items, (GFunc)gtk_tree_path_free, NULL); g_list_free(selected_items); g_free(current_filename); - g_free(buf); + if(buf) + g_free(buf); } static gint @@ -1033,12 +1077,11 @@ cb_xfdesktop_combo_color_changed(GtkComboBox *combo, static void xfdesktop_settings_update_iconview_folder(AppearancePanel *panel) { - gchar *current_folder, *prop_last, *dirname; + gchar *current_folder, *dirname; TRACE("entering"); - prop_last = xfdesktop_settings_generate_per_workspace_binding_string(panel, "last-image"); - current_folder = xfconf_channel_get_string(panel->channel, prop_last, DEFAULT_BACKDROP); + current_folder = xfdesktop_settings_get_backdrop_image(panel); dirname = g_path_get_dirname(current_folder); gtk_file_chooser_set_current_folder((GtkFileChooser*)panel->btn_folder, dirname); @@ -1047,7 +1090,6 @@ xfdesktop_settings_update_iconview_folder(AppearancePanel *panel) cb_folder_selection_changed(panel->btn_folder, panel); g_free(current_folder); - g_free(prop_last); g_free(dirname); } @@ -1057,15 +1099,30 @@ static void xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel, gboolean remove_binding) { - gchar *buf; + gchar *buf, *old_property = NULL; XfconfChannel *channel = panel->channel; - /* Style combobox */ + /* Image style combo box */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "image-style"); if(remove_binding) { xfconf_g_property_unbind_by_property(channel, buf, G_OBJECT(panel->image_style_combo), "active"); } else { + /* If the current image style doesn't exist, try to load the old one */ + if(!xfconf_channel_has_property(channel, buf)) { + gint image_style; + old_property = xfdesktop_settings_generate_old_binding_string(panel, "image-style"); + + /* default to stretched when trying to migrate */ + image_style = xfconf_channel_get_int(channel, old_property, XFCE_BACKDROP_IMAGE_STRETCHED); + + /* xfce_translate_image_styles will do sanity checking */ + gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), + xfce_translate_image_styles(image_style)); + + g_free(old_property); + } + xfconf_g_property_bind(channel, buf, G_TYPE_INT, G_OBJECT(panel->image_style_combo), "active"); /* determine if the iconview is sensitive */ @@ -1073,12 +1130,31 @@ xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel, } g_free(buf); - /* Color options*/ + /* Color style combo box */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "color-style"); if(remove_binding) { xfconf_g_property_unbind_by_property(channel, buf, G_OBJECT(panel->color_style_combo), "active"); } else { + /* If the current color style doesn't exist, try to load the old one */ + if(!xfconf_channel_has_property(channel, buf)) { + gint color_style; + old_property = xfdesktop_settings_generate_old_binding_string(panel, "color-style"); + + /* default to solid when trying to migrate */ + color_style = xfconf_channel_get_int(channel, old_property, XFCE_BACKDROP_COLOR_SOLID); + + /* sanity check */ + if(color_style < 0 || color_style > XFCE_BACKDROP_COLOR_TRANSPARENT) { + g_warning("invalid color style, setting to solid"); + color_style = XFCE_BACKDROP_COLOR_SOLID; + } + + gtk_combo_box_set_active(GTK_COMBO_BOX(panel->color_style_combo), + color_style); + g_free(old_property); + } + xfconf_g_property_bind(channel, buf, G_TYPE_INT, G_OBJECT(panel->color_style_combo), "active"); /* update the color button sensitivity */ @@ -1086,27 +1162,63 @@ xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel, } g_free(buf); + /* color 1 button */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "color1"); if(remove_binding) { xfconf_g_property_unbind(panel->color1_btn_id); } else { + /* If the first color doesn't exist, try to load the old one */ + if(!xfconf_channel_has_property(channel, buf)) { + GValue value = { 0, }; + old_property = xfdesktop_settings_generate_old_binding_string(panel, "color1"); + + xfconf_channel_get_property(channel, old_property, &value); + + if(G_VALUE_HOLDS_BOXED(&value)) { + gtk_color_button_set_color(GTK_COLOR_BUTTON(panel->color1_btn), + g_value_get_boxed(&value)); + g_value_unset(&value); + } + + g_free(old_property); + } + + /* Now bind to the new value */ panel->color1_btn_id = xfconf_g_property_bind_gdkcolor(channel, buf, G_OBJECT(panel->color1_btn), "color"); } g_free(buf); + /* color 2 button */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "color2"); if(remove_binding) { xfconf_g_property_unbind(panel->color2_btn_id); } else { + /* If the 2nd color doesn't exist, try to load the old one */ + if(!xfconf_channel_has_property(channel, buf)) { + GValue value = { 0, }; + old_property = xfdesktop_settings_generate_old_binding_string(panel, "color1"); + + xfconf_channel_get_property(channel, old_property, &value); + + if(G_VALUE_HOLDS_BOXED(&value)) { + gtk_color_button_set_color(GTK_COLOR_BUTTON(panel->color1_btn), + g_value_get_boxed(&value)); + g_value_unset(&value); + } + + g_free(old_property); + } + + /* Now bind to the new value */ panel->color2_btn_id = xfconf_g_property_bind_gdkcolor(channel, buf, G_OBJECT(panel->color2_btn), "color"); } g_free(buf); - /* Cycle timer options */ + /* enable cycle timer check box */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "backdrop-cycle-enable"); if(remove_binding) { xfconf_g_property_unbind_by_property(channel, buf, @@ -1117,6 +1229,7 @@ xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel, } g_free(buf); + /* cycle timer spin box */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "backdrop-cycle-timer"); if(remove_binding) { xfconf_g_property_unbind_by_property(channel, buf, @@ -1129,6 +1242,7 @@ xfdesktop_settings_background_tab_change_bindings(AppearancePanel *panel, } g_free(buf); + /* cycle random order check box */ buf = xfdesktop_settings_generate_per_workspace_binding_string(panel, "backdrop-cycle-random-order"); if(remove_binding) { xfconf_g_property_unbind_by_property(channel, buf, @@ -1445,8 +1559,8 @@ xfdesktop_settings_dialog_setup_tabs(GtkBuilder *main_gxml, panel); /* Pick the first entries so something shows up */ - gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), XFCE_BACKDROP_IMAGE_SCALED); - gtk_combo_box_set_active(GTK_COMBO_BOX(panel->color_style_combo), 0); + gtk_combo_box_set_active(GTK_COMBO_BOX(panel->image_style_combo), XFCE_BACKDROP_IMAGE_STRETCHED); + gtk_combo_box_set_active(GTK_COMBO_BOX(panel->color_style_combo), XFCE_BACKDROP_COLOR_SOLID); /* Use these settings for all workspaces checkbox */ panel->chk_apply_to_all = GTK_WIDGET(gtk_builder_get_object(appearance_gxml, diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c index c4827a9..2e01f48 100644 --- a/src/xfce-backdrop.c +++ b/src/xfce-backdrop.c @@ -267,12 +267,14 @@ xfce_backdrop_class_init(XfceBackdropClass *klass) | G_PARAM_STATIC_NICK \ | G_PARAM_STATIC_BLURB) + /* Defaults to an invalid color style so that + * xfce_workspace_migrate_backdrop_color_style can handle it properly */ g_object_class_install_property(gobject_class, PROP_COLOR_STYLE, g_param_spec_enum("color-style", "color style", "color style", XFCE_TYPE_BACKDROP_COLOR_STYLE, - XFCE_BACKDROP_COLOR_SOLID, + XFCE_BACKDROP_COLOR_INVALID, XFDESKTOP_PARAM_FLAGS)); g_object_class_install_property(gobject_class, PROP_COLOR1, @@ -289,19 +291,23 @@ xfce_backdrop_class_init(XfceBackdropClass *klass) GDK_TYPE_COLOR, XFDESKTOP_PARAM_FLAGS)); + /* Defaults to an invalid image style so that + * xfce_workspace_migrate_backdrop_image_style can handle it properly */ g_object_class_install_property(gobject_class, PROP_IMAGE_STYLE, g_param_spec_enum("image-style", "image style", "image style", XFCE_TYPE_BACKDROP_IMAGE_STYLE, - XFCE_BACKDROP_IMAGE_SCALED, + XFCE_BACKDROP_IMAGE_INVALID, XFDESKTOP_PARAM_FLAGS)); + /* The DEFAULT_BACKDROP is provided in the function + * xfce_workspace_migrate_backdrop_image instead of here */ g_object_class_install_property(gobject_class, PROP_IMAGE_FILENAME, g_param_spec_string("image-filename", "image filename", "image filename", - DEFAULT_BACKDROP, + NULL, XFDESKTOP_PARAM_FLAGS)); g_object_class_install_property(gobject_class, PROP_BACKDROP_CYCLE_ENABLE, @@ -553,8 +559,8 @@ xfce_backdrop_set_color_style(XfceBackdrop *backdrop, XfceBackdropColorStyle style) { g_return_if_fail(XFCE_IS_BACKDROP(backdrop)); - g_return_if_fail((int)style >= 0 && style <= XFCE_BACKDROP_COLOR_TRANSPARENT); - + g_return_if_fail((int)style >= -1 && style <= XFCE_BACKDROP_COLOR_TRANSPARENT); + if(style != backdrop->priv->color_style) { xfce_backdrop_clear_cached_image(backdrop); backdrop->priv->color_style = style; @@ -821,6 +827,12 @@ xfce_backdrop_generate_canvas(XfceBackdrop *backdrop) w = backdrop->priv->width; h = backdrop->priv->height; + /* In case we somehow end up here, give a warning and apply a temp fix */ + if(backdrop->priv->color_style == XFCE_BACKDROP_COLOR_INVALID) { + g_warning("xfce_backdrop_generate_canvas: Invalid color style"); + backdrop->priv->color_style = XFCE_BACKDROP_COLOR_SOLID; + } + if(backdrop->priv->color_style == XFCE_BACKDROP_COLOR_SOLID) final_image = create_solid(&backdrop->priv->color1, w, h, FALSE, 0xff); else if(backdrop->priv->color_style == XFCE_BACKDROP_COLOR_TRANSPARENT) { diff --git a/src/xfce-backdrop.h b/src/xfce-backdrop.h index 1aba049..8a46927 100644 --- a/src/xfce-backdrop.h +++ b/src/xfce-backdrop.h @@ -40,6 +40,7 @@ typedef struct _XfceBackdropPriv XfceBackdropPriv; typedef enum { + XFCE_BACKDROP_IMAGE_INVALID = -1, XFCE_BACKDROP_IMAGE_NONE = 0, XFCE_BACKDROP_IMAGE_CENTERED, XFCE_BACKDROP_IMAGE_TILED, @@ -51,6 +52,7 @@ typedef enum typedef enum { + XFCE_BACKDROP_COLOR_INVALID = -1, XFCE_BACKDROP_COLOR_SOLID = 0, XFCE_BACKDROP_COLOR_HORIZ_GRADIENT, XFCE_BACKDROP_COLOR_VERT_GRADIENT, diff --git a/src/xfce-workspace.c b/src/xfce-workspace.c index 70796d8..ab39155 100644 --- a/src/xfce-workspace.c +++ b/src/xfce-workspace.c @@ -314,6 +314,144 @@ xfce_workspace_get_property(GObject *object, } } +/* Attempts to get the backdrop colors from the xfdesktop pre-4.11 format */ +static void +xfce_workspace_migrate_backdrop_color_style(XfceWorkspace *workspace, + XfceBackdrop *backdrop, + guint monitor) +{ + XfconfChannel *channel = workspace->priv->channel; + char buf[1024]; + gint pp_len; + GValue value = { 0, }; + + TRACE("entering"); + + /* Use the old property format */ + g_snprintf(buf, sizeof(buf), "%smonitor%d/", + workspace->priv->property_prefix, monitor); + pp_len = strlen(buf); + + /* Color style */ + buf[pp_len] = 0; + g_strlcat(buf, "color-style", sizeof(buf)); + xfconf_channel_get_property(channel, buf, &value); + + if(G_VALUE_HOLDS_INT(&value)) { + xfce_backdrop_set_color_style(backdrop, g_value_get_int(&value)); + g_value_unset(&value); + } + + /* first color */ + buf[pp_len] = 0; + g_strlcat(buf, "color1", sizeof(buf)); + xfconf_channel_get_property(channel, buf, &value); + + if(G_VALUE_HOLDS_BOXED(&value)) { + xfce_backdrop_set_first_color(backdrop, g_value_get_boxed(&value)); + g_value_unset(&value); + } + + /* second color */ + buf[pp_len] = 0; + g_strlcat(buf, "color2", sizeof(buf)); + xfconf_channel_get_property(channel, buf, &value); + + if(G_VALUE_HOLDS_BOXED(&value)) { + xfce_backdrop_set_second_color(backdrop, g_value_get_boxed(&value)); + g_value_unset(&value); + } + + /* Fallback to solid if nothing was set anywhere */ + if(xfce_backdrop_get_color_style(backdrop) == XFCE_BACKDROP_COLOR_INVALID) + xfce_backdrop_set_color_style(backdrop, XFCE_BACKDROP_COLOR_SOLID); +} + +/* Attempts to get the backdrop image from the xfdesktop pre-4.11 format */ +static void +xfce_workspace_migrate_backdrop_image(XfceWorkspace *workspace, + XfceBackdrop *backdrop, + guint monitor) +{ + XfconfChannel *channel = workspace->priv->channel; + char buf[1024]; + gint pp_len; + GValue value = { 0, }; + const gchar *filename; + + TRACE("entering"); + + /* Use the old property format */ + g_snprintf(buf, sizeof(buf), "%smonitor%d/", + workspace->priv->property_prefix, monitor); + pp_len = strlen(buf); + + /* Try the old backdrop */ + buf[pp_len] = 0; + g_strlcat(buf, "image-path", sizeof(buf)); + xfconf_channel_get_property(channel, buf, &value); + + /* Either there was a backdrop to migrate from or we use the backdrop + * we provide as a default */ + if(G_VALUE_HOLDS_STRING(&value)) + filename = g_value_get_string(&value); + else + filename = DEFAULT_BACKDROP; + + xfce_backdrop_set_image_filename(backdrop, filename); + + if(G_VALUE_HOLDS_STRING(&value)) + g_value_unset(&value); +} + +/* Attempts to get the image style from the xfdesktop pre-4.11 format */ +static void +xfce_workspace_migrate_backdrop_image_style(XfceWorkspace *workspace, + XfceBackdrop *backdrop, + guint monitor) +{ + XfconfChannel *channel = workspace->priv->channel; + char buf[1024]; + gint pp_len; + GValue value = { 0, }; + + /* Use the old property format */ + g_snprintf(buf, sizeof(buf), "%smonitor%d/", + workspace->priv->property_prefix, monitor); + pp_len = strlen(buf); + + /* show image */ + buf[pp_len] = 0; + g_strlcat(buf, "image-show", sizeof(buf)); + xfconf_channel_get_property(channel, buf, &value); + + if(G_VALUE_HOLDS_BOOLEAN(&value)) { + gboolean show_image = g_value_get_boolean(&value); + + /* if we aren't showing the image, set the style and exit the function + * so we don't set the style to something else */ + if(!show_image) { + xfce_backdrop_set_image_style(backdrop, XFCE_BACKDROP_IMAGE_NONE); + g_value_unset(&value); + return; + } + + g_value_unset(&value); + } + + /* image style */ + buf[pp_len] = 0; + g_strlcat(buf, "image-style", sizeof(buf)); + xfconf_channel_get_property(channel, buf, &value); + + if(G_VALUE_HOLDS_INT(&value)) { + XfceBackdropImageStyle style; + style = xfce_translate_image_styles(g_value_get_int(&value)); + xfce_backdrop_set_image_style(backdrop, style); + g_value_unset(&value); + } +} + static void xfce_workspace_connect_backdrop_settings(XfceWorkspace *workspace, XfceBackdrop *backdrop, @@ -378,6 +516,18 @@ xfce_workspace_connect_backdrop_settings(XfceWorkspace *workspace, xfconf_g_property_bind(channel, buf, G_TYPE_STRING, G_OBJECT(backdrop), "image-filename"); + /* If we didn't get a filename try to load one from a previous version */ + if(xfce_backdrop_get_image_filename(backdrop) == NULL) + xfce_workspace_migrate_backdrop_image(workspace, backdrop, monitor); + + /* If we didn't get a proper color style, attempt to get the old one */ + if(xfce_backdrop_get_color_style(backdrop) == XFCE_BACKDROP_COLOR_INVALID) + xfce_workspace_migrate_backdrop_color_style(workspace, backdrop, monitor); + + /* Same for image style, this also deals with 'Auto' */ + if(xfce_backdrop_get_image_style(backdrop) == XFCE_BACKDROP_IMAGE_INVALID) + xfce_workspace_migrate_backdrop_image_style(workspace, backdrop, monitor); + g_free(monitor_name); } -- 1.8.3.2