diff options
author | Linus Groh <mail@linusgroh.de> | 2020-12-27 18:55:26 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-27 22:46:52 +0100 |
commit | 00402686f3dc21fb33d7606615dbffc0fb5dbac5 (patch) | |
tree | 8f29112edfcf4a69627979809aa7f5f049b80367 /Services/SystemMenu/main.cpp | |
parent | bb1d52eaf01ad511fbb2d34b96600eb1aee27dbe (diff) | |
download | serenity-00402686f3dc21fb33d7606615dbffc0fb5dbac5.zip |
SystemMenu: Use GUI::AppFile
Diffstat (limited to 'Services/SystemMenu/main.cpp')
-rw-r--r-- | Services/SystemMenu/main.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Services/SystemMenu/main.cpp b/Services/SystemMenu/main.cpp index 174feec844..32a57e8c8b 100644 --- a/Services/SystemMenu/main.cpp +++ b/Services/SystemMenu/main.cpp @@ -32,6 +32,7 @@ #include <LibCore/StandardPaths.h> #include <LibGUI/Action.h> #include <LibGUI/ActionGroup.h> +#include <LibGUI/AppFile.h> #include <LibGUI/Application.h> #include <LibGUI/FileIconProvider.h> #include <LibGUI/Icon.h> @@ -102,19 +103,10 @@ int main(int argc, char** argv) Vector<String> discover_apps_and_categories() { HashTable<String> seen_app_categories; - Core::DirIterator dt("/res/apps", Core::DirIterator::SkipDots); - while (dt.has_next()) { - auto af_name = dt.next_path(); - auto af_path = String::format("/res/apps/%s", af_name.characters()); - auto af = Core::ConfigFile::open(af_path); - if (!af->has_key("App", "Name") || !af->has_key("App", "Executable")) - continue; - auto app_name = af->read_entry("App", "Name"); - auto app_executable = af->read_entry("App", "Executable"); - auto app_category = af->read_entry("App", "Category"); - g_apps.append({ app_executable, app_name, app_category }); - seen_app_categories.set(app_category); - } + GUI::AppFile::for_each([&](auto af) { + g_apps.append({ af->executable(), af->name(), af->category() }); + seen_app_categories.set(af->category()); + }); quick_sort(g_apps, [](auto& a, auto& b) { return a.name < b.name; }); Vector<String> sorted_app_categories; |