forked from enlightenment/efl
Formatted according to the indent commands that I think KainX sent me a
while ago - -i3 -bl -bad -nbap -sob -ncdb -di20 -nbc -lp -nce -npcs -sc -ncs -l80 Looks downright evil to me, is the above correct? SVN revision: 24670
This commit is contained in:
parent
fb4772a769
commit
c50838cae9
|
@ -15,29 +15,29 @@
|
|||
#define E_NEW_BIG(s, n) (s *)malloc(n * sizeof(s))
|
||||
#define E_FREE(p) { if (p) {free(p); p = NULL;} }
|
||||
|
||||
Ecore_List *ecore_desktop_paths_config;
|
||||
Ecore_List *ecore_desktop_paths_menus;
|
||||
Ecore_List *ecore_desktop_paths_directories;
|
||||
Ecore_List *ecore_desktop_paths_desktops;
|
||||
Ecore_List *ecore_desktop_paths_icons;
|
||||
Ecore_List *ecore_desktop_paths_kde_legacy;
|
||||
Ecore_List *ecore_desktop_paths_config;
|
||||
Ecore_List *ecore_desktop_paths_menus;
|
||||
Ecore_List *ecore_desktop_paths_directories;
|
||||
Ecore_List *ecore_desktop_paths_desktops;
|
||||
Ecore_List *ecore_desktop_paths_icons;
|
||||
Ecore_List *ecore_desktop_paths_kde_legacy;
|
||||
|
||||
struct _Ecore_Desktop
|
||||
{
|
||||
Ecore_Hash *data, *group, *Categories, *OnlyShowIn, *NotShowIn;
|
||||
char *name;
|
||||
char *generic;
|
||||
char *comment;
|
||||
char *type;
|
||||
char *categories;
|
||||
char *exec;
|
||||
char *icon;
|
||||
char *icon_path;
|
||||
char* path;
|
||||
char* deletiondate;
|
||||
char *startup;
|
||||
char *window_class;
|
||||
int allocated; /* FIXME: NoDisplay, Hidden */
|
||||
Ecore_Hash *data, *group, *Categories, *OnlyShowIn, *NotShowIn;
|
||||
char *name;
|
||||
char *generic;
|
||||
char *comment;
|
||||
char *type;
|
||||
char *categories;
|
||||
char *exec;
|
||||
char *icon;
|
||||
char *icon_path;
|
||||
char *path;
|
||||
char *deletiondate;
|
||||
char *startup;
|
||||
char *window_class;
|
||||
int allocated; /* FIXME: NoDisplay, Hidden */
|
||||
};
|
||||
typedef struct _Ecore_Desktop Ecore_Desktop;
|
||||
|
||||
|
@ -52,70 +52,103 @@ typedef enum _Ecore_Desktop_Tree_Element_Type Ecore_Desktop_Tree_Element_Type;
|
|||
|
||||
struct _Ecore_Desktop_Tree_Element
|
||||
{
|
||||
void *element; /* A pointer to the element. */
|
||||
Ecore_Desktop_Tree_Element_Type type; /* The type of the element. */
|
||||
void *element; /* A pointer to the element. */
|
||||
Ecore_Desktop_Tree_Element_Type type; /* The type of the element. */
|
||||
};
|
||||
typedef struct _Ecore_Desktop_Tree_Element Ecore_Desktop_Tree_Element;
|
||||
|
||||
typedef struct _Ecore_Desktop_Tree Ecore_Desktop_Tree;
|
||||
struct _Ecore_Desktop_Tree
|
||||
{
|
||||
Ecore_Desktop_Tree_Element *elements; /* An array of elements. */
|
||||
int size; /* The size of the array. */
|
||||
char **buffers; /* An array of pointers to the bits of data. */
|
||||
int buffers_size; /* The size of the array. */
|
||||
Ecore_Desktop_Tree *parent; /* Parent if this is a child. */
|
||||
Ecore_Desktop_Tree_Element *elements; /* An array of elements. */
|
||||
int size; /* The size of the array. */
|
||||
char **buffers; /* An array of pointers to the bits of data. */
|
||||
int buffers_size; /* The size of the array. */
|
||||
Ecore_Desktop_Tree *parent; /* Parent if this is a child. */
|
||||
};
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
# endif
|
||||
|
||||
/* Function Prototypes */
|
||||
void ecore_desktop_paths_init(void);
|
||||
char *ecore_desktop_paths_search_for_file(Ecore_List *paths, char *file, int sub, int (*func) (const void *data, char *path), const void *data);
|
||||
char *ecore_desktop_paths_recursive_search(char *path, char *d, int (*dir_func) (const void *data, char *path), int (*func) (const void *data, char *path), const void *data);
|
||||
void ecore_desktop_paths_shutdown(void);
|
||||
void ecore_desktop_paths_init(void);
|
||||
char *ecore_desktop_paths_search_for_file(Ecore_List * paths,
|
||||
char *file, int sub,
|
||||
int (*func) (const
|
||||
void
|
||||
*data,
|
||||
char
|
||||
*path),
|
||||
const void *data);
|
||||
char *ecore_desktop_paths_recursive_search(char *path, char *d,
|
||||
int (*dir_func)
|
||||
(const void *data,
|
||||
char *path),
|
||||
int (*func) (const
|
||||
void
|
||||
*data,
|
||||
char
|
||||
*path),
|
||||
const void *data);
|
||||
void ecore_desktop_paths_shutdown(void);
|
||||
|
||||
Ecore_Hash *ecore_desktop_hash_from_paths(char *paths);
|
||||
Ecore_List *ecore_desktop_list_from_paths(char *paths);
|
||||
Ecore_Hash *ecore_desktop_hash_from_paths(char *paths);
|
||||
Ecore_List *ecore_desktop_list_from_paths(char *paths);
|
||||
|
||||
void ecore_desktop_init(void);
|
||||
void ecore_desktop_shutdown(void);
|
||||
Ecore_Hash *ecore_desktop_parse_ini_file(char *file);
|
||||
Ecore_Desktop *ecore_desktop_parse_file(char *file);
|
||||
void ecore_desktop_destroy(Ecore_Desktop * desktop);
|
||||
|
||||
void ecore_desktop_init(void);
|
||||
void ecore_desktop_shutdown(void);
|
||||
Ecore_Hash *ecore_desktop_parse_ini_file(char *file);
|
||||
Ecore_Desktop *ecore_desktop_parse_file(char *file);
|
||||
void ecore_desktop_destroy(Ecore_Desktop * desktop);
|
||||
|
||||
|
||||
char *ecore_desktop_find_icon(char *icon, char *icon_size, char *icon_theme);
|
||||
|
||||
|
||||
Ecore_Desktop_Tree *ecore_desktop_menus_get(char *file, Ecore_Desktop_Tree * merge_stack, int level);
|
||||
char *ecore_desktop_find_icon(char *icon, char *icon_size,
|
||||
char *icon_theme);
|
||||
|
||||
Ecore_Desktop_Tree *ecore_desktop_menus_get(char *file,
|
||||
Ecore_Desktop_Tree * merge_stack,
|
||||
int level);
|
||||
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_new(char *buffer);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_add(Ecore_Desktop_Tree * tree, char *element);
|
||||
void ecore_desktop_tree_track(Ecore_Desktop_Tree * tree, void *element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_extend(Ecore_Desktop_Tree * tree, char *element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree, int before, void *element, Ecore_Desktop_Tree_Element_Type type);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree, int before, Ecore_Desktop_Tree * element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree, Ecore_Desktop_Tree * element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_add_hash(Ecore_Desktop_Tree * tree, Ecore_Hash * element);
|
||||
void ecore_desktop_tree_remove(Ecore_Desktop_Tree * tree, int element);
|
||||
int ecore_desktop_tree_exist(Ecore_Desktop_Tree * tree, char *element);
|
||||
int ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree, int level, int (*func) (const void *data, Ecore_Desktop_Tree * tree, int element, int level), const void *data);
|
||||
void ecore_esktop_tree_dump(Ecore_Desktop_Tree * tree, int level);
|
||||
void ecore_desktop_tree_del(Ecore_Desktop_Tree * tree);
|
||||
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_add(Ecore_Desktop_Tree * tree,
|
||||
char *element);
|
||||
void ecore_desktop_tree_track(Ecore_Desktop_Tree * tree,
|
||||
void *element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_extend(Ecore_Desktop_Tree * tree,
|
||||
char *element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree,
|
||||
int before, void *element,
|
||||
Ecore_Desktop_Tree_Element_Type
|
||||
type);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree,
|
||||
int before,
|
||||
Ecore_Desktop_Tree * element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree,
|
||||
Ecore_Desktop_Tree *
|
||||
element);
|
||||
Ecore_Desktop_Tree *ecore_desktop_tree_add_hash(Ecore_Desktop_Tree * tree,
|
||||
Ecore_Hash * element);
|
||||
void ecore_desktop_tree_remove(Ecore_Desktop_Tree * tree,
|
||||
int element);
|
||||
int ecore_desktop_tree_exist(Ecore_Desktop_Tree * tree,
|
||||
char *element);
|
||||
int ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree,
|
||||
int level,
|
||||
int (*func) (const void *data,
|
||||
Ecore_Desktop_Tree
|
||||
* tree,
|
||||
int element,
|
||||
int level),
|
||||
const void *data);
|
||||
void ecore_esktop_tree_dump(Ecore_Desktop_Tree * tree,
|
||||
int level);
|
||||
void ecore_desktop_tree_del(Ecore_Desktop_Tree * tree);
|
||||
|
||||
Ecore_Desktop_Tree *ecore_desktop_xmlame_new(char *buffer);
|
||||
Ecore_Desktop_Tree *ecore_desktop_xmlame_get(char *file);
|
||||
|
||||
char *ecore_desktop_get_home(void);
|
||||
|
||||
char *ecore_desktop_get_home(void);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,214 +1,246 @@
|
|||
#include "Ecore_Desktop.h"
|
||||
#include "ecore_desktop_private.h"
|
||||
|
||||
extern int reject_count, not_over_count;
|
||||
extern int reject_count, not_over_count;
|
||||
|
||||
static Ecore_Hash *ini_file_cache;
|
||||
static Ecore_Hash *desktop_cache;
|
||||
static Ecore_Hash *ini_file_cache;
|
||||
static Ecore_Hash *desktop_cache;
|
||||
|
||||
|
||||
Ecore_Hash *
|
||||
Ecore_Hash *
|
||||
ecore_desktop_parse_ini_file(char *file)
|
||||
{
|
||||
Ecore_Hash *result;
|
||||
Ecore_Hash *result;
|
||||
|
||||
/* FIXME: should probably look in ini_file_cache first. */
|
||||
result = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (result)
|
||||
{
|
||||
FILE *f;
|
||||
char buffer[MAX_PATH];
|
||||
Ecore_Hash *current = NULL;
|
||||
FILE *f;
|
||||
char buffer[MAX_PATH];
|
||||
Ecore_Hash *current = NULL;
|
||||
|
||||
f = fopen(file, "r");
|
||||
if (!f)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Cannot Open File %s\n", file);
|
||||
ecore_hash_destroy(result);
|
||||
return NULL;
|
||||
}
|
||||
ecore_hash_set_free_key(result, free);
|
||||
ecore_hash_set_free_value(result, (Ecore_Free_Cb) ecore_hash_destroy);
|
||||
*buffer = '\0';
|
||||
f = fopen(file, "r");
|
||||
if (!f)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Cannot Open File %s\n", file);
|
||||
ecore_hash_destroy(result);
|
||||
return NULL;
|
||||
}
|
||||
ecore_hash_set_free_key(result, free);
|
||||
ecore_hash_set_free_value(result, (Ecore_Free_Cb) ecore_hash_destroy);
|
||||
*buffer = '\0';
|
||||
#ifdef DEBUG
|
||||
fprintf(stdout, "PARSING INI %s\n", file);
|
||||
fprintf(stdout, "PARSING INI %s\n", file);
|
||||
#endif
|
||||
while (fgets(buffer, sizeof(buffer), f) != NULL)
|
||||
{
|
||||
char *c;
|
||||
char *key;
|
||||
char *value;
|
||||
while (fgets(buffer, sizeof(buffer), f) != NULL)
|
||||
{
|
||||
char *c;
|
||||
char *key;
|
||||
char *value;
|
||||
|
||||
c = buffer;
|
||||
/* Strip preceeding blanks. */
|
||||
while (((*c == ' ') || (*c == '\t')) && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
/* Skip blank lines and comments */
|
||||
if ((*c == '\0') || (*c == '\n') || (*c == '#'))
|
||||
continue;
|
||||
if (*c == '[') /* New group. */
|
||||
{
|
||||
key = c + 1;
|
||||
while ((*c != ']') && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
*c++ = '\0';
|
||||
current = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (current)
|
||||
{
|
||||
ecore_hash_set_free_key(current, free);
|
||||
ecore_hash_set_free_value(current, free);
|
||||
ecore_hash_set(result, strdup(key), current);
|
||||
c = buffer;
|
||||
/* Strip preceeding blanks. */
|
||||
while (((*c == ' ') || (*c == '\t')) && (*c != '\n')
|
||||
&& (*c != '\0'))
|
||||
c++;
|
||||
/* Skip blank lines and comments */
|
||||
if ((*c == '\0') || (*c == '\n') || (*c == '#'))
|
||||
continue;
|
||||
if (*c == '[') /* New group. */
|
||||
{
|
||||
key = c + 1;
|
||||
while ((*c != ']') && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
*c++ = '\0';
|
||||
current = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (current)
|
||||
{
|
||||
ecore_hash_set_free_key(current, free);
|
||||
ecore_hash_set_free_value(current, free);
|
||||
ecore_hash_set(result, strdup(key), current);
|
||||
#ifdef DEBUG
|
||||
fprintf(stdout, " GROUP [%s]\n", key);
|
||||
fprintf(stdout, " GROUP [%s]\n", key);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (current) /* key=value pair of current group. */
|
||||
{
|
||||
key = c;
|
||||
/* Find trailing blanks or =. */
|
||||
while ((*c != '=') && (*c != ' ') && (*c != '\t') && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
if (*c != '=') /* Find equals. */
|
||||
{
|
||||
*c++ = '\0';
|
||||
while ((*c != '=') && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
}
|
||||
if (*c == '=') /* Equals found. */
|
||||
{
|
||||
*c++ = '\0';
|
||||
/* Strip preceeding blanks. */
|
||||
while (((*c == ' ') || (*c == '\t')) && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
value = c;
|
||||
/* Find end. */
|
||||
while ((*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
*c++ = '\0';
|
||||
/* FIXME: should strip space at end, then unescape value. */
|
||||
ecore_hash_set(current, strdup(key), strdup(value));
|
||||
}
|
||||
}
|
||||
else if (current) /* key=value pair of current group. */
|
||||
{
|
||||
key = c;
|
||||
/* Find trailing blanks or =. */
|
||||
while ((*c != '=') && (*c != ' ') && (*c != '\t')
|
||||
&& (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
if (*c != '=') /* Find equals. */
|
||||
{
|
||||
*c++ = '\0';
|
||||
while ((*c != '=') && (*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
}
|
||||
if (*c == '=') /* Equals found. */
|
||||
{
|
||||
*c++ = '\0';
|
||||
/* Strip preceeding blanks. */
|
||||
while (((*c == ' ') || (*c == '\t')) && (*c != '\n')
|
||||
&& (*c != '\0'))
|
||||
c++;
|
||||
value = c;
|
||||
/* Find end. */
|
||||
while ((*c != '\n') && (*c != '\0'))
|
||||
c++;
|
||||
*c++ = '\0';
|
||||
/* FIXME: should strip space at end, then unescape value. */
|
||||
ecore_hash_set(current, strdup(key), strdup(value));
|
||||
#ifdef DEBUG
|
||||
fprintf(stdout, " %s=%s\n", key, value);
|
||||
fprintf(stdout, " %s=%s\n", key, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
buffer[0] = (char)0;
|
||||
}
|
||||
buffer[0] = (char)0;
|
||||
|
||||
fclose(f);
|
||||
ecore_hash_set(ini_file_cache, strdup(file), result);
|
||||
fclose(f);
|
||||
ecore_hash_set(ini_file_cache, strdup(file), result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Ecore_Desktop *
|
||||
Ecore_Desktop *
|
||||
ecore_desktop_parse_file(char *file)
|
||||
{
|
||||
Ecore_Desktop *result;
|
||||
Ecore_Desktop *result;
|
||||
|
||||
result = (Ecore_Desktop *) ecore_hash_get(desktop_cache, file);
|
||||
if (!result)
|
||||
{
|
||||
result = calloc(1, sizeof(Ecore_Desktop));
|
||||
if (result)
|
||||
{
|
||||
result->data = ecore_desktop_parse_ini_file(file);
|
||||
if (result->data)
|
||||
{
|
||||
result->group = (Ecore_Hash *) ecore_hash_get(result->data, "Desktop Entry");
|
||||
if (!result->group)
|
||||
result->group = (Ecore_Hash *) ecore_hash_get(result->data, "KDE Desktop Entry");
|
||||
if (result->group)
|
||||
{
|
||||
char *value;
|
||||
result = calloc(1, sizeof(Ecore_Desktop));
|
||||
if (result)
|
||||
{
|
||||
result->data = ecore_desktop_parse_ini_file(file);
|
||||
if (result->data)
|
||||
{
|
||||
result->group =
|
||||
(Ecore_Hash *) ecore_hash_get(result->data,
|
||||
"Desktop Entry");
|
||||
if (!result->group)
|
||||
result->group =
|
||||
(Ecore_Hash *) ecore_hash_get(result->data,
|
||||
"KDE Desktop Entry");
|
||||
if (result->group)
|
||||
{
|
||||
char *value;
|
||||
|
||||
result->name = (char *)ecore_hash_get(result->group, "Name");
|
||||
result->generic = (char *)ecore_hash_get(result->group, "GenericName");
|
||||
result->comment = (char *)ecore_hash_get(result->group, "Comment");
|
||||
result->type = (char *)ecore_hash_get(result->group, "Type");
|
||||
result->exec = (char *)ecore_hash_get(result->group, "Exec");
|
||||
result->window_class = (char *)ecore_hash_get(result->group, "StartupWMClass");
|
||||
result->icon = (char *)ecore_hash_get(result->group, "Icon");
|
||||
result->categories = (char *)ecore_hash_get(result->group, "Categories");
|
||||
if (result->categories)
|
||||
result->Categories = ecore_desktop_hash_from_paths(result->categories);
|
||||
value = (char *)ecore_hash_get(result->group, "OnlyShowIn");
|
||||
if (value)
|
||||
result->OnlyShowIn = ecore_desktop_hash_from_paths(value);
|
||||
value = (char *)ecore_hash_get(result->group, "NotShowIn");
|
||||
if (value)
|
||||
result->NotShowIn = ecore_desktop_hash_from_paths(value);
|
||||
value = (char *)ecore_hash_get(result->group, "X-KDE-StartupNotify");
|
||||
if (value)
|
||||
result->startup = (!strcmp(value, "true")) ? "1" : "0";
|
||||
value = (char *)ecore_hash_get(result->group, "StartupNotify");
|
||||
if (value)
|
||||
result->startup = (!strcmp(value, "true")) ? "1" : "0";
|
||||
} else {
|
||||
/*Maybe it's a 'trash' file - which also follows the Desktop FDO spec*/
|
||||
result->group = (Ecore_Hash *) ecore_hash_get(result->data, "Trash Info");
|
||||
if (result->group) {
|
||||
result->path = (char *)ecore_hash_get(result->group, "Path");
|
||||
result->deletiondate = (char *)ecore_hash_get(result->group, "DeletionDate");
|
||||
}
|
||||
result->name =
|
||||
(char *)ecore_hash_get(result->group, "Name");
|
||||
result->generic =
|
||||
(char *)ecore_hash_get(result->group, "GenericName");
|
||||
result->comment =
|
||||
(char *)ecore_hash_get(result->group, "Comment");
|
||||
result->type =
|
||||
(char *)ecore_hash_get(result->group, "Type");
|
||||
result->exec =
|
||||
(char *)ecore_hash_get(result->group, "Exec");
|
||||
result->window_class =
|
||||
(char *)ecore_hash_get(result->group,
|
||||
"StartupWMClass");
|
||||
result->icon =
|
||||
(char *)ecore_hash_get(result->group, "Icon");
|
||||
result->categories =
|
||||
(char *)ecore_hash_get(result->group, "Categories");
|
||||
if (result->categories)
|
||||
result->Categories =
|
||||
ecore_desktop_hash_from_paths(result->categories);
|
||||
value =
|
||||
(char *)ecore_hash_get(result->group, "OnlyShowIn");
|
||||
if (value)
|
||||
result->OnlyShowIn =
|
||||
ecore_desktop_hash_from_paths(value);
|
||||
value =
|
||||
(char *)ecore_hash_get(result->group, "NotShowIn");
|
||||
if (value)
|
||||
result->NotShowIn =
|
||||
ecore_desktop_hash_from_paths(value);
|
||||
value =
|
||||
(char *)ecore_hash_get(result->group,
|
||||
"X-KDE-StartupNotify");
|
||||
if (value)
|
||||
result->startup =
|
||||
(!strcmp(value, "true")) ? "1" : "0";
|
||||
value =
|
||||
(char *)ecore_hash_get(result->group,
|
||||
"StartupNotify");
|
||||
if (value)
|
||||
result->startup =
|
||||
(!strcmp(value, "true")) ? "1" : "0";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*Maybe it's a 'trash' file - which also follows the Desktop FDO spec */
|
||||
result->group =
|
||||
(Ecore_Hash *) ecore_hash_get(result->data,
|
||||
"Trash Info");
|
||||
if (result->group)
|
||||
{
|
||||
result->path =
|
||||
(char *)ecore_hash_get(result->group, "Path");
|
||||
result->deletiondate =
|
||||
(char *)ecore_hash_get(result->group,
|
||||
"DeletionDate");
|
||||
}
|
||||
}
|
||||
|
||||
ecore_hash_set(desktop_cache, strdup(file), result);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(result);
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
ecore_hash_set(desktop_cache, strdup(file), result);
|
||||
}
|
||||
else
|
||||
{
|
||||
free(result);
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ecore_desktop_init()
|
||||
{
|
||||
if (!ini_file_cache)
|
||||
{
|
||||
ini_file_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (ini_file_cache)
|
||||
{
|
||||
ecore_hash_set_free_key(ini_file_cache, free);
|
||||
ecore_hash_set_free_value(ini_file_cache, (Ecore_Free_Cb) ecore_hash_destroy);
|
||||
}
|
||||
ini_file_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (ini_file_cache)
|
||||
{
|
||||
ecore_hash_set_free_key(ini_file_cache, free);
|
||||
ecore_hash_set_free_value(ini_file_cache,
|
||||
(Ecore_Free_Cb) ecore_hash_destroy);
|
||||
}
|
||||
}
|
||||
if (!desktop_cache)
|
||||
{
|
||||
desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (desktop_cache)
|
||||
{
|
||||
ecore_hash_set_free_key(desktop_cache, free);
|
||||
ecore_hash_set_free_value(desktop_cache, (Ecore_Free_Cb) ecore_desktop_destroy);
|
||||
}
|
||||
desktop_cache = ecore_hash_new(ecore_str_hash, ecore_str_compare);
|
||||
if (desktop_cache)
|
||||
{
|
||||
ecore_hash_set_free_key(desktop_cache, free);
|
||||
ecore_hash_set_free_value(desktop_cache,
|
||||
(Ecore_Free_Cb) ecore_desktop_destroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ecore_desktop_shutdown()
|
||||
{
|
||||
if (ini_file_cache)
|
||||
{
|
||||
ecore_hash_destroy(ini_file_cache);
|
||||
ini_file_cache = NULL;
|
||||
ecore_hash_destroy(ini_file_cache);
|
||||
ini_file_cache = NULL;
|
||||
}
|
||||
if (desktop_cache)
|
||||
{
|
||||
ecore_hash_destroy(desktop_cache);
|
||||
desktop_cache = NULL;
|
||||
ecore_hash_destroy(desktop_cache);
|
||||
desktop_cache = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ecore_desktop_destroy(Ecore_Desktop * desktop)
|
||||
{
|
||||
|
@ -221,24 +253,23 @@ ecore_desktop_destroy(Ecore_Desktop * desktop)
|
|||
free(desktop);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
char *
|
||||
ecore_desktop_get_home()
|
||||
{
|
||||
char *d;
|
||||
int length;
|
||||
char home[MAX_PATH];
|
||||
char *d;
|
||||
int length;
|
||||
char home[MAX_PATH];
|
||||
|
||||
/* Get Home Dir, check for trailing '/', strip it */
|
||||
snprintf(home, sizeof(home), "%s", getenv("HOME"));
|
||||
d = strrchr(home, '/');
|
||||
if (d)
|
||||
{
|
||||
if (strlen(d) == 1)
|
||||
{
|
||||
if (home[(length = strlen(home) - 1)] == '/')
|
||||
home[length] = '\0';
|
||||
}
|
||||
if (strlen(d) == 1)
|
||||
{
|
||||
if (home[(length = strlen(home) - 1)] == '/')
|
||||
home[length] = '\0';
|
||||
}
|
||||
}
|
||||
return strdup(home);
|
||||
}
|
||||
|
|
|
@ -5,20 +5,20 @@
|
|||
|
||||
//#define DEBUG 1
|
||||
|
||||
static char * _ecore_desktop_find_icon0(char *icon, char *icon_size, char *icon_theme);
|
||||
|
||||
static char *_ecore_desktop_find_icon0(char *icon, char *icon_size,
|
||||
char *icon_theme);
|
||||
|
||||
/* FIXME: Ideally this should be -
|
||||
* {".png", ".svg", ".xpm", "", NULL}
|
||||
* Add them in when they are supported in .eaps.
|
||||
*/
|
||||
static const char *ext[] = { ".png", ".svg", ".xpm", "", NULL };
|
||||
static const char *ext[] = { ".png", ".svg", ".xpm", "", NULL };
|
||||
|
||||
char *
|
||||
char *
|
||||
ecore_desktop_find_icon(char *icon, char *icon_size, char *icon_theme)
|
||||
{
|
||||
char icn[MAX_PATH], path[MAX_PATH];
|
||||
char *dir, *home;
|
||||
char icn[MAX_PATH], path[MAX_PATH];
|
||||
char *dir, *home;
|
||||
|
||||
if (icon == NULL)
|
||||
return NULL;
|
||||
|
@ -42,15 +42,15 @@ ecore_desktop_find_icon(char *icon, char *icon_size, char *icon_theme)
|
|||
|
||||
if (!icon_theme)
|
||||
{
|
||||
/* Check If Dir Supplied In Desktop File */
|
||||
dir = ecore_file_get_dir(icn);
|
||||
if (!strcmp(dir, icn) == 0)
|
||||
{
|
||||
snprintf(path, MAX_PATH, "%s", icn);
|
||||
/* Check Supplied Dir For Icon */
|
||||
if (ecore_file_exists(path))
|
||||
return strdup(icn);
|
||||
}
|
||||
/* Check If Dir Supplied In Desktop File */
|
||||
dir = ecore_file_get_dir(icn);
|
||||
if (!strcmp(dir, icn) == 0)
|
||||
{
|
||||
snprintf(path, MAX_PATH, "%s", icn);
|
||||
/* Check Supplied Dir For Icon */
|
||||
if (ecore_file_exists(path))
|
||||
return strdup(icn);
|
||||
}
|
||||
}
|
||||
|
||||
dir = _ecore_desktop_find_icon0(icon, icon_size, icon_theme);
|
||||
|
@ -68,7 +68,7 @@ ecore_desktop_find_icon(char *icon, char *icon_size, char *icon_theme)
|
|||
* @param icon_theme The icon theme to search in.
|
||||
* @return The full path to the found icon.
|
||||
*/
|
||||
static char *
|
||||
static char *
|
||||
_ecore_desktop_find_icon0(char *icon, char *icon_size, char *icon_theme)
|
||||
{
|
||||
/* NOTES ON OPTIMIZATIONS
|
||||
|
@ -96,14 +96,15 @@ _ecore_desktop_find_icon0(char *icon, char *icon_size, char *icon_theme)
|
|||
* the .theme files.
|
||||
*/
|
||||
|
||||
char icn[MAX_PATH], path[MAX_PATH];
|
||||
char *theme_path, *found;
|
||||
char icn[MAX_PATH], path[MAX_PATH];
|
||||
char *theme_path, *found;
|
||||
|
||||
if ((icon == NULL) || (icon[0] == '\0'))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "\tTrying To Find Icon %s (%s) in theme %s\n", icon, icon_size, icon_theme);
|
||||
fprintf(stderr, "\tTrying To Find Icon %s (%s) in theme %s\n", icon,
|
||||
icon_size, icon_theme);
|
||||
#endif
|
||||
|
||||
/* Get the theme description file. */
|
||||
|
@ -111,177 +112,236 @@ _ecore_desktop_find_icon0(char *icon, char *icon_size, char *icon_theme)
|
|||
#ifdef DEBUG
|
||||
printf("SEARCHING FOR %s\n", icn);
|
||||
#endif
|
||||
theme_path = ecore_desktop_paths_search_for_file(ecore_desktop_paths_icons, icn, 1, NULL, NULL);
|
||||
theme_path =
|
||||
ecore_desktop_paths_search_for_file(ecore_desktop_paths_icons, icn, 1,
|
||||
NULL, NULL);
|
||||
if (theme_path)
|
||||
{
|
||||
Ecore_Hash *theme;
|
||||
Ecore_Hash *theme;
|
||||
|
||||
/* Parse the theme description file. */
|
||||
/* Parse the theme description file. */
|
||||
#ifdef DEBUG
|
||||
printf("Path to %s is %s\n", icn, theme_path);
|
||||
printf("Path to %s is %s\n", icn, theme_path);
|
||||
#endif
|
||||
theme = ecore_desktop_parse_ini_file(theme_path);
|
||||
if (theme)
|
||||
{
|
||||
Ecore_Hash *icon_group;
|
||||
theme = ecore_desktop_parse_ini_file(theme_path);
|
||||
if (theme)
|
||||
{
|
||||
Ecore_Hash *icon_group;
|
||||
|
||||
/* Grab the themes directory list, and what it inherits. */
|
||||
icon_group = (Ecore_Hash *) ecore_hash_get(theme, "Icon Theme");
|
||||
if (icon_group)
|
||||
{
|
||||
char *directories, *inherits;
|
||||
/* Grab the themes directory list, and what it inherits. */
|
||||
icon_group = (Ecore_Hash *) ecore_hash_get(theme, "Icon Theme");
|
||||
if (icon_group)
|
||||
{
|
||||
char *directories, *inherits;
|
||||
|
||||
directories = (char *)ecore_hash_get(icon_group, "Directories");
|
||||
inherits = (char *)ecore_hash_get(icon_group, "Inherits");
|
||||
if (directories)
|
||||
{
|
||||
Ecore_List *directory_paths;
|
||||
directories =
|
||||
(char *)ecore_hash_get(icon_group, "Directories");
|
||||
inherits = (char *)ecore_hash_get(icon_group, "Inherits");
|
||||
if (directories)
|
||||
{
|
||||
Ecore_List *directory_paths;
|
||||
|
||||
/* Split the directory list. */
|
||||
/* Split the directory list. */
|
||||
#ifdef DEBUG
|
||||
printf("Inherits %s Directories %s\n", inherits, directories);
|
||||
printf("Inherits %s Directories %s\n", inherits,
|
||||
directories);
|
||||
#endif
|
||||
directory_paths = ecore_desktop_list_from_paths(directories);
|
||||
if (directory_paths)
|
||||
{
|
||||
int wanted_size;
|
||||
int minimal_size = INT_MAX;
|
||||
int i;
|
||||
char *closest = NULL;
|
||||
char *directory;
|
||||
directory_paths =
|
||||
ecore_desktop_list_from_paths(directories);
|
||||
if (directory_paths)
|
||||
{
|
||||
int wanted_size;
|
||||
int minimal_size = INT_MAX;
|
||||
int i;
|
||||
char *closest = NULL;
|
||||
char *directory;
|
||||
|
||||
wanted_size = atoi(icon_size);
|
||||
/* Loop through the themes directories. */
|
||||
wanted_size = atoi(icon_size);
|
||||
/* Loop through the themes directories. */
|
||||
|
||||
ecore_list_goto_first(directory_paths);
|
||||
while ((directory = ecore_list_next(directory_paths)) != NULL)
|
||||
{
|
||||
Ecore_Hash *sub_group;
|
||||
ecore_list_goto_first(directory_paths);
|
||||
while ((directory =
|
||||
ecore_list_next(directory_paths)) != NULL)
|
||||
{
|
||||
Ecore_Hash *sub_group;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("FDO icon path = %s\n", directory_paths);
|
||||
printf("FDO icon path = %s\n",
|
||||
directory_paths);
|
||||
#endif
|
||||
/* Get the details for this theme directory. */
|
||||
sub_group = (Ecore_Hash *) ecore_hash_get(theme, directory);
|
||||
if (sub_group)
|
||||
{
|
||||
char *size, *type, *minsize, *maxsize, *threshold;
|
||||
int j;
|
||||
/* Get the details for this theme directory. */
|
||||
sub_group =
|
||||
(Ecore_Hash *) ecore_hash_get(theme,
|
||||
directory);
|
||||
if (sub_group)
|
||||
{
|
||||
char *size, *type, *minsize,
|
||||
*maxsize, *threshold;
|
||||
int j;
|
||||
|
||||
size = (char *)ecore_hash_get(sub_group, "Size");
|
||||
type = (char *)ecore_hash_get(sub_group, "Type");
|
||||
minsize = (char *)ecore_hash_get(sub_group, "MinSize");
|
||||
maxsize = (char *)ecore_hash_get(sub_group, "MaxSize");
|
||||
threshold = (char *)ecore_hash_get(sub_group, "Threshold");
|
||||
if (size)
|
||||
{
|
||||
int match = 0;
|
||||
int this_size, result_size = 0, min_size, max_size, thresh_size;
|
||||
size =
|
||||
(char *)ecore_hash_get(sub_group,
|
||||
"Size");
|
||||
type =
|
||||
(char *)ecore_hash_get(sub_group,
|
||||
"Type");
|
||||
minsize =
|
||||
(char *)ecore_hash_get(sub_group,
|
||||
"MinSize");
|
||||
maxsize =
|
||||
(char *)ecore_hash_get(sub_group,
|
||||
"MaxSize");
|
||||
threshold =
|
||||
(char *)ecore_hash_get(sub_group,
|
||||
"Threshold");
|
||||
if (size)
|
||||
{
|
||||
int match = 0;
|
||||
int this_size,
|
||||
result_size =
|
||||
0, min_size, max_size,
|
||||
thresh_size;
|
||||
|
||||
if (!minsize)
|
||||
minsize = size;
|
||||
if (!maxsize)
|
||||
maxsize = size;
|
||||
if (!threshold)
|
||||
threshold = "2";
|
||||
min_size = atoi(minsize);
|
||||
max_size = atoi(maxsize);
|
||||
thresh_size = atoi(threshold);
|
||||
if (!minsize)
|
||||
minsize = size;
|
||||
if (!maxsize)
|
||||
maxsize = size;
|
||||
if (!threshold)
|
||||
threshold = "2";
|
||||
min_size = atoi(minsize);
|
||||
max_size = atoi(maxsize);
|
||||
thresh_size = atoi(threshold);
|
||||
|
||||
/* Does this theme directory match the required icon size? */
|
||||
this_size = atoi(size);
|
||||
if (!type)
|
||||
type = "Threshold";
|
||||
switch (type[0])
|
||||
{
|
||||
case 'F': /* Fixed. */
|
||||
{
|
||||
match = (wanted_size == this_size);
|
||||
result_size = abs(this_size - wanted_size);
|
||||
break;
|
||||
}
|
||||
case 'S': /* Scaled. */
|
||||
{
|
||||
match = ((min_size <= wanted_size) && (wanted_size <= max_size));
|
||||
if (wanted_size < min_size)
|
||||
result_size = min_size - wanted_size;
|
||||
if (wanted_size > max_size)
|
||||
result_size = wanted_size - max_size;
|
||||
break;
|
||||
}
|
||||
default: /* Threshold. */
|
||||
{
|
||||
match = (((this_size - thresh_size) <= wanted_size)
|
||||
&& (wanted_size <= (this_size + thresh_size)));
|
||||
if (wanted_size < (this_size - thresh_size))
|
||||
result_size = min_size - wanted_size;
|
||||
if (wanted_size > (this_size + thresh_size))
|
||||
result_size = wanted_size - max_size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Does this theme directory match the required icon size? */
|
||||
this_size = atoi(size);
|
||||
if (!type)
|
||||
type = "Threshold";
|
||||
switch (type[0])
|
||||
{
|
||||
case 'F': /* Fixed. */
|
||||
{
|
||||
match =
|
||||
(wanted_size ==
|
||||
this_size);
|
||||
result_size =
|
||||
abs(this_size -
|
||||
wanted_size);
|
||||
break;
|
||||
}
|
||||
case 'S': /* Scaled. */
|
||||
{
|
||||
match =
|
||||
((min_size <= wanted_size)
|
||||
&& (wanted_size <=
|
||||
max_size));
|
||||
if (wanted_size < min_size)
|
||||
result_size =
|
||||
min_size - wanted_size;
|
||||
if (wanted_size > max_size)
|
||||
result_size =
|
||||
wanted_size - max_size;
|
||||
break;
|
||||
}
|
||||
default: /* Threshold. */
|
||||
{
|
||||
match =
|
||||
(((this_size -
|
||||
thresh_size) <=
|
||||
wanted_size)
|
||||
&& (wanted_size <=
|
||||
(this_size +
|
||||
thresh_size)));
|
||||
if (wanted_size <
|
||||
(this_size -
|
||||
thresh_size))
|
||||
result_size =
|
||||
min_size - wanted_size;
|
||||
if (wanted_size >
|
||||
(this_size +
|
||||
thresh_size))
|
||||
result_size =
|
||||
wanted_size - max_size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Look for icon with all extensions. */
|
||||
for (j = 0; ext[j] != NULL; j++)
|
||||
{
|
||||
snprintf(path, MAX_PATH, "%s/%s/%s%s", icon_theme, directory, icon, ext[j]);
|
||||
/* Look for icon with all extensions. */
|
||||
for (j = 0; ext[j] != NULL; j++)
|
||||
{
|
||||
snprintf(path, MAX_PATH,
|
||||
"%s/%s/%s%s",
|
||||
icon_theme, directory,
|
||||
icon, ext[j]);
|
||||
#ifdef DEBUG
|
||||
printf("FDO icon = %s\n", path);
|
||||
printf("FDO icon = %s\n", path);
|
||||
#endif
|
||||
found = ecore_desktop_paths_search_for_file(ecore_desktop_paths_icons, path, 0, NULL, NULL);
|
||||
if (found)
|
||||
{
|
||||
if (match) /* If there is a match in sizes, return the icon. */
|
||||
return found;
|
||||
if (result_size < minimal_size) /* While we are here, figure out our next fallback strategy. */
|
||||
{
|
||||
minimal_size = result_size;
|
||||
closest = found;
|
||||
}
|
||||
}
|
||||
}
|
||||
found =
|
||||
ecore_desktop_paths_search_for_file
|
||||
(ecore_desktop_paths_icons,
|
||||
path, 0, NULL, NULL);
|
||||
if (found)
|
||||
{
|
||||
if (match) /* If there is a match in sizes, return the icon. */
|
||||
return found;
|
||||
if (result_size < minimal_size) /* While we are here, figure out our next fallback strategy. */
|
||||
{
|
||||
minimal_size =
|
||||
result_size;
|
||||
closest = found;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} /* while ((directory = ecore_list_next(directory_paths)) != NULL) */
|
||||
}
|
||||
}
|
||||
} /* while ((directory = ecore_list_next(directory_paths)) != NULL) */
|
||||
|
||||
/* Fall back strategy #1, look for closest size in this theme. */
|
||||
if (closest)
|
||||
return closest;
|
||||
/* Fall back strategy #1, look for closest size in this theme. */
|
||||
if (closest)
|
||||
return closest;
|
||||
|
||||
/* Fall back strategy #2, Try again with the parent theme. */
|
||||
if ((inherits) && (inherits[0] != '\0') && (strcmp(icon_theme, "hicolor") != 0))
|
||||
{
|
||||
found = _ecore_desktop_find_icon0(icon, icon_size, inherits);
|
||||
if (found != NULL)
|
||||
return found;
|
||||
}
|
||||
/* Fall back strategy #2, Try again with the parent theme. */
|
||||
if ((inherits) && (inherits[0] != '\0')
|
||||
&& (strcmp(icon_theme, "hicolor") != 0))
|
||||
{
|
||||
found =
|
||||
_ecore_desktop_find_icon0(icon, icon_size,
|
||||
inherits);
|
||||
if (found != NULL)
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Fall back strategy #3, Try the default hicolor theme. */
|
||||
if ((!((inherits) && (inherits[0] != '\0'))) && (strcmp(icon_theme, "hicolor") != 0))
|
||||
{
|
||||
found = _ecore_desktop_find_icon0(icon, icon_size, "hicolor");
|
||||
if (found != NULL)
|
||||
return found;
|
||||
}
|
||||
/* Fall back strategy #3, Try the default hicolor theme. */
|
||||
if ((!((inherits) && (inherits[0] != '\0')))
|
||||
&& (strcmp(icon_theme, "hicolor") != 0))
|
||||
{
|
||||
found =
|
||||
_ecore_desktop_find_icon0(icon, icon_size,
|
||||
"hicolor");
|
||||
if (found != NULL)
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Fall back strategy #4, Just search in the base of the icon directories. */
|
||||
for (i = 0; ext[i] != NULL; i++)
|
||||
{
|
||||
snprintf(path, MAX_PATH, "%s%s", icon, ext[i]);
|
||||
/* Fall back strategy #4, Just search in the base of the icon directories. */
|
||||
for (i = 0; ext[i] != NULL; i++)
|
||||
{
|
||||
snprintf(path, MAX_PATH, "%s%s", icon, ext[i]);
|
||||
#ifdef DEBUG
|
||||
printf("FDO icon = %s\n", path);
|
||||
printf("FDO icon = %s\n", path);
|
||||
#endif
|
||||
found = ecore_desktop_paths_search_for_file(ecore_desktop_paths_icons, path, 0, NULL, NULL);
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
found =
|
||||
ecore_desktop_paths_search_for_file
|
||||
(ecore_desktop_paths_icons, path, 0, NULL,
|
||||
NULL);
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
free(theme_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
free(theme_path);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,7 @@
|
|||
#include <Ecore_File.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
# endif
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#include "Ecore_Desktop.h"
|
||||
#include "ecore_desktop_private.h"
|
||||
|
||||
static void ecore_desktop_tree_dump_each_hash_node(void *value, void *user_data);
|
||||
static void ecore_desktop_tree_dump_each_hash_node(void *value,
|
||||
void *user_data);
|
||||
|
||||
/* Just a quick and dirty tree implemtation that will likely get replaced by
|
||||
* something much saner at a later date. I wrote most of this while falling
|
||||
|
@ -41,8 +42,10 @@ ecore_desktop_tree_new(char *buffer)
|
|||
tree = E_NEW(Ecore_Desktop_Tree, 1);
|
||||
if ((tree) && (buffer))
|
||||
{
|
||||
tree->buffers = (char **)realloc(tree->buffers, (tree->buffers_size + 1) * sizeof(char *));
|
||||
tree->buffers[tree->buffers_size++] = strdup(buffer);
|
||||
tree->buffers =
|
||||
(char **)realloc(tree->buffers,
|
||||
(tree->buffers_size + 1) * sizeof(char *));
|
||||
tree->buffers[tree->buffers_size++] = strdup(buffer);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
@ -50,7 +53,12 @@ ecore_desktop_tree_new(char *buffer)
|
|||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_tree_add(Ecore_Desktop_Tree * tree, char *element)
|
||||
{
|
||||
tree->elements = (Ecore_Desktop_Tree_Element *) realloc(tree->elements, (tree->size + 1) * sizeof(Ecore_Desktop_Tree_Element));
|
||||
tree->elements =
|
||||
(Ecore_Desktop_Tree_Element *) realloc(tree->elements,
|
||||
(tree->size +
|
||||
1) *
|
||||
sizeof
|
||||
(Ecore_Desktop_Tree_Element));
|
||||
tree->elements[tree->size].element = element;
|
||||
tree->elements[tree->size++].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING;
|
||||
return tree;
|
||||
|
@ -59,7 +67,9 @@ ecore_desktop_tree_add(Ecore_Desktop_Tree * tree, char *element)
|
|||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_tree_extend(Ecore_Desktop_Tree * tree, char *element)
|
||||
{
|
||||
tree->buffers = (char **)realloc(tree->buffers, (tree->buffers_size + 1) * sizeof(char *));
|
||||
tree->buffers =
|
||||
(char **)realloc(tree->buffers,
|
||||
(tree->buffers_size + 1) * sizeof(char *));
|
||||
tree->buffers[tree->buffers_size++] = strdup(element);
|
||||
tree = ecore_desktop_tree_add(tree, tree->buffers[tree->buffers_size - 1]);
|
||||
|
||||
|
@ -69,22 +79,30 @@ ecore_desktop_tree_extend(Ecore_Desktop_Tree * tree, char *element)
|
|||
void
|
||||
ecore_desktop_tree_track(Ecore_Desktop_Tree * tree, void *element)
|
||||
{
|
||||
tree->buffers = (char **)realloc(tree->buffers, (tree->buffers_size + 1) * sizeof(char *));
|
||||
tree->buffers =
|
||||
(char **)realloc(tree->buffers,
|
||||
(tree->buffers_size + 1) * sizeof(char *));
|
||||
tree->buffers[tree->buffers_size++] = element;
|
||||
}
|
||||
|
||||
/* OK, so we need an insert after all, and it falls into the dumb category. */
|
||||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree, int before, void *element, Ecore_Desktop_Tree_Element_Type type)
|
||||
ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree, int before, void *element,
|
||||
Ecore_Desktop_Tree_Element_Type type)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
tree->elements = (Ecore_Desktop_Tree_Element *) realloc(tree->elements, (tree->size + 1) * sizeof(Ecore_Desktop_Tree_Element));
|
||||
tree->elements =
|
||||
(Ecore_Desktop_Tree_Element *) realloc(tree->elements,
|
||||
(tree->size +
|
||||
1) *
|
||||
sizeof
|
||||
(Ecore_Desktop_Tree_Element));
|
||||
tree->size++;
|
||||
for (i = tree->size - 1; i > before; i--)
|
||||
{
|
||||
tree->elements[i].element = tree->elements[i - 1].element;
|
||||
tree->elements[i].type = tree->elements[i - 1].type;
|
||||
tree->elements[i].element = tree->elements[i - 1].element;
|
||||
tree->elements[i].type = tree->elements[i - 1].type;
|
||||
}
|
||||
tree->elements[before].element = element;
|
||||
tree->elements[before].type = type;
|
||||
|
@ -93,25 +111,31 @@ ecore_desktop_tree_insert(Ecore_Desktop_Tree * tree, int before, void *element,
|
|||
|
||||
/* OK, so we need a tree merge after all, and it falls into the dumb category. */
|
||||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree, int before, Ecore_Desktop_Tree * element)
|
||||
ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree, int before,
|
||||
Ecore_Desktop_Tree * element)
|
||||
{
|
||||
int i, size;
|
||||
int i, size;
|
||||
|
||||
size = element->size;
|
||||
if (size)
|
||||
{
|
||||
tree->elements = (Ecore_Desktop_Tree_Element *) realloc(tree->elements, (tree->size + size) * sizeof(Ecore_Desktop_Tree_Element));
|
||||
tree->size += size;
|
||||
for (i = tree->size - 1; i > before; i--)
|
||||
{
|
||||
tree->elements[i].element = tree->elements[i - size].element;
|
||||
tree->elements[i].type = tree->elements[i - size].type;
|
||||
}
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
tree->elements[before + i].element = element->elements[i].element;
|
||||
tree->elements[before + i].type = element->elements[i].type;
|
||||
}
|
||||
tree->elements =
|
||||
(Ecore_Desktop_Tree_Element *) realloc(tree->elements,
|
||||
(tree->size +
|
||||
size) *
|
||||
sizeof
|
||||
(Ecore_Desktop_Tree_Element));
|
||||
tree->size += size;
|
||||
for (i = tree->size - 1; i > before; i--)
|
||||
{
|
||||
tree->elements[i].element = tree->elements[i - size].element;
|
||||
tree->elements[i].type = tree->elements[i - size].type;
|
||||
}
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
tree->elements[before + i].element = element->elements[i].element;
|
||||
tree->elements[before + i].type = element->elements[i].type;
|
||||
}
|
||||
}
|
||||
|
||||
/* Careful, this might screw up the freeing order if that is important. */
|
||||
|
@ -132,9 +156,15 @@ ecore_desktop_tree_merge(Ecore_Desktop_Tree * tree, int before, Ecore_Desktop_Tr
|
|||
}
|
||||
|
||||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree, Ecore_Desktop_Tree * element)
|
||||
ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree,
|
||||
Ecore_Desktop_Tree * element)
|
||||
{
|
||||
tree->elements = (Ecore_Desktop_Tree_Element *) realloc(tree->elements, (tree->size + 1) * sizeof(Ecore_Desktop_Tree_Element));
|
||||
tree->elements =
|
||||
(Ecore_Desktop_Tree_Element *) realloc(tree->elements,
|
||||
(tree->size +
|
||||
1) *
|
||||
sizeof
|
||||
(Ecore_Desktop_Tree_Element));
|
||||
tree->elements[tree->size].element = element;
|
||||
tree->elements[tree->size++].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE;
|
||||
element->parent = tree;
|
||||
|
@ -144,7 +174,12 @@ ecore_desktop_tree_add_child(Ecore_Desktop_Tree * tree, Ecore_Desktop_Tree * ele
|
|||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_tree_add_hash(Ecore_Desktop_Tree * tree, Ecore_Hash * element)
|
||||
{
|
||||
tree->elements = (Ecore_Desktop_Tree_Element *) realloc(tree->elements, (tree->size + 1) * sizeof(Ecore_Desktop_Tree_Element));
|
||||
tree->elements =
|
||||
(Ecore_Desktop_Tree_Element *) realloc(tree->elements,
|
||||
(tree->size +
|
||||
1) *
|
||||
sizeof
|
||||
(Ecore_Desktop_Tree_Element));
|
||||
tree->elements[tree->size].element = element;
|
||||
tree->elements[tree->size++].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH;
|
||||
return tree;
|
||||
|
@ -155,74 +190,83 @@ ecore_desktop_tree_remove(Ecore_Desktop_Tree * tree, int element)
|
|||
{
|
||||
if (tree->size > element)
|
||||
{
|
||||
tree->elements[element].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL;
|
||||
tree->elements[element].element = NULL;
|
||||
tree->elements[element].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL;
|
||||
tree->elements[element].element = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ecore_desktop_tree_exist(Ecore_Desktop_Tree * tree, char *element)
|
||||
{
|
||||
int exist = 0;
|
||||
int i;
|
||||
int exist = 0;
|
||||
int i;
|
||||
|
||||
/* This is the dumb part of the tree, a linear search. */
|
||||
for (i = 0; i < tree->size; i++)
|
||||
{
|
||||
if ((tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING) && (strcmp((char *)tree->elements[i].element, element) == 0))
|
||||
{
|
||||
exist = 1;
|
||||
break;
|
||||
}
|
||||
if ((tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING)
|
||||
&& (strcmp((char *)tree->elements[i].element, element) == 0))
|
||||
{
|
||||
exist = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return exist;
|
||||
}
|
||||
|
||||
int
|
||||
ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree, int level, int (*func) (const void *data, Ecore_Desktop_Tree * tree, int element, int level),
|
||||
const void *data)
|
||||
ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree, int level,
|
||||
int (*func) (const void *data,
|
||||
Ecore_Desktop_Tree * tree, int element,
|
||||
int level), const void *data)
|
||||
{
|
||||
int result = 0;
|
||||
int i;
|
||||
int result = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tree->size; i++)
|
||||
{
|
||||
if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE)
|
||||
{
|
||||
if (ecore_desktop_tree_foreach((Ecore_Desktop_Tree *) tree->elements[i].element, level + 1, func, data))
|
||||
result = 1;
|
||||
}
|
||||
else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL)
|
||||
{
|
||||
/* This falls into the dumb category. */
|
||||
int j = i;
|
||||
int k = i;
|
||||
int moved = 0;
|
||||
if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE)
|
||||
{
|
||||
if (ecore_desktop_tree_foreach
|
||||
((Ecore_Desktop_Tree *) tree->elements[i].element, level + 1,
|
||||
func, data))
|
||||
result = 1;
|
||||
}
|
||||
else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL)
|
||||
{
|
||||
/* This falls into the dumb category. */
|
||||
int j = i;
|
||||
int k = i;
|
||||
int moved = 0;
|
||||
|
||||
/* Find the next non NULL element. */
|
||||
while ((j < tree->size) && (tree->elements[j].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL))
|
||||
j++;
|
||||
/* Move the next batch of non NULL up. */
|
||||
while ((j < tree->size) && (tree->elements[j].type != ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL))
|
||||
{
|
||||
moved = 1;
|
||||
tree->elements[k].type = tree->elements[j].type;
|
||||
tree->elements[k].element = tree->elements[j].element;
|
||||
tree->elements[j].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL;
|
||||
tree->elements[j].element = NULL;
|
||||
j++;
|
||||
k++;
|
||||
}
|
||||
if (moved)
|
||||
i--;
|
||||
else
|
||||
tree->size = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func(data, tree, i, level))
|
||||
result = 1;
|
||||
}
|
||||
/* Find the next non NULL element. */
|
||||
while ((j < tree->size)
|
||||
&& (tree->elements[j].type ==
|
||||
ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL))
|
||||
j++;
|
||||
/* Move the next batch of non NULL up. */
|
||||
while ((j < tree->size)
|
||||
&& (tree->elements[j].type !=
|
||||
ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL))
|
||||
{
|
||||
moved = 1;
|
||||
tree->elements[k].type = tree->elements[j].type;
|
||||
tree->elements[k].element = tree->elements[j].element;
|
||||
tree->elements[j].type = ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL;
|
||||
tree->elements[j].element = NULL;
|
||||
j++;
|
||||
k++;
|
||||
}
|
||||
if (moved)
|
||||
i--;
|
||||
else
|
||||
tree->size = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func(data, tree, i, level))
|
||||
result = 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -230,60 +274,64 @@ ecore_desktop_tree_foreach(Ecore_Desktop_Tree * tree, int level, int (*func) (co
|
|||
void
|
||||
ecore_desktop_tree_dump(Ecore_Desktop_Tree * tree, int level)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < tree->size; i++)
|
||||
{
|
||||
int j;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < level; j++)
|
||||
printf(".");
|
||||
switch (tree->elements[i].type)
|
||||
{
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL:
|
||||
{
|
||||
printf("NULL\n");
|
||||
}
|
||||
break;
|
||||
for (j = 0; j < level; j++)
|
||||
printf(".");
|
||||
switch (tree->elements[i].type)
|
||||
{
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_NULL:
|
||||
{
|
||||
printf("NULL\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING:
|
||||
{
|
||||
printf("%s\n", (char *)tree->elements[i].element);
|
||||
}
|
||||
break;
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_STRING:
|
||||
{
|
||||
printf("%s\n", (char *)tree->elements[i].element);
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE:
|
||||
{
|
||||
printf("TREE ELEMENT TYPE\n");
|
||||
ecore_desktop_tree_dump((Ecore_Desktop_Tree *) tree->elements[i].element, level + 1);
|
||||
}
|
||||
break;
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE:
|
||||
{
|
||||
printf("TREE ELEMENT TYPE\n");
|
||||
ecore_desktop_tree_dump((Ecore_Desktop_Tree *) tree->
|
||||
elements[i].element, level + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH:
|
||||
{
|
||||
int lev;
|
||||
case ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH:
|
||||
{
|
||||
int lev;
|
||||
|
||||
lev = level + 1;
|
||||
printf("HASH ELEMENT TYPE\n");
|
||||
ecore_hash_for_each_node((Ecore_Hash *) tree->elements[i].element, ecore_desktop_tree_dump_each_hash_node, &lev);
|
||||
}
|
||||
break;
|
||||
lev = level + 1;
|
||||
printf("HASH ELEMENT TYPE\n");
|
||||
ecore_hash_for_each_node((Ecore_Hash *) tree->elements[i].
|
||||
element,
|
||||
ecore_desktop_tree_dump_each_hash_node,
|
||||
&lev);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
printf("UNKNOWN ELEMENT TYPE!\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
printf("UNKNOWN ELEMENT TYPE!\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ecore_desktop_tree_dump_each_hash_node(void *value, void *user_data)
|
||||
{
|
||||
Ecore_Hash_Node *node;
|
||||
int level;
|
||||
int j;
|
||||
Ecore_Hash_Node *node;
|
||||
int level;
|
||||
int j;
|
||||
|
||||
node = (Ecore_Hash_Node *) value;
|
||||
level = *((int *)user_data);
|
||||
|
@ -295,14 +343,15 @@ ecore_desktop_tree_dump_each_hash_node(void *value, void *user_data)
|
|||
void
|
||||
ecore_desktop_tree_del(Ecore_Desktop_Tree * tree)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = tree->size - 1; i >= 0; i--)
|
||||
{
|
||||
if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE)
|
||||
ecore_desktop_tree_del((Ecore_Desktop_Tree *) tree->elements[i].element);
|
||||
else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH)
|
||||
ecore_hash_destroy((Ecore_Hash *) tree->elements[i].element);
|
||||
if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_TREE)
|
||||
ecore_desktop_tree_del((Ecore_Desktop_Tree *) tree->elements[i].
|
||||
element);
|
||||
else if (tree->elements[i].type == ECORE_DESKTOP_TREE_ELEMENT_TYPE_HASH)
|
||||
ecore_hash_destroy((Ecore_Hash *) tree->elements[i].element);
|
||||
}
|
||||
|
||||
E_FREE(tree->elements);
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
* The final '>' of a tag is replaced with a '\0', but it's existance can be implied.
|
||||
*/
|
||||
|
||||
static char *_ecore_desktop_xmlame_parse(Ecore_Desktop_Tree * tree, char *buffer);
|
||||
static char *_ecore_desktop_xmlame_parse(Ecore_Desktop_Tree * tree,
|
||||
char *buffer);
|
||||
|
||||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_xmlame_new(char *buffer)
|
||||
|
@ -37,93 +38,95 @@ ecore_desktop_xmlame_new(char *buffer)
|
|||
Ecore_Desktop_Tree *
|
||||
ecore_desktop_xmlame_get(char *file)
|
||||
{
|
||||
int size;
|
||||
char *buffer;
|
||||
int size;
|
||||
char *buffer;
|
||||
Ecore_Desktop_Tree *tree = NULL;
|
||||
|
||||
size = ecore_file_size(file);
|
||||
buffer = (char *)malloc(size + 1);
|
||||
if (buffer)
|
||||
{
|
||||
int fd;
|
||||
int fd;
|
||||
|
||||
buffer[0] = '\0';
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
if (read(fd, buffer, size) == size)
|
||||
buffer[size] = '\0';
|
||||
}
|
||||
tree = ecore_desktop_xmlame_new(buffer);
|
||||
if (tree)
|
||||
{
|
||||
/* Have the file name as the first item on the tree, for later reference. */
|
||||
ecore_desktop_tree_extend(tree, file);
|
||||
_ecore_desktop_xmlame_parse(tree, buffer);
|
||||
}
|
||||
buffer[0] = '\0';
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd != -1)
|
||||
{
|
||||
if (read(fd, buffer, size) == size)
|
||||
buffer[size] = '\0';
|
||||
}
|
||||
tree = ecore_desktop_xmlame_new(buffer);
|
||||
if (tree)
|
||||
{
|
||||
/* Have the file name as the first item on the tree, for later reference. */
|
||||
ecore_desktop_tree_extend(tree, file);
|
||||
_ecore_desktop_xmlame_parse(tree, buffer);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
static char *
|
||||
static char *
|
||||
_ecore_desktop_xmlame_parse(Ecore_Desktop_Tree * tree, char *buffer)
|
||||
{
|
||||
do
|
||||
{
|
||||
char *text;
|
||||
char *text;
|
||||
|
||||
/* Skip any white space at the beginning. */
|
||||
while ((*buffer != '\0') && (isspace(*buffer)))
|
||||
buffer++;
|
||||
text = buffer;
|
||||
/* Find the beginning of a tag. */
|
||||
while ((*buffer != '<') && (*buffer != '\0'))
|
||||
buffer++;
|
||||
/* Check for data between tags. */
|
||||
if (buffer != text)
|
||||
{
|
||||
char t;
|
||||
/* Skip any white space at the beginning. */
|
||||
while ((*buffer != '\0') && (isspace(*buffer)))
|
||||
buffer++;
|
||||
text = buffer;
|
||||
/* Find the beginning of a tag. */
|
||||
while ((*buffer != '<') && (*buffer != '\0'))
|
||||
buffer++;
|
||||
/* Check for data between tags. */
|
||||
if (buffer != text)
|
||||
{
|
||||
char t;
|
||||
|
||||
t = *buffer;
|
||||
*buffer = '\0';
|
||||
ecore_desktop_tree_extend(tree, strdup(text));
|
||||
*buffer = t;
|
||||
}
|
||||
if (*buffer != '\0')
|
||||
{
|
||||
char *begin;
|
||||
t = *buffer;
|
||||
*buffer = '\0';
|
||||
ecore_desktop_tree_extend(tree, strdup(text));
|
||||
*buffer = t;
|
||||
}
|
||||
if (*buffer != '\0')
|
||||
{
|
||||
char *begin;
|
||||
|
||||
begin = buffer++;
|
||||
/* Find the end of the tag. */
|
||||
while ((*buffer != '>') && (*buffer != '\0'))
|
||||
buffer++;
|
||||
/* We have our tag, do something with it. */
|
||||
if (*buffer != '\0')
|
||||
{
|
||||
*buffer++ = '\0';
|
||||
if (begin[1] == '/')
|
||||
{ /* The end of an element. */
|
||||
ecore_desktop_tree_add(tree, begin);
|
||||
break;
|
||||
}
|
||||
else if ((begin[1] == '!') || (begin[1] == '-') || (*(buffer - 2) == '/'))
|
||||
{ /* This is a script, a comment, or a stand alone tag. */
|
||||
ecore_desktop_tree_add(tree, begin);
|
||||
}
|
||||
else
|
||||
{ /* The beginning of an element. */
|
||||
Ecore_Desktop_Tree *new_tree;
|
||||
begin = buffer++;
|
||||
/* Find the end of the tag. */
|
||||
while ((*buffer != '>') && (*buffer != '\0'))
|
||||
buffer++;
|
||||
/* We have our tag, do something with it. */
|
||||
if (*buffer != '\0')
|
||||
{
|
||||
*buffer++ = '\0';
|
||||
if (begin[1] == '/')
|
||||
{ /* The end of an element. */
|
||||
ecore_desktop_tree_add(tree, begin);
|
||||
break;
|
||||
}
|
||||
else if ((begin[1] == '!') || (begin[1] == '-')
|
||||
|| (*(buffer - 2) == '/'))
|
||||
{ /* This is a script, a comment, or a stand alone tag. */
|
||||
ecore_desktop_tree_add(tree, begin);
|
||||
}
|
||||
else
|
||||
{ /* The beginning of an element. */
|
||||
Ecore_Desktop_Tree *new_tree;
|
||||
|
||||
new_tree = ecore_desktop_xmlame_new(NULL);
|
||||
if (new_tree)
|
||||
{
|
||||
ecore_desktop_tree_add_child(tree, new_tree);
|
||||
ecore_desktop_tree_add(new_tree, begin);
|
||||
buffer = _ecore_desktop_xmlame_parse(new_tree, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
new_tree = ecore_desktop_xmlame_new(NULL);
|
||||
if (new_tree)
|
||||
{
|
||||
ecore_desktop_tree_add_child(tree, new_tree);
|
||||
ecore_desktop_tree_add(new_tree, begin);
|
||||
buffer =
|
||||
_ecore_desktop_xmlame_parse(new_tree, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (*buffer != '\0');
|
||||
|
||||
|
|
Loading…
Reference in New Issue