[gnome-boxes/special-chars-shared-folder: 23/23] 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: 23/23] shared-folder-popover: Use GFile API to get folder path and name
- Date: Mon, 15 Oct 2018 14:48:51 +0000 (UTC)
commit 2733e91afa87ce0bcca8e7df39a3b293b14d24cf
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]