diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index e223cd868..51250156f 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -2958,20 +2958,20 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) mountpoint = udi + strlen(udi) + 1; v = e_fm2_dbus_volume_find(udi); if (v) - { - e_fm2_dbus_mount_add(v, mountpoint); - _e_fm2_volume_icon_update(v); - if (e_config->dbus_auto_open && !eina_list_count(v->mounts)) - { - E_Action *a; - Eina_List *m; - - a = e_action_find("fileman"); - m = e_manager_list(); - if (a && a->func.go && m && eina_list_data_get(m)) - a->func.go(E_OBJECT(eina_list_data_get(m)), mountpoint); - } - } + { + e_fm2_dbus_mount_add(v, mountpoint); + _e_fm2_volume_icon_update(v); + if (e_config->dbus_auto_open && !eina_list_count(v->mounts)) + { + E_Action *a; + Eina_List *m; + + a = e_action_find("fileman"); + m = e_manager_list(); + if (a && a->func.go && m && eina_list_data_get(m)) + a->func.go(E_OBJECT(eina_list_data_get(m)), mountpoint); + } + } } break; @@ -2984,10 +2984,10 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e) udi = e->data; v = e_fm2_dbus_volume_find(udi); if (v) - { - e_fm2_dbus_mount_del(v); - _e_fm2_volume_icon_update(v); - } + { + e_fm2_dbus_mount_del(v); + _e_fm2_volume_icon_update(v); + } } break; diff --git a/src/bin/e_fm_dbus.c b/src/bin/e_fm_dbus.c index 52580ceea..ab68db77a 100644 --- a/src/bin/e_fm_dbus.c +++ b/src/bin/e_fm_dbus.c @@ -269,18 +269,19 @@ e_fm2_dbus_volume_add(E_Volume *v) EAPI void e_fm2_dbus_volume_del(E_Volume *v) { - Eina_List *l, *l_nxt; E_Fm2_Mount *m; - + // printf("VOL- %s\n", v->udi); - if (v->storage) - v->storage->volumes = eina_list_remove(v->storage->volumes, v); _e_vols = eina_list_remove(_e_vols, v); _e_fm2_volume_erase(v); - EINA_LIST_FOREACH_SAFE(v->mounts, l, l_nxt, m) + if (v->storage) + { + v->storage->volumes = eina_list_remove(v->storage->volumes, v); + v->storage = NULL; + } + EINA_LIST_FREE(v->mounts, m) { _e_fm2_dbus_unmount_ok(m); - v->mounts = eina_list_remove_list(v->mounts, l); _e_fm2_dbus_mount_free(m); } _e_volume_free(v); @@ -302,8 +303,6 @@ _e_fm2_volume_write(E_Volume *v) f = fopen(buf, "w"); if (f) { - - fprintf(f, "[Desktop Entry]\n" "Encoding=UTF-8\n" @@ -373,7 +372,7 @@ e_fm2_dbus_volume_find(const char *udi) EINA_LIST_FOREACH(_e_vols, l, v) { - if (!strcmp(udi, v->udi)) return v; + if ((v->udi) && (!strcmp(udi, v->udi))) return v; } return NULL; } @@ -428,7 +427,6 @@ e_fm2_dbus_mount_add(E_Volume *v, const char *mountpoint) EAPI void e_fm2_dbus_mount_del(E_Volume *v) { - Eina_List *l, *l_nxt; E_Fm2_Mount *m; v->mounted = 0; @@ -437,11 +435,10 @@ e_fm2_dbus_mount_del(E_Volume *v) eina_stringshare_del(v->mount_point); v->mount_point = NULL; } - - EINA_LIST_FOREACH_SAFE(v->mounts, l, l_nxt, m) + + EINA_LIST_FREE(v->mounts, m) { _e_fm2_dbus_unmount_ok(m); - v->mounts = eina_list_remove_list(v->mounts, l); _e_fm2_dbus_mount_free(m); } } @@ -515,7 +512,6 @@ e_fm2_dbus_mount(E_Volume *v, EAPI void e_fm2_dbus_mount_fail(E_Volume *v) { - Eina_List *l, *l_nxt; E_Fm2_Mount *m; v->mounted = 0; @@ -525,10 +521,9 @@ e_fm2_dbus_mount_fail(E_Volume *v) v->mount_point = NULL; } - EINA_LIST_FOREACH_SAFE(v->mounts, l, l_nxt, m) + EINA_LIST_FREE(v->mounts, m) { - _e_fm2_dbus_mount_fail(m); - v->mounts = eina_list_remove_list(v->mounts, l); + _e_fm2_dbus_unmount_ok(m); _e_fm2_dbus_mount_free(m); } } @@ -561,6 +556,7 @@ e_fm2_dbus_unmount_fail(E_Volume *v) static void _e_fm2_dbus_mount_ok(E_Fm2_Mount *m) { + if (m->mounted) return; m->mounted = 1; if (m->volume) m->mount_point = eina_stringshare_add(m->volume->mount_point); @@ -572,6 +568,7 @@ _e_fm2_dbus_mount_ok(E_Fm2_Mount *m) static void _e_fm2_dbus_mount_fail(E_Fm2_Mount *m) { + if (!m->mounted) return; m->mounted = 0; if (m->mount_point) { @@ -585,6 +582,7 @@ _e_fm2_dbus_mount_fail(E_Fm2_Mount *m) static void _e_fm2_dbus_unmount_ok(E_Fm2_Mount *m) { + if (!m->mounted) return; m->mounted = 0; if (m->mount_point) { @@ -598,6 +596,7 @@ _e_fm2_dbus_unmount_ok(E_Fm2_Mount *m) static void _e_fm2_dbus_unmount_fail(E_Fm2_Mount *m) { + if (m->mounted) return; m->mounted = 1; if (m->unmount_fail) m->unmount_fail(m->data); diff --git a/src/bin/e_fm_shared.h b/src/bin/e_fm_shared.h index 1f85893dc..5cab2e760 100644 --- a/src/bin/e_fm_shared.h +++ b/src/bin/e_fm_shared.h @@ -104,6 +104,7 @@ _e_storage_free(E_Storage *s) E_Volume *v; EINA_LIST_FREE(s->volumes, v) { + v->storage = NULL; _e_volume_free(v); } if (s->udi) eina_stringshare_del(s->udi); @@ -126,8 +127,8 @@ _e_volume_edd_new(void) if (!eet_eina_stream_data_descriptor_class_set(&eddc, "e_volume", sizeof (E_Volume))) return NULL; - eddc.func.str_alloc = (char *(*)(const char *)) strdup; - eddc.func.str_free = (void (*)(const char *)) free; +// eddc.func.str_alloc = (char *(*)(const char *)) strdup; +// eddc.func.str_free = (void (*)(const char *)) free; edd = eet_data_descriptor_stream_new(&eddc); #define DAT(x, y, z) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Volume, x, y, z) @@ -157,8 +158,8 @@ _e_storage_edd_new(void) if (!eet_eina_stream_data_descriptor_class_set(&eddc, "e_storage", sizeof (E_Storage))) return NULL; - eddc.func.str_alloc = (char *(*)(const char *)) strdup; - eddc.func.str_free = (void (*)(const char *)) free; +// eddc.func.str_alloc = (char *(*)(const char *)) strdup; +// eddc.func.str_free = (void (*)(const char *)) free; edd = eet_data_descriptor_stream_new(&eddc); #define DAT(x, y, z) EET_DATA_DESCRIPTOR_ADD_BASIC(edd, E_Storage, x, y, z)