Author: benny
Date: 2007-05-20 14:07:15 +0000 (Sun, 20 May 2007)
New Revision: 25732

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/plugins/thunar-uca/thunar-uca-editor.c
Log:
2007-05-20      Benedikt Meurer <[EMAIL PROTECTED]>

        * plugins/thunar-uca/thunar-uca-editor.c: Properly quote files
          selected via the file chooser if necessary. Bug #3105.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog      2007-05-20 13:06:03 UTC (rev 25731)
+++ thunar/trunk/ChangeLog      2007-05-20 14:07:15 UTC (rev 25732)
@@ -1,5 +1,10 @@
 2007-05-20     Benedikt Meurer <[EMAIL PROTECTED]>
 
+       * plugins/thunar-uca/thunar-uca-editor.c: Properly quote files
+         selected via the file chooser if necessary. Bug #3105.
+
+2007-05-20     Benedikt Meurer <[EMAIL PROTECTED]>
+
        * thunar-vfs/thunar-vfs-volume-freebsd.c,
          thunar-vfs/thunar-vfs-volume-hal.c,
          thunar-vfs/thunar-vfs-volume.{c,h}, thunar-vfs/thunar-vfs.symbols:

Modified: thunar/trunk/plugins/thunar-uca/thunar-uca-editor.c
===================================================================
--- thunar/trunk/plugins/thunar-uca/thunar-uca-editor.c 2007-05-20 13:06:03 UTC 
(rev 25731)
+++ thunar/trunk/plugins/thunar-uca/thunar-uca-editor.c 2007-05-20 14:07:15 UTC 
(rev 25732)
@@ -1,6 +1,6 @@
 /* $Id$ */
 /*-
- * Copyright (c) 2005-2006 Benedikt Meurer <[EMAIL PROTECTED]>
+ * Copyright (c) 2005-2007 Benedikt Meurer <[EMAIL PROTECTED]>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -483,7 +483,9 @@
   GtkFileFilter *filter;
   GtkWidget     *chooser;
   gchar         *filename;
+  gchar        **argv = NULL;
   gchar         *s;
+  gint           argc;
 
   g_return_if_fail (THUNAR_UCA_IS_EDITOR (uca_editor));
 
@@ -581,7 +583,20 @@
   /* run the chooser dialog */
   if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT)
     {
+      /* determine the path to the selected file */
       filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+
+      /* check if we need to quote the filename */
+      if (!g_shell_parse_argv (filename, &argc, &argv, NULL) || argc > 1)
+        {
+          /* shell is unable to interpret properly without quoting */
+          s = g_shell_quote (filename);
+          g_free (filename);
+          filename = s;
+        }
+      g_strfreev (argv);
+
+      /* append %f to filename, user may change that afterwards */
       s = g_strconcat (filename, " %f", NULL);
       gtk_entry_set_text (GTK_ENTRY (uca_editor->command_entry), s);
       g_free (filename);

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to