mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
Terminal+LibVT: Use GUI::FileIconProvider for app icons
This commit is contained in:
parent
bcecd2fa2f
commit
b53011a198
2 changed files with 10 additions and 4 deletions
|
@ -419,6 +419,11 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/bin", "r") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (unveil("/bin/Terminal", "x") < 0) {
|
||||
perror("unveil");
|
||||
return 1;
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Clipboard.h>
|
||||
#include <LibGUI/DragOperation.h>
|
||||
#include <LibGUI/FileIconProvider.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/ScrollBar.h>
|
||||
|
@ -858,10 +860,9 @@ void TerminalWidget::context_menu_event(GUI::ContextMenuEvent& event)
|
|||
auto af_path = String::format("/res/apps/%s.af", LexicalPath(handler).basename().characters());
|
||||
auto af = Core::ConfigFile::open(af_path);
|
||||
auto handler_name = af->read_entry("App", "Name", handler);
|
||||
auto handler_icon = af->read_entry("Icons", "16x16", {});
|
||||
|
||||
auto icon = Gfx::Bitmap::load_from_file(handler_icon);
|
||||
auto action = GUI::Action::create(String::format("Open in %s", handler_name.characters()), move(icon), [this, handler](auto&) {
|
||||
auto handler_executable = af->read_entry("App", "Executable");
|
||||
auto handler_icon = GUI::FileIconProvider::icon_for_path(handler_executable).bitmap_for_size(16);
|
||||
auto action = GUI::Action::create(String::format("Open in %s", handler_name.characters()), handler_icon, [this, handler](auto&) {
|
||||
Desktop::Launcher::open(m_context_menu_href, handler);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue