]> spindle.queued.net Git - midori/commitdiff
Handle more tokens in sokoke_spawn_program
authorChristian Dywan <christian@twotoasts.de>
Sun, 8 Jul 2012 12:39:42 +0000 (14:39 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 8 Jul 2012 18:12:38 +0000 (20:12 +0200)
extensions/addons.c
midori/midori-browser.c
midori/sokoke.c

index ad705a118e20c7a75f782cccb8ae690836bbdecc..4ab06c2b100393d6b426a1c0380de8dc10776bcf 100644 (file)
@@ -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);
index e765cdecbcda0cab42e9347ec9f3275f1ce6b207..8378ea81ed1207cf9abb0487e5d8878b59592c94 100644 (file)
@@ -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);
index ab04352a75e94d4541bdce22d3cf670c5f90fb5e..18ab9c9eeba0e7b6707738322e72d8b3b54d93ce 100644 (file)
@@ -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)