From 3b113ff9cb7f06d33d98e3482c3c3320171ceb55 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 11 Jul 2024 07:09:22 +0300 Subject: [PATCH] implement open file action --- src/Entity/Browser/Menu/File/Open.php | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Entity/Browser/Menu/File/Open.php b/src/Entity/Browser/Menu/File/Open.php index affdc5a..522e94d 100644 --- a/src/Entity/Browser/Menu/File/Open.php +++ b/src/Entity/Browser/Menu/File/Open.php @@ -33,7 +33,32 @@ class Open 'activate', function() { - // @TODO + $dialog = new \GtkFileChooserDialog( + 'Open file', + $this->file->menu->browser->gtk, + \GtkFileChooserAction::OPEN, + [ + 'Cancel', + \GtkResponseType::CANCEL, + 'Open', + \GtkResponseType::OK + ] + ); + + /* @TODO keep last path + $dialog->set_current_folder();*/ + + if (\GtkResponseType::OK == $dialog->run()) + { + $this->file->menu->browser->container->tab->append( + sprintf( + 'file://%s', + $dialog->get_filename() + ) + ); + } + + $dialog->destroy(); } ); }