summaryrefslogtreecommitdiff
path: root/src/bin/e_bg.c
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2010-12-21 09:26:43 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2010-12-21 09:26:43 +0000
commite9bfb04e12c4a55a31d40fac510326e245868a63 (patch)
tree6cc1e765a07a2222e68a7e6ad3838d7352ed6197 /src/bin/e_bg.c
parent4d602b28e9113a04a215bb03482c58546fcc92b7 (diff)
copy backgrounds to e dir
SVN revision: 55686
Diffstat (limited to 'src/bin/e_bg.c')
-rw-r--r--src/bin/e_bg.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/bin/e_bg.c b/src/bin/e_bg.c
index 88f4f91..8e96eae 100644
--- a/src/bin/e_bg.c
+++ b/src/bin/e_bg.c
@@ -637,14 +637,48 @@ e_bg_handler_set(Evas_Object *obj __UNUSED__, const char *path, void *data __UNU
637 637
638 if (_e_bg_file_edje_check(path)) 638 if (_e_bg_file_edje_check(path))
639 { 639 {
640 char buf[PATH_MAX];
641 int copy = 1;
642
640 E_Container *con = e_container_current_get(e_manager_current_get()); 643 E_Container *con = e_container_current_get(e_manager_current_get());
641 E_Zone *zone = e_zone_current_get(con); 644 E_Zone *zone = e_zone_current_get(con);
642 E_Desk *desk = e_desk_current_get(zone); 645 E_Desk *desk = e_desk_current_get(zone);
643 646
644 e_bg_add(con->num, zone->num, desk->x, desk->y, path); 647 /* if not in system dir or user dir, copy to user dir */
645 e_bg_update(); 648 e_prefix_data_concat_static(buf, "data/backgrounds");
646 e_config_save_queue(); 649 if (!strncmp(buf, path, strlen(buf)))
647 return; 650 copy = 0;
651 if (copy)
652 {
653 e_user_dir_concat_static(buf, "backgrounds");
654 if (!strncmp(buf, path, strlen(buf)))
655 copy = 0;
656 }
657 if (copy)
658 {
659 const char *file;
660 char *name;
661
662 file = ecore_file_file_get(path);
663 name = ecore_file_strip_ext(file);
664
665 e_user_dir_snprintf(buf, sizeof(buf), "backgrounds/%s-%f.edj", name, ecore_time_unix_get());
666 free(name);
667
668 if (!ecore_file_exists(buf))
669 {
670 ecore_file_cp(path, buf);
671 e_bg_add(con->num, zone->num, desk->x, desk->y, buf);
672 }
673 else
674 e_bg_add(con->num, zone->num, desk->x, desk->y, path);
675 }
676 else
677 e_bg_add(con->num, zone->num, desk->x, desk->y, path);
678
679 e_bg_update();
680 e_config_save_queue();
681 return;
648 } 682 }
649 683
650 e_bg_image_import(path, _e_bg_handler_image_imported, NULL); 684 e_bg_image_import(path, _e_bg_handler_image_imported, NULL);