1 |
diff -p -up xdg-user-dirs-0.13/xdg-user-dirs-update.c.0003 xdg-user-dirs-0.13/xdg-user-dirs-update.c |
2 |
--- xdg-user-dirs-0.13/xdg-user-dirs-update.c.0003 2010-01-11 13:17:01.000000000 +0100 |
3 |
+++ xdg-user-dirs-0.13/xdg-user-dirs-update.c 2010-09-15 09:07:20.000000000 +0200 |
4 |
@@ -28,6 +28,15 @@ Directory backwards_compat_dirs[] = { |
5 |
{ NULL} |
6 |
}; |
7 |
|
8 |
+Directory mdk_folders_dirs[] = { |
9 |
+ { "DOWNLOAD", "Downloads" }, |
10 |
+ { "DOCUMENTS", "Documents" }, |
11 |
+ { "MUSIC", "Music" }, |
12 |
+ { "PICTURES", "Pictures" }, |
13 |
+ { "VIDEOS", "Video" }, |
14 |
+ { NULL} |
15 |
+}; |
16 |
+ |
17 |
static Directory *default_dirs = NULL; |
18 |
static Directory *user_dirs = NULL; |
19 |
static int user_dirs_changed = 0; |
20 |
@@ -873,6 +882,19 @@ lookup_backwards_compat (Directory *dir) |
21 |
return NULL; |
22 |
} |
23 |
|
24 |
+static const char * |
25 |
+lookup_mdk_folders (Directory *dir) |
26 |
+{ |
27 |
+ int i; |
28 |
+ |
29 |
+ for (i = 0; mdk_folders_dirs[i].name != NULL; i++) |
30 |
+ { |
31 |
+ if (strcmp (dir->name, mdk_folders_dirs[i].name) == 0) |
32 |
+ return dgettext("menu-messages", mdk_folders_dirs[i].path); |
33 |
+ } |
34 |
+ return NULL; |
35 |
+} |
36 |
+ |
37 |
static Directory * |
38 |
find_dir (Directory *dirs, const char *name) |
39 |
{ |
40 |
@@ -939,9 +961,24 @@ create_dirs (int force) |
41 |
free (path_name); |
42 |
path_name = NULL; |
43 |
} |
44 |
- else |
45 |
- relative_path_name = strdup (compat_dir->path); |
46 |
- } |
47 |
+ else |
48 |
+ relative_path_name = strdup (compat_dir->path); |
49 |
+ } else { |
50 |
+ /* try to reuse mdk-folder */ |
51 |
+ const char *mdk_folder; |
52 |
+ mdk_folder = lookup_mdk_folders (default_dir); |
53 |
+ if (mdk_folder) |
54 |
+ { |
55 |
+ path_name = concat_strings (get_home_dir (), "/", mdk_folder, NULL); |
56 |
+ if (!is_directory (path_name)) |
57 |
+ { |
58 |
+ path_name = NULL; |
59 |
+ free (path_name); |
60 |
+ } |
61 |
+ else |
62 |
+ relative_path_name = strdup (mdk_folder); |
63 |
+ } |
64 |
+ } |
65 |
} |
66 |
|
67 |
if (path_name == NULL) |