summaryrefslogtreecommitdiff
path: root/thunar-volman
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2007-01-12 00:40:26 +0000
committerBenedikt Meurer <benny@xfce.org>2007-01-12 00:40:26 +0000
commit78a62c7ccd2b66f2d618b61fddf33e8f36681fe1 (patch)
tree4c5c8cdfe32365d8c75a384c01a47e1f019e3478 /thunar-volman
parent5e6ee92f0391e4c6f2d233e8d3fac7a6db006558 (diff)
downloadthunar-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)
Diffstat (limited to 'thunar-volman')
-rw-r--r--thunar-volman/tvm-block-device.c45
-rw-r--r--thunar-volman/tvm-preferences.c4
2 files changed, 46 insertions, 3 deletions
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));
/**