Date: | 2015-04-25 23:46:28 (8 years 1 month ago) |
---|---|
Author: | Maarten ter Huurne |
Commit: | f17fae79b6840c930d19bb5d88898f66b4694e60 |
Message: | Moved section directory delete code to Menu class It is better to have all the file handling code for menu entry files in the same place. |
Files: |
src/gmenu2x.cpp (1 diff) src/menu.cpp (1 diff) |
Change Details
src/gmenu2x.cpp | ||
---|---|---|
1026 | 1026 | |
1027 | 1027 | void GMenu2X::deleteSection() |
1028 | 1028 | { |
1029 | string path = getHome() + "/sections/" + menu->selSection(); | |
1030 | if (rmdir(path.c_str()) && errno != ENOENT) { | |
1031 | WARNING("Removal of section dir \"%s\" failed: %s\n", | |
1032 | path.c_str(), strerror(errno)); | |
1033 | } | |
1034 | 1029 | menu->deleteSelectedSection(); |
1035 | 1030 | } |
1036 | 1031 |
src/menu.cpp | ||
---|---|---|
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | void Menu::deleteSelectedSection() { | |
504 | INFO("Deleting section '%s'\n", selSection().c_str()); | |
503 | void Menu::deleteSelectedSection() | |
504 | { | |
505 | string const& sectionName = selSection(); | |
506 | INFO("Deleting section '%s'\n", sectionName.c_str()); | |
505 | 507 | |
506 | gmenu2x.sc.del("sections/"+selSection()+".png"); | |
507 | links.erase( links.begin()+selSectionIndex() ); | |
508 | sections.erase( sections.begin()+selSectionIndex() ); | |
508 | gmenu2x.sc.del("sections/" + sectionName + ".png"); | |
509 | auto idx = selSectionIndex(); | |
510 | links.erase(links.begin() + idx); | |
511 | sections.erase(sections.begin() + idx); | |
509 | 512 | setSectionIndex(0); //reload sections |
513 | ||
514 | string path = GMenu2X::getHome() + "/sections/" + sectionName; | |
515 | if (rmdir(path.c_str()) && errno != ENOENT) { | |
516 | WARNING("Removal of section dir \"%s\" failed: %s\n", | |
517 | path.c_str(), strerror(errno)); | |
518 | } | |
510 | 519 | } |
511 | 520 | |
512 | 521 | bool Menu::linkChangeSection(uint linkIndex, uint oldSectionIndex, uint newSectionIndex) { |
Branches:
install_locations
master
opkrun
packages