forked from enlightenment/efl
parent
beacf6f976
commit
b197b55abc
|
@ -248,8 +248,11 @@ efreet_desktop_command_progress_get(Efreet_Desktop *desktop, Eina_List *files,
|
|||
Eina_List *execs;
|
||||
|
||||
execs = efreet_desktop_command_build(command);
|
||||
ret = efreet_desktop_command_execs_process(command, execs);
|
||||
eina_list_free(execs);
|
||||
if (execs)
|
||||
{
|
||||
ret = efreet_desktop_command_execs_process(command, execs);
|
||||
eina_list_free(execs);
|
||||
}
|
||||
efreet_desktop_command_free(command);
|
||||
}
|
||||
|
||||
|
@ -399,6 +402,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
|||
{
|
||||
exec = efreet_desktop_command_append_single(exec, &size,
|
||||
&len, file, *p);
|
||||
if (!exec) goto error;
|
||||
file_added = 1;
|
||||
}
|
||||
break;
|
||||
|
@ -410,20 +414,24 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
|||
{
|
||||
exec = efreet_desktop_command_append_multiple(exec, &size,
|
||||
&len, command, *p);
|
||||
if (!exec) goto error;
|
||||
file_added = 1;
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
exec = efreet_desktop_command_append_icon(exec, &size, &len,
|
||||
command->desktop);
|
||||
if (!exec) goto error;
|
||||
break;
|
||||
case 'c':
|
||||
exec = efreet_desktop_command_append_quoted(exec, &size, &len,
|
||||
command->desktop->name);
|
||||
if (!exec) goto error;
|
||||
break;
|
||||
case 'k':
|
||||
exec = efreet_desktop_command_append_quoted(exec, &size, &len,
|
||||
command->desktop->orig_path);
|
||||
if (!exec) goto error;
|
||||
break;
|
||||
case 'v':
|
||||
case 'm':
|
||||
|
@ -470,6 +478,7 @@ efreet_desktop_command_build(Efreet_Desktop_Command *command)
|
|||
exec[len++] = ' ';
|
||||
exec = efreet_desktop_command_append_multiple(exec, &size,
|
||||
&len, command, 'F');
|
||||
if (!exec) goto error;
|
||||
file_added = 1;
|
||||
}
|
||||
#endif
|
||||
|
@ -514,6 +523,7 @@ efreet_desktop_command_append_quoted(char *dest, int *size, int *len, char *src)
|
|||
{
|
||||
if (!src) return dest;
|
||||
dest = efreet_string_append(dest, size, len, "'");
|
||||
if (!dest) return NULL;
|
||||
|
||||
/* single quotes in src need to be escaped */
|
||||
if (strchr(src, '\''))
|
||||
|
@ -523,16 +533,24 @@ efreet_desktop_command_append_quoted(char *dest, int *size, int *len, char *src)
|
|||
while (*p)
|
||||
{
|
||||
if (*p == '\'')
|
||||
{
|
||||
dest = efreet_string_append(dest, size, len, "\'\\\'");
|
||||
if (!dest) return NULL;
|
||||
}
|
||||
|
||||
dest = efreet_string_append_char(dest, size, len, *p);
|
||||
if (!dest) return NULL;
|
||||
p++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dest = efreet_string_append(dest, size, len, src);
|
||||
if (!dest) return NULL;
|
||||
}
|
||||
|
||||
dest = efreet_string_append(dest, size, len, "'");
|
||||
if (!dest) return NULL;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -553,10 +571,14 @@ efreet_desktop_command_append_multiple(char *dest, int *size, int *len,
|
|||
if (first)
|
||||
first = 0;
|
||||
else
|
||||
{
|
||||
dest = efreet_string_append_char(dest, size, len, ' ');
|
||||
if (!dest) return NULL;
|
||||
}
|
||||
|
||||
dest = efreet_desktop_command_append_single(dest, size, len,
|
||||
file, tolower(type));
|
||||
if (!dest) return NULL;
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
@ -591,6 +613,7 @@ efreet_desktop_command_append_single(char *dest, int *size, int *len,
|
|||
if (!str) return dest;
|
||||
|
||||
dest = efreet_desktop_command_append_quoted(dest, size, len, str);
|
||||
if (!dest) return NULL;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -602,7 +625,9 @@ efreet_desktop_command_append_icon(char *dest, int *size, int *len,
|
|||
if (!desktop->icon || !desktop->icon[0]) return dest;
|
||||
|
||||
dest = efreet_string_append(dest, size, len, "--icon ");
|
||||
if (!dest) return NULL;
|
||||
dest = efreet_desktop_command_append_quoted(dest, size, len, desktop->icon);
|
||||
if (!dest) return NULL;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
@ -667,6 +692,7 @@ efreet_desktop_command_file_process(Efreet_Desktop_Command *command, const char
|
|||
else
|
||||
{
|
||||
char *absol = efreet_desktop_command_path_absolute(file);
|
||||
if (!absol) goto error;
|
||||
/* process local uri/path */
|
||||
if (command->flags & EFREET_DESKTOP_EXEC_FLAG_FULLPATH)
|
||||
f->fullpath = strdup(absol);
|
||||
|
@ -687,6 +713,9 @@ efreet_desktop_command_file_process(Efreet_Desktop_Command *command, const char
|
|||
INF(" file: %s", f->file);
|
||||
#endif
|
||||
return f;
|
||||
error:
|
||||
IF_FREE(f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -774,9 +803,12 @@ efreet_desktop_cb_download_complete(void *data, const char *file __UNUSED__,
|
|||
Eina_List *execs;
|
||||
|
||||
execs = efreet_desktop_command_build(f->command);
|
||||
/* TODO: Need to handle the return value from efreet_desktop_command_execs_process */
|
||||
efreet_desktop_command_execs_process(f->command, execs);
|
||||
eina_list_free(execs);
|
||||
if (execs)
|
||||
{
|
||||
/* TODO: Need to handle the return value from efreet_desktop_command_execs_process */
|
||||
efreet_desktop_command_execs_process(f->command, execs);
|
||||
eina_list_free(execs);
|
||||
}
|
||||
efreet_desktop_command_free(f->command);
|
||||
}
|
||||
}
|
||||
|
@ -823,7 +855,9 @@ efreet_desktop_command_path_absolute(const char *path)
|
|||
len = strlen(buf);
|
||||
|
||||
if (buf[len-1] != '/') buf = efreet_string_append(buf, &size, &len, "/");
|
||||
if (!buf) return NULL;
|
||||
buf = efreet_string_append(buf, &size, &len, path);
|
||||
if (!buf) return NULL;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
|
@ -355,6 +355,7 @@ efreet_icon_find_theme_check(const char *theme_name)
|
|||
{
|
||||
if ((fake_null) && (!theme_name)) return fake_null;
|
||||
theme = efreet_icon_theme_new();
|
||||
if (!theme) return NULL;
|
||||
theme->fake = 1;
|
||||
if (theme_name)
|
||||
{
|
||||
|
@ -392,6 +393,7 @@ efreet_icon_path_find(const char *theme_name, const char *icon, unsigned int siz
|
|||
char *tmp;
|
||||
|
||||
tmp = efreet_icon_remove_extension(icon);
|
||||
if (!tmp) return NULL;
|
||||
value = efreet_icon_find_helper(theme, tmp, size);
|
||||
FREE(tmp);
|
||||
}
|
||||
|
@ -436,7 +438,11 @@ efreet_icon_list_find(const char *theme_name, Eina_List *icons,
|
|||
Eina_List *tmps = NULL;
|
||||
|
||||
EINA_LIST_FOREACH(icons, l, icon)
|
||||
tmps = eina_list_append(tmps, efreet_icon_remove_extension(icon));
|
||||
{
|
||||
data = efreet_icon_remove_extension(icon);
|
||||
if (!data) return NULL;
|
||||
tmps = eina_list_append(tmps, data);
|
||||
}
|
||||
|
||||
value = efreet_icon_list_find_helper(theme, tmps, size);
|
||||
EINA_LIST_FREE(tmps, data)
|
||||
|
@ -1311,6 +1317,7 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
|
|||
if (!theme)
|
||||
{
|
||||
theme = efreet_icon_theme_new();
|
||||
if (!theme) goto error;
|
||||
theme->name.internal = key;
|
||||
eina_hash_add(efreet_icon_themes,
|
||||
(void *)theme->name.internal, theme);
|
||||
|
@ -1332,6 +1339,7 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
|
|||
if (ecore_file_exists(path))
|
||||
efreet_icon_theme_index_read(theme, path);
|
||||
}
|
||||
error:
|
||||
closedir(dirs);
|
||||
|
||||
/* if we were given a theme name we want to make sure that that given
|
||||
|
@ -1356,7 +1364,9 @@ efreet_icon_theme_dir_scan(const char *search_dir, const char *theme_name)
|
|||
static void
|
||||
efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
||||
{
|
||||
/* TODO: return error value */
|
||||
Efreet_Ini *ini;
|
||||
Efreet_Icon_Theme_Directory *dir;
|
||||
const char *tmp;
|
||||
|
||||
if (!theme || !path) return;
|
||||
|
@ -1426,13 +1436,15 @@ efreet_icon_theme_index_read(Efreet_Icon_Theme *theme, const char *path)
|
|||
|
||||
if (p) *p = '\0';
|
||||
|
||||
theme->directories = eina_list_append(theme->directories,
|
||||
efreet_icon_theme_directory_new(ini, s));
|
||||
dir = efreet_icon_theme_directory_new(ini, s);
|
||||
if (!dir) goto error;
|
||||
theme->directories = eina_list_append(theme->directories, dir);
|
||||
|
||||
if (p) s = ++p;
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
efreet_ini_free(ini);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue