forked from enlightenment/enlightenment
1. fix a segv on restart with ibar unreffing without a ref
2. add app icons (based off applications/all repository - need to make this a function of its own though) 3. fix default apps to have name/class info. SVN revision: 12336
This commit is contained in:
parent
aa5ebc1df0
commit
81d0ed0945
Binary file not shown.
|
@ -37,12 +37,14 @@ static int _e_apps_cb_exit (void *data, int type, void *event);
|
|||
|
||||
/* local subsystem globals */
|
||||
static Evas_Hash *_e_apps = NULL;
|
||||
static Evas_List *_e_apps_list = NULL;
|
||||
static Ecore_Timer *_e_apps_checker = NULL;
|
||||
static int _e_apps_callbacks_walking = 0;
|
||||
static int _e_apps_callbacks_delete_me = 0;
|
||||
static Evas_List *_e_apps_change_callbacks = NULL;
|
||||
static Ecore_Event_Handler *_e_apps_exit_handler = NULL;
|
||||
static Evas_List *_e_apps_repositories = NULL;
|
||||
static E_App *_e_apps_all = NULL;
|
||||
|
||||
/* externally accessible functions */
|
||||
int
|
||||
|
@ -53,15 +55,21 @@ e_app_init(void)
|
|||
|
||||
home = e_user_homedir_get();
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/applications/all", home);
|
||||
E_FREE(home);
|
||||
free(home);
|
||||
_e_apps_repositories = evas_list_append(_e_apps_repositories, strdup(buf));
|
||||
_e_apps_exit_handler = ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, _e_apps_cb_exit, NULL);
|
||||
_e_apps_all = e_app_new(buf, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
e_app_shutdown(void)
|
||||
{
|
||||
if (_e_apps_all)
|
||||
{
|
||||
e_object_unref(E_OBJECT(_e_apps_all));
|
||||
_e_apps_all = NULL;
|
||||
}
|
||||
while (_e_apps_repositories)
|
||||
{
|
||||
free(_e_apps_repositories->data);
|
||||
|
@ -144,6 +152,7 @@ e_app_new(char *path, int scan_subdirs)
|
|||
return NULL;
|
||||
}
|
||||
_e_apps = evas_hash_add(_e_apps, a->path, a);
|
||||
_e_apps_list = evas_list_prepend(_e_apps_list, a);
|
||||
_e_app_monitor();
|
||||
return a;
|
||||
}
|
||||
|
@ -180,8 +189,7 @@ e_app_subdir_scan(E_App *a, int scan_subdirs)
|
|||
Evas_List *pl;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s", a->path, s);
|
||||
if (e_file_exists(buf))
|
||||
a2 = e_app_new(buf, scan_subdirs);
|
||||
if (e_file_exists(buf)) a2 = e_app_new(buf, scan_subdirs);
|
||||
pl = _e_apps_repositories;
|
||||
while ((!a2) && (pl))
|
||||
{
|
||||
|
@ -270,6 +278,38 @@ e_app_change_callback_del(void (*func) (void *data, E_App *a, E_App_Change ch),
|
|||
}
|
||||
}
|
||||
|
||||
E_App *
|
||||
e_app_window_name_class_find(char *name, char *class)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
for (l = _e_apps_list; l; l = l->next)
|
||||
{
|
||||
E_App *a;
|
||||
|
||||
a = l->data;
|
||||
if ((a->win_name) || (a->win_class))
|
||||
{
|
||||
int ok = 0;
|
||||
|
||||
// printf("%s.%s == %s.%s\n", name, class, a->win_name, a->win_class);
|
||||
if ((!a->win_name) ||
|
||||
((a->win_name) && (!strcmp(a->win_name, name))))
|
||||
ok++;
|
||||
if ((!a->win_class) ||
|
||||
((a->win_class) && (!strcmp(a->win_class, class))))
|
||||
ok++;
|
||||
if (ok >= 2)
|
||||
{
|
||||
_e_apps_list = evas_list_remove_list(_e_apps_list, l);
|
||||
_e_apps_list = evas_list_prepend(_e_apps_list, a);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_app_free(E_App *a)
|
||||
|
@ -287,12 +327,14 @@ _e_app_free(E_App *a)
|
|||
E_App *a2;
|
||||
|
||||
a2 = a->subapps->data;
|
||||
e_object_unref(E_OBJECT(a2));
|
||||
a->subapps = evas_list_remove(a->subapps, a2);
|
||||
a2->parent = NULL;
|
||||
e_object_unref(E_OBJECT(a2));
|
||||
}
|
||||
if (a->parent)
|
||||
a->parent->subapps = evas_list_remove(a->parent->subapps, a);
|
||||
_e_apps = evas_hash_del(_e_apps, a->path, a);
|
||||
_e_apps_list = evas_list_remove(_e_apps_list, a);
|
||||
if (a->name) free(a->name);
|
||||
if (a->generic) free(a->generic);
|
||||
if (a->comment) free(a->comment);
|
||||
|
|
|
@ -54,4 +54,7 @@ EAPI int e_app_running_get(E_App *a);
|
|||
|
||||
EAPI void e_app_change_callback_add(void (*func) (void *data, E_App *a, E_App_Change ch), void *data);
|
||||
EAPI void e_app_change_callback_del(void (*func) (void *data, E_App *a, E_App_Change ch), void *data);
|
||||
|
||||
EAPI E_App *e_app_window_name_class_find(char *name, char *class);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -418,6 +418,7 @@ _e_border_free(E_Border *bd)
|
|||
if (bd->client.icccm.icon_name) free(bd->client.icccm.icon_name);
|
||||
if (bd->client.icccm.machine) free(bd->client.icccm.machine);
|
||||
e_object_del(E_OBJECT(bd->shape));
|
||||
if (bd->icon_object) evas_object_del(bd->icon_object);
|
||||
evas_object_del(bd->bg_object);
|
||||
e_canvas_del(bd->bg_ecore_evas);
|
||||
ecore_evas_free(bd->bg_ecore_evas);
|
||||
|
@ -1134,11 +1135,59 @@ _e_border_eval(E_Border *bd)
|
|||
}
|
||||
if (bd->client.icccm.fetch.name_class)
|
||||
{
|
||||
if (bd->client.icccm.name) free(bd->client.icccm.name);
|
||||
int nc_change = 0;
|
||||
char *pname, *pclass;
|
||||
|
||||
pname = bd->client.icccm.name;
|
||||
pclass = bd->client.icccm.class;
|
||||
bd->client.icccm.name = NULL;
|
||||
if (bd->client.icccm.class) free(bd->client.icccm.class);
|
||||
bd->client.icccm.class = NULL;
|
||||
ecore_x_window_prop_name_class_get(bd->client.win, &bd->client.icccm.name, &bd->client.icccm.class);
|
||||
if ((pname) && (bd->client.icccm.name) &&
|
||||
(pclass) && (bd->client.icccm.class))
|
||||
{
|
||||
if (!((!strcmp(bd->client.icccm.name, pname)) &&
|
||||
(!strcmp(bd->client.icccm.class, pclass))))
|
||||
nc_change = 1;
|
||||
}
|
||||
else if (((!pname) || (!pclass)) &&
|
||||
((bd->client.icccm.name) || (bd->client.icccm.class)))
|
||||
nc_change = 1;
|
||||
else if (((bd->client.icccm.name) || (bd->client.icccm.class)) &&
|
||||
((!pname) || (!pclass)))
|
||||
nc_change = 1;
|
||||
if (pname) free(pname);
|
||||
if (pclass) free(pclass);
|
||||
if (nc_change)
|
||||
{
|
||||
E_App *a;
|
||||
|
||||
a = NULL;
|
||||
if (bd->icon_object)
|
||||
{
|
||||
evas_object_del(bd->icon_object);
|
||||
bd->icon_object = NULL;
|
||||
}
|
||||
if ((bd->client.icccm.name) && (bd->client.icccm.class))
|
||||
{
|
||||
a = e_app_window_name_class_find(bd->client.icccm.name,
|
||||
bd->client.icccm.class);
|
||||
if (a)
|
||||
{
|
||||
bd->icon_object = edje_object_add(bd->bg_evas);
|
||||
edje_object_file_set(bd->icon_object, a->path, "icon");
|
||||
if (bd->bg_object)
|
||||
{
|
||||
evas_object_show(bd->icon_object);
|
||||
edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_hide(bd->icon_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bd->client.icccm.fetch.name_class = 0;
|
||||
}
|
||||
if (bd->client.icccm.fetch.icon_name)
|
||||
|
@ -1357,6 +1406,19 @@ _e_border_eval(E_Border *bd)
|
|||
evas_object_resize(o, bd->w, bd->h);
|
||||
evas_object_show(o);
|
||||
bd->client.border.changed = 0;
|
||||
|
||||
if (bd->icon_object)
|
||||
{
|
||||
if (bd->bg_object)
|
||||
{
|
||||
evas_object_show(bd->icon_object);
|
||||
edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_hide(bd->icon_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bd->new_client)
|
||||
|
|
|
@ -36,6 +36,7 @@ struct _E_Border
|
|||
Evas *bg_evas;
|
||||
Ecore_X_Window bg_win;
|
||||
Evas_Object *bg_object;
|
||||
Evas_Object *icon_object;
|
||||
Ecore_X_Window event_win;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -493,6 +493,7 @@ _ibar_bar_icon_new(IBar_Bar *ibb, E_App *a)
|
|||
if (!ic) return NULL;
|
||||
ic->ibb = ibb;
|
||||
ic->app = a;
|
||||
e_object_ref(E_OBJECT(a));
|
||||
ibb->icons = evas_list_append(ibb->icons, ic);
|
||||
|
||||
o = evas_object_rectangle_add(ibb->evas);
|
||||
|
|
Loading…
Reference in New Issue