Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37750332
en ru br
ALT Linux repos
S:45.0-alt1
5.0: 2.26.0-alt1
4.1: 2.22.2.1-alt1.M41.1
4.0: 2.16.3-alt2
3.0: 2.10.2-alt1

Group :: Graphical desktop/GNOME
RPM: gnome-control-center

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: gnome-control-center-2.32.1-duplicated-background.patch
Download


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)
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin