diff options
author | Benedikt Meurer <benny@xfce.org> | 2007-01-12 00:40:26 +0000 |
---|---|---|
committer | Benedikt Meurer <benny@xfce.org> | 2007-01-12 00:40:26 +0000 |
commit | 78a62c7ccd2b66f2d618b61fddf33e8f36681fe1 (patch) | |
tree | 4c5c8cdfe32365d8c75a384c01a47e1f019e3478 | |
parent | 5e6ee92f0391e4c6f2d233e8d3fac7a6db006558 (diff) | |
download | thunar-volman-78a62c7ccd2b66f2d618b61fddf33e8f36681fe1.tar.gz |
2007-01-12 Benedikt Meurer <benny@xfce.org>
* thunar-volman/tvm-block-device.c: Support autorun.exe if wine is
installed on the system.
* thunar-volman/tvm-preferences.c(tvm_preferences_class_init): Enable
autorun and autoopen by default, which is safe, since we prompt
for confirmation every time, as required by the specification.
(Old svn revision: 2341)
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | thunar-volman/tvm-block-device.c | 45 | ||||
-rw-r--r-- | thunar-volman/tvm-preferences.c | 4 |
3 files changed, 54 insertions, 3 deletions
@@ -1,5 +1,13 @@ 2007-01-12 Benedikt Meurer <benny@xfce.org> + * thunar-volman/tvm-block-device.c: Support autorun.exe if wine is + installed on the system. + * thunar-volman/tvm-preferences.c(tvm_preferences_class_init): Enable + autorun and autoopen by default, which is safe, since we prompt + for confirmation every time, as required by the specification. + +2007-01-12 Benedikt Meurer <benny@xfce.org> + * Initial import. # vi:set ts=8 sw=8 noet ai nocindent: diff --git a/thunar-volman/tvm-block-device.c b/thunar-volman/tvm-block-device.c index 9b7fa1e..e6ec8b3 100644 --- a/thunar-volman/tvm-block-device.c +++ b/thunar-volman/tvm-block-device.c @@ -254,6 +254,7 @@ tvm_block_device_autorun (TvmPreferences *preferences, gchar line[1024]; gchar *path_vcd; gchar *message; + gchar *wine; gchar **argv; FILE *fp; gint response; @@ -292,7 +293,8 @@ tvm_block_device_autorun (TvmPreferences *preferences, { /* check if one of the autorun files is present and executable */ path_autorun = g_build_filename (mount_point, AUTORUN[n], NULL); - if (g_file_test (path_autorun, G_FILE_TEST_IS_EXECUTABLE)) + if (g_file_test (path_autorun, G_FILE_TEST_IS_EXECUTABLE) + && g_file_test (path_autorun, G_FILE_TEST_IS_REGULAR)) { /* prompt the user whether to execute this file */ message = g_strdup_printf (_("Would you like to allow \"%s\" to run?"), AUTORUN[n]); @@ -323,6 +325,47 @@ tvm_block_device_autorun (TvmPreferences *preferences, } g_free (path_autorun); } + + /* check if wine is present */ + wine = g_find_program_in_path ("wine"); + if (G_UNLIKELY (wine != NULL)) + { + /* check if we have an autorun.exe file */ + path_autorun = g_build_filename (mount_point, "autorun.exe", NULL); + if (g_file_test (path_autorun, G_FILE_TEST_IS_REGULAR)) + { + /* prompt the user whether to execute this file */ + message = g_strdup_printf (_("Would you like to allow \"%s\" to run?"), "autorun.exe"); + response = tvm_prompt (context, udi, "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 autorun */ + if (response == TVM_RESPONSE_AUTORUN) + { + /* prepare argv to launch autorun.exe file */ + argv = g_new (gchar *, 3); + argv[0] = wine; + argv[1] = g_strdup ("autorun.exe"); + argv[2] = NULL; + + /* try to launch the autorun.exe file via wine */ + result = g_spawn_async (mount_point, argv, NULL, 0, NULL, NULL, NULL, error); + + /* cleanup */ + g_free (path_autorun); + g_strfreev (argv); + + /* outa here */ + return result; + } + } + g_free (path_autorun); + } + g_free (wine); } /* check if autoopen support is enabled */ diff --git a/thunar-volman/tvm-preferences.c b/thunar-volman/tvm-preferences.c index 4e01fd2..712db87 100644 --- a/thunar-volman/tvm-preferences.c +++ b/thunar-volman/tvm-preferences.c @@ -225,7 +225,7 @@ tvm_preferences_class_init (TvmPreferencesClass *klass) g_param_spec_boolean ("autorun", "autorun", "autorun", - FALSE, + TRUE, EXO_PARAM_READWRITE)); /** @@ -238,7 +238,7 @@ tvm_preferences_class_init (TvmPreferencesClass *klass) g_param_spec_boolean ("autoopen", "autoopen", "autoopen", - FALSE, + TRUE, EXO_PARAM_READWRITE)); /** |