diff options
author | Jannis Pohlmann <jannis@xfce.org> | 2010-07-20 12:39:46 +0200 |
---|---|---|
committer | Jannis Pohlmann <jannis@xfce.org> | 2010-07-25 19:42:29 +0200 |
commit | a1cb43a6485957a74c35f58dd42022d7116f00b7 (patch) | |
tree | d231274d3e6c4fd545f297dfe63d0f194117e7e1 | |
parent | fef3c1273d39bfb04c818d379d43db09a5c0323b (diff) | |
download | thunar-volman-a1cb43a6485957a74c35f58dd42022d7116f00b7.tar.gz |
Add support for opening autorun.exe files with wine.
-rw-r--r-- | thunar-volman/tvm-block-device.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/thunar-volman/tvm-block-device.c b/thunar-volman/tvm-block-device.c index 7c999e9..d9c4d9f 100644 --- a/thunar-volman/tvm-block-device.c +++ b/thunar-volman/tvm-block-device.c @@ -134,6 +134,7 @@ tvm_block_device_autorun (TvmContext *context, gchar *autoplay_command; gchar *message; gchar *mount_path; + gchar *wine; guint n; gint response; @@ -219,6 +220,57 @@ tvm_block_device_autorun (TvmContext *context, } } } + + /* check if wine is present */ + wine = g_find_program_in_path ("wine"); + if (wine != NULL) + { + /* check if we have an autorun.exe file */ + if (tvm_file_test (mount, "autorun.exe", G_FILE_TEST_IS_REGULAR)) + { + /* prompt the user to execute this file */ + message = g_strdup_printf (_("Would you like to allow \"%s\" to run?"), + "autorun.exe"); + response = tvm_prompt (context, "gnome-fs-executable", + _("Auto-Run Confirmation"), + _("Auto-Run capability detected"), message, + _("Ig_nore"), GTK_RESPONSE_CANCEL, + _("_Allow Auto-Run"), TVM_RESPONSE_AUTORUN, + NULL); + g_free (message); + + /* check if we should run autogen.exe */ + if (response == TVM_RESPONSE_AUTORUN) + { + /* determine the mount point as a string */ + mount_point = g_mount_get_root (mount); + mount_path = g_file_get_path (mount_point); + g_object_unref (mount_point); + + /* prepare argv to launch the autorun file */ + argv = g_new0 (gchar *, 3); + argv[0] = g_strdup (wine); + argv[1] = g_strdup ("autorun.exe"); + argv[2] = NULL; + + /* try to launch the autorun file */ + result = g_spawn_async (mount_path, argv, NULL, 0, NULL, NULL, NULL, + error); + + /* free strings */ + g_strfreev (argv); + g_free (mount_path); + + /* free path to wine */ + g_free (wine); + + return result; + } + } + + /* free path to wine */ + g_free (wine); + } } return FALSE; |