Date:2015-04-25 23:46:28 (5 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
10261026
10271027void GMenu2X::deleteSection()
10281028{
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    }
10341029    menu->deleteSelectedSection();
10351030}
10361031
src/menu.cpp
500500    }
501501}
502502
503void Menu::deleteSelectedSection() {
504    INFO("Deleting section '%s'\n", selSection().c_str());
503void Menu::deleteSelectedSection()
504{
505    string const& sectionName = selSection();
506    INFO("Deleting section '%s'\n", sectionName.c_str());
505507
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);
509512    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    }
510519}
511520
512521bool Menu::linkChangeSection(uint linkIndex, uint oldSectionIndex, uint newSectionIndex) {

Archive Download the corresponding diff file



interactive