Maybe eapp code works now.

SVN revision: 14241
This commit is contained in:
sebastid 2005-04-19 09:04:10 +00:00 committed by sebastid
parent 476da93cd4
commit 88ce4c329d
1 changed files with 39 additions and 26 deletions

View File

@ -227,10 +227,6 @@ e_app_subdir_scan(E_App *a, int scan_subdirs)
if (a2) if (a2)
{ {
a2->references = evas_list_append(a2->references, a); a2->references = evas_list_append(a2->references, a);
/* Don't add an extra ref when referencing,
* else the object won't be deleted after deleting from
* disk */
e_object_unref(E_OBJECT(a2));
a->subapps = evas_list_append(a->subapps, a2); a->subapps = evas_list_append(a->subapps, a2);
} }
} }
@ -369,22 +365,21 @@ _e_app_free(E_App *a)
{ {
/* If we are the parent, remove us */ /* If we are the parent, remove us */
a2->parent = NULL; a2->parent = NULL;
/* unref the child so it will be deleted too */
e_object_unref(E_OBJECT(a2));
} }
else else
{ {
/* We have a reference */ /* We have a reference */
a2->references = evas_list_remove(a2->references, a); a2->references = evas_list_remove(a2->references, a);
} }
/* unref the child so it will be deleted too */
e_object_unref(E_OBJECT(a2));
} }
for (l = a->references; l; l = l->next) for (l = a->references; l; l = l->next)
{ {
E_App *a2; E_App *a2;
a2 = l->data; a2 = l->next;
if (a2) a2->subapps = evas_list_remove(a2->subapps, a);
a2->subapps = evas_list_remove(a2->subapps, a);
} }
evas_list_free(a->references); evas_list_free(a->references);
@ -710,6 +705,10 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
{ {
_e_app_subdir_rescan(app); _e_app_subdir_rescan(app);
} }
else
{
printf("BUG: Weird event for .order: %d\n", event);
}
} }
else if (!strcmp(file, ".directory.eapp")) else if (!strcmp(file, ".directory.eapp"))
{ {
@ -725,6 +724,10 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
_e_app_fields_empty(app); _e_app_fields_empty(app);
app->name = strdup(ecore_file_get_file(app->path)); app->name = strdup(ecore_file_get_file(app->path));
} }
else
{
printf("BUG: Weird event for .directory.eapp: %d\n", event);
}
} }
else else
{ {
@ -747,8 +750,7 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
* app */ * app */
_e_app_subdir_rescan(app); _e_app_subdir_rescan(app);
} }
else if ((event == ECORE_FILE_EVENT_DELETED_FILE) else if (event == ECORE_FILE_EVENT_DELETED_FILE)
|| (event == ECORE_FILE_EVENT_DELETED_DIRECTORY))
{ {
E_App *a; E_App *a;
@ -756,10 +758,16 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
if (a) if (a)
{ {
a->deleted = 1; a->deleted = 1;
for (l = a->references; l; l = l->next)
{
E_App *a2;
a2 = l->data;
_e_app_subdir_rescan(a2);
}
_e_app_subdir_rescan(app); _e_app_subdir_rescan(app);
} }
} }
/*
else if (event == ECORE_FILE_EVENT_DELETED_SELF) else if (event == ECORE_FILE_EVENT_DELETED_SELF)
{ {
Evas_List *l; Evas_List *l;
@ -772,9 +780,8 @@ _e_app_cb_monitor(void *data, Ecore_File_Monitor *em,
a2 = l->data; a2 = l->data;
_e_app_subdir_rescan(a2); _e_app_subdir_rescan(a2);
} }
_e_app_change(app, E_APP_DEL); _e_app_subdir_rescan(app->parent);
} }
*/
} }
} }
@ -825,9 +832,7 @@ _e_app_subdir_rescan(E_App *app)
ch = calloc(1, sizeof(E_App_Change_Info)); ch = calloc(1, sizeof(E_App_Change_Info));
ch->app = a2; ch->app = a2;
ch->change = E_APP_ADD; ch->change = E_APP_ADD;
/* Don't add an extra ref, already added by e_app_new
e_object_ref(E_OBJECT(ch->app)); e_object_ref(E_OBJECT(ch->app));
*/
changes = evas_list_append(changes, ch); changes = evas_list_append(changes, ch);
} }
} }
@ -851,15 +856,23 @@ _e_app_subdir_rescan(E_App *app)
} }
if (a2) if (a2)
{ {
a2->deleted = 1; if (a2->deleted)
ch = calloc(1, sizeof(E_App_Change_Info)); {
ch->app = a2; /* Just unref it, so it will be deleted */
ch->change = E_APP_DEL; e_object_unref(E_OBJECT(a2));
/* We don't need to ref this, }
* it has an extra ref else
e_object_ref(E_OBJECT(ch->app)); {
*/ a2->deleted = 1;
changes = evas_list_append(changes, ch); ch = calloc(1, sizeof(E_App_Change_Info));
ch->app = a2;
ch->change = E_APP_DEL;
/* We don't need to ref this,
* it has an extra ref
e_object_ref(E_OBJECT(ch->app));
*/
changes = evas_list_append(changes, ch);
}
} }
} }
/* FIXME: We only need to tell about order changes if there are! */ /* FIXME: We only need to tell about order changes if there are! */