Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_apps.c e_apps.h e_border.c e_border.h Log Message: 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. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_apps.c 2 Dec 2004 07:00:30 -0000 1.4 +++ e_apps.c 2 Dec 2004 10:07:50 -0000 1.5 @@ -37,12 +37,14 @@ /* 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 @@ 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 @@ 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 @@ 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 * +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 *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); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_apps.h 25 Nov 2004 05:31:20 -0000 1.2 +++ e_apps.h 2 Dec 2004 10:07:50 -0000 1.3 @@ -54,4 +54,7 @@ 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 =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- e_border.c 2 Dec 2004 07:43:33 -0000 1.10 +++ e_border.c 2 Dec 2004 10:07:50 -0000 1.11 @@ -418,6 +418,7 @@ 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 @@ } 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 @@ 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) =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_border.h 25 Nov 2004 15:32:36 -0000 1.4 +++ e_border.h 2 Dec 2004 10:07:50 -0000 1.5 @@ -36,6 +36,7 @@ Evas *bg_evas; Ecore_X_Window bg_win; Evas_Object *bg_object; + Evas_Object *icon_object; Ecore_X_Window event_win; struct { ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs