1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-25 18:05:20 +02:00

Remove unnecessary file existence check in WallpaperDialog::exec()

Browsing the user's wallpaper directory will simply add no new files
to the list of wallpapers available if the directory doesn't exist.
WallpaperDialog::exec doesn't need to care about that.

Because wallpapers are files, not directories, also don't return
directories in the result. The code that makes the wallpapers list
calls FileLister::getFiles and ignores directories anyway.
This commit is contained in:
Nebuleon Fumika 2014-08-13 07:27:55 +00:00 committed by Maarten ter Huurne
parent cf896e6175
commit f85ef14b3e

View File

@ -43,30 +43,17 @@ bool WallpaperDialog::exec()
bool close = false, result = true; bool close = false, result = true;
FileLister fl; FileLister fl;
fl.setShowDirectories(false);
fl.setFilter("png"); fl.setFilter("png");
string filepath = GMenu2X::getHome() + "/skins/" fl.browse(GMenu2X::getHome() + "/skins/"
+ gmenu2x->confStr["skin"] + "/wallpapers"; + gmenu2x->confStr["skin"] + "/wallpapers", true);
if (fileExists(filepath)) { fl.browse(GMENU2X_SYSTEM_DIR "/skins/"
fl.browse(filepath, true); + gmenu2x->confStr["skin"] + "/wallpapers", false);
}
filepath = GMENU2X_SYSTEM_DIR "/skins/"
+ gmenu2x->confStr["skin"] + "/wallpapers";
if (fileExists(filepath)) {
fl.browse(filepath, false);
}
if (gmenu2x->confStr["skin"] != "Default") { if (gmenu2x->confStr["skin"] != "Default") {
filepath = GMenu2X::getHome() + "/skins/Default/wallpapers"; fl.browse(GMenu2X::getHome() + "/skins/Default/wallpapers", false);
if (fileExists(filepath)) { fl.browse(GMENU2X_SYSTEM_DIR "/skins/Default/wallpapers", false);
fl.browse(filepath, false);
}
filepath = GMENU2X_SYSTEM_DIR "/skins/Default/wallpapers";
if (fileExists(filepath)) {
fl.browse(filepath, false);
}
} }
vector<string> wallpapers = fl.getFiles(); vector<string> wallpapers = fl.getFiles();