forked from enlightenment/enlightenment
alert made more robust just in case... but mor eimportantle e_apps and
e_apps_cache now use stringshare. bit by bit my friends... bit by bit... SVN revision: 18782
This commit is contained in:
parent
608a3e40f5
commit
141a376232
|
@ -1412,7 +1412,7 @@ e_action_name_list(void)
|
|||
}
|
||||
|
||||
E_Action *
|
||||
e_action_add(char *name)
|
||||
e_action_add(const char *name)
|
||||
{
|
||||
E_Action *act;
|
||||
|
||||
|
@ -1421,15 +1421,15 @@ e_action_add(char *name)
|
|||
{
|
||||
act = E_OBJECT_ALLOC(E_Action, E_ACTION_TYPE, _e_action_free);
|
||||
if (!act) return NULL;
|
||||
act->name = strdup(name);
|
||||
actions = evas_hash_add(actions, name, act);
|
||||
act->name = name;
|
||||
actions = evas_hash_direct_add(actions, act->name, act);
|
||||
action_names = evas_list_append(action_names, name);
|
||||
}
|
||||
return act;
|
||||
}
|
||||
|
||||
E_Action *
|
||||
e_action_find(char *name)
|
||||
e_action_find(const char *name)
|
||||
{
|
||||
E_Action *act;
|
||||
|
||||
|
@ -1444,7 +1444,6 @@ _e_action_free(E_Action *act)
|
|||
{
|
||||
actions = evas_hash_del(actions, act->name, act);
|
||||
action_names = evas_list_remove(action_names, act->name);
|
||||
E_FREE(act->name);
|
||||
free(act);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ EAPI int e_actions_init(void);
|
|||
EAPI int e_actions_shutdown(void);
|
||||
|
||||
EAPI Evas_List *e_action_name_list(void);
|
||||
EAPI E_Action *e_action_add(char *name);
|
||||
EAPI E_Action *e_action_find(char *name);
|
||||
EAPI E_Action *e_action_add(const char *name);
|
||||
EAPI E_Action *e_action_find(const char *name);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -19,12 +19,18 @@ static Display *dd = NULL;
|
|||
static char *title = NULL, *str1 = NULL, *str2 = NULL, *str3 = NULL;
|
||||
static Font font = 0;
|
||||
static XFontStruct *fs = NULL;
|
||||
|
||||
static GC gc = 0;
|
||||
static Window win = 0, b1 = 0, b2 = 0, b3 = 0;
|
||||
static int ww = 600, hh = 440;
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
e_alert_init(char *disp)
|
||||
e_alert_init(const char *disp)
|
||||
{
|
||||
XGCValues gcv;
|
||||
int wid, hih, mask;
|
||||
XSetWindowAttributes att;
|
||||
|
||||
dd = XOpenDisplay(disp);
|
||||
if (!dd) return 0;
|
||||
font = XLoadFont(dd, "fixed");
|
||||
|
@ -36,49 +42,6 @@ e_alert_init(char *disp)
|
|||
str1 = "(F1) Ignore";
|
||||
str2 = "(F2) Restart";
|
||||
str3 = "(F3) Exit";
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_alert_shutdown(void)
|
||||
{
|
||||
XFreeFont(dd, fs);
|
||||
XCloseDisplay(dd);
|
||||
title = NULL;
|
||||
str1 = NULL;
|
||||
str2 = NULL;
|
||||
str3 = NULL;
|
||||
dd = NULL;
|
||||
font = 0;
|
||||
fs = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
e_alert_show(char *text)
|
||||
{
|
||||
int wid, hih, w, i, j, k, mask;
|
||||
XGCValues gcv;
|
||||
GC gc;
|
||||
char line[1024];
|
||||
XEvent ev;
|
||||
XSetWindowAttributes att;
|
||||
int fw, fh, ww, hh, mh;
|
||||
KeyCode key;
|
||||
int button;
|
||||
Window win = 0, b1 = 0, b2 = 0, b3 = 0;
|
||||
|
||||
if (!text) return;
|
||||
|
||||
if ((!dd) || (!fs))
|
||||
{
|
||||
fprintf(stderr, text);
|
||||
fflush(stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
ww = 600;
|
||||
hh = 440;
|
||||
|
||||
wid = DisplayWidth(dd, DefaultScreen(dd));
|
||||
hih = DisplayHeight(dd, DefaultScreen(dd));
|
||||
|
@ -106,24 +69,60 @@ e_alert_show(char *text)
|
|||
XSetForeground(dd, gc, att.border_pixel);
|
||||
XSelectInput(dd, win, KeyPressMask | KeyReleaseMask | ExposureMask);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_alert_shutdown(void)
|
||||
{
|
||||
XDestroyWindow(dd, win);
|
||||
XFreeGC(dd, gc);
|
||||
XFreeFont(dd, fs);
|
||||
XCloseDisplay(dd);
|
||||
title = NULL;
|
||||
str1 = NULL;
|
||||
str2 = NULL;
|
||||
str3 = NULL;
|
||||
dd = NULL;
|
||||
font = 0;
|
||||
fs = NULL;
|
||||
gc = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
e_alert_show(const char *text)
|
||||
{
|
||||
int w, i, j, k;
|
||||
char line[1024];
|
||||
XEvent ev;
|
||||
int fw, fh, mh;
|
||||
KeyCode key;
|
||||
int button;
|
||||
|
||||
if (!text) return;
|
||||
|
||||
if ((!dd) || (!fs))
|
||||
{
|
||||
fprintf(stderr, text);
|
||||
fflush(stderr);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fh = fs->ascent + fs->descent;
|
||||
mh = ((ww - 20) / 3) - 20;
|
||||
|
||||
/* fixed size... */
|
||||
w = 5 + (((ww - 20 - mh) * 0) / 4);
|
||||
XMoveResizeWindow(dd, b1, w, hh - 15 - fh, mh + 10, fh + 10);
|
||||
XSelectInput(dd, b1,
|
||||
ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
XSelectInput(dd, b1, ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
w = 5 + (((ww - 20 - mh) * 1) / 2);
|
||||
XMoveResizeWindow(dd, b2, w, hh - 15 - fh, mh + 10, fh + 10);
|
||||
XSelectInput(dd, b2,
|
||||
ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
XSelectInput(dd, b2, ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
w = 5 + (((ww - 20 - mh) * 2) / 2);
|
||||
XMoveResizeWindow(dd, b3, w, hh - 15 - fh, mh + 10, fh + 10);
|
||||
XSelectInput(dd, b3,
|
||||
ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
XSelectInput(dd, b3, ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
|
||||
XSync(dd, False);
|
||||
XMapWindow(dd, win);
|
||||
XGrabPointer(dd, win, True, ButtonPressMask | ButtonReleaseMask,
|
||||
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
|
||||
|
@ -212,7 +211,6 @@ e_alert_show(char *text)
|
|||
}
|
||||
}
|
||||
XDestroyWindow(dd, win);
|
||||
XFreeGC(dd, gc);
|
||||
XSync(dd, False);
|
||||
|
||||
switch (button)
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#ifndef E_ALERT_H
|
||||
#define E_ALERT_H
|
||||
|
||||
int e_alert_init(char *disp);
|
||||
int e_alert_init(const char *disp);
|
||||
int e_alert_shutdown(void);
|
||||
|
||||
void e_alert_show(char *text);
|
||||
void e_alert_show(const char *text);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
168
src/bin/e_apps.c
168
src/bin/e_apps.c
|
@ -123,11 +123,11 @@ e_app_init(void)
|
|||
e_app_cache_init();
|
||||
home = e_user_homedir_get();
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/applications/trash", home);
|
||||
_e_apps_path_trash = strdup(buf);
|
||||
_e_apps_path_trash = evas_stringshare_add(buf);
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/applications/all", home);
|
||||
_e_apps_path_all = strdup(buf);
|
||||
_e_apps_path_all = evas_stringshare_add(buf);
|
||||
free(home);
|
||||
_e_apps_repositories = evas_list_append(_e_apps_repositories, strdup(buf));
|
||||
_e_apps_repositories = evas_list_append(_e_apps_repositories, evas_stringshare_add(buf));
|
||||
_e_apps_exit_handler = ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, _e_apps_cb_exit, NULL);
|
||||
_e_apps_border_add_handler = ecore_event_handler_add(E_EVENT_BORDER_ADD, _e_app_cb_event_border_add, NULL);
|
||||
_e_apps_all = e_app_new(buf, 1);
|
||||
|
@ -145,7 +145,7 @@ e_app_shutdown(void)
|
|||
}
|
||||
while (_e_apps_repositories)
|
||||
{
|
||||
free(_e_apps_repositories->data);
|
||||
evas_stringshare_del(_e_apps_repositories->data);
|
||||
_e_apps_repositories = evas_list_remove_list(_e_apps_repositories, _e_apps_repositories);
|
||||
}
|
||||
if (_e_apps_exit_handler)
|
||||
|
@ -158,8 +158,8 @@ e_app_shutdown(void)
|
|||
ecore_event_handler_del(_e_apps_border_add_handler);
|
||||
_e_apps_border_add_handler = NULL;
|
||||
}
|
||||
free(_e_apps_path_trash);
|
||||
free(_e_apps_path_all);
|
||||
evas_stringshare_del(_e_apps_path_trash);
|
||||
evas_stringshare_del(_e_apps_path_all);
|
||||
{
|
||||
Evas_List *l;
|
||||
for (l = _e_apps_list; l; l = l->next)
|
||||
|
@ -235,7 +235,7 @@ e_app_new(const char *path, int scan_subdirs)
|
|||
/* no image for now */
|
||||
a->image = NULL;
|
||||
/* record the path */
|
||||
a->path = strdup(path);
|
||||
a->path = evas_stringshare_add(path);
|
||||
|
||||
if (ecore_file_is_dir(a->path))
|
||||
{
|
||||
|
@ -243,7 +243,7 @@ e_app_new(const char *path, int scan_subdirs)
|
|||
if (ecore_file_exists(buf))
|
||||
e_app_fields_fill(a, buf);
|
||||
else
|
||||
a->name = strdup(ecore_file_get_file(a->path));
|
||||
a->name = evas_stringshare_add(ecore_file_get_file(a->path));
|
||||
if (scan_subdirs) e_app_subdir_scan(a, scan_subdirs);
|
||||
|
||||
a->monitor = ecore_file_monitor_add(a->path, _e_app_cb_monitor, a);
|
||||
|
@ -272,7 +272,7 @@ e_app_new(const char *path, int scan_subdirs)
|
|||
|
||||
error:
|
||||
if (a->monitor) ecore_file_monitor_del(a->monitor);
|
||||
if (a->path) free(a->path);
|
||||
if (a->path) evas_stringshare_del(a->path);
|
||||
e_app_fields_empty(a);
|
||||
free(a);
|
||||
return NULL;
|
||||
|
@ -285,8 +285,7 @@ e_app_empty_new(const char *path)
|
|||
|
||||
a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free);
|
||||
a->image = NULL;
|
||||
if (path)
|
||||
a->path = strdup(path);
|
||||
if (path) a->path = evas_stringshare_add(path);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -469,8 +468,8 @@ e_app_prepend_relative(E_App *add, E_App *before)
|
|||
if (ecore_file_exists(buf))
|
||||
snprintf(buf, sizeof(buf), "%s/%s", before->parent->path, ecore_file_get_file(add->path));
|
||||
ecore_file_mv(add->path, buf);
|
||||
free(add->path);
|
||||
add->path = strdup(buf);
|
||||
evas_stringshare_del(add->path);
|
||||
add->path = evas_stringshare_add(buf);
|
||||
}
|
||||
|
||||
_e_app_save_order(before->parent);
|
||||
|
@ -495,8 +494,8 @@ e_app_append(E_App *add, E_App *parent)
|
|||
if (ecore_file_exists(buf))
|
||||
snprintf(buf, sizeof(buf), "%s/%s", parent->path, ecore_file_get_file(add->path));
|
||||
ecore_file_mv(add->path, buf);
|
||||
free(add->path);
|
||||
add->path = strdup(buf);
|
||||
evas_stringshare_del(add->path);
|
||||
add->path = evas_stringshare_add(buf);
|
||||
}
|
||||
|
||||
_e_app_save_order(parent);
|
||||
|
@ -628,8 +627,8 @@ e_app_remove(E_App *a)
|
|||
/* Move to trash */
|
||||
snprintf(buf, sizeof(buf), "%s/%s", _e_apps_path_trash, ecore_file_get_file(a->path));
|
||||
ecore_file_mv(a->path, buf);
|
||||
free(a->path);
|
||||
a->path = strdup(buf);
|
||||
evas_stringshare_del(a->path);
|
||||
a->path = evas_stringshare_add(buf);
|
||||
}
|
||||
_e_app_save_order(a->parent);
|
||||
_e_app_change(a, E_APP_DEL);
|
||||
|
@ -867,6 +866,15 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
ef = eet_open(path, EET_FILE_MODE_READ);
|
||||
if (!ef) return;
|
||||
|
||||
#define STORE(member) \
|
||||
if (v) \
|
||||
{ \
|
||||
str = alloca(size + 1); \
|
||||
memcpy(str, v, size); \
|
||||
str[size] = 0; \
|
||||
a->member = evas_stringshare_add(str); \
|
||||
free(v); \
|
||||
}
|
||||
if (lang)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "app/info/name[%s]", lang);
|
||||
|
@ -875,14 +883,7 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
}
|
||||
else
|
||||
v = eet_read(ef, "app/info/name", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->name = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(name);
|
||||
|
||||
if (lang)
|
||||
{
|
||||
|
@ -892,15 +893,7 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
}
|
||||
else
|
||||
v = eet_read(ef, "app/info/generic", &size);
|
||||
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->generic = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(generic);
|
||||
|
||||
if (lang)
|
||||
{
|
||||
|
@ -910,70 +903,20 @@ e_app_fields_fill(E_App *a, const char *path)
|
|||
}
|
||||
else
|
||||
v = eet_read(ef, "app/info/comment", &size);
|
||||
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->comment = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(comment);
|
||||
|
||||
v = eet_read(ef, "app/info/exe", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->exe = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(exe);
|
||||
v = eet_read(ef, "app/icon/class", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->icon_class = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(icon_class);
|
||||
v = eet_read(ef, "app/window/name", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->win_name = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(win_name);
|
||||
v = eet_read(ef, "app/window/class", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->win_class = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(win_class);
|
||||
v = eet_read(ef, "app/window/title", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->win_title = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(win_title);
|
||||
v = eet_read(ef, "app/window/role", &size);
|
||||
if (v)
|
||||
{
|
||||
str = malloc(size + 1);
|
||||
memcpy(str, v, size);
|
||||
str[size] = 0;
|
||||
a->win_role = str;
|
||||
free(v);
|
||||
}
|
||||
STORE(win_role);
|
||||
v = eet_read(ef, "app/info/startup_notify", &size);
|
||||
if (v)
|
||||
{
|
||||
|
@ -1105,15 +1048,24 @@ e_app_fields_save(E_App *a)
|
|||
void
|
||||
e_app_fields_empty(E_App *a)
|
||||
{
|
||||
E_FREE(a->name);
|
||||
E_FREE(a->generic);
|
||||
E_FREE(a->comment);
|
||||
E_FREE(a->exe);
|
||||
E_FREE(a->icon_class);
|
||||
E_FREE(a->win_name);
|
||||
E_FREE(a->win_class);
|
||||
E_FREE(a->win_title);
|
||||
E_FREE(a->win_role);
|
||||
if (a->name) evas_stringshare_del(a->name);
|
||||
if (a->generic) evas_stringshare_del(a->generic);
|
||||
if (a->comment) evas_stringshare_del(a->comment);
|
||||
if (a->exe) evas_stringshare_del(a->exe);
|
||||
if (a->icon_class) evas_stringshare_del(a->icon_class);
|
||||
if (a->win_name) evas_stringshare_del(a->win_name);
|
||||
if (a->win_class) evas_stringshare_del(a->win_class);
|
||||
if (a->win_title) evas_stringshare_del(a->win_title);
|
||||
if (a->win_role) evas_stringshare_del(a->win_role);
|
||||
a->name = NULL;
|
||||
a->generic = NULL;
|
||||
a->comment = NULL;
|
||||
a->exe = NULL;
|
||||
a->icon_class = NULL;
|
||||
a->win_name = NULL;
|
||||
a->win_class = NULL;
|
||||
a->win_title = NULL;
|
||||
a->win_role = NULL;
|
||||
}
|
||||
|
||||
Ecore_List *
|
||||
|
@ -1358,7 +1310,7 @@ _e_app_free(E_App *a)
|
|||
_e_apps = evas_hash_del(_e_apps, a->path, a);
|
||||
_e_apps_list = evas_list_remove(_e_apps_list, a);
|
||||
e_app_fields_empty(a);
|
||||
E_FREE(a->path);
|
||||
if (a->path) evas_stringshare_del(a->path);
|
||||
free(a);
|
||||
}
|
||||
}
|
||||
|
@ -1460,7 +1412,7 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
|
|||
else if (event == ECORE_FILE_EVENT_DELETED_FILE)
|
||||
{
|
||||
e_app_fields_empty(app);
|
||||
app->name = strdup(ecore_file_get_file(app->path));
|
||||
app->name = evas_stringshare_add(ecore_file_get_file(app->path));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1856,7 +1808,7 @@ _e_app_cb_expire_timer(void *data)
|
|||
static void
|
||||
_e_app_cache_copy(E_App_Cache *ac, E_App *a)
|
||||
{
|
||||
#define IF_DUP(x) if ((ac->x) && (ac->x[0] != 0)) a->x = strdup(ac->x)
|
||||
#define IF_DUP(x) if ((ac->x) && (ac->x[0] != 0)) a->x = evas_stringshare_add(ac->x)
|
||||
IF_DUP(name);
|
||||
IF_DUP(generic);
|
||||
IF_DUP(comment);
|
||||
|
@ -1891,7 +1843,7 @@ _e_app_cb_scan_cache_timer(void *data)
|
|||
ecore_list_destroy(sc->files);
|
||||
e_app_cache_free(sc->cache);
|
||||
ecore_timer_del(sc->timer);
|
||||
free(sc->path);
|
||||
evas_stringshare_del(sc->path);
|
||||
free(sc);
|
||||
printf("Cache scan finish.\n");
|
||||
return 0;
|
||||
|
@ -1942,7 +1894,7 @@ _e_app_cache_new(E_App_Cache *ac, char *path, int scan_subdirs)
|
|||
|
||||
a = E_OBJECT_ALLOC(E_App, E_APP_TYPE, _e_app_free);
|
||||
_e_app_cache_copy(ac, a);
|
||||
a->path = strdup(path);
|
||||
a->path = evas_stringshare_add(path);
|
||||
a->scanned = 1;
|
||||
for (l = ac->subapps; l; l = l->next)
|
||||
{
|
||||
|
@ -1965,10 +1917,10 @@ _e_app_cache_new(E_App_Cache *ac, char *path, int scan_subdirs)
|
|||
_e_app_cache_copy(ac2, a2);
|
||||
if (ac2->is_dir)
|
||||
{
|
||||
E_FREE(a2->exe);
|
||||
if (a2->exe) evas_stringshare_del(a2->exe);
|
||||
}
|
||||
a2->parent = a;
|
||||
a2->path = strdup(buf);
|
||||
a2->path = evas_stringshare_add(buf);
|
||||
a->subapps = evas_list_append(a->subapps, a2);
|
||||
_e_apps = evas_hash_add(_e_apps, a2->path, a2);
|
||||
_e_apps_list = evas_list_prepend(_e_apps_list, a2);
|
||||
|
@ -2009,7 +1961,7 @@ _e_app_cache_new(E_App_Cache *ac, char *path, int scan_subdirs)
|
|||
sc = calloc(1, sizeof(E_App_Scan_Cache));
|
||||
if (sc)
|
||||
{
|
||||
sc->path = strdup(path);
|
||||
sc->path = evas_stringshare_add(path);
|
||||
sc->cache = ac;
|
||||
sc->app = a;
|
||||
sc->files = e_app_dir_file_list_get(a);
|
||||
|
|
|
@ -4,14 +4,7 @@
|
|||
#include "e.h"
|
||||
|
||||
#define NEWD(str, typ) \
|
||||
eet_data_descriptor_new(str, sizeof(typ), \
|
||||
(void *(*) (void *))evas_list_next, \
|
||||
(void *(*) (void *, void *))evas_list_append, \
|
||||
(void *(*) (void *))evas_list_data, \
|
||||
(void *(*) (void *))evas_list_free, \
|
||||
(void (*) (void *, int (*) (void *, const char *, void *, void *), void *))evas_hash_foreach, \
|
||||
(void *(*) (void *, const char *, void *))evas_hash_add, \
|
||||
(void (*) (void *))evas_hash_free)
|
||||
{ eddc.name = str; eddc.size = sizeof(typ); }
|
||||
|
||||
#define FREED(eed) \
|
||||
if (eed) \
|
||||
|
@ -31,7 +24,24 @@ static Eet_Data_Descriptor *_e_app_cache_edd = NULL;
|
|||
int
|
||||
e_app_cache_init(void)
|
||||
{
|
||||
_e_app_cache_edd = NEWD("E_App_Cache", E_App_Cache);
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
|
||||
eddc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
|
||||
eddc.func.mem_alloc = NULL;
|
||||
eddc.func.mem_free = NULL;
|
||||
eddc.func.str_alloc = evas_stringshare_add;
|
||||
eddc.func.str_free = evas_stringshare_del;
|
||||
eddc.func.list_next = evas_list_next;
|
||||
eddc.func.list_append = evas_list_append;
|
||||
eddc.func.list_data = evas_list_data;
|
||||
eddc.func.list_free = evas_list_free;
|
||||
eddc.func.hash_foreach = evas_hash_foreach;
|
||||
eddc.func.hash_add = evas_hash_add;
|
||||
eddc.func.hash_free = evas_hash_free;
|
||||
|
||||
NEWD("E_App_Cache", E_App_Cache);
|
||||
_e_app_cache_edd = eet_data_descriptor2_new(&eddc);
|
||||
|
||||
NEWI("nm", name, EET_T_STRING);
|
||||
NEWI("gn", generic, EET_T_STRING);
|
||||
NEWI("cm", comment, EET_T_STRING);
|
||||
|
@ -113,7 +123,7 @@ e_app_cache_generate(E_App *a)
|
|||
if ((!ac2->is_link) && (!ac2->is_dir))
|
||||
ac2->file_mod_time = ecore_file_mod_time(buf);
|
||||
ac->subapps = evas_list_append(ac->subapps, ac2);
|
||||
ac->subapps_hash = evas_hash_add(ac->subapps_hash, ac2->file, ac2);
|
||||
ac->subapps_hash = evas_hash_direct_add(ac->subapps_hash, ac2->file, ac2);
|
||||
}
|
||||
}
|
||||
return ac;
|
||||
|
@ -123,16 +133,16 @@ void
|
|||
e_app_cache_free(E_App_Cache *ac)
|
||||
{
|
||||
if (!ac) return;
|
||||
E_FREE(ac->name);
|
||||
E_FREE(ac->generic);
|
||||
E_FREE(ac->comment);
|
||||
E_FREE(ac->exe);
|
||||
E_FREE(ac->file);
|
||||
E_FREE(ac->win_name);
|
||||
E_FREE(ac->win_class);
|
||||
E_FREE(ac->win_title);
|
||||
E_FREE(ac->win_role);
|
||||
E_FREE(ac->icon_class);
|
||||
if (ac->name) evas_stringshare_del(ac->name);
|
||||
if (ac->generic) evas_stringshare_del(ac->generic);
|
||||
if (ac->comment) evas_stringshare_del(ac->comment);
|
||||
if (ac->exe) evas_stringshare_del(ac->exe);
|
||||
if (ac->file) evas_stringshare_del(ac->file);
|
||||
if (ac->win_name) evas_stringshare_del(ac->win_name);
|
||||
if (ac->win_class) evas_stringshare_del(ac->win_class);
|
||||
if (ac->win_title) evas_stringshare_del(ac->win_title);
|
||||
if (ac->win_role) evas_stringshare_del(ac->win_role);
|
||||
if (ac->icon_class) evas_stringshare_del(ac->icon_class);
|
||||
while (ac->subapps)
|
||||
{
|
||||
E_App_Cache *ac2;
|
||||
|
@ -161,17 +171,15 @@ e_app_cache_save(E_App_Cache *ac, char *path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_e_eapp_cache_fill(E_App_Cache *ac, E_App *a)
|
||||
{
|
||||
#define IF_DUP(x) if (a->x) ac->x = strdup(a->x)
|
||||
#define IF_DUP(x) if (a->x) ac->x = evas_stringshare_add(a->x)
|
||||
IF_DUP(name);
|
||||
IF_DUP(generic);
|
||||
IF_DUP(comment);
|
||||
IF_DUP(exe);
|
||||
ac->file = strdup(ecore_file_get_file(a->path));
|
||||
ac->file = evas_stringshare_add(ecore_file_get_file(a->path));
|
||||
IF_DUP(win_name);
|
||||
IF_DUP(win_class);
|
||||
IF_DUP(win_title);
|
||||
|
|
|
@ -10,4 +10,5 @@ temperature \
|
|||
cpufreq \
|
||||
ibox \
|
||||
start \
|
||||
randr
|
||||
randr \
|
||||
gadget_test
|
||||
|
|
Loading…
Reference in New Issue