forked from pool/gnome-control-center
84d210d56d
Forwarding to openSUSE:Factory OBS-URL: https://build.opensuse.org/request/show/62339 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-control-center?expand=0&rev=91
116 lines
3.0 KiB
Diff
116 lines
3.0 KiB
Diff
Index: gnome-control-center-2.32.1/capplets/appearance/appearance-desktop.c
|
|
===================================================================
|
|
--- gnome-control-center-2.32.1.orig/capplets/appearance/appearance-desktop.c
|
|
+++ gnome-control-center-2.32.1/capplets/appearance/appearance-desktop.c
|
|
@@ -48,6 +48,50 @@ static const GtkTargetEntry drag_types[]
|
|
|
|
static void wp_update_preview (GtkFileChooser *chooser, AppearanceData *data);
|
|
|
|
+static GnomeWPItem *
|
|
+lookup_with_symlink (AppearanceData *data,
|
|
+ const char *path,
|
|
+ char **real_path)
|
|
+{
|
|
+ GnomeWPItem *item;
|
|
+ gchar *readlink;
|
|
+
|
|
+ if (real_path)
|
|
+ *real_path = NULL;
|
|
+
|
|
+ if (!path)
|
|
+ return NULL;
|
|
+
|
|
+ item = g_hash_table_lookup (data->wp_hash, path);
|
|
+ if (item)
|
|
+ return item;
|
|
+
|
|
+ /* if the current background is not in the hash of known backgrounds,
|
|
+ * see if it's a symlink and if the file it points to is in the hash */
|
|
+
|
|
+ readlink = g_strdup (path);
|
|
+
|
|
+ while (readlink &&
|
|
+ g_file_test (readlink, G_FILE_TEST_IS_SYMLINK) &&
|
|
+ item == NULL) {
|
|
+ gchar *new;
|
|
+
|
|
+ new = g_file_read_link (readlink, NULL);
|
|
+ g_free (readlink);
|
|
+ readlink = new;
|
|
+
|
|
+ if (readlink)
|
|
+ item = g_hash_table_lookup (data->wp_hash, readlink);
|
|
+ }
|
|
+
|
|
+ if (item != NULL && real_path)
|
|
+ *real_path = readlink;
|
|
+ else
|
|
+ g_free (readlink);
|
|
+
|
|
+ return item;
|
|
+}
|
|
+
|
|
static void
|
|
select_item (AppearanceData *data,
|
|
GnomeWPItem * item,
|
|
@@ -418,11 +462,16 @@ wp_uri_changed (const gchar *uri,
|
|
AppearanceData *data)
|
|
{
|
|
GnomeWPItem *item, *selected;
|
|
+ gchar *realuri;
|
|
+
|
|
+ realuri = NULL;
|
|
+ item = lookup_with_symlink (data, uri, &realuri);
|
|
+ if (!realuri)
|
|
+ realuri = g_strdup (uri);
|
|
|
|
- item = g_hash_table_lookup (data->wp_hash, uri);
|
|
selected = get_selected_item (data, NULL);
|
|
|
|
- if (selected != NULL && strcmp (selected->filename, uri) != 0)
|
|
+ if (selected != NULL && strcmp (selected->filename, realuri) != 0)
|
|
{
|
|
if (item == NULL)
|
|
item = wp_add_image (data, uri);
|
|
@@ -430,6 +479,8 @@ wp_uri_changed (const gchar *uri,
|
|
if (item)
|
|
select_item (data, item, TRUE);
|
|
}
|
|
+
|
|
+ g_free (realuri);
|
|
}
|
|
|
|
static void
|
|
@@ -936,6 +987,7 @@ wp_load_stuffs (void *user_data)
|
|
AppearanceData *data;
|
|
gchar *imagepath, *uri, *style;
|
|
GnomeWPItem *item;
|
|
+ gchar *realpath;
|
|
|
|
data = (AppearanceData *) user_data;
|
|
|
|
@@ -971,7 +1023,12 @@ wp_load_stuffs (void *user_data)
|
|
|
|
g_free (uri);
|
|
|
|
- item = g_hash_table_lookup (data->wp_hash, imagepath);
|
|
+ realpath = NULL;
|
|
+ item = lookup_with_symlink (data, imagepath, &realpath);
|
|
+ if (realpath) {
|
|
+ g_free (imagepath);
|
|
+ imagepath = realpath;
|
|
+ }
|
|
|
|
if (item != NULL)
|
|
{
|
|
@@ -986,7 +1043,9 @@ wp_load_stuffs (void *user_data)
|
|
wp_props_load_wallpaper (item->filename, item, data);
|
|
}
|
|
|
|
+ data->wp_update_gconf = FALSE;
|
|
select_item (data, item, FALSE);
|
|
+ data->wp_update_gconf = TRUE;
|
|
}
|
|
}
|
|
else if (strcmp (style, "none") != 0)
|