--- a/src/9panel.c Tue Feb 19 19:44:38 2008 +0100
+++ b/src/9panel.c Tue Apr 01 17:29:23 2008 +0200
@@ -457,6 +457,47 @@ panel_get_string(GKeyFile *keyfile, cons
return string;
}
+static char *
+panel_translate_app_exec_to_command_line(const char *execline)
+{
+ GString* cmd;
+ const char *p;
+
+ trace("%s\n", execline);
+
+ if (strchr(execline, '%') == NULL)
+ return g_strdup(execline);
+
+ cmd = g_string_new("");
+
+ for (p=execline; *p ; p++)
+ {
+ if( *p == '%' )
+ {
+ /* It's a escape character so eat the second one ... */
+ p++;
+ if (*p == '%')
+ g_string_append_c( cmd, '%' );
+ else if (*p == 0)
+ break;
+ else
+ {
+ /* We do not manage %U %u %d ... */
+ }
+ }
+ else
+ {
+ /* It's a normal character so add it to the string */
+ g_string_append_c( cmd, *p);
+ }
+ }
+
+ return g_string_free(cmd, FALSE);
+}
+
+
+
+
/*
*
*
@@ -468,6 +509,7 @@ panel_load_desktop_file_type_application
char *type, *categorie;
GError *gerror;
struct application *app;
+ char *exec_cmdline = NULL;
keyfile = g_key_file_new();
if (keyfile == NULL)
@@ -531,7 +573,9 @@ panel_load_desktop_file_type_application
if (suffix) *suffix = '\0';
app->label = label;
}
- app->cmdline = panel_get_string(keyfile, "Exec");
+ exec_cmdline = panel_get_string(keyfile, "Exec");
+ if (exec_cmdline)
+ app->cmdline = panel_translate_app_exec_to_command_line(exec_cmdline);
app->icon = panel_get_string(keyfile, "Icon");
app->generic_name = panel_get_string(keyfile, "GenericName");
if (app->generic_name == NULL)
@@ -539,6 +583,7 @@ panel_load_desktop_file_type_application
g_free(type);
g_free(categorie);
+ g_free(exec_cmdline);
return app;