From f0dae8e9010a08f5f57f73ceaa24c5e270b5e849 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sun, 14 May 2006 01:13:42 +0000 Subject: [PATCH] eap icons update realtime in borders based off on-disk changes etc. etc. (editing icons seems to work like a charm for me so far). SVN revision: 22598 --- src/bin/e_apps.c | 78 +++++++++++++++++++++++++++++++---- src/bin/e_apps.h | 1 - src/bin/e_border.c | 38 ++++++++++++----- src/bin/e_eap_editor.c | 8 ++-- src/bin/e_int_border_menu.c | 7 +++- src/modules/ibar/e_mod_main.c | 7 +++- 6 files changed, 115 insertions(+), 24 deletions(-) diff --git a/src/bin/e_apps.c b/src/bin/e_apps.c index 70f27cea4..3be1b7d06 100644 --- a/src/bin/e_apps.c +++ b/src/bin/e_apps.c @@ -444,6 +444,7 @@ e_app_exec(E_App *a, int launch_id) { Ecore_Exe *exe; E_App_Instance *inst; + Evas_List *l; E_OBJECT_CHECK_RETURN(a, 0); E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, 0); @@ -476,6 +477,13 @@ e_app_exec(E_App *a, int launch_id) // e_object_ref(E_OBJECT(a)); _e_apps_start_pending = evas_list_append(_e_apps_start_pending, a); if (a->startup_notify) a->starting = 1; + for (l = a->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + _e_app_change(a2, E_APP_EXEC); + } _e_app_change(a, E_APP_EXEC); return 1; } @@ -759,13 +767,13 @@ e_app_files_append(Evas_List *files, E_App *parent) EAPI void e_app_remove(E_App *a) { + Evas_List *l; char buf[PATH_MAX]; if (!a) return; if (!a->parent) return; a->parent->subapps = evas_list_remove(a->parent->subapps, a); - /* Check if this app is in a repository or in the parents dir */ snprintf(buf, sizeof(buf), "%s/%s", a->parent->path, ecore_file_get_file(a->path)); if (ecore_file_exists(buf)) @@ -777,8 +785,16 @@ e_app_remove(E_App *a) a->path = evas_stringshare_add(buf); } _e_app_save_order(a->parent); + for (l = a->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + e_app_remove(a2); + } _e_app_change(a, E_APP_DEL); a->parent = NULL; + e_object_unref(E_OBJECT(a)); } EAPI void @@ -1295,7 +1311,17 @@ e_app_fields_save(E_App *a) eet_close(ef); if (a->parent) { + Evas_List *l; + _e_app_change(a->parent, E_APP_CHANGE); + _e_app_change(a, E_APP_CHANGE); + for (l = a->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + if (_e_app_copy(a2, a)) _e_app_change(a2, E_APP_CHANGE); + } _e_app_subdir_rescan(a->parent); } } @@ -1565,8 +1591,13 @@ _e_app_free(E_App *a) } /* If this is an original, it wont be deleted until all references * are gone */ - if (a->references) + while (a->references) { + E_App *a2; + + a2 = a->references->data; + a2->orig = NULL; + a->references = evas_list_remove_list(a->references, a->references); printf("BUG: An original eapp shouldn't have any references when freed! %d\n", evas_list_count(a->references)); } @@ -1603,16 +1634,19 @@ _e_app_change(E_App *a, E_App_Change ch) { Evas_List *l; + if (ch == E_APP_DEL) + printf("APP_DEL %s\n", a->path); + if (ch == E_APP_CHANGE) + printf("APP_CHANGE %s\n", a->path); + if (ch == E_APP_ADD) + printf("APP_ADD %s\n", a->path); _e_apps_callbacks_walking = 1; for (l = _e_apps_change_callbacks; l; l = l->next) { E_App_Callback *cb; cb = l->data; - if (!cb->delete_me) - { - cb->func(cb->data, a, ch); - } + if (!cb->delete_me) cb->func(cb->data, a, ch); } _e_apps_callbacks_walking = 0; if (_e_apps_callbacks_delete_me) @@ -1641,6 +1675,7 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em, { E_App *app; char *file; + Evas_List *l; app = data; if ((!app) || (app->deleted)) @@ -1675,6 +1710,13 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em, e_app_fields_empty(app); e_app_fields_fill(app, path); _e_app_change(app, E_APP_CHANGE); + for (l = app->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + if (_e_app_copy(a2, app)) _e_app_change(a2, E_APP_CHANGE); + } } else if (event == ECORE_FILE_EVENT_DELETED_FILE) { @@ -1720,7 +1762,6 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em, else { _e_app_change(a, E_APP_CHANGE); - for (l = a->references; l; l = l->next) { E_App *a2; @@ -1996,6 +2037,7 @@ _e_apps_cb_exit(void *data, int type, void *event) Ecore_Exe_Event_Del *ev; E_App_Instance *ai; E_App *a; + Evas_List *l; ev = event; if (!ev->exe) return 1; @@ -2049,6 +2091,13 @@ _e_apps_cb_exit(void *data, int type, void *event) free(ai); a->instances = evas_list_remove(a->instances, ai); _e_apps_start_pending = evas_list_remove(_e_apps_start_pending, a); + for (l = a->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + _e_app_change(a2, E_APP_EXIT); + } _e_app_change(a, E_APP_EXIT); return 1; } @@ -2085,6 +2134,13 @@ _e_app_cb_event_border_add(void *data, int type, void *event) while (removes) { a = removes->data; + for (l = a->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + _e_app_change(a2, E_APP_READY); + } _e_app_change(a, E_APP_READY); _e_apps_start_pending = evas_list_remove(_e_apps_start_pending, a); e_object_unref(E_OBJECT(a)); @@ -2098,11 +2154,19 @@ _e_app_cb_expire_timer(void *data) { E_App_Instance *inst; E_App *a; + Evas_List *l; inst = data; a = inst->app; _e_apps_start_pending = evas_list_remove(_e_apps_start_pending, a); inst->expire_timer = NULL; + for (l = a->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + _e_app_change(a2, E_APP_READY_EXPIRE); + } _e_app_change(a, E_APP_READY_EXPIRE); return 0; } diff --git a/src/bin/e_apps.h b/src/bin/e_apps.h index ae191cd3f..d042ba124 100644 --- a/src/bin/e_apps.h +++ b/src/bin/e_apps.h @@ -52,7 +52,6 @@ struct _E_App Evas_List *references; /* If this app is in a main repository, this would be a list to other eapp pointing to this */ - Ecore_File_Monitor *monitor; /* Check for changes and files */ unsigned char startup_notify : 1; /* disable while starting etc. */ diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 7ba31277f..ed3bf0a98 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -6571,20 +6571,36 @@ static void _e_border_app_change(void *data, E_App *app, E_App_Change change) { Evas_List *l; - - for (l = borders; l; l = l->next) + + switch (change) { - E_Border *bd; - - bd = l->data; - if (e_app_equals(bd->app, app)) + case E_APP_ADD: + case E_APP_DEL: + case E_APP_CHANGE: + for (l = borders; l; l = l->next) { - e_object_unref(E_OBJECT(bd->app)); - bd->app = NULL; - - bd->changes.icon = 1; - bd->changed = 1; + E_Border *bd; + + bd = l->data; +// if (e_app_equals(bd->app, app)) + { + if (bd->app) + { + e_object_unref(E_OBJECT(bd->app)); + bd->app = NULL; + } + + bd->changes.icon = 1; + bd->changed = 1; + } } + break; + case E_APP_EXEC: + case E_APP_READY: + case E_APP_READY_EXPIRE: + case E_APP_EXIT: + default: + break; } } diff --git a/src/bin/e_eap_editor.c b/src/bin/e_eap_editor.c index 5b2df1cdd..e63f23f45 100644 --- a/src/bin/e_eap_editor.c +++ b/src/bin/e_eap_editor.c @@ -170,8 +170,9 @@ _e_eap_edit_basic_apply_data(E_Config_Dialog *cfd, void *data) /* FIXME: hardcoded until the eap editor provides fields to change it */ eap->width = 128; eap->height = 128; - - e_app_fields_save(eap); + + if ((eap->name) && (eap->exe)) + e_app_fields_save(eap); return 1; } @@ -224,7 +225,8 @@ _e_eap_edit_advanced_apply_data(E_Config_Dialog *cfd, void *data) eap->width = 128; eap->height = 128; - e_app_fields_save(eap); + if ((eap->name) && (eap->exe)) + e_app_fields_save(eap); return 1; } diff --git a/src/bin/e_int_border_menu.c b/src/bin/e_int_border_menu.c index 9e092cd09..b42752533 100644 --- a/src/bin/e_int_border_menu.c +++ b/src/bin/e_int_border_menu.c @@ -566,10 +566,15 @@ _e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi) if (bd->client.icccm.name) a->exe = evas_stringshare_add(bd->client.icccm.name); if (bd->client.netwm.startup_id > 0) a->startup_notify = 1; + bd->app = a; + e_object_ref(E_OBJECT(bd->app)); } } if (!a) return; - e_eap_edit_show(m->zone->container, a); + if (a->orig) + e_eap_edit_show(m->zone->container, a->orig); + else + e_eap_edit_show(m->zone->container, a); } static void diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 2abd493f9..2e704eed3 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -759,7 +759,12 @@ _ibar_cb_menu_icon_properties(void *data, E_Menu *m, E_Menu_Item *mi) IBar_Icon *ic; ic = data; - /* FIXME: - show eap editor on the ic->app */ + if (ic->app->orig) + e_eap_edit_show(ic->ibar->inst->gcc->gadcon->zone->container, + ic->app->orig); + else + e_eap_edit_show(ic->ibar->inst->gcc->gadcon->zone->container, + ic->app); } static void