[Goodies-commits] r2341 - in thunar-volman/trunk: . thunar-volman

Benedikt Meurer benny at xfce.org
Fri Jan 12 01:40:27 CET 2007


Author: benny
Date: 2007-01-12 00:40:26 +0000 (Fri, 12 Jan 2007)
New Revision: 2341

Modified:
   thunar-volman/trunk/ChangeLog
   thunar-volman/trunk/thunar-volman/tvm-block-device.c
   thunar-volman/trunk/thunar-volman/tvm-preferences.c
Log:
2007-01-12	Benedikt Meurer <benny at 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.




Modified: thunar-volman/trunk/ChangeLog
===================================================================
--- thunar-volman/trunk/ChangeLog	2007-01-11 23:11:32 UTC (rev 2340)
+++ thunar-volman/trunk/ChangeLog	2007-01-12 00:40:26 UTC (rev 2341)
@@ -1,5 +1,13 @@
 2007-01-12	Benedikt Meurer <benny at 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 at xfce.org>
+
 	* Initial import.
 
 # vi:set ts=8 sw=8 noet ai nocindent:

Modified: thunar-volman/trunk/thunar-volman/tvm-block-device.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-block-device.c	2007-01-11 23:11:32 UTC (rev 2340)
+++ thunar-volman/trunk/thunar-volman/tvm-block-device.c	2007-01-12 00:40:26 UTC (rev 2341)
@@ -254,6 +254,7 @@
   gchar       line[1024];
   gchar      *path_vcd;
   gchar      *message;
+  gchar      *wine;
   gchar     **argv;
   FILE       *fp;
   gint        response;
@@ -292,7 +293,8 @@
         {
           /* 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 @@
             }
           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 */

Modified: thunar-volman/trunk/thunar-volman/tvm-preferences.c
===================================================================
--- thunar-volman/trunk/thunar-volman/tvm-preferences.c	2007-01-11 23:11:32 UTC (rev 2340)
+++ thunar-volman/trunk/thunar-volman/tvm-preferences.c	2007-01-12 00:40:26 UTC (rev 2341)
@@ -225,7 +225,7 @@
                                    g_param_spec_boolean ("autorun",
                                                          "autorun",
                                                          "autorun",
-                                                         FALSE,
+                                                         TRUE,
                                                          EXO_PARAM_READWRITE));
 
   /**
@@ -238,7 +238,7 @@
                                    g_param_spec_boolean ("autoopen",
                                                          "autoopen",
                                                          "autoopen",
-                                                         FALSE,
+                                                         TRUE,
                                                          EXO_PARAM_READWRITE));
 
   /**




More information about the Goodies-commits mailing list