forked from enlightenment/enlightenment
with this commit, udisks mounting is now fully functional (wfm!) and has a number of benefits over the HAL backend, such as being able to automount media that's in your fstab
dev notes: changes to efm were required for this to work since udisks doesn't report back a mount point upon executing a mount command, so the actual dir listing/display must be delayed by another callback until we actually know where the disk is to avoid opening a random directory SVN revision: 55916
This commit is contained in:
parent
97a5b973f0
commit
ef105564ba
|
@ -823,6 +823,16 @@ _e_fm2_cb_mount_ok(void *data)
|
|||
sd = evas_object_smart_data_get(data);
|
||||
if (!sd) return; // safety
|
||||
|
||||
if (sd->mount->volume->efm_mode != EFM_MODE_USING_HAL_MOUNT)
|
||||
{
|
||||
/* Clean up typebuf. */
|
||||
_e_fm2_typebuf_hide(data);
|
||||
/* we only just now have the mount point so we should do stuff we couldn't do before */
|
||||
eina_stringshare_replace(&sd->realpath, sd->mount->volume->mount_point);
|
||||
eina_stringshare_replace(&sd->mount->mount_point, sd->mount->volume->mount_point);
|
||||
_e_fm2_dir_load_props(sd);
|
||||
}
|
||||
|
||||
if (strcmp(sd->mount->mount_point, sd->realpath))
|
||||
{
|
||||
e_fm2_path_set(sd->obj, "/", sd->mount->mount_point);
|
||||
|
@ -994,11 +1004,14 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
|
|||
{
|
||||
E_Volume *v = NULL;
|
||||
|
||||
v = e_fm2_device_volume_find(sd->dev + strlen("removable:"));
|
||||
v = e_fm2_device_volume_find(sd->dev + sizeof("removable:") - 1);
|
||||
if (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);
|
||||
if (v->efm_mode != EFM_MODE_USING_HAL_MOUNT) return;
|
||||
}
|
||||
}
|
||||
else if (sd->config->view.open_dirs_in_place == 0)
|
||||
{
|
||||
|
@ -1151,6 +1164,8 @@ _e_fm2_dir_load_props(E_Fm2_Smart_Data *sd)
|
|||
{
|
||||
E_Fm2_Custom_File *cf;
|
||||
|
||||
|
||||
if (!sd->realpath) return; /* come back later */
|
||||
if (!(sd->view_flags & E_FM2_VIEW_LOAD_DIR_CUSTOM)) return;
|
||||
|
||||
cf = e_fm2_custom_file_get(sd->realpath);
|
||||
|
@ -2574,16 +2589,22 @@ EAPI int
|
|||
_e_fm2_client_mount(const char *udi, const char *mountpoint)
|
||||
{
|
||||
char *d;
|
||||
int l, l1, l2;
|
||||
int l, l1, l2 = 0;
|
||||
|
||||
if (!udi || !mountpoint)
|
||||
if (!udi)
|
||||
return 0;
|
||||
|
||||
l1 = strlen(udi);
|
||||
if (mountpoint)
|
||||
{
|
||||
l2 = strlen(mountpoint);
|
||||
l = l1 + 1 + l2 + 1;
|
||||
}
|
||||
else
|
||||
l = l1 + 1;
|
||||
d = alloca(l);
|
||||
strcpy(d, udi);
|
||||
if (mountpoint)
|
||||
strcpy(d + l1 + 1, mountpoint);
|
||||
|
||||
return _e_fm_client_send_new(E_FM_OP_MOUNT, (void *)d, l);
|
||||
|
@ -3241,8 +3262,9 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
|
|||
v = e_fm2_device_volume_find(dev + strlen("removable:"));
|
||||
if (v)
|
||||
{
|
||||
if (!v->mount_point)
|
||||
if ((!v->mount_point) && (v->efm_mode == EFM_MODE_USING_HAL_MOUNT))
|
||||
v->mount_point = e_fm2_device_volume_mountpoint_get(v);
|
||||
else return NULL;
|
||||
|
||||
if (PRT("%s/%s", v->mount_point, path) >= sizeof(buf))
|
||||
return NULL;
|
||||
|
|
|
@ -127,7 +127,7 @@ _e_fm_main_udisks_poll(void *data __UNUSED__,
|
|||
DBUS_TYPE_INVALID))
|
||||
dbus_error_free(&err);
|
||||
|
||||
printf("name: %s\nfrom: %s\nto: %s\n", name, from, to);
|
||||
//printf("name: %s\nfrom: %s\nto: %s\n", name, from, to);
|
||||
if ((name) && !strcmp(name, E_UDISKS_BUS))
|
||||
_e_fm_main_udisks_test(NULL, NULL, NULL);
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ _e_fm_main_udisks_volume_add(const char *udi,
|
|||
v = calloc(1, sizeof(E_Volume));
|
||||
if (!v) return NULL;
|
||||
// printf("VOL+ %s\n", udi);
|
||||
v->efm_mode = USING_UDISKS_MOUNT;
|
||||
v->efm_mode = EFM_MODE_USING_UDISKS_MOUNT;
|
||||
v->udi = eina_stringshare_add(udi);
|
||||
v->icon = NULL;
|
||||
v->first_time = first_time;
|
||||
|
@ -825,7 +825,7 @@ _e_fm_main_udisks_volume_mount(E_Volume *v)
|
|||
char buf2[256];
|
||||
Eina_List *opt = NULL;
|
||||
|
||||
if ((!v) || (v->guard) || (!v->storage) || (!v->storage->removable))
|
||||
if ((!v) || (v->guard))
|
||||
return;
|
||||
|
||||
// printf("mount %s %s [fs type = %s]\n", v->udi, v->mount_point, v->fstype);
|
||||
|
|
|
@ -130,12 +130,13 @@ e_fm2_device_volume_add(E_Volume *v)
|
|||
v->parent);
|
||||
*/
|
||||
/* Check mount point */
|
||||
if ((!v->mount_point) || (v->mount_point[0] == 0))
|
||||
if ((v->efm_mode == EFM_MODE_USING_HAL_MOUNT) &&
|
||||
((!v->mount_point) || (!v->mount_point[0])))
|
||||
{
|
||||
if (v->mount_point) eina_stringshare_del(v->mount_point);
|
||||
v->mount_point = NULL;
|
||||
v->mount_point = e_fm2_device_volume_mountpoint_get(v);
|
||||
if ((!v->mount_point) || (v->mount_point[0] == 0))
|
||||
if ((!v->mount_point) || (!v->mount_point[0]))
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
const char *id;
|
||||
|
@ -377,6 +378,8 @@ e_fm2_device_volume_mountpoint_get(E_Volume *v)
|
|||
// printf("GET MOUNTPOINT = %s\n", v->mount_point);
|
||||
return eina_stringshare_add(v->mount_point);
|
||||
}
|
||||
else if (v->efm_mode != EFM_MODE_USING_HAL_MOUNT)
|
||||
return NULL;
|
||||
|
||||
if (v->label && v->label[0] != '\0')
|
||||
snprintf(buf, sizeof(buf) - 1, "/media/%s", v->label);
|
||||
|
|
Loading…
Reference in New Issue