|
43 | 43 | BACKGROUND_COLLECTION_TYPE_DIRECTORY = "directory" |
44 | 44 | BACKGROUND_COLLECTION_TYPE_XML = "xml" |
45 | 45 |
|
| 46 | +CONFIG_FOLDER = os.path.join(GLib.get_user_config_dir(), 'cinnamon', 'backgrounds') |
| 47 | +OLD_CONFIG_FOLDER = os.path.expanduser("~/.cinnamon/backgrounds") |
| 48 | +USER_FOLDERS_FILE_NAME = 'user-folders.lst' |
| 49 | + |
46 | 50 | # even though pickle supports higher protocol versions, we want to version 2 because it's the latest |
47 | 51 | # version supported by python2 which (at this time) is still used by older versions of Cinnamon. |
48 | 52 | # When those versions are no longer supported, we can consider using a newer version. |
@@ -340,7 +344,9 @@ def get_system_backgrounds(self): |
340 | 344 |
|
341 | 345 | def get_user_backgrounds(self): |
342 | 346 | self.user_backgrounds = [] |
343 | | - path = os.path.expanduser("~/.cinnamon/backgrounds/user-folders.lst") |
| 347 | + path = os.path.join(CONFIG_FOLDER, USER_FOLDERS_FILE_NAME) |
| 348 | + old_path = os.path.join(OLD_CONFIG_FOLDER, USER_FOLDERS_FILE_NAME) |
| 349 | + path = path if os.path.exists(path) else old_path |
344 | 350 | if os.path.exists(path): |
345 | 351 | with open(path) as f: |
346 | 352 | folders = f.readlines() |
@@ -463,10 +469,10 @@ def remove_folder(self): |
463 | 469 | break |
464 | 470 |
|
465 | 471 | def update_folder_list(self): |
466 | | - path = os.path.expanduser("~/.cinnamon/backgrounds") |
| 472 | + path = CONFIG_FOLDER |
467 | 473 | if not os.path.exists(path): |
468 | 474 | os.makedirs(path, mode=0o755, exist_ok=True) |
469 | | - path = os.path.expanduser("~/.cinnamon/backgrounds/user-folders.lst") |
| 475 | + path = os.path.join(CONFIG_FOLDER, USER_FOLDERS_FILE_NAME) |
470 | 476 | if len(self.user_backgrounds) == 0: |
471 | 477 | file_data = "" |
472 | 478 | else: |
|
0 commit comments