#include "e.h"
-#include "e_fm_dbus.h"
+#include "e_fm_device.h"
#include "e_fm_op.h"
#define OVERCLIP 128
static void _e_fm_error_ignore_this_cb(void *data, E_Dialog *dialog);
static void _e_fm_error_ignore_all_cb(void *data, E_Dialog *dialog);
-static void _e_fm_dbus_error_dialog(const char *title, const char *msg, const char *pstr);
+static void _e_fm_device_error_dialog(const char *title, const char *msg, const char *pstr);
static void _e_fm2_file_delete(Evas_Object *obj);
static void _e_fm2_file_delete_menu(void *data, E_Menu *m, E_Menu_Item *mi);
if (!sd) return; // safety
if (sd->mount)
{
- // At this moment E_Fm2_Mount object already deleted in e_fm_dbus.c
+ // At this moment E_Fm2_Mount object already deleted in e_fm_device.c
sd->mount = NULL;
if (sd->config->view.open_dirs_in_place)
e_fm2_path_set(data, "favorites", "/");
&& strncmp(sd->mount->mount_point, sd->realpath,
strlen(sd->mount->mount_point)))
{
- e_fm2_dbus_unmount(sd->mount);
+ e_fm2_device_unmount(sd->mount);
sd->mount = NULL;
}
{
E_Volume *v = NULL;
- v = e_fm2_dbus_volume_find(sd->dev + strlen("removable:"));
+ v = e_fm2_device_volume_find(sd->dev + strlen("removable:"));
if (v)
- sd->mount = e_fm2_dbus_mount(v,
+ sd->mount = e_fm2_device_mount(v,
_e_fm2_cb_mount_ok, _e_fm2_cb_mount_fail,
_e_fm2_cb_unmount_ok, NULL, obj);
}
else if (sd->config->view.open_dirs_in_place == 0)
{
E_Fm2_Mount *m;
- m = e_fm2_dbus_mount_find(sd->realpath);
+ m = e_fm2_device_mount_find(sd->realpath);
if (m)
- sd->mount = e_fm2_dbus_mount(m->volume,
+ sd->mount = e_fm2_device_mount(m->volume,
_e_fm2_cb_mount_ok, _e_fm2_cb_mount_fail,
_e_fm2_cb_unmount_ok, NULL, obj);
}
E_Storage *s;
s = _e_fm_shared_codec_storage_decode(e->data, e->size);
- if (s) e_fm2_dbus_storage_add(s);
+ if (s) e_fm2_device_storage_add(s);
}
break;
E_Storage *s;
udi = e->data;
- s = e_fm2_dbus_storage_find(udi);
- if (s) e_fm2_dbus_storage_del(s);
+ s = e_fm2_device_storage_find(udi);
+ if (s) e_fm2_device_storage_del(s);
}
break;
v = _e_fm_shared_codec_volume_decode(e->data, e->size);
if (v)
{
- e_fm2_dbus_volume_add(v);
- if (e_config->dbus_auto_mount && !v->mounted && !v->first_time)
+ e_fm2_device_volume_add(v);
+ if (e_config->device_auto_mount && !v->mounted && !v->first_time)
_e_fm2_client_mount(v->udi, v->mount_point);
v->first_time = 0;
}
E_Volume *v;
udi = e->data;
- v = e_fm2_dbus_volume_find(udi);
- if (v) e_fm2_dbus_volume_del(v);
+ v = e_fm2_device_volume_find(udi);
+ if (v) e_fm2_device_volume_del(v);
}
break;
udi = e->data;
mountpoint = udi + strlen(udi) + 1;
- v = e_fm2_dbus_volume_find(udi);
+ v = e_fm2_device_volume_find(udi);
if (v)
{
- e_fm2_dbus_mount_add(v, mountpoint);
+ e_fm2_device_mount_add(v, mountpoint);
_e_fm2_volume_icon_update(v);
- if (e_config->dbus_auto_open && !eina_list_count(v->mounts))
+ if (e_config->device_auto_open && !eina_list_count(v->mounts))
{
E_Action *a;
Eina_List *m;
char *udi;
udi = e->data;
- v = e_fm2_dbus_volume_find(udi);
+ v = e_fm2_device_volume_find(udi);
if (v)
{
- e_fm2_dbus_mount_del(v);
+ e_fm2_device_mount_del(v);
_e_fm2_volume_icon_update(v);
}
}
char *udi;
udi = e->data;
- v = e_fm2_dbus_volume_find(udi);
+ v = e_fm2_device_volume_find(udi);
if (v)
{
- _e_fm_dbus_error_dialog(_("Mount Error"), _("Can't mount device"), e->data);
- e_fm2_dbus_mount_fail(v);
+ _e_fm_device_error_dialog(_("Mount Error"), _("Can't mount device"), e->data);
+ e_fm2_device_mount_fail(v);
}
}
break;
char *udi;
udi = e->data;
- v = e_fm2_dbus_volume_find(udi);
+ v = e_fm2_device_volume_find(udi);
if (v)
{
- _e_fm_dbus_error_dialog(_("Unmount Error"), _("Can't unmount device"), e->data);
- e_fm2_dbus_unmount_fail(v);
+ _e_fm_device_error_dialog(_("Unmount Error"), _("Can't unmount device"), e->data);
+ e_fm2_device_unmount_fail(v);
}
}
break;
char *udi;
udi = e->data;
- v = e_fm2_dbus_volume_find(udi);
+ v = e_fm2_device_volume_find(udi);
if (v)
- _e_fm_dbus_error_dialog(_("Eject Error"), _("Can't eject device"), e->data);
+ _e_fm_device_error_dialog(_("Eject Error"), _("Can't eject device"), e->data);
}
break;
{
E_Volume *v;
- v = e_fm2_dbus_volume_find(dev + strlen("removable:"));
+ v = e_fm2_device_volume_find(dev + strlen("removable:"));
if (v)
{
if (!v->mount_point)
- v->mount_point = e_fm2_dbus_volume_mountpoint_get(v);;
+ v->mount_point = e_fm2_device_volume_mountpoint_get(v);;
if (PRT("%s/%s", v->mount_point, path) >= sizeof(buf))
return NULL;
}
else if (!strcmp(type, "Removable"))
{
ic->info.removable = EINA_TRUE;
- if ((!e_fm2_dbus_storage_find(ic->info.link)) &&
- (!e_fm2_dbus_volume_find(ic->info.link)))
+ if ((!e_fm2_device_storage_find(ic->info.link)) &&
+ (!e_fm2_device_volume_find(ic->info.link)))
{
_e_fm2_live_file_del(ic->sd->obj, ic->info.file);
efreet_desktop_free(desktop);
sd->dev = sd->path = sd->realpath = NULL;
if (sd->mount)
{
- e_fm2_dbus_unmount(sd->mount);
+ e_fm2_device_unmount(sd->mount);
sd->mount = NULL;
}
if (sd->config) _e_fm2_config_free(sd->config);
{
E_Volume *v;
- v = e_fm2_dbus_volume_find(ic->info.link);
+ v = e_fm2_device_volume_find(ic->info.link);
if (v)
{
mi = e_menu_item_new(mn);
}
static void
-_e_fm_dbus_error_dialog(const char *title, const char *msg, const char *pstr)
+_e_fm_device_error_dialog(const char *title, const char *msg, const char *pstr)
{
E_Manager *man;
E_Container *con;
con = e_container_current_get(man);
if (!con) return;
- dialog = e_dialog_new(con, "E", "_fm_dbus_error_dialog");
+ dialog = e_dialog_new(con, "E", "_fm_device_error_dialog");
e_dialog_title_set(dialog, title);
e_dialog_icon_set(dialog, "drive-harddisk", 64);
e_dialog_button_add(dialog, _("OK"), NULL, NULL, NULL);
v = data;
if (!v) return;
- mp = e_fm2_dbus_volume_mountpoint_get(v);
+ mp = e_fm2_device_volume_mountpoint_get(v);
_e_fm2_client_mount(v->udi, mp);
eina_stringshare_del(mp);
}
E_Volume *v;
if (!ic) return;
- v = e_fm2_dbus_volume_find(ic->info.link);
+ v = e_fm2_device_volume_find(ic->info.link);
_update_volume_icon(v, ic);
}
+++ /dev/null
-#include "e_fm_dbus.h"
-#include "e_fm_shared_codec.h"
-#include "e_fm_shared_dbus.h"
-
-static void _e_fm2_volume_write(E_Volume *v) EINA_ARG_NONNULL(1);
-static void _e_fm2_volume_erase(E_Volume *v) EINA_ARG_NONNULL(1);
-static void _e_fm2_dbus_mount_free(E_Fm2_Mount *m); EINA_ARG_NONNULL(1);
-static void _e_fm2_dbus_mount_ok(E_Fm2_Mount *m) EINA_ARG_NONNULL(1);
-static void _e_fm2_dbus_mount_fail(E_Fm2_Mount *m) EINA_ARG_NONNULL(1);
-static void _e_fm2_dbus_unmount_ok(E_Fm2_Mount *m) EINA_ARG_NONNULL(1);
-static void _e_fm2_dbus_unmount_fail(E_Fm2_Mount *m) EINA_ARG_NONNULL(1);
-
-static Eina_List *_e_stores = NULL;
-static Eina_List *_e_vols = NULL;
-
-EAPI void
-e_fm2_dbus_storage_add(E_Storage *s)
-{
- if (e_fm2_dbus_storage_find(s->udi)) return;
-
- s->validated = EINA_TRUE;
- _e_stores = eina_list_append(_e_stores, s);
-/*
- printf("STO+\n"
- " udi: %s\n"
- " bus: %s\n"
- " drive_type: %s\n"
- " model: %s\n"
- " vendor: %s\n"
- " serial: %s\n"
- " removable: %i\n"
- " media_available: %i\n"
- " media_size: %lli\n"
- " requires_eject: %i\n"
- " hotpluggable: %i\n"
- " media_check_enabled: %i\n"
- " icon.drive: %s\n"
- " icon.volume: %s\n\n"
- ,
- s->udi,
- s->bus,
- s->drive_type,
- s->model,
- s->vendor,
- s->serial,
- s->removable,
- s->media_available,
- s->media_size,
- s->requires_eject,
- s->hotpluggable,
- s->media_check_enabled,
- s->icon.drive,
- s->icon.volume);
- */
- if ((s->removable == 0) &&
- (s->media_available == 0) &&
- (s->media_size == 0) &&
- (s->requires_eject == 0) &&
- (s->hotpluggable == 0) &&
- (s->media_check_enabled == 0))
- {
-// printf(" Ignore this storage\n");
- }
- else
- {
- s->trackable = EINA_TRUE;
- }
-}
-
-EAPI void
-e_fm2_dbus_storage_del(E_Storage *s)
-{
-// printf("STO- %s\n", s->udi);
- _e_stores = eina_list_remove(_e_stores, s);
- _e_fm_shared_dbus_storage_free(s);
-}
-
-EAPI E_Storage *
-e_fm2_dbus_storage_find(const char *udi)
-{
- Eina_List *l;
- E_Storage *s;
-
- if (!udi) return NULL;
- EINA_LIST_FOREACH(_e_stores, l, s)
- {
- if (!strcmp(udi, s->udi)) return s;
- }
- return NULL;
-}
-
-#define TEBIBYTE_SIZE 1099511627776LL
-#define GIBIBYTE_SIZE 1073741824
-#define MEBIBYTE_SIZE 1048576
-#define KIBIBYTE_SIZE 1024
-
-EAPI void
-e_fm2_dbus_volume_add(E_Volume *v)
-{
- E_Storage *s;
-
- if (e_fm2_dbus_volume_find(v->udi)) return;
-
- v->validated = EINA_TRUE;
- _e_vols = eina_list_append(_e_vols, v);
-/*
- printf("VOL+\n"
- " udi: %s\n"
- " uuid: %s\n"
- " fstype: %s\n"
- " size: %llu\n"
- " label: %s\n"
- " partition: %d\n"
- " partition_number: %d\n"
- " partition_label: %s\n"
- " mounted: %d\n"
- " mount_point: %s\n"
- " parent: %s\n"
- ,
- v->udi,
- v->uuid,
- v->fstype,
- v->size,
- v->label,
- v->partition,
- v->partition_number,
- v->partition ? v->partition_label : "(not a partition)",
- v->mounted,
- v->mount_point,
- v->parent);
- */
- /* Check mount point */
- if ((!v->mount_point) || (v->mount_point[0] == 0))
- {
- if (v->mount_point) eina_stringshare_del(v->mount_point);
- v->mount_point = NULL;
- v->mount_point = e_fm2_dbus_volume_mountpoint_get(v);
- if ((!v->mount_point) || (v->mount_point[0] == 0))
- {
- char buf[PATH_MAX];
- const char *id;
-
- if (v->mount_point) eina_stringshare_del(v->mount_point);
- v->mount_point = NULL;
- id = "disk";
- if ((v->uuid) && (v->uuid[0])) id = v->uuid;
- if (ecore_file_is_dir("/media"))
- snprintf(buf, sizeof(buf), "/media/%s", id);
- else if (ecore_file_is_dir("/mnt"))
- snprintf(buf, sizeof(buf), "/mnt/%s", id);
- else if (ecore_file_is_dir("/tmp"))
- snprintf(buf, sizeof(buf), "/tmp/%s", id);
- else
- buf[0] = 0;
- v->mount_point = eina_stringshare_add(buf);
- }
- }
-
- /* Search parent storage */
- if ((s = e_fm2_dbus_storage_find(v->parent)))
- {
- v->storage = s;
- s->volumes = eina_list_append(s->volumes, v);
- }
-
- if (v->storage)
- {
- char label[1024] = {0};
- char size[256] = {0};
- const char *icon = NULL;
- unsigned long long sz;
-
- /* Compute the size in a readable form */
- if (v->size)
- {
- if ((sz = (v->size / TEBIBYTE_SIZE)) > 0)
- snprintf(size, sizeof(size) - 1, _("%llu TiB"), sz);
- else if ((sz = (v->size / GIBIBYTE_SIZE)) > 0)
- snprintf(size, sizeof(size) - 1, _("%llu GiB"), sz);
- else if ((sz = (v->size / MEBIBYTE_SIZE)) > 0)
- snprintf(size, sizeof(size) - 1, _("%llu MiB"), sz);
- else if ((sz = (v->size / KIBIBYTE_SIZE)) > 0)
- snprintf(size, sizeof(size) - 1, _("%llu KiB"), sz);
- else
- snprintf(size, sizeof(size) - 1, _("%llu B"), v->size);
- }
-
- /* Choose the label */
- if ((v->label) && (v->label[0]))
- {}
- else if ((v->partition_label) && (v->partition_label[0]))
- snprintf(label, sizeof(label) - 1, "%s", v->partition_label);
- else if (((v->storage->vendor) && (v->storage->vendor[0])) &&
- ((v->storage->model) && (v->storage->model[0])))
- {
- if (size[0] != '\0')
- snprintf(label, sizeof(label) - 1, "%s %s - %s", v->storage->vendor, v->storage->model, size);
- else
- snprintf(label, sizeof(label) - 1, "%s %s", v->storage->vendor, v->storage->model);
- }
- else if ((v->storage->model) && (v->storage->model[0]))
- {
- if (size[0] != '\0')
- snprintf(label, sizeof(label) - 1, "%s - %s", v->storage->model, size);
- else
- snprintf(label, sizeof(label) - 1, "%s", v->storage->model);
- }
- else if ((v->storage->vendor) && (v->storage->vendor[0]))
- {
- if (size[0] != '\0')
- snprintf(label, sizeof(label) - 1, "%s - %s", v->storage->vendor, size);
- else
- snprintf(label, sizeof(label) - 1, "%s", v->storage->vendor);
- }
- else
- snprintf(label, sizeof(label), _("Unknown Volume"));
-
- if (label[0])
- {
- if (v->label) eina_stringshare_del(v->label);
- v->label = eina_stringshare_add(label);
- }
-
- /* Choose the icon */
- /* http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html */
- if (v->storage->icon.volume)
- icon = v->storage->icon.volume;
- else
- {
- if (!strcmp(v->storage->drive_type, "disk"))
- {
- if (v->storage->removable == 0)
- icon = "drive-harddisk";
- else
- icon = "drive-removable-media";
- }
- else if (!strcmp(v->storage->drive_type, "cdrom"))
- icon = "drive-optical";
- else if (!strcmp(v->storage->drive_type, "floppy"))
- icon = "media-floppy";
- else if (!strcmp(v->storage->drive_type, "tape"))
- icon = "media-tape";
- else if (!strcmp(v->storage->drive_type, "compact_flash")
- || !strcmp(v->storage->drive_type, "memory_stick")
- || !strcmp(v->storage->drive_type, "smart_media")
- || !strcmp(v->storage->drive_type, "sd_mmc"))
- icon = "media-flash";
- }
- if (icon)
- {
- if (v->icon) eina_stringshare_del(v->icon);
- v->icon = eina_stringshare_add(icon);
- }
-
- if ((!v->mount_point) ||
- (strcmp(v->mount_point, "/") &&
- strcmp(v->mount_point, "/home") &&
- strcmp(v->mount_point, "/tmp")))
- _e_fm2_volume_write(v);
- }
-}
-
-EAPI void
-e_fm2_dbus_volume_del(E_Volume *v)
-{
- E_Fm2_Mount *m;
-
-// printf("VOL- %s\n", v->udi);
- _e_vols = eina_list_remove(_e_vols, v);
- _e_fm2_volume_erase(v);
- 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);
- _e_fm2_dbus_mount_free(m);
- }
- _e_fm_shared_dbus_volume_free(v);
-}
-
-static void
-_e_fm2_volume_write(E_Volume *v)
-{
- char buf[PATH_MAX], buf2[PATH_MAX];
- FILE *f;
- const char *id;
-
- if (!v->storage) return;
- id = ecore_file_file_get(v->storage->udi);
-// printf("vol write %s\n", id);
- e_user_dir_snprintf(buf, sizeof(buf), "fileman/favorites/|%s_%d.desktop",
- id, v->partition_number);
-
- f = fopen(buf, "w");
- if (f)
- {
- fprintf(f,
- "[Desktop Entry]\n"
- "Encoding=UTF-8\n"
- "Type=Link\n"
- "X-Enlightenment-Type=Removable\n"
- "X-Enlightenment-Removable-State=Full\n"
- "Name=%s\n"
- "Icon=%s\n"
- "Comment=%s\n"
- "URL=file:/%s\n"
- ,
- v->label,
- v->icon,
- _("Removable Device"),
- v->udi);
- fclose(f);
-
- if (e_config->dbus_desktop)
- {
- e_user_homedir_snprintf(buf2, sizeof(buf2),
- "%s/|%s_%d.desktop",
- _("Desktop"), id, v->partition_number);
- ecore_file_symlink(buf, buf2);
- }
-
- /* FIXME: manipulate icon directly */
- _e_fm2_file_force_update(buf);
- //_e_fm2_file_force_update(buf2);
- }
-}
-
-#undef TEBIBYTE_SIZE
-#undef GIBIBYTE_SIZE
-#undef MEBIBYTE_SIZE
-#undef KIBIBYTE_SIZE
-
-static void
-_e_fm2_volume_erase(E_Volume *v)
-{
- char buf[PATH_MAX] = {0};
- const char *id;
-
- if (!v->storage) return;
- id = ecore_file_file_get(v->storage->udi);
- e_user_homedir_snprintf(buf, sizeof(buf), "%s/|%s_%d.desktop",
- _("Desktop"), id, v->partition_number);
- ecore_file_unlink(buf);
- _e_fm2_file_force_update(buf);
-
- if (e_config->dbus_desktop)
- {
- e_user_dir_snprintf(buf, sizeof(buf),
- "fileman/favorites/|%s_%d.desktop",
- id, v->partition_number);
- ecore_file_unlink(buf);
- _e_fm2_file_force_update(buf);
- }
-}
-
-EAPI E_Volume *
-e_fm2_dbus_volume_find(const char *udi)
-{
- Eina_List *l;
- E_Volume *v;
-
- if (!udi) return NULL;
-
- EINA_LIST_FOREACH(_e_vols, l, v)
- {
- if (!v->udi) continue;
- if (!strcmp(udi, v->udi)) return v;
- }
-
- return NULL;
-}
-
-EAPI const char *
-e_fm2_dbus_volume_mountpoint_get(E_Volume *v)
-{
- char buf[PATH_MAX] = {0};
-
- if (!v) return NULL;
- if (v->mount_point)
- {
-// printf("GET MOUNTPOINT = %s\n", v->mount_point);
- return eina_stringshare_add(v->mount_point);
- }
-
- if (v->label && v->label[0] != '\0')
- snprintf(buf, sizeof(buf) - 1, "/media/%s", v->label);
- else if (v->uuid && v->uuid[0] != '\0')
- snprintf(buf, sizeof(buf) - 1, "/media/%s", v->uuid);
- else if ((v->storage) && (v->storage->serial) && v->storage->serial[0] != '\0')
- snprintf(buf, sizeof(buf) - 1, "/media/%s", v->storage->serial);
- else
- {
- static int mount_count = 1;
- snprintf(buf, sizeof(buf) - 1, "/media/unknown-%i", mount_count++);
- }
-// printf("GET MOUNTPOINT = %s\n", buf);
- return eina_stringshare_add(buf);
-}
-
-EAPI void
-e_fm2_dbus_mount_add(E_Volume *v, const char *mountpoint)
-{
- Eina_List *l;
- E_Fm2_Mount *m;
-
- v->mounted = EINA_TRUE;
- if (mountpoint && (*mountpoint != 0))
- {
- if (v->mount_point)
- eina_stringshare_del(v->mount_point);
- v->mount_point = eina_stringshare_add(mountpoint);
- }
-
- EINA_LIST_FOREACH(v->mounts, l, m)
- _e_fm2_dbus_mount_ok(m);
-
-// printf("MOUNT %s %s\n", v->udi, v->mount_point);
-}
-
-EAPI void
-e_fm2_dbus_mount_del(E_Volume *v)
-{
- E_Fm2_Mount *m;
-
- v->mounted = EINA_FALSE;
- if (v->mount_point)
- {
- eina_stringshare_del(v->mount_point);
- v->mount_point = NULL;
- }
-
- EINA_LIST_FREE(v->mounts, m)
- {
- _e_fm2_dbus_unmount_ok(m);
- _e_fm2_dbus_mount_free(m);
- }
-}
-
-EAPI void
-_e_fm2_dbus_mount_free(E_Fm2_Mount *m)
-{
- if (!m) return;
-
- if (m->udi) eina_stringshare_del(m->udi);
- if (m->mount_point) eina_stringshare_del(m->mount_point);
-
- free(m);
-}
-
-EAPI E_Fm2_Mount *
-e_fm2_dbus_mount_find(const char *path)
-{
- Eina_List *l;
- E_Volume *v;
-
- EINA_LIST_FOREACH(_e_vols, l, v)
- {
- if (v->mounted
- && v->mount_point
- && !strncmp(path, v->mount_point, strlen(v->mount_point))
- && v->mounts)
- return eina_list_data_get(v->mounts);
- }
- return NULL;
-}
-
-EAPI E_Fm2_Mount *
-e_fm2_dbus_mount(E_Volume *v,
- Ecore_Cb mount_ok, Ecore_Cb mount_fail,
- Ecore_Cb unmount_ok, Ecore_Cb unmount_fail,
- void *data)
-{
- E_Fm2_Mount *m;
-
- if (!v) return NULL;
-
- m = calloc(1, sizeof(E_Fm2_Mount));
- if (!m) return NULL;
- m->udi = eina_stringshare_add(v->udi);
- m->mount_ok = mount_ok;
- m->mount_fail = mount_fail;
- m->unmount_ok = unmount_ok;
- m->unmount_fail = unmount_fail;
- m->data = data;
- m->volume = v;
- m->mounted = v->mounted;
-
- v->mounts = eina_list_prepend(v->mounts, m);
-
-// printf("BEGIN MOUNT %p '%s'\n", m, v->mount_point);
-
- if (!v->mounted)
- {
- v->auto_unmount = EINA_TRUE;
- _e_fm2_client_mount(v->udi, v->mount_point);
- }
- else
- {
- v->auto_unmount = EINA_FALSE;
- m->mount_point = eina_stringshare_add(v->mount_point);
- }
-
- return m;
-}
-
-EAPI void
-e_fm2_dbus_mount_fail(E_Volume *v)
-{
- E_Fm2_Mount *m;
-
- v->mounted = EINA_FALSE;
- if (v->mount_point)
- {
- eina_stringshare_del(v->mount_point);
- v->mount_point = NULL;
- }
-
- EINA_LIST_FREE(v->mounts, m)
- {
- _e_fm2_dbus_mount_fail(m);
- _e_fm2_dbus_mount_free(m);
- }
-}
-
-EAPI void
-e_fm2_dbus_unmount(E_Fm2_Mount *m)
-{
- E_Volume *v;
-
- if (!(v = m->volume)) return;
- v->mounts = eina_list_remove(v->mounts, m);
- _e_fm2_dbus_mount_free(m);
-
- if (v->auto_unmount && v->mounted && !eina_list_count(v->mounts))
- _e_fm2_client_unmount(v->udi);
-}
-
-EAPI void
-e_fm2_dbus_unmount_fail(E_Volume *v)
-{
- Eina_List *l;
- E_Fm2_Mount *m;
-
- v->mounted = EINA_TRUE;
-
- EINA_LIST_FOREACH(v->mounts, l, m)
- _e_fm2_dbus_unmount_fail(m);
-}
-
-static void
-_e_fm2_dbus_mount_ok(E_Fm2_Mount *m)
-{
- if (m->mounted) return;
- m->mounted = EINA_TRUE;
- if (m->volume)
- m->mount_point = eina_stringshare_add(m->volume->mount_point);
- if (m->mount_ok)
- m->mount_ok(m->data);
-// printf("MOUNT OK '%s'\n", m->mount_point);
-}
-
-static void
-_e_fm2_dbus_mount_fail(E_Fm2_Mount *m)
-{
- m->mounted = EINA_FALSE;
- if (m->mount_point)
- {
- eina_stringshare_del(m->mount_point);
- m->mount_point = NULL;
- }
- if (m->mount_fail)
- m->mount_fail(m->data);
-}
-
-static void
-_e_fm2_dbus_unmount_ok(E_Fm2_Mount *m)
-{
- if (!m->mounted) return;
- m->mounted = EINA_FALSE;
- if (m->mount_point)
- {
- eina_stringshare_del(m->mount_point);
- m->mount_point = NULL;
- }
- if (m->unmount_ok)
- m->unmount_ok(m->data);
-}
-
-static void
-_e_fm2_dbus_unmount_fail(E_Fm2_Mount *m)
-{
- if (m->mounted) return;
- m->mounted = EINA_TRUE;
- if (m->unmount_fail)
- m->unmount_fail(m->data);
-}
-
-EAPI void
-e_fm2_dbus_show_desktop_icons(void)
-{
- Eina_List *l;
- E_Volume *v;
- char buf[PATH_MAX] = {0};
- char buf2[PATH_MAX] = {0};
- const char *id;
-
- EINA_LIST_FOREACH(_e_vols, l, v)
- {
- if (!v) continue;
- if (!v->storage) continue;
-
- id = ecore_file_file_get(v->storage->udi);
-
- e_user_dir_snprintf(buf, sizeof(buf),
- "fileman/favorites/|%s_%d.desktop",
- id, v->partition_number);
-
- e_user_homedir_snprintf(buf2, sizeof(buf2),
- "%s/|%s_%d.desktop",
- _("Desktop"), id, v->partition_number);
-
- if (ecore_file_exists(buf) && !ecore_file_exists(buf2))
- {
- ecore_file_symlink(buf, buf2);
- _e_fm2_file_force_update(buf2);
- }
- }
-}
-
-EAPI void
-e_fm2_dbus_hide_desktop_icons(void)
-{
- Eina_List *l;
- E_Volume *v;
- char buf[PATH_MAX] = {0};
- const char *id;
-
- EINA_LIST_FOREACH(_e_vols, l, v)
- {
- if (!v) continue;
- if (!v->storage) continue;
-
- id = ecore_file_file_get(v->storage->udi);
-
- e_user_homedir_snprintf(buf, sizeof(buf),
- "%s/|%s_%d.desktop",
- _("Desktop"), id, v->partition_number);
-
- if (ecore_file_exists(buf))
- {
- ecore_file_unlink(buf);
- _e_fm2_file_force_update(buf);
- }
- }
-}
-
-EAPI Eina_List*
-e_fm2_dbus_volume_list_get(void)
-{
- return _e_vols;
-}