[Xfce4-commits] <midori:master> Handle more tokens in sokoke_spawn_program

Christian Dywan noreply at xfce.org
Sun Jul 8 20:14:02 CEST 2012


Updating branch refs/heads/master
         to 0c201ca2b89492d252116af692857c7df928fa8c (commit)
       from 8ad44b86c322c2d8b6b5029e48b26b8e26295ee3 (commit)

commit 0c201ca2b89492d252116af692857c7df928fa8c
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Jul 8 14:39:42 2012 +0200

    Handle more tokens in sokoke_spawn_program

 extensions/addons.c     |    2 +-
 midori/midori-browser.c |    2 +-
 midori/sokoke.c         |   17 ++++++++++-------
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/extensions/addons.c b/extensions/addons.c
index ad705a1..4ab06c2 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -491,7 +491,7 @@ addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
 
         g_object_get (settings, "text-editor", &text_editor, NULL);
         if (text_editor && *text_editor)
-            sokoke_spawn_program (text_editor, TRUE, element->fullpath, TRUE);
+            sokoke_spawn_program (text_editor, FALSE, element->fullpath, TRUE);
         else
         {
             gchar* element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index e765cde..8378ea8 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -3498,7 +3498,7 @@ _action_source_view_activate (GtkAction*     action,
     }
     else
     {
-        sokoke_spawn_program (text_editor, TRUE, filename, TRUE);
+        sokoke_spawn_program (text_editor, FALSE, filename, TRUE);
         g_free (filename);
     }
     g_free (text_editor);
diff --git a/midori/sokoke.c b/midori/sokoke.c
index ab04352..18ab9c9 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -408,16 +408,19 @@ sokoke_prepare_command (const gchar* command,
         gchar* real_command;
         gchar* command_ready;
 
-        /* .desktop files accept %u as URI, we cheap and treat it like %s */
-        if ((uri_format = strstr (command, "%u")))
-            uri_format[1] = 's';
-
         real_command = quote_command ? g_shell_quote (command) : g_strdup (command);
 
-        if (strstr (command, "%s"))
+        /* .desktop files accept %u, %U, %f, %F as URI/ filename, we treat it like %s */
+        if ((uri_format = strstr (real_command, "%u"))
+         || (uri_format = strstr (real_command, "%U"))
+         || (uri_format = strstr (real_command, "%f"))
+         || (uri_format = strstr (real_command, "%F")))
+            uri_format[1] = 's';
+
+        if (strstr (real_command, "%s"))
         {
-            gchar* argument_quoted = g_shell_quote (argument);
-            command_ready = sokoke_replace_variables (real_command, "%s", argument_quoted);
+            gchar* argument_quoted = quote_argument ? g_shell_quote (argument) : g_strdup (argument);
+            command_ready = g_strdup_printf (real_command, argument_quoted);
             g_free (argument_quoted);
         }
         else if (quote_argument)


More information about the Xfce4-commits mailing list