Enlightenment CVS committal
Author : onefang
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop
Modified Files:
Ecore_Desktop.h ecore_desktop.c
Log Message:
Expand FDO command arguments and allow other argument parsing again.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/Ecore_Desktop.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- Ecore_Desktop.h 7 Sep 2006 13:16:21 -0000 1.24
+++ Ecore_Desktop.h 11 Sep 2006 21:40:17 -0000 1.25
@@ -47,6 +47,7 @@
char *exec;
char *exec_params;
char *icon;
+ char *original_icon;
char *icon_class;
char *icon_path;
char *path;
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- ecore_desktop.c 10 Sep 2006 11:11:54 -0000 1.28
+++ ecore_desktop.c 11 Sep 2006 21:40:17 -0000 1.29
@@ -293,6 +293,8 @@
result->icon =
(char *)ecore_hash_get(result->group, "Icon");
+ if (result->icon)
+ result->original_icon = strdup(result->icon);
result->icon_class =
(char *)ecore_hash_get(result->group,
"X-Enlightenment-IconClass");
value =
@@ -664,6 +666,8 @@
free(desktop->original_lang);
if (desktop->eap_name)
free(desktop->eap_name);
+ if (desktop->original_icon)
+ free(desktop->original_icon);
if (desktop->icon_class)
free(desktop->icon_class);
if (desktop->window_class)
@@ -710,8 +714,121 @@
if (fill && (desktop->exec_params))
{
- /* FIXME: Handle the fdo %x replacable params. Some should be
stripped, some should be expanded. */
params = strdup(desktop->exec_params);
+ if (params)
+ {
+ Ecore_DList *command;
+
+ command = ecore_dlist_new();
+ if (command)
+ {
+ char *p, *t, buf[PATH_MAX + 10];
+ int len = 0;
+
+ ecore_dlist_set_free_cb(command, free);
+ t = params;
+ for (p = params; *p; p++)
+ {
+ if (*p == '%')
+ {
+ *p = '\0';
+ ecore_dlist_append(command, strdup(t));
+ *p = '%';
+ t = p;
+ }
+ }
+ if (t < p)
+ {
+ ecore_dlist_append(command, strdup(t));
+ }
+ if (!ecore_dlist_is_empty(command))
+ {
+ ecore_dlist_goto_first(command);
+ while ((p = ecore_dlist_next(command)) != NULL)
+ {
+ t = NULL;
+ /* FIXME: implement the rest of these when
EFM can pass us files. */
+ if (p[0] == '%')
+ switch (p[1])
+ {
+ case 'f' : /* Single file name,
multiple invokations if multiple files. If the file is on the net, download
first and point to temp file. */
+ break;
+
+ case 'u' : /* Single URL, multiple
invokations if multiple URLs. */
+ break;
+
+ case 'c' : /* Translated Name field
frem .desktop file. */
+ t = desktop->name;
+ break;
+
+ case 'k' : /* Location of the
.desktop file, may be a URL, or empty. */
+ t = desktop->original_path;
+ break;
+
+ case 'F' : /* Multiple file names.
If the files are on the net, download first and point to temp files. */
+ break;
+
+ case 'U' : /* Multiple URLs. */
+ break;
+
+ case 'd' : /* Directory of the file
in %f. */
+ break;
+
+ case 'D' : /* Directories of the
files in %F. */
+ break;
+
+ case 'n' : /* Single filename
without path. */
+ break;
+
+ case 'N' : /* Multiple filenames
without paths. */
+ break;
+
+ case 'i' : /* "--icon Icon" field
from .desktop file, or empty. */
+ if (desktop->original_icon)
+ {
+ snprintf(buf, sizeof(buf),
"--icon %s", desktop->original_icon);
+ t = buf;
+ }
+ break;
+
+ case 'v' : /* Device field from
.desktop file. */
+ break;
+
+ case '%' : /* A '%' character. */
+ t = "%";
+ break;
+
+ default :
+ break;
+ }
+ if (t)
+ {
+ len += strlen(t);
+ ecore_dlist_previous(command);
+ ecore_dlist_insert(command, strdup(t));
+ ecore_dlist_next(command);
+ ecore_dlist_next(command);
+ }
+ len += strlen(p);
+ }
+ free(params);
+ params = malloc(len);
+ if (params)
+ {
+ params[0] = '\0';
+ ecore_dlist_goto_first(command);
+ while ((p = ecore_dlist_next(command)) != NULL)
+ {
+ if (p[0] == '%')
+ strcat(params, &p[2]);
+ else
+ strcat(params, p);
+ }
+ }
+ }
+ ecore_list_destroy(command);
+ }
+ }
}
else if (desktop->exec_params)
params = strdup(desktop->exec_params);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs