mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
SystemMenu: Use GUI::AppFile
This commit is contained in:
parent
bb1d52eaf0
commit
00402686f3
1 changed files with 5 additions and 13 deletions
|
@ -32,6 +32,7 @@
|
||||||
#include <LibCore/StandardPaths.h>
|
#include <LibCore/StandardPaths.h>
|
||||||
#include <LibGUI/Action.h>
|
#include <LibGUI/Action.h>
|
||||||
#include <LibGUI/ActionGroup.h>
|
#include <LibGUI/ActionGroup.h>
|
||||||
|
#include <LibGUI/AppFile.h>
|
||||||
#include <LibGUI/Application.h>
|
#include <LibGUI/Application.h>
|
||||||
#include <LibGUI/FileIconProvider.h>
|
#include <LibGUI/FileIconProvider.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
|
@ -102,19 +103,10 @@ int main(int argc, char** argv)
|
||||||
Vector<String> discover_apps_and_categories()
|
Vector<String> discover_apps_and_categories()
|
||||||
{
|
{
|
||||||
HashTable<String> seen_app_categories;
|
HashTable<String> seen_app_categories;
|
||||||
Core::DirIterator dt("/res/apps", Core::DirIterator::SkipDots);
|
GUI::AppFile::for_each([&](auto af) {
|
||||||
while (dt.has_next()) {
|
g_apps.append({ af->executable(), af->name(), af->category() });
|
||||||
auto af_name = dt.next_path();
|
seen_app_categories.set(af->category());
|
||||||
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);
|
|
||||||
}
|
|
||||||
quick_sort(g_apps, [](auto& a, auto& b) { return a.name < b.name; });
|
quick_sort(g_apps, [](auto& a, auto& b) { return a.name < b.name; });
|
||||||
|
|
||||||
Vector<String> sorted_app_categories;
|
Vector<String> sorted_app_categories;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue