Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hubert Figuière
Compiano
Commits
2b9895f2
Commit
2b9895f2
authored
Sep 18, 2022
by
Hubert Figuière
Browse files
ui: fix crash if there is no previously open soundfont
parent
3ff0b270
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/widgets/file_chooser_button.rs
View file @
2b9895f2
...
...
@@ -75,14 +75,10 @@ impl ObjectImpl for FileChooserButtonPriv {
let
priv_
=
FileChooserButtonPriv
::
from_instance
(
b
);
// We must hold a reference to the Native dialog, or it crashes.
priv_
.dialog
.replace
(
Some
(
file_chooser
.clone
()));
print_on_err!
(
file_chooser
.set_current_folder
(
priv_
.file
.borrow
()
.as_ref
()
.and_then
(|
f
|
f
.parent
())
.as_ref
()
));
let
current_folder
=
priv_
.file
.borrow
()
.as_ref
()
.and_then
(|
f
|
f
.parent
());
if
current_folder
.is_some
()
{
print_on_err!
(
file_chooser
.set_current_folder
(
current_folder
.as_ref
()));
}
file_chooser
.connect_response
(
glib
::
clone!
(
@
weak
b
=>
move
|
w
,
r
|
{
if
r
==
gtk4
::
ResponseType
::
Accept
{
b
.set_property
(
"file"
,
&
w
.file
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment