1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-04 23:37:10 +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;
FileLister fl;
fl.setShowDirectories(false);
fl.setFilter("png");
string filepath = GMenu2X::getHome() + "/skins/"
+ gmenu2x->confStr["skin"] + "/wallpapers";
if (fileExists(filepath)) {
fl.browse(filepath, true);
}
filepath = GMENU2X_SYSTEM_DIR "/skins/"
+ gmenu2x->confStr["skin"] + "/wallpapers";
if (fileExists(filepath)) {
fl.browse(filepath, false);
}
fl.browse(GMenu2X::getHome() + "/skins/"
+ gmenu2x->confStr["skin"] + "/wallpapers", true);
fl.browse(GMENU2X_SYSTEM_DIR "/skins/"
+ gmenu2x->confStr["skin"] + "/wallpapers", false);
if (gmenu2x->confStr["skin"] != "Default") {
filepath = GMenu2X::getHome() + "/skins/Default/wallpapers";
if (fileExists(filepath)) {
fl.browse(filepath, false);
}
filepath = GMENU2X_SYSTEM_DIR "/skins/Default/wallpapers";
if (fileExists(filepath)) {
fl.browse(filepath, false);
}
fl.browse(GMenu2X::getHome() + "/skins/Default/wallpapers", false);
fl.browse(GMENU2X_SYSTEM_DIR "/skins/Default/wallpapers", false);
}
vector<string> wallpapers = fl.getFiles();