[gnome-boxes/special-chars-shared-folder] shared-folder-popover: Use GFile API to get folder path and name
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/special-chars-shared-folder] shared-folder-popover: Use GFile API to get folder path and name
- Date: Thu, 11 Oct 2018 11:33:34 +0000 (UTC)
commit 3ad330e37f52ec16191514490f1edce188556a26
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Oct 11 13:31:17 2018 +0200
shared-folder-popover: Use GFile API to get folder path and name
The current implementation was using Vala's string.scanf() to parse
the resulting URI from the file chooser button, causing non-utf8
strings to have unexpected behavior.
Fixes #252
src/shared-folder-popover.vala | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/shared-folder-popover.vala b/src/shared-folder-popover.vala
index f1e095b8..32e9af67 100644
--- a/src/shared-folder-popover.vala
+++ b/src/shared-folder-popover.vala
@@ -24,15 +24,15 @@ public void on_cancel (Gtk.Button cancel_button) {
[GtkCallback]
public void on_save (Gtk.Button save_button) {
- var path = file_chooser_button.get_uri ();
+ var uri = file_chooser_button.get_uri ();
+ File file = File.new_for_uri (uri);
var name = name_entry.get_text ();
- if (path != null) {
- path.scanf ("file://%s", path);
+ if (uri != null) {
if (name == "")
- name = Path.get_basename (path);
+ name = file.get_basename ();
- saved (path, name, target_position);
+ saved (file.get_path (), name, target_position);
}
popdown ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]