Sophie

Sophie

distrib > Mandriva > 2010.1 > i586 > media > main-testing-src > by-pkgid > 6d373db97cbe0c6d5b1a5e345d4af2ff > files > 6

xdg-user-dirs-0.12-3mdv2010.1.src.rpm

--- xdg-user-dirs-0.8/xdg-user-dirs-update.c.mdkfolders	2007-08-02 18:13:10.000000000 +0200
+++ xdg-user-dirs-0.8/xdg-user-dirs-update.c	2007-08-02 18:29:29.000000000 +0200
@@ -26,6 +26,15 @@ Directory backwards_compat_dirs[] = {
   { NULL}
 };
 
+Directory mdk_folders_dirs[] = {
+  { "DOWNLOAD", "Downloads" },
+  { "DOCUMENTS", "Documents" },
+  { "MUSIC", "Music" },
+  { "PICTURES", "Pictures" },
+  { "VIDEOS", "Video" },
+  { NULL}
+};
+
 static Directory *default_dirs = NULL;
 static Directory *user_dirs = NULL;
 static int user_dirs_changed = 0;
@@ -842,6 +851,19 @@ lookup_backwards_compat (Directory *dir)
   return NULL;
 }
 
+static const char *
+lookup_mdk_folders (Directory *dir)
+{
+  int i;
+
+  for (i = 0; mdk_folders_dirs[i].name != NULL; i++)
+    {
+      if (strcmp (dir->name, mdk_folders_dirs[i].name) == 0)
+	return dgettext("menu-messages", mdk_folders_dirs[i].path);
+    }
+  return NULL;
+}
+
 static Directory *
 find_dir (Directory *dirs, const char *name)
 {
@@ -907,9 +929,24 @@ create_dirs (int force)
 		  path_name = NULL;
 		  free (path_name);
 		}
-	      else
-		relative_path_name = strdup (compat_dir->path);
-	    }
+	      else 
+		  relative_path_name = strdup (compat_dir->path);
+	      } else {
+	         /* try to reuse mdk-folder */
+		  const char *mdk_folder;
+		  mdk_folder = lookup_mdk_folders (default_dir);
+		  if (mdk_folder)
+  		    {
+		      path_name = concat_strings (get_home_dir (), "/", mdk_folder, NULL);
+		      if (!is_directory (path_name))
+			{
+			  path_name = NULL;
+			  free (path_name);
+			}
+		      else 
+	  		 relative_path_name = strdup (mdk_folder);
+	            }
+	       }
 	}
 
       if (path_name == NULL)