mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
ThemeEditor: Update theme path on theme load
Prior to this change, the 'Save' action was saving a file to the startup path (or just showed a File Picker dialog) if a file has been opened by the Open action or by drag-n-dropping a file to the program.
This commit is contained in:
parent
be7ae76829
commit
4e1a794abe
Notes:
sideshowbarker
2024-07-19 17:13:46 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/4e1a794abef Pull-request: https://github.com/SerenityOS/serenity/pull/9979
3 changed files with 8 additions and 0 deletions
|
@ -105,6 +105,8 @@ void PreviewWidget::set_theme_from_file(String const& path, int fd)
|
|||
|
||||
m_preview_palette = Gfx::Palette(Gfx::PaletteImpl::create_with_anonymous_buffer(theme));
|
||||
set_preview_palette(m_preview_palette);
|
||||
if (on_theme_load_from_file)
|
||||
on_theme_load_from_file(path);
|
||||
}
|
||||
|
||||
void PreviewWidget::paint_event(GUI::PaintEvent& event)
|
||||
|
|
|
@ -23,6 +23,8 @@ public:
|
|||
void set_preview_palette(const Gfx::Palette&);
|
||||
void set_theme_from_file(String const& path, int fd);
|
||||
|
||||
Function<void(String const&)> on_theme_load_from_file;
|
||||
|
||||
private:
|
||||
explicit PreviewWidget(const Gfx::Palette&);
|
||||
|
||||
|
|
|
@ -130,6 +130,10 @@ int main(int argc, char** argv)
|
|||
|
||||
auto& file_menu = window->add_menu("&File");
|
||||
|
||||
preview_widget.on_theme_load_from_file = [&](String const& new_path) {
|
||||
path = new_path;
|
||||
};
|
||||
|
||||
auto save_to_result = [&](FileSystemAccessClient::Result const& result) {
|
||||
if (result.error != 0)
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue