Commit f283abd5 authored by Alessandro Bono's avatar Alessandro Bono

teleport-remote-device: Use GtkFileChooserNative

Use GtkFileChooserNative which is more sandbox friendly.
parent 971d52be
......@@ -155,7 +155,7 @@ teleport_remote_device_class_init (TeleportRemoteDeviceClass *klass)
static void
open_file_picker(GtkButton *btn,
Peer *device) {
GtkWidget *dialog;
GtkFileChooserNative *dialog;
GtkWidget * window;
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
gint res;
......@@ -164,29 +164,26 @@ open_file_picker(GtkButton *btn,
window = gtk_widget_get_toplevel (GTK_WIDGET (btn));
if (gtk_widget_is_toplevel (window))
{
dialog = gtk_file_chooser_dialog_new ("Open File",
dialog = gtk_file_chooser_native_new ("Open File",
GTK_WINDOW(window),
action,
("_Cancel"),
GTK_RESPONSE_CANCEL,
("_Open"),
GTK_RESPONSE_ACCEPT,
NULL);
("_Cancel"));
res = gtk_dialog_run (GTK_DIALOG (dialog));
res = gtk_native_dialog_run (GTK_NATIVE_DIALOG (dialog));
if (res == GTK_RESPONSE_ACCEPT)
{
char *filename;
GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
filename = gtk_file_chooser_get_filename (chooser);
g_print("Choosen file is %s\n", filename);
gtk_widget_destroy (dialog);
g_object_unref (dialog);
teleport_server_add_route (g_compute_checksum_for_string (G_CHECKSUM_SHA256, filename, -1), filename, device->ip);
g_free (filename);
}
else
{
gtk_widget_destroy (dialog);
g_object_unref (dialog);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment