forked from enlightenment/efl
parent
f9a0087270
commit
e21eff359b
|
@ -24,10 +24,10 @@ static Ecore_Hash *desktop_cache;
|
|||
|
||||
Ecore_Desktop *_ecore_desktop_get(const char *file, const char *lang);
|
||||
void _ecore_desktop_destroy(Ecore_Desktop * desktop);
|
||||
|
||||
#define IFGETDUP(src, key, dst) src = (char *)ecore_hash_get(result->group, key); if (src) dst = strdup(src); else dst = NULL;
|
||||
#define IFFREE(src) if (src) free(src); src = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Desktop_Main_Group .desktop file Functions
|
||||
*
|
||||
|
@ -133,7 +133,8 @@ ecore_desktop_ini_get(const char *file)
|
|||
*c++ = '\0';
|
||||
/* FIXME: should strip space at end, then unescape value. */
|
||||
tv = ecore_hash_remove(current, key);
|
||||
if (tv) free(tv);
|
||||
if (tv)
|
||||
free(tv);
|
||||
if (value[0] != '\0')
|
||||
ecore_hash_set(current, strdup(key), strdup(value));
|
||||
#ifdef DEBUG
|
||||
|
@ -188,13 +189,13 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
char *value;
|
||||
int stated = 0;
|
||||
|
||||
result = (Ecore_Desktop *) ecore_hash_get(desktop_cache, (char *) file);
|
||||
result = (Ecore_Desktop *) ecore_hash_get(desktop_cache, (char *)file);
|
||||
/* Check if the cache is still valid. */
|
||||
if (result)
|
||||
{
|
||||
if (stat(result->original_path, &st) >= 0)
|
||||
{
|
||||
if(st.st_mtime > result->mtime)
|
||||
if (st.st_mtime > result->mtime)
|
||||
{
|
||||
ecore_hash_remove(desktop_cache, result->original_path);
|
||||
result = NULL;
|
||||
|
@ -234,10 +235,12 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
char *categories = NULL;
|
||||
int size = 0;
|
||||
|
||||
value = (char *) ecore_file_get_file(result->original_path);
|
||||
value =
|
||||
(char *)ecore_file_get_file(result->original_path);
|
||||
if (value)
|
||||
{
|
||||
char *temp = strrchr(value, '.');
|
||||
|
||||
if (temp)
|
||||
*temp = '\0';
|
||||
result->eap_name = malloc(strlen(value) + 5);
|
||||
|
@ -280,7 +283,7 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
{
|
||||
char *p;
|
||||
|
||||
value = (char *) ecore_file_get_file(tmp); /* In case the exe included a path. */
|
||||
value = (char *)ecore_file_get_file(tmp); /* In case the exe included a path. */
|
||||
p = value;
|
||||
while ((*p != '\0') && (*p != ' '))
|
||||
{
|
||||
|
@ -293,19 +296,25 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
free(tmp);
|
||||
}
|
||||
}
|
||||
IFGETDUP(value, "X-Enlightenment-WindowName", result->window_name);
|
||||
IFGETDUP(value, "X-Enlightenment-WindowTitle", result->window_title);
|
||||
IFGETDUP(value, "X-Enlightenment-WindowRole", result->window_role);
|
||||
IFGETDUP(value, "X-Enlightenment-WindowName",
|
||||
result->window_name);
|
||||
IFGETDUP(value, "X-Enlightenment-WindowTitle",
|
||||
result->window_title);
|
||||
IFGETDUP(value, "X-Enlightenment-WindowRole",
|
||||
result->window_role);
|
||||
|
||||
IFGETDUP(value, "Icon", result->icon);
|
||||
if (result->icon)
|
||||
result->original_icon = strdup(result->icon);
|
||||
IFGETDUP(value, "X-Enlightenment-IconClass", result->icon_class);
|
||||
IFGETDUP(value, "X-Enlightenment-IconPath", result->icon_path);
|
||||
IFGETDUP(value, "X-Enlightenment-IconClass",
|
||||
result->icon_class);
|
||||
IFGETDUP(value, "X-Enlightenment-IconPath",
|
||||
result->icon_path);
|
||||
|
||||
if ((result->icon != NULL) && (result->icon_path == NULL) && (strchr(result->icon, '/') != NULL))
|
||||
if ((result->icon != NULL) && (result->icon_path == NULL)
|
||||
&& (strchr(result->icon, '/') != NULL))
|
||||
{
|
||||
if(result->icon[0] == '/')
|
||||
if (result->icon[0] == '/')
|
||||
{
|
||||
result->icon_path = strdup(result->icon);
|
||||
result->icon = NULL;
|
||||
|
@ -314,17 +323,23 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
{
|
||||
char *temp;
|
||||
|
||||
size = strlen(result->original_path) + strlen(result->icon) + 2;
|
||||
size =
|
||||
strlen(result->original_path) +
|
||||
strlen(result->icon) + 2;
|
||||
temp = malloc(size);
|
||||
if (temp)
|
||||
{
|
||||
char *dir;
|
||||
|
||||
dir = ecore_file_get_dir(result->original_path);
|
||||
dir =
|
||||
ecore_file_get_dir(result->
|
||||
original_path);
|
||||
if (dir)
|
||||
{
|
||||
sprintf(temp, "%s/%s", dir, result->icon);
|
||||
result->icon_path = ecore_file_realpath(temp);
|
||||
sprintf(temp, "%s/%s", dir,
|
||||
result->icon);
|
||||
result->icon_path =
|
||||
ecore_file_realpath(temp);
|
||||
result->icon = NULL;
|
||||
free(dir);
|
||||
}
|
||||
|
@ -365,13 +380,10 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
if (value)
|
||||
result->wait_exit = (strcmp(value, "true") == 0);
|
||||
value =
|
||||
(char *)ecore_hash_get(result->group,
|
||||
"NoDisplay");
|
||||
(char *)ecore_hash_get(result->group, "NoDisplay");
|
||||
if (value)
|
||||
result->no_display = (strcmp(value, "true") == 0);
|
||||
value =
|
||||
(char *)ecore_hash_get(result->group,
|
||||
"Hidden");
|
||||
value = (char *)ecore_hash_get(result->group, "Hidden");
|
||||
if (value)
|
||||
result->hidden = (strcmp(value, "true") == 0);
|
||||
|
||||
|
@ -389,9 +401,12 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
size = 0;
|
||||
if ((result->icon) && (result->icon[0] != '/'))
|
||||
size += strlen(result->icon) + 1;
|
||||
if (eap_name) size += strlen(eap_name) + 1;
|
||||
if (exe) size += strlen(exe) + 1;
|
||||
if (categories) size += strlen(categories) + 1;
|
||||
if (eap_name)
|
||||
size += strlen(eap_name) + 1;
|
||||
if (exe)
|
||||
size += strlen(exe) + 1;
|
||||
if (categories)
|
||||
size += strlen(categories) + 1;
|
||||
result->icon_class = malloc(size + 1);
|
||||
if (result->icon_class)
|
||||
{
|
||||
|
@ -399,7 +414,8 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
int done = 0;
|
||||
|
||||
result->icon_class[0] = '\0';
|
||||
if ((result->icon) && (result->icon[0] != '/') && (result->icon[0] != '\0'))
|
||||
if ((result->icon) && (result->icon[0] != '/')
|
||||
&& (result->icon[0] != '\0'))
|
||||
{
|
||||
strcat(result->icon_class, result->icon);
|
||||
done = 1;
|
||||
|
@ -468,11 +484,13 @@ _ecore_desktop_get(const char *file, const char *lang)
|
|||
if (result->group)
|
||||
{
|
||||
IFGETDUP(value, "Path", result->path);
|
||||
IFGETDUP(value, "DeletionDate", result->deletiondate);
|
||||
IFGETDUP(value, "DeletionDate",
|
||||
result->deletiondate);
|
||||
}
|
||||
}
|
||||
|
||||
ecore_hash_set(desktop_cache, strdup(result->original_path), result);
|
||||
ecore_hash_set(desktop_cache, strdup(result->original_path),
|
||||
result);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -495,13 +513,17 @@ ecore_desktop_save(Ecore_Desktop * desktop)
|
|||
if ((desktop->ondisk) && (desktop->original_path))
|
||||
{
|
||||
desktop->data = ecore_desktop_ini_get(desktop->original_path);
|
||||
desktop->group = (Ecore_Hash *) ecore_hash_get(desktop->data, "Desktop Entry");
|
||||
desktop->group =
|
||||
(Ecore_Hash *) ecore_hash_get(desktop->data, "Desktop Entry");
|
||||
if (!desktop->group)
|
||||
desktop->group = (Ecore_Hash *) ecore_hash_get(desktop->data, "KDE Desktop Entry");
|
||||
desktop->group =
|
||||
(Ecore_Hash *) ecore_hash_get(desktop->data,
|
||||
"KDE Desktop Entry");
|
||||
if (!desktop->group)
|
||||
{
|
||||
trash = 1;
|
||||
desktop->group = (Ecore_Hash *) ecore_hash_get(desktop->data, "Trash Info");
|
||||
desktop->group =
|
||||
(Ecore_Hash *) ecore_hash_get(desktop->data, "Trash Info");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -527,34 +549,65 @@ ecore_desktop_save(Ecore_Desktop * desktop)
|
|||
|
||||
real = ecore_file_readlink(desktop->original_path);
|
||||
if (real)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-OriginalPath"), real);
|
||||
ecore_hash_set(desktop->group,
|
||||
strdup("X-Enlightenment-OriginalPath"),
|
||||
real);
|
||||
}
|
||||
}
|
||||
|
||||
temp = ecore_desktop_get_command(desktop, NULL, 0);
|
||||
if (temp)
|
||||
ecore_hash_set(desktop->group, strdup("Exec"), temp);
|
||||
if (desktop->name) ecore_hash_set(desktop->group, strdup("Name"), strdup(desktop->name));
|
||||
if (desktop->generic) ecore_hash_set(desktop->group, strdup("GenericName"), strdup(desktop->generic));
|
||||
if (desktop->comment) ecore_hash_set(desktop->group, strdup("Comment"), strdup(desktop->comment));
|
||||
if (desktop->type) ecore_hash_set(desktop->group, strdup("Type"), strdup(desktop->type));
|
||||
if (desktop->URL) ecore_hash_set(desktop->group, strdup("URL"), strdup(desktop->URL));
|
||||
if (desktop->file) ecore_hash_set(desktop->group, strdup("File"), strdup(desktop->file));
|
||||
if (desktop->icon) ecore_hash_set(desktop->group, strdup("Icon"), strdup(desktop->icon));
|
||||
if (desktop->icon_class) ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconClass"), strdup(desktop->icon_class));
|
||||
if (desktop->icon_path) ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconPath"), strdup(desktop->icon_path));
|
||||
if (desktop->window_class) ecore_hash_set(desktop->group, strdup("StartupWMClass"), strdup(desktop->window_class));
|
||||
if (desktop->categories) ecore_hash_set(desktop->group, strdup("Categories"), strdup(desktop->categories));
|
||||
if (desktop->window_name) ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowName"), strdup(desktop->window_name));
|
||||
if (desktop->window_title) ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowTitle"), strdup(desktop->window_title));
|
||||
if (desktop->window_role) ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowRole"), strdup(desktop->window_role));
|
||||
if (desktop->name)
|
||||
ecore_hash_set(desktop->group, strdup("Name"),
|
||||
strdup(desktop->name));
|
||||
if (desktop->generic)
|
||||
ecore_hash_set(desktop->group, strdup("GenericName"),
|
||||
strdup(desktop->generic));
|
||||
if (desktop->comment)
|
||||
ecore_hash_set(desktop->group, strdup("Comment"),
|
||||
strdup(desktop->comment));
|
||||
if (desktop->type)
|
||||
ecore_hash_set(desktop->group, strdup("Type"),
|
||||
strdup(desktop->type));
|
||||
if (desktop->URL)
|
||||
ecore_hash_set(desktop->group, strdup("URL"), strdup(desktop->URL));
|
||||
if (desktop->file)
|
||||
ecore_hash_set(desktop->group, strdup("File"),
|
||||
strdup(desktop->file));
|
||||
if (desktop->icon)
|
||||
ecore_hash_set(desktop->group, strdup("Icon"),
|
||||
strdup(desktop->icon));
|
||||
if (desktop->icon_class)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconClass"),
|
||||
strdup(desktop->icon_class));
|
||||
if (desktop->icon_path)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-IconPath"),
|
||||
strdup(desktop->icon_path));
|
||||
if (desktop->window_class)
|
||||
ecore_hash_set(desktop->group, strdup("StartupWMClass"),
|
||||
strdup(desktop->window_class));
|
||||
if (desktop->categories)
|
||||
ecore_hash_set(desktop->group, strdup("Categories"),
|
||||
strdup(desktop->categories));
|
||||
if (desktop->window_name)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowName"),
|
||||
strdup(desktop->window_name));
|
||||
if (desktop->window_title)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowTitle"),
|
||||
strdup(desktop->window_title));
|
||||
if (desktop->window_role)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-WindowRole"),
|
||||
strdup(desktop->window_role));
|
||||
ecore_hash_remove(desktop->group, "X-KDE-StartupNotify");
|
||||
if (desktop->wait_exit)
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-WaitExit"), strdup("true"));
|
||||
ecore_hash_set(desktop->group, strdup("X-Enlightenment-WaitExit"),
|
||||
strdup("true"));
|
||||
else
|
||||
ecore_hash_remove(desktop->group, "X-Enlightenment-WaitExit");
|
||||
if (desktop->startup)
|
||||
ecore_hash_set(desktop->group, strdup("StartupNotify"), strdup("true"));
|
||||
ecore_hash_set(desktop->group, strdup("StartupNotify"),
|
||||
strdup("true"));
|
||||
else
|
||||
ecore_hash_remove(desktop->group, "StartupNotify");
|
||||
if (desktop->no_display)
|
||||
|
@ -568,8 +621,12 @@ ecore_desktop_save(Ecore_Desktop * desktop)
|
|||
|
||||
/* FIXME: deal with the ShowIn's. */
|
||||
|
||||
if (desktop->path) ecore_hash_set(desktop->group, strdup("Path"), strdup(desktop->path));
|
||||
if (desktop->deletiondate) ecore_hash_set(desktop->group, strdup("DeletionDate"), strdup(desktop->deletiondate));
|
||||
if (desktop->path)
|
||||
ecore_hash_set(desktop->group, strdup("Path"),
|
||||
strdup(desktop->path));
|
||||
if (desktop->deletiondate)
|
||||
ecore_hash_set(desktop->group, strdup("DeletionDate"),
|
||||
strdup(desktop->deletiondate));
|
||||
|
||||
if (desktop->original_path)
|
||||
{
|
||||
|
@ -580,18 +637,19 @@ ecore_desktop_save(Ecore_Desktop * desktop)
|
|||
ecore_file_unlink(desktop->original_path);
|
||||
f = fopen(desktop->original_path, "wb");
|
||||
list = ecore_hash_keys(desktop->group);
|
||||
if ((!f) || (!list)) return;
|
||||
if ((!f) || (!list))
|
||||
return;
|
||||
|
||||
if (trash)
|
||||
fprintf(f, "[Trash Info]\n");
|
||||
else
|
||||
fprintf(f, "[Desktop Entry]\n");
|
||||
ecore_list_goto_first(list);
|
||||
while ((key = (char *) ecore_list_next(list)))
|
||||
while ((key = (char *)ecore_list_next(list)))
|
||||
{
|
||||
char *value;
|
||||
|
||||
value = (char *) ecore_hash_get(desktop->group, key);
|
||||
value = (char *)ecore_hash_get(desktop->group, key);
|
||||
if ((value) && (value[0] != '\0'))
|
||||
fprintf(f, "%s=%s\n", key, value);
|
||||
}
|
||||
|
@ -609,8 +667,6 @@ ecore_desktop_save(Ecore_Desktop * desktop)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Setup what ever needs to be setup to support Ecore_Desktop.
|
||||
*
|
||||
|
@ -622,9 +678,11 @@ ecore_desktop_save(Ecore_Desktop * desktop)
|
|||
EAPI int
|
||||
ecore_desktop_init()
|
||||
{
|
||||
if (++init_count != 1) return init_count;
|
||||
if (++init_count != 1)
|
||||
return init_count;
|
||||
|
||||
if (!ecore_desktop_paths_init()) return --init_count;
|
||||
if (!ecore_desktop_paths_init())
|
||||
return --init_count;
|
||||
|
||||
if (!desktop_cache)
|
||||
{
|
||||
|
@ -637,7 +695,8 @@ ecore_desktop_init()
|
|||
}
|
||||
}
|
||||
|
||||
if (!ecore_desktop_icon_init()) return --init_count;
|
||||
if (!ecore_desktop_icon_init())
|
||||
return --init_count;
|
||||
|
||||
return init_count;
|
||||
}
|
||||
|
@ -653,7 +712,8 @@ ecore_desktop_init()
|
|||
EAPI int
|
||||
ecore_desktop_shutdown()
|
||||
{
|
||||
if (--init_count != 0) return init_count;
|
||||
if (--init_count != 0)
|
||||
return init_count;
|
||||
|
||||
ecore_desktop_icon_shutdown();
|
||||
|
||||
|
@ -710,9 +770,7 @@ _ecore_desktop_destroy(Ecore_Desktop * desktop)
|
|||
IFFREE(desktop->window_title)
|
||||
IFFREE(desktop->window_role)
|
||||
IFFREE(desktop->NotShowIn)
|
||||
IFFREE(desktop->OnlyShowIn)
|
||||
IFFREE(desktop->Categories)
|
||||
if (desktop->data)
|
||||
IFFREE(desktop->OnlyShowIn) IFFREE(desktop->Categories) if (desktop->data)
|
||||
{
|
||||
ecore_hash_destroy(desktop->data);
|
||||
desktop->data = NULL;
|
||||
|
@ -751,7 +809,7 @@ ecore_desktop_home_get()
|
|||
}
|
||||
|
||||
EAPI char *
|
||||
ecore_desktop_get_command(Ecore_Desktop *desktop, Ecore_List *files, int fill)
|
||||
ecore_desktop_get_command(Ecore_Desktop * desktop, Ecore_List * files, int fill)
|
||||
{
|
||||
char *result = NULL, *params = NULL;
|
||||
|
||||
|
@ -794,54 +852,55 @@ ecore_desktop_get_command(Ecore_Desktop *desktop, Ecore_List *files, int fill)
|
|||
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. */
|
||||
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. */
|
||||
case 'u': /* Single URL, multiple invokations if multiple URLs. */
|
||||
break;
|
||||
|
||||
case 'c' : /* Translated Name field frem .desktop file. */
|
||||
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. */
|
||||
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. */
|
||||
case 'F': /* Multiple file names. If the files are on the net, download first and point to temp files. */
|
||||
break;
|
||||
|
||||
case 'U' : /* Multiple URLs. */
|
||||
case 'U': /* Multiple URLs. */
|
||||
break;
|
||||
|
||||
case 'd' : /* Directory of the file in %f. */
|
||||
case 'd': /* Directory of the file in %f. */
|
||||
break;
|
||||
|
||||
case 'D' : /* Directories of the files in %F. */
|
||||
case 'D': /* Directories of the files in %F. */
|
||||
break;
|
||||
|
||||
case 'n' : /* Single filename without path. */
|
||||
case 'n': /* Single filename without path. */
|
||||
break;
|
||||
|
||||
case 'N' : /* Multiple filenames without paths. */
|
||||
case 'N': /* Multiple filenames without paths. */
|
||||
break;
|
||||
|
||||
case 'i' : /* "--icon Icon" field from .desktop file, or empty. */
|
||||
case 'i': /* "--icon Icon" field from .desktop file, or empty. */
|
||||
if (desktop->original_icon)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "--icon %s", desktop->original_icon);
|
||||
snprintf(buf, sizeof(buf), "--icon %s",
|
||||
desktop->original_icon);
|
||||
t = buf;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'v' : /* Device field from .desktop file. */
|
||||
case 'v': /* Device field from .desktop file. */
|
||||
break;
|
||||
|
||||
case '%' : /* A '%' character. */
|
||||
case '%': /* A '%' character. */
|
||||
t = "%";
|
||||
break;
|
||||
|
||||
default :
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (t)
|
||||
|
@ -883,7 +942,6 @@ ecore_desktop_get_command(Ecore_Desktop *desktop, Ecore_List *files, int fill)
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
EAPI char *
|
||||
ecore_desktop_merge_command(char *exec, char *params)
|
||||
{
|
||||
|
|
|
@ -55,8 +55,12 @@ struct _ecore_desktop_menu_legacy_data
|
|||
int length, menu_length, level;
|
||||
};
|
||||
|
||||
static int _ecore_desktop_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, int element, int level);
|
||||
static Ecore_Desktop_Tree *_ecore_desktop_menu_get0(char *file, Ecore_Desktop_Tree * merge_stack, int level);
|
||||
static int _ecore_desktop_menu_make_apps(const void *data,
|
||||
Ecore_Desktop_Tree * tree,
|
||||
int element, int level);
|
||||
static Ecore_Desktop_Tree *_ecore_desktop_menu_get0(char *file,
|
||||
Ecore_Desktop_Tree *
|
||||
merge_stack, int level);
|
||||
static Ecore_Desktop_Tree *_ecore_desktop_menu_create_menu();
|
||||
static int _ecore_desktop_menu_unxml(const void *data,
|
||||
Ecore_Desktop_Tree * tree,
|
||||
|
@ -82,8 +86,7 @@ static int _ecore_desktop_menu_expand_apps(struct
|
|||
_ecore_desktop_menu_unxml_data
|
||||
*unxml_data, char *app_dir,
|
||||
Ecore_Hash * pool);
|
||||
static int _ecore_desktop_menu_check_app(void *data,
|
||||
const char *path);
|
||||
static int _ecore_desktop_menu_check_app(void *data, const char *path);
|
||||
|
||||
static int _ecore_desktop_menu_merge(const void *data,
|
||||
Ecore_Desktop_Tree * tree,
|
||||
|
@ -114,20 +117,22 @@ static int _ecore_desktop_menu_apply_rules(struct
|
|||
* Functions that deal with freedesktop.org menus.
|
||||
*/
|
||||
|
||||
|
||||
EAPI void
|
||||
ecore_desktop_menu_for_each(void (*func)(char *name, char *path, Ecore_Hash *apps))
|
||||
ecore_desktop_menu_for_each(void (*func)
|
||||
(char *name, char *path, Ecore_Hash * apps))
|
||||
{
|
||||
char *menu_file;
|
||||
|
||||
/* Find the main menu file. */
|
||||
menu_file = ecore_desktop_paths_file_find(ecore_desktop_paths_menus,
|
||||
"applications.menu", -1, NULL, NULL);
|
||||
"applications.menu", -1, NULL,
|
||||
NULL);
|
||||
if (!menu_file)
|
||||
{
|
||||
/* Try various quirks of various systems. */
|
||||
menu_file = ecore_desktop_paths_file_find(ecore_desktop_paths_menus,
|
||||
"debian-menu.menu", -1, NULL, NULL);
|
||||
"debian-menu.menu", -1, NULL,
|
||||
NULL);
|
||||
/* FIXME: If all else fails, run debians funky menu generator shit. */
|
||||
}
|
||||
|
||||
|
@ -140,7 +145,8 @@ ecore_desktop_menu_for_each(void (*func)(char *name, char *path, Ecore_Hash *app
|
|||
if (menus)
|
||||
{
|
||||
/* create the .desktop and order files from the menu */
|
||||
ecore_desktop_tree_foreach(menus, 0, _ecore_desktop_menu_make_apps, func);
|
||||
ecore_desktop_tree_foreach(menus, 0, _ecore_desktop_menu_make_apps,
|
||||
func);
|
||||
// FIXME: Can't free this just yet, causes major memory corruption.
|
||||
// ecore_desktop_tree_del(menus);
|
||||
}
|
||||
|
@ -149,7 +155,8 @@ ecore_desktop_menu_for_each(void (*func)(char *name, char *path, Ecore_Hash *app
|
|||
}
|
||||
|
||||
static int
|
||||
_ecore_desktop_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, int element, int level)
|
||||
_ecore_desktop_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree,
|
||||
int element, int level)
|
||||
{
|
||||
if (tree->elements[element].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING)
|
||||
{
|
||||
|
@ -158,7 +165,8 @@ _ecore_desktop_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, int e
|
|||
char *path;
|
||||
char *name;
|
||||
Ecore_Hash *apps;
|
||||
void (*func)(char *name, char *path, Ecore_Hash *apps);
|
||||
void (*func) (char *name, char *path,
|
||||
Ecore_Hash * apps);
|
||||
|
||||
func = data;
|
||||
name = (char *)tree->elements[element].element;
|
||||
|
@ -177,7 +185,6 @@ _ecore_desktop_menu_make_apps(const void *data, Ecore_Desktop_Tree * tree, int e
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decode a freedesktop.org menu XML jungle.
|
||||
*
|
||||
|
@ -196,7 +203,8 @@ ecore_desktop_menu_get(char *file)
|
|||
}
|
||||
|
||||
static Ecore_Desktop_Tree *
|
||||
_ecore_desktop_menu_get0(char *file, Ecore_Desktop_Tree * merge_stack, int level)
|
||||
_ecore_desktop_menu_get0(char *file, Ecore_Desktop_Tree * merge_stack,
|
||||
int level)
|
||||
{
|
||||
Ecore_Desktop_Tree *menu_xml;
|
||||
struct _ecore_desktop_menu_unxml_data data;
|
||||
|
@ -518,8 +526,7 @@ _ecore_desktop_menu_unxml(const void *data, Ecore_Desktop_Tree * tree,
|
|||
{
|
||||
_ecore_desktop_menu_unxml(data, sub,
|
||||
0,
|
||||
level +
|
||||
1);
|
||||
level + 1);
|
||||
ecore_desktop_tree_add_child(menu,
|
||||
(Ecore_Desktop_Tree
|
||||
*)
|
||||
|
@ -552,6 +559,7 @@ _ecore_desktop_menu_unxml(const void *data, Ecore_Desktop_Tree * tree,
|
|||
element)[0] != '<'))
|
||||
{
|
||||
char
|
||||
|
||||
temp[PATH_MAX];
|
||||
|
||||
sprintf(temp, "%s %s",
|
||||
|
@ -730,7 +738,8 @@ _ecore_desktop_menu_legacy_menu_dir(void *data, const char *path)
|
|||
{
|
||||
char temp[PATH_MAX];
|
||||
|
||||
sprintf(temp, "<MENU < L> <%s> <>", &temp_path[start]);
|
||||
sprintf(temp, "<MENU < L> <%s> <>",
|
||||
&temp_path[start]);
|
||||
menu->elements[0].element = strdup(temp);
|
||||
ecore_desktop_tree_track(menu,
|
||||
menu->elements[0].element);
|
||||
|
@ -740,7 +749,8 @@ _ecore_desktop_menu_legacy_menu_dir(void *data, const char *path)
|
|||
ecore_desktop_tree_track(menu,
|
||||
menu->elements[1].element);
|
||||
|
||||
ecore_desktop_tree_add_child(legacy_data->current, menu);
|
||||
ecore_desktop_tree_add_child(legacy_data->current,
|
||||
menu);
|
||||
/* This is not needed, but if it was, this is where it would go.
|
||||
* sprintf(temp, "<AppDir %s/", temp_path);
|
||||
* ecore_desktop_tree_extend(menu, temp);
|
||||
|
@ -828,7 +838,7 @@ _ecore_desktop_menu_legacy_menu(void *data, const char *path)
|
|||
menu_count = strlen(menu_path);
|
||||
if (menu_count)
|
||||
menu_count++;
|
||||
file = (char *) &path[legacy_data->length + menu_count];
|
||||
file = (char *)&path[legacy_data->length + menu_count];
|
||||
count = strlen(file);
|
||||
|
||||
if (strcmp(".directory", file) == 0)
|
||||
|
@ -860,7 +870,9 @@ _ecore_desktop_menu_legacy_menu(void *data, const char *path)
|
|||
sprintf(temp, "%s%s", legacy_data->prefix, file);
|
||||
ecore_hash_set(pool, strdup(temp), strdup(path));
|
||||
#ifdef DEBUG
|
||||
printf("POOLING - _ecore_desktop_menu_legacy_menu(void *data, %s) - %s - %s\n", path, file, temp);
|
||||
printf
|
||||
("POOLING - _ecore_desktop_menu_legacy_menu(void *data, %s) - %s - %s\n",
|
||||
path, file, temp);
|
||||
#endif
|
||||
if (rules->size > 0)
|
||||
{
|
||||
|
@ -871,7 +883,8 @@ _ecore_desktop_menu_legacy_menu(void *data, const char *path)
|
|||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf("PROBLEM - _ecore_desktop_menu_legacy_menu(void *data, %s) - %s\n", path, file);
|
||||
printf("PROBLEM - _ecore_desktop_menu_legacy_menu(void *data, %s) - %s\n",
|
||||
path, file);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -1029,7 +1042,9 @@ _ecore_desktop_menu_expand_apps(struct _ecore_desktop_menu_unxml_data
|
|||
our_data.path = dir;
|
||||
our_data.length = strlen(dir);
|
||||
#ifdef DEBUG
|
||||
printf("EXPANDING - _ecore_desktop_menu_expand_apps(unxml_data, %s) - %s\n", app_dir, dir);
|
||||
printf
|
||||
("EXPANDING - _ecore_desktop_menu_expand_apps(unxml_data, %s) - %s\n",
|
||||
app_dir, dir);
|
||||
#endif
|
||||
ecore_desktop_paths_recursive_search(dir, NULL, -1, NULL,
|
||||
_ecore_desktop_menu_check_app,
|
||||
|
@ -1061,13 +1076,16 @@ _ecore_desktop_menu_check_app(void *data, const char *path)
|
|||
file[i] = '-';
|
||||
ecore_hash_set(our_data->pool, file, strdup(path));
|
||||
#ifdef DEBUG
|
||||
printf("POOLING - _ecore_desktop_menu_check_app(void *data, %s) - %s\n", path, file);
|
||||
printf
|
||||
("POOLING - _ecore_desktop_menu_check_app(void *data, %s) - %s\n",
|
||||
path, file);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf("PROBLEM - _ecore_desktop_menu_check_app(void *data, %s)\n", path);
|
||||
printf("PROBLEM - _ecore_desktop_menu_check_app(void *data, %s)\n",
|
||||
path);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1218,7 +1236,8 @@ _ecore_desktop_menu_merge(const void *data, Ecore_Desktop_Tree * tree,
|
|||
* Slackware uses them.
|
||||
*/
|
||||
merge_path[0] = '\0';
|
||||
printf("\n### Didn't expect a MergeFile parent type in the FDO menu. onefang must write more code now.\n");
|
||||
printf
|
||||
("\n### Didn't expect a MergeFile parent type in the FDO menu. onefang must write more code now.\n");
|
||||
}
|
||||
if (merge_path[0] != '\0')
|
||||
{
|
||||
|
@ -1305,8 +1324,7 @@ _ecore_desktop_menu_expand_default_dirs(const void *data,
|
|||
if (strcmp(string, "<DefaultAppDirs/") == 0)
|
||||
{
|
||||
_ecore_desktop_menu_add_dirs(merge, ecore_desktop_paths_desktops,
|
||||
"<AppDir", "</AppDir", NULL,
|
||||
element);
|
||||
"<AppDir", "</AppDir", NULL, element);
|
||||
result = 1;
|
||||
}
|
||||
else if (strcmp(string, "<DefaultDirectoryDirs/") == 0)
|
||||
|
@ -1568,7 +1586,8 @@ _ecore_desktop_menu_select_app(void *value, void *user_data)
|
|||
ecore_hash_set(generate_data->apps, key, strdup(app));
|
||||
#ifdef DEBUG
|
||||
printf("INCLUDING %s%s - %s\n",
|
||||
((generate_data->unallocated) ? "UNALLOCATED " : ""), app, key);
|
||||
((generate_data->unallocated) ? "UNALLOCATED " : ""),
|
||||
app, key);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -1576,7 +1595,8 @@ _ecore_desktop_menu_select_app(void *value, void *user_data)
|
|||
ecore_hash_remove(generate_data->apps, key);
|
||||
#ifdef DEBUG
|
||||
printf("EXCLUDING %s%s - %s\n",
|
||||
((generate_data->unallocated) ? "UNALLOCATED " : ""), app, key);
|
||||
((generate_data->unallocated) ? "UNALLOCATED " : ""),
|
||||
app, key);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,8 @@
|
|||
#include <libgen.h>
|
||||
#include <strings.h>
|
||||
|
||||
|
||||
/* FIXME: Add functions to add paths before the user paths, after the user but before the system paths, and at the end. */
|
||||
|
||||
|
||||
/* This really slows things down and no doubt drags in some KDE bloat at start up.
|
||||
* To work around this, I add a few extra things to try in the _ecore_desktop_paths_get()
|
||||
* calls below.
|
||||
|
@ -38,8 +36,6 @@
|
|||
* and correct those guesses.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
static Ecore_List *_ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
|
||||
char *before, char *env_home,
|
||||
char *env, char *env_home_default,
|
||||
|
@ -80,11 +76,11 @@ static int _ecore_desktop_paths_cb_exe_exit(void *data, int type,
|
|||
static Ecore_Event_Handler *exit_handler = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
EAPI int
|
||||
ecore_desktop_paths_init(void)
|
||||
{
|
||||
if (++init_count != 1) return init_count;
|
||||
if (++init_count != 1)
|
||||
return init_count;
|
||||
|
||||
#if defined GNOME_SUPPORT || defined KDE_SUPPORT
|
||||
exit_handler =
|
||||
|
@ -119,8 +115,7 @@ ecore_desktop_paths_init(void)
|
|||
{
|
||||
|
||||
_ecore_desktop_paths_massage_path(path, home,
|
||||
this_config,
|
||||
NULL);
|
||||
this_config, NULL);
|
||||
_ecore_desktop_paths_check_and_add(gnome_data, path);
|
||||
}
|
||||
E_FN_DEL(ecore_list_destroy, config_list);
|
||||
|
@ -135,7 +130,8 @@ ecore_desktop_paths_init(void)
|
|||
EAPI int
|
||||
ecore_desktop_paths_shutdown(void)
|
||||
{
|
||||
if (--init_count != 0) return init_count;
|
||||
if (--init_count != 0)
|
||||
return init_count;
|
||||
|
||||
_ecore_desktop_paths_destroy();
|
||||
E_FN_DEL(ecore_list_destroy, gnome_data);
|
||||
|
@ -161,7 +157,8 @@ _ecore_desktop_paths_create(void)
|
|||
if (!ecore_desktop_paths_desktops)
|
||||
{
|
||||
ecore_desktop_paths_desktops =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DESKTOPS, NULL, "XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DESKTOPS, NULL,
|
||||
"XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
"~/.local/share:~/.kde/share",
|
||||
"/usr/local/share:/usr/share",
|
||||
"applications:applnk:applications/kde",
|
||||
|
@ -176,16 +173,15 @@ _ecore_desktop_paths_create(void)
|
|||
{
|
||||
#ifdef KDE_SUPPORT
|
||||
ecore_desktop_paths_kde_legacy =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
"apps");
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, "apps");
|
||||
#else
|
||||
ecore_desktop_paths_kde_legacy =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL, "XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_KDE_LEGACY, NULL,
|
||||
"XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
"~/.local/share:~/.kde/share",
|
||||
"/usr/local/share:/usr/share",
|
||||
"applnk",
|
||||
NULL,
|
||||
"apps");
|
||||
"/usr/local/share:/usr/share", "applnk",
|
||||
NULL, "apps");
|
||||
#endif
|
||||
if (ecore_desktop_paths_kde_legacy)
|
||||
{
|
||||
|
@ -226,10 +222,12 @@ _ecore_desktop_paths_create(void)
|
|||
char *gnome;
|
||||
|
||||
ecore_desktop_paths_icons =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_ICONS, "~/.icons", "XDG_DATA_HOME",
|
||||
"XDG_DATA_DIRS", "~/.local/share:~/.kde/share",
|
||||
"/usr/local/share:/usr/share:/usr/X11R6/share", "icons:pixmaps",
|
||||
"dist/icons", "icon:pixmap");
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_ICONS, "~/.icons",
|
||||
"XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
"~/.local/share:~/.kde/share",
|
||||
"/usr/local/share:/usr/share:/usr/X11R6/share",
|
||||
"icons:pixmaps", "dist/icons",
|
||||
"icon:pixmap");
|
||||
_ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons,
|
||||
"/usr/local/share/pixmaps/");
|
||||
_ecore_desktop_paths_check_and_add(ecore_desktop_paths_icons,
|
||||
|
@ -242,27 +240,30 @@ _ecore_desktop_paths_create(void)
|
|||
}
|
||||
if (!ecore_desktop_paths_menus)
|
||||
ecore_desktop_paths_menus =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_MENUS, NULL, "XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
|
||||
"~/.config", "/etc/xdg:/var/lib/menu-xdg", "menus", NULL,
|
||||
"xdgconf-menu");
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_MENUS, NULL,
|
||||
"XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
|
||||
"~/.config", "/etc/xdg:/var/lib/menu-xdg",
|
||||
"menus", NULL, "xdgconf-menu");
|
||||
if (!ecore_desktop_paths_directories)
|
||||
ecore_desktop_paths_directories =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DIRECTORIES, NULL, "XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_DIRECTORIES, NULL,
|
||||
"XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
"~/.local/share:~/.kde/share",
|
||||
"/usr/local/share:/usr/share",
|
||||
"desktop-directories", "gnome/vfolders",
|
||||
"xdgdata-dirs");
|
||||
if (!ecore_desktop_paths_config)
|
||||
ecore_desktop_paths_config =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_CONFIG, NULL, "XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_CONFIG, NULL,
|
||||
"XDG_CONFIG_HOME", "XDG_CONFIG_DIRS",
|
||||
"~/.config", "/etc/xdg", "", NULL, NULL);
|
||||
if (!ecore_desktop_paths_xsessions)
|
||||
ecore_desktop_paths_xsessions =
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_XSESSIONS, NULL, "XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
_ecore_desktop_paths_get(ECORE_DESKTOP_PATHS_XSESSIONS, NULL,
|
||||
"XDG_DATA_HOME", "XDG_DATA_DIRS",
|
||||
"~/.local/share:~/.kde/share",
|
||||
"/usr/local/share:/usr/share",
|
||||
"xsessions", NULL,
|
||||
NULL);
|
||||
"/usr/local/share:/usr/share", "xsessions",
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -377,8 +378,8 @@ ecore_desktop_paths_file_find(Ecore_List * paths, const char *file, int sub,
|
|||
}
|
||||
else if (sub != 0)
|
||||
path =
|
||||
ecore_desktop_paths_recursive_search(this_path, file, sub, NULL,
|
||||
func, data);
|
||||
ecore_desktop_paths_recursive_search(this_path, file, sub,
|
||||
NULL, func, data);
|
||||
if (path && (!func))
|
||||
break;
|
||||
}
|
||||
|
@ -404,6 +405,7 @@ _ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
|
|||
Ecore_List *paths = NULL;
|
||||
Ecore_List *types = NULL;
|
||||
Ecore_List *gnome_extras = NULL;
|
||||
|
||||
#ifdef KDE_SUPPORT
|
||||
Ecore_List *kdes = NULL;
|
||||
#endif
|
||||
|
@ -453,9 +455,11 @@ _ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
|
|||
char *this_path;
|
||||
|
||||
ecore_list_goto_first(prepend_user_paths[path_type]);
|
||||
while ((this_path = ecore_list_next(prepend_user_paths[path_type])) != NULL)
|
||||
while ((this_path =
|
||||
ecore_list_next(prepend_user_paths[path_type])) != NULL)
|
||||
{
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path, NULL);
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path,
|
||||
NULL);
|
||||
_ecore_desktop_paths_check_and_add(paths, path);
|
||||
}
|
||||
}
|
||||
|
@ -493,9 +497,11 @@ _ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
|
|||
char *this_path;
|
||||
|
||||
ecore_list_goto_first(append_user_paths[path_type]);
|
||||
while ((this_path = ecore_list_next(append_user_paths[path_type])) != NULL)
|
||||
while ((this_path =
|
||||
ecore_list_next(append_user_paths[path_type])) != NULL)
|
||||
{
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path, NULL);
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path,
|
||||
NULL);
|
||||
_ecore_desktop_paths_check_and_add(paths, path);
|
||||
}
|
||||
}
|
||||
|
@ -505,9 +511,11 @@ _ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
|
|||
char *this_path;
|
||||
|
||||
ecore_list_goto_first(prepend_system_paths[path_type]);
|
||||
while ((this_path = ecore_list_next(prepend_system_paths[path_type])) != NULL)
|
||||
while ((this_path =
|
||||
ecore_list_next(prepend_system_paths[path_type])) != NULL)
|
||||
{
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path, NULL);
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path,
|
||||
NULL);
|
||||
_ecore_desktop_paths_check_and_add(paths, path);
|
||||
}
|
||||
}
|
||||
|
@ -545,9 +553,11 @@ _ecore_desktop_paths_get(Ecore_Desktop_Paths_Type path_type,
|
|||
char *this_path;
|
||||
|
||||
ecore_list_goto_first(append_system_paths[path_type]);
|
||||
while ((this_path = ecore_list_next(append_system_paths[path_type])) != NULL)
|
||||
while ((this_path =
|
||||
ecore_list_next(append_system_paths[path_type])) != NULL)
|
||||
{
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path, NULL);
|
||||
_ecore_desktop_paths_massage_path(path, home, this_path,
|
||||
NULL);
|
||||
_ecore_desktop_paths_check_and_add(paths, path);
|
||||
}
|
||||
}
|
||||
|
@ -682,16 +692,16 @@ _ecore_desktop_paths_check_and_add(Ecore_List * paths, char *path)
|
|||
}
|
||||
|
||||
char *
|
||||
ecore_desktop_paths_recursive_search(const char *path, const char *file, int sub,
|
||||
int (*dir_func) (void *data,
|
||||
const char *path),
|
||||
ecore_desktop_paths_recursive_search(const char *path, const char *file,
|
||||
int sub, int (*dir_func) (void *data,
|
||||
const char
|
||||
*path),
|
||||
int (*func) (void *data, const char *path),
|
||||
void *data)
|
||||
{
|
||||
char *fpath = NULL;
|
||||
DIR *dir = NULL;
|
||||
|
||||
|
||||
if ((sub != 0) && (sub != -1))
|
||||
sub -= 1;
|
||||
|
||||
|
@ -714,16 +724,15 @@ ecore_desktop_paths_recursive_search(const char *path, const char *file, int sub
|
|||
if ((strcmp(basename(info_text), ".") != 0)
|
||||
&& (strcmp(basename(info_text), "..") != 0))
|
||||
{
|
||||
snprintf(info_text, PATH_MAX, "%s%s/", path, script->d_name);
|
||||
snprintf(info_text, PATH_MAX, "%s%s/", path,
|
||||
script->d_name);
|
||||
if (dir_func)
|
||||
if (dir_func(data, info_text))
|
||||
break;
|
||||
if (sub != 0)
|
||||
fpath =
|
||||
ecore_desktop_paths_recursive_search(info_text,
|
||||
file, sub,
|
||||
dir_func,
|
||||
func, data);
|
||||
ecore_desktop_paths_recursive_search
|
||||
(info_text, file, sub, dir_func, func, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -897,8 +906,8 @@ ecore_desktop_paths_to_hash(const char *paths)
|
|||
start = end;
|
||||
do /* FIXME: There is probably a better way to do this. */
|
||||
{
|
||||
while ((*end != ';') && (*end != ':') && (*end != ',')
|
||||
&& (*end != '\0'))
|
||||
while ((*end != ';') && (*end != ':')
|
||||
&& (*end != ',') && (*end != '\0'))
|
||||
end++;
|
||||
}
|
||||
while ((end != path) && (*(end - 1) == '\\') && (*end != '\0')); /* Ignore any escaped ;:, */
|
||||
|
@ -955,8 +964,8 @@ ecore_desktop_paths_to_list(const char *paths)
|
|||
start = end;
|
||||
do /* FIXME: There is probably a better way to do this. */
|
||||
{
|
||||
while ((*end != ';') && (*end != ':') && (*end != ',')
|
||||
&& (*end != '\0'))
|
||||
while ((*end != ';') && (*end != ':')
|
||||
&& (*end != ',') && (*end != '\0'))
|
||||
end++;
|
||||
}
|
||||
while ((end != path) && (*(end - 1) == '\\') && (*end != '\0')); /* Ignore any escaped ;:, */
|
||||
|
@ -979,20 +988,36 @@ ecore_desktop_paths_to_list(const char *paths)
|
|||
}
|
||||
|
||||
EAPI int
|
||||
ecore_desktop_paths_for_each(Ecore_Desktop_Paths_Type type, Ecore_For_Each function, void *user_data)
|
||||
ecore_desktop_paths_for_each(Ecore_Desktop_Paths_Type type,
|
||||
Ecore_For_Each function, void *user_data)
|
||||
{
|
||||
Ecore_List *list = NULL;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ECORE_DESKTOP_PATHS_CONFIG : list = ecore_desktop_paths_config; break;
|
||||
case ECORE_DESKTOP_PATHS_MENUS : list = ecore_desktop_paths_menus; break;
|
||||
case ECORE_DESKTOP_PATHS_DIRECTORIES : list = ecore_desktop_paths_directories; break;
|
||||
case ECORE_DESKTOP_PATHS_DESKTOPS : list = ecore_desktop_paths_desktops; break;
|
||||
case ECORE_DESKTOP_PATHS_ICONS : list = ecore_desktop_paths_icons; break;
|
||||
case ECORE_DESKTOP_PATHS_KDE_LEGACY : list = ecore_desktop_paths_kde_legacy; break;
|
||||
case ECORE_DESKTOP_PATHS_XSESSIONS : list = ecore_desktop_paths_xsessions; break;
|
||||
case ECORE_DESKTOP_PATHS_MAX : break;
|
||||
case ECORE_DESKTOP_PATHS_CONFIG:
|
||||
list = ecore_desktop_paths_config;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_MENUS:
|
||||
list = ecore_desktop_paths_menus;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_DIRECTORIES:
|
||||
list = ecore_desktop_paths_directories;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_DESKTOPS:
|
||||
list = ecore_desktop_paths_desktops;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_ICONS:
|
||||
list = ecore_desktop_paths_icons;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_KDE_LEGACY:
|
||||
list = ecore_desktop_paths_kde_legacy;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_XSESSIONS:
|
||||
list = ecore_desktop_paths_xsessions;
|
||||
break;
|
||||
case ECORE_DESKTOP_PATHS_MAX:
|
||||
break;
|
||||
}
|
||||
if (list)
|
||||
return ecore_list_for_each(list, function, user_data);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
/** xmlame.c Extensively Mocked Language Approximately Mangled for Enlightenment.
|
||||
*
|
||||
* This is NOT a real XML parser. There were a few ways we could go when it came
|
||||
|
|
Loading…
Reference in New Issue