forked from enlightenment/enlightenment
lok's patch for handling tracking of mounts better.
SVN revision: 31950
This commit is contained in:
parent
22d5db1761
commit
055b45c306
132
src/bin/e_fm.c
132
src/bin/e_fm.c
|
@ -189,6 +189,7 @@ struct _E_Fm2_Mount
|
||||||
{
|
{
|
||||||
const char *udi;
|
const char *udi;
|
||||||
const char *mount_point;
|
const char *mount_point;
|
||||||
|
int instances;
|
||||||
|
|
||||||
Ecore_Timer *timeout;
|
Ecore_Timer *timeout;
|
||||||
void (*mount_ok) (void *data);
|
void (*mount_ok) (void *data);
|
||||||
|
@ -213,6 +214,7 @@ static E_Volume *e_volume_find(const char *udi);
|
||||||
static E_Storage *e_storage_find(const char *udi);
|
static E_Storage *e_storage_find(const char *udi);
|
||||||
|
|
||||||
static const char *_e_fm2_dev_path_map(const char *dev, const char *path);
|
static const char *_e_fm2_dev_path_map(const char *dev, const char *path);
|
||||||
|
static char *_e_fm2_vol_mountpoint_resolve(E_Volume *v);
|
||||||
static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf);
|
static void _e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf);
|
||||||
static void _e_fm2_file_del(Evas_Object *obj, const char *file);
|
static void _e_fm2_file_del(Evas_Object *obj, const char *file);
|
||||||
static void _e_fm2_queue_process(Evas_Object *obj);
|
static void _e_fm2_queue_process(Evas_Object *obj);
|
||||||
|
@ -468,9 +470,10 @@ EAPI void
|
||||||
e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
|
e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
|
||||||
{
|
{
|
||||||
E_Fm2_Smart_Data *sd;
|
E_Fm2_Smart_Data *sd;
|
||||||
|
Evas_List *l;
|
||||||
|
|
||||||
sd = evas_object_smart_data_get(obj);
|
sd = evas_object_smart_data_get(obj);
|
||||||
if (!sd) return; // safety
|
if (!sd || !path) return; // safety
|
||||||
if (!evas_object_type_get(obj)) return; // safety
|
if (!evas_object_type_get(obj)) return; // safety
|
||||||
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety
|
||||||
|
|
||||||
|
@ -510,12 +513,6 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
|
||||||
|
|
||||||
if (sd->dev) evas_stringshare_del(sd->dev);
|
if (sd->dev) evas_stringshare_del(sd->dev);
|
||||||
if (sd->path) evas_stringshare_del(sd->path);
|
if (sd->path) evas_stringshare_del(sd->path);
|
||||||
if (sd->mount)
|
|
||||||
{
|
|
||||||
printf("UM2\n");
|
|
||||||
_e_fm2_unmount(sd->mount);
|
|
||||||
sd->mount = NULL;
|
|
||||||
}
|
|
||||||
if (sd->realpath)
|
if (sd->realpath)
|
||||||
{
|
{
|
||||||
evas_stringshare_del(sd->realpath);
|
evas_stringshare_del(sd->realpath);
|
||||||
|
@ -532,7 +529,29 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
|
||||||
_e_fm2_icons_free(obj);
|
_e_fm2_icons_free(obj);
|
||||||
edje_object_part_text_set(sd->overlay, "e.text.busy_label", "");
|
edje_object_part_text_set(sd->overlay, "e.text.busy_label", "");
|
||||||
|
|
||||||
if ((sd->dev) && (!strncmp(sd->dev, "removable:", 10)))
|
if (!sd->mount && !sd->dev)
|
||||||
|
{
|
||||||
|
for (l = _e_fm2_mounts; l; l = l->next)
|
||||||
|
{
|
||||||
|
E_Fm2_Mount *m;
|
||||||
|
m = l->data;
|
||||||
|
if (!strncmp(m->mount_point, sd->realpath, strlen(m->mount_point)))
|
||||||
|
{
|
||||||
|
sd->mount = m;
|
||||||
|
m->instances++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!l && sd->mount && strncmp(sd->mount->mount_point, sd->realpath,
|
||||||
|
strlen(sd->mount->mount_point)))
|
||||||
|
{
|
||||||
|
printf("UM2\n");
|
||||||
|
_e_fm2_unmount(sd->mount);
|
||||||
|
sd->mount = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((!sd->mount) && (sd->dev) && (!strncmp(sd->dev, "removable:", 10)))
|
||||||
{
|
{
|
||||||
E_Volume *v;
|
E_Volume *v;
|
||||||
|
|
||||||
|
@ -1371,22 +1390,22 @@ _e_fm2_mount_flush(void)
|
||||||
E_Fm2_Mount *m;
|
E_Fm2_Mount *m;
|
||||||
Evas_List *l, *dels = NULL;
|
Evas_List *l, *dels = NULL;
|
||||||
|
|
||||||
if (_e_fm2_mount_stack > 1) return;
|
|
||||||
for (l = _e_fm2_mounts; l; l = l->next)
|
for (l = _e_fm2_mounts; l; l = l->next)
|
||||||
{
|
{
|
||||||
m = l->data;
|
m = l->data;
|
||||||
if (m->delete_me) dels = evas_list_append(dels, m);
|
if (m->instances == 0)
|
||||||
}
|
|
||||||
while (dels)
|
|
||||||
{
|
{
|
||||||
m = dels->data;
|
|
||||||
_e_fm2_mounts = evas_list_remove(_e_fm2_mounts, m);
|
_e_fm2_mounts = evas_list_remove(_e_fm2_mounts, m);
|
||||||
dels = evas_list_remove_list(dels, dels);
|
|
||||||
evas_stringshare_del(m->udi);
|
evas_stringshare_del(m->udi);
|
||||||
evas_stringshare_del(m->mount_point);
|
evas_stringshare_del(m->mount_point);
|
||||||
if (m->timeout) ecore_timer_del(m->timeout);
|
if (m->timeout)
|
||||||
|
{
|
||||||
|
ecore_timer_del(m->timeout);
|
||||||
|
m->timeout = NULL;
|
||||||
|
}
|
||||||
free(m);
|
free(m);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1405,7 +1424,7 @@ _e_fm2_mount_ok(const char *udi)
|
||||||
for (l = _e_fm2_mounts; l; l = l->next)
|
for (l = _e_fm2_mounts; l; l = l->next)
|
||||||
{
|
{
|
||||||
m = l->data;
|
m = l->data;
|
||||||
if ((!m->delete_me) && (!strcmp(m->udi, udi)) && (m->mount_ok))
|
if ((!strcmp(m->udi, udi)) && (m->mount_ok))
|
||||||
{
|
{
|
||||||
m->mounted = 1;
|
m->mounted = 1;
|
||||||
m->mount_ok(m->data);
|
m->mount_ok(m->data);
|
||||||
|
@ -1416,7 +1435,7 @@ _e_fm2_mount_ok(const char *udi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_e_fm2_mount_flush();
|
//_e_fm2_mount_flush();
|
||||||
_e_fm2_mount_stack--;
|
_e_fm2_mount_stack--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1512,18 +1531,19 @@ _e_fm2_mount(E_Volume *v, void (*mount_ok) (void *data), void (*mount_fail) (voi
|
||||||
int exists = 0;
|
int exists = 0;
|
||||||
int mounted = 0;
|
int mounted = 0;
|
||||||
|
|
||||||
m = calloc(1, sizeof(E_Fm2_Mount));
|
|
||||||
if (!m) return NULL;
|
|
||||||
for (l = _e_fm2_mounts; l; l = l->next)
|
for (l = _e_fm2_mounts; l; l = l->next)
|
||||||
{
|
{
|
||||||
m2 = l->data;
|
m2 = l->data;
|
||||||
if (!strcmp(v->udi, m2->udi))
|
if (!strcmp(v->udi, m2->udi))
|
||||||
{
|
{
|
||||||
exists = 1;
|
m = m2;
|
||||||
mounted = m2->mounted;
|
m->instances++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m = calloc(1, sizeof(E_Fm2_Mount));
|
||||||
|
if (!m) return NULL;
|
||||||
m->udi = evas_stringshare_add(v->udi);
|
m->udi = evas_stringshare_add(v->udi);
|
||||||
m->mount_point = evas_stringshare_add(v->mount_point);
|
m->mount_point = evas_stringshare_add(v->mount_point);
|
||||||
m->mount_ok = mount_ok;
|
m->mount_ok = mount_ok;
|
||||||
|
@ -1531,13 +1551,14 @@ _e_fm2_mount(E_Volume *v, void (*mount_ok) (void *data), void (*mount_fail) (voi
|
||||||
m->unmount_ok = unmount_ok;
|
m->unmount_ok = unmount_ok;
|
||||||
m->unmount_fail = unmount_fail;
|
m->unmount_fail = unmount_fail;
|
||||||
m->data = data;
|
m->data = data;
|
||||||
m->mounted = mounted;
|
m->mounted = v->mounted;
|
||||||
if (!exists)
|
m->instances++;
|
||||||
|
if (!v->mounted)
|
||||||
{
|
{
|
||||||
m->timeout = ecore_timer_add(10.0, _e_fm2_cb_mount_timeout, m);
|
m->timeout = ecore_timer_add(10.0, _e_fm2_cb_mount_timeout, m);
|
||||||
_e_fm2_client_mount(m->udi, m->mount_point);
|
_e_fm2_client_mount(m->udi, m->mount_point);
|
||||||
}
|
|
||||||
_e_fm2_mounts = evas_list_prepend(_e_fm2_mounts, m);
|
_e_fm2_mounts = evas_list_prepend(_e_fm2_mounts, m);
|
||||||
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,12 +1570,13 @@ _e_fm2_unmount(E_Fm2_Mount *m)
|
||||||
int exists = 0;
|
int exists = 0;
|
||||||
|
|
||||||
_e_fm2_mount_stack++;
|
_e_fm2_mount_stack++;
|
||||||
|
m->instances--;
|
||||||
for (l = _e_fm2_mounts; l; l = l->next)
|
for (l = _e_fm2_mounts; l; l = l->next)
|
||||||
{
|
{
|
||||||
m2 = l->data;
|
m2 = l->data;
|
||||||
if (!strcmp(m->udi, m2->udi)) exists++;
|
if (!strcmp(m->udi, m2->udi)) break;
|
||||||
}
|
}
|
||||||
if (exists == 1)
|
if (l && !m->instances)
|
||||||
{
|
{
|
||||||
printf("_e_fm2_unmount UM\n");
|
printf("_e_fm2_unmount UM\n");
|
||||||
_e_fm2_client_unmount(m->udi);
|
_e_fm2_client_unmount(m->udi);
|
||||||
|
@ -1944,15 +1966,20 @@ _e_fm2_client_mount(const char *udi, const char *mountpoint)
|
||||||
{
|
{
|
||||||
E_Fm2_Client *cl;
|
E_Fm2_Client *cl;
|
||||||
char *d;
|
char *d;
|
||||||
|
const char *mp;
|
||||||
int l, l1, l2;
|
int l, l1, l2;
|
||||||
|
|
||||||
|
if (!strncmp(mountpoint, "/media/", 7))
|
||||||
|
mp = mountpoint + 7;
|
||||||
|
else
|
||||||
|
mp = mountpoint;
|
||||||
l1 = strlen(udi);
|
l1 = strlen(udi);
|
||||||
l2 = strlen(mountpoint);
|
l2 = strlen(mp);
|
||||||
l = l1 + 1 + l2 + 1;
|
l = l1 + 1 + l2 + 1;
|
||||||
d = alloca(l);
|
d = alloca(l);
|
||||||
strcpy(d, udi);
|
strcpy(d, udi);
|
||||||
strcpy(d + l1 + 1, mountpoint);
|
strcpy(d + l1 + 1, mp);
|
||||||
printf("SEND %s %s\n", udi, mountpoint);
|
printf("SEND %s %s\n", udi, mp);
|
||||||
cl = _e_fm2_client_get();
|
cl = _e_fm2_client_get();
|
||||||
if (!cl)
|
if (!cl)
|
||||||
{
|
{
|
||||||
|
@ -2525,21 +2552,21 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
||||||
s = e_storage_find(v->parent);
|
s = e_storage_find(v->parent);
|
||||||
if (!v->mount_point)
|
if (!v->mount_point)
|
||||||
{
|
{
|
||||||
|
char buf[512];
|
||||||
if (v->uuid)
|
if (v->uuid)
|
||||||
v->mount_point = strdup(v->uuid);
|
snprintf(buf, sizeof(buf), "/media/%s", strdup(v->uuid));
|
||||||
else if (v->label)
|
else if (v->label)
|
||||||
v->mount_point = strdup(v->label);
|
snprintf(buf, sizeof(buf), "/media/%s", strdup(v->label));
|
||||||
else if ((v->storage) && (v->storage->serial))
|
else if ((v->storage) && (v->storage->serial))
|
||||||
v->mount_point = strdup(v->storage->serial);
|
snprintf(buf, sizeof(buf), "/media/%s", strdup(v->storage->serial));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[256];
|
|
||||||
static int mount_count = 0;
|
static int mount_count = 0;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "unknown-%i\n", mount_count);
|
snprintf(buf, sizeof(buf), "unknown-%i\n", mount_count);
|
||||||
mount_count++;
|
mount_count++;
|
||||||
v->mount_point = strdup(buf);
|
|
||||||
}
|
}
|
||||||
|
v->mount_point = strdup(buf);
|
||||||
}
|
}
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
|
@ -2587,8 +2614,11 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
||||||
{
|
{
|
||||||
v->mounted = 1;
|
v->mounted = 1;
|
||||||
if (v->mount_point) free(v->mount_point);
|
if (v->mount_point) free(v->mount_point);
|
||||||
|
if (mountpoint[0] == 0)
|
||||||
|
v->mount_point = _e_fm2_vol_mountpoint_resolve(v);
|
||||||
|
else
|
||||||
v->mount_point = strdup(mountpoint);
|
v->mount_point = strdup(mountpoint);
|
||||||
printf("MOUNT %s %s\n", udi, mountpoint);
|
printf("MOUNT %s %s\n", v->udi, v->mount_point);
|
||||||
}
|
}
|
||||||
_e_fm2_mount_ok(udi);
|
_e_fm2_mount_ok(udi);
|
||||||
}
|
}
|
||||||
|
@ -2605,7 +2635,12 @@ e_fm2_client_data(Ecore_Ipc_Event_Client_Data *e)
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
v->mounted = 0;
|
v->mounted = 0;
|
||||||
printf("UNMOUNT %s %s\n", udi, mountpoint);
|
if (v->mount_point) free(v->mount_point);
|
||||||
|
if (mountpoint[0] == 0)
|
||||||
|
v->mount_point = _e_fm2_vol_mountpoint_resolve(v);
|
||||||
|
else
|
||||||
|
v->mount_point = strdup(mountpoint);
|
||||||
|
printf("UNMOUNT %s %s\n", v->udi, v->mount_point);
|
||||||
}
|
}
|
||||||
_e_fm2_unmount_ok(udi);
|
_e_fm2_unmount_ok(udi);
|
||||||
}
|
}
|
||||||
|
@ -2693,9 +2728,9 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
|
||||||
E_Volume *v;
|
E_Volume *v;
|
||||||
|
|
||||||
v = e_volume_find(dev + strlen("removable:"));
|
v = e_volume_find(dev + strlen("removable:"));
|
||||||
if (v)
|
if (v && v->mount_point)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "/media/%s", v->mount_point);
|
snprintf(buf, sizeof(buf), "%s%s", v->mount_point, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CMP("dvd") || CMP("dvd-*")) {
|
else if (CMP("dvd") || CMP("dvd-*")) {
|
||||||
|
@ -2740,6 +2775,27 @@ _e_fm2_dev_path_map(const char *dev, const char *path)
|
||||||
return evas_stringshare_add(buf);
|
return evas_stringshare_add(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
_e_fm2_vol_mountpoint_resolve(E_Volume *v)
|
||||||
|
{
|
||||||
|
if (!v) return;
|
||||||
|
char buf[512];
|
||||||
|
if (v->uuid)
|
||||||
|
snprintf(buf, sizeof(buf), "/media/%s", strdup(v->uuid));
|
||||||
|
else if (v->label)
|
||||||
|
snprintf(buf, sizeof(buf), "/media/%s", strdup(v->label));
|
||||||
|
else if ((v->storage) && (v->storage->serial))
|
||||||
|
snprintf(buf, sizeof(buf), "/media/%s", strdup(v->storage->serial));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static int mount_count = 0;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "/media/unknown-%i", mount_count);
|
||||||
|
mount_count++;
|
||||||
|
}
|
||||||
|
return strdup(buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf)
|
_e_fm2_file_add(Evas_Object *obj, const char *file, int unique, const char *file_rel, int after, E_Fm2_Finfo *finf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,8 +142,10 @@ static void _e_dbus_cb_vol_is(void *user_data, void *reply_data, DBusError *erro
|
||||||
static void _e_dbus_cb_dev_add(void *data, DBusMessage *msg);
|
static void _e_dbus_cb_dev_add(void *data, DBusMessage *msg);
|
||||||
static void _e_dbus_cb_dev_del(void *data, DBusMessage *msg);
|
static void _e_dbus_cb_dev_del(void *data, DBusMessage *msg);
|
||||||
static void _e_dbus_cb_cap_add(void *data, DBusMessage *msg);
|
static void _e_dbus_cb_cap_add(void *data, DBusMessage *msg);
|
||||||
|
static void _e_dbus_cb_prop_modified(void *data, DBusMessage *msg);
|
||||||
static void _e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error);
|
static void _e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error);
|
||||||
static void _e_dbus_cb_vol_prop(void *data, void *reply_data, DBusError *error);
|
static void _e_dbus_cb_vol_prop(void *data, void *reply_data, DBusError *error);
|
||||||
|
static void _e_dbus_cb_vol_prop_mount_modified(void *data, void *reply_data, DBusError *error);
|
||||||
static void _e_dbus_cb_vol_mounted(void *user_data, void *method_return, DBusError *error);
|
static void _e_dbus_cb_vol_mounted(void *user_data, void *method_return, DBusError *error);
|
||||||
static void _e_dbus_cb_vol_unmounted(void *user_data, void *method_return, DBusError *error);
|
static void _e_dbus_cb_vol_unmounted(void *user_data, void *method_return, DBusError *error);
|
||||||
|
|
||||||
|
@ -428,6 +430,54 @@ _e_dbus_cb_cap_add(void *data, DBusMessage *msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_dbus_cb_prop_modified(void *data, DBusMessage *msg)
|
||||||
|
{
|
||||||
|
E_Volume *v;
|
||||||
|
DBusMessageIter iter, sub, subsub;
|
||||||
|
struct {
|
||||||
|
const char *name;
|
||||||
|
int added;
|
||||||
|
int removed;
|
||||||
|
} prop;
|
||||||
|
int num_changes = 0, i;
|
||||||
|
|
||||||
|
if (!(v = data)) return;
|
||||||
|
|
||||||
|
if (dbus_message_get_error_name(msg))
|
||||||
|
{
|
||||||
|
printf("DBUS ERROR: %s\n", dbus_message_get_error_name(msg));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!dbus_message_iter_init(msg, &iter)) return;
|
||||||
|
|
||||||
|
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_INT32) return;
|
||||||
|
dbus_message_iter_get_basic(&iter, &num_changes);
|
||||||
|
if (num_changes == 0) return;
|
||||||
|
|
||||||
|
dbus_message_iter_next(&iter);
|
||||||
|
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY) return;
|
||||||
|
dbus_message_iter_recurse(&iter, &sub);
|
||||||
|
|
||||||
|
for (i = 0; i < num_changes; i++, dbus_message_iter_next(&sub))
|
||||||
|
{
|
||||||
|
dbus_message_iter_recurse(&sub, &subsub);
|
||||||
|
|
||||||
|
if (dbus_message_iter_get_arg_type(&subsub) != DBUS_TYPE_STRING) break;
|
||||||
|
dbus_message_iter_get_basic(&subsub, &(prop.name));
|
||||||
|
if (!strcmp(prop.name, "volume.mount_point"))
|
||||||
|
{
|
||||||
|
e_hal_device_get_all_properties(_e_dbus_conn, v->udi,
|
||||||
|
_e_dbus_cb_vol_prop_mount_modified,
|
||||||
|
v);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbus_message_iter_next(&subsub);
|
||||||
|
dbus_message_iter_next(&subsub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error)
|
_e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error)
|
||||||
{
|
{
|
||||||
|
@ -487,7 +537,7 @@ _e_dbus_cb_store_prop(void *data, void *reply_data, DBusError *error)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
printf("ERR %s\n", s->udi);
|
printf("ERR on %s \n name : %s\n msg : %s\n", s->udi, error->name, error->message);
|
||||||
e_storage_del(s->udi);
|
e_storage_del(s->udi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,6 +680,52 @@ _e_dbus_cb_vol_prop(void *data, void *reply_data, DBusError *error)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_dbus_cb_vol_prop_mount_modified(void *data, void *reply_data, DBusError *error)
|
||||||
|
{
|
||||||
|
E_Volume *v = data;
|
||||||
|
E_Storage *s = NULL;
|
||||||
|
E_Hal_Device_Get_All_Properties_Return *ret = reply_data;
|
||||||
|
int err = 0;
|
||||||
|
char *str = NULL;
|
||||||
|
|
||||||
|
if (!ret) return;
|
||||||
|
if (dbus_error_is_set(error))
|
||||||
|
{
|
||||||
|
dbus_error_free(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
v->mounted = e_hal_property_bool_get(ret, "volume.is_mounted", &err);
|
||||||
|
if (err) printf("HAL Error : can't get volume.is_mounted property");
|
||||||
|
|
||||||
|
if (v->mount_point) free(v->mount_point);
|
||||||
|
v->mount_point = e_hal_property_string_get(ret, "volume.mount_point", &err);
|
||||||
|
if (err) printf("HAL Error : can't get volume.is_mount_point property");
|
||||||
|
|
||||||
|
printf("**VOL udi: %s mount_point: %s mounted: %d\n", v->udi, v->mount_point, v->mounted);
|
||||||
|
{
|
||||||
|
char *buf;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
size = strlen(v->udi) + 1 + strlen(v->mount_point) + 1;
|
||||||
|
buf = alloca(size);
|
||||||
|
strcpy(buf, v->udi);
|
||||||
|
strcpy(buf + strlen(buf) + 1, v->mount_point);
|
||||||
|
if (v->mounted)
|
||||||
|
ecore_ipc_server_send(_e_ipc_server,
|
||||||
|
6/*E_IPC_DOMAIN_FM*/,
|
||||||
|
12/*mount done*/,
|
||||||
|
0, 0, 0, buf, size);
|
||||||
|
else
|
||||||
|
ecore_ipc_server_send(_e_ipc_server,
|
||||||
|
6/*E_IPC_DOMAIN_FM*/,
|
||||||
|
13/*unmount done*/,
|
||||||
|
0, 0, 0, buf, size);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static Evas_List *_e_vols = NULL;
|
static Evas_List *_e_vols = NULL;
|
||||||
|
|
||||||
EAPI E_Volume *
|
EAPI E_Volume *
|
||||||
|
@ -646,6 +742,10 @@ e_volume_add(const char *udi)
|
||||||
_e_vols = evas_list_append(_e_vols, v);
|
_e_vols = evas_list_append(_e_vols, v);
|
||||||
e_hal_device_get_all_properties(_e_dbus_conn, v->udi,
|
e_hal_device_get_all_properties(_e_dbus_conn, v->udi,
|
||||||
_e_dbus_cb_vol_prop, v);
|
_e_dbus_cb_vol_prop, v);
|
||||||
|
e_dbus_signal_handler_add(_e_dbus_conn, "org.freedesktop.Hal",
|
||||||
|
udi,
|
||||||
|
"org.freedesktop.Hal.Device",
|
||||||
|
"PropertyModified", _e_dbus_cb_prop_modified, v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,6 +793,7 @@ _e_dbus_cb_vol_mounted(void *user_data, void *method_return, DBusError *error)
|
||||||
|
|
||||||
v->mounted = 1;
|
v->mounted = 1;
|
||||||
printf("MOUNT: %s from %s\n", v->udi, v->mount_point);
|
printf("MOUNT: %s from %s\n", v->udi, v->mount_point);
|
||||||
|
printf("DBus Error name: %s \nmsg : %s\n", error->name, error->message);
|
||||||
size = strlen(v->udi) + 1 + strlen(v->mount_point) + 1;
|
size = strlen(v->udi) + 1 + strlen(v->mount_point) + 1;
|
||||||
buf = alloca(size);
|
buf = alloca(size);
|
||||||
strcpy(buf, v->udi);
|
strcpy(buf, v->udi);
|
||||||
|
@ -742,7 +843,7 @@ e_volume_mount(E_Volume *v)
|
||||||
// ecore_list_append(opt, "user");
|
// ecore_list_append(opt, "user");
|
||||||
// ecore_list_append(opt, "utf8");
|
// ecore_list_append(opt, "utf8");
|
||||||
e_hal_device_volume_mount(_e_dbus_conn, v->udi, v->mount_point,
|
e_hal_device_volume_mount(_e_dbus_conn, v->udi, v->mount_point,
|
||||||
v->fstype, opt, _e_dbus_cb_vol_mounted, v);
|
v->fstype, opt, NULL, v);
|
||||||
// ecore_list_destroy(opt);
|
// ecore_list_destroy(opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,7 +1001,11 @@ _e_ipc_cb_server_data(void *data, int type, void *event)
|
||||||
{
|
{
|
||||||
if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
|
if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
|
||||||
continue;
|
continue;
|
||||||
if (!strcmp(dp->d_name, ".order")) dot_order = 1;
|
if (!strcmp(dp->d_name, ".order"))
|
||||||
|
{
|
||||||
|
dot_order = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
files = evas_list_append(files, strdup(dp->d_name));
|
files = evas_list_append(files, strdup(dp->d_name));
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
|
@ -964,16 +964,14 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
|
||||||
Evas_Coord mw, mh;
|
Evas_Coord mw, mh;
|
||||||
Evas_Object *o, *ocon, *of, *oi, *mt;
|
Evas_Object *o, *ocon, *of, *oi, *mt;
|
||||||
Evas *evas;
|
Evas *evas;
|
||||||
Evas_List *l;
|
Evas_List *l = NULL, *apps = NULL, *mlist = NULL;
|
||||||
Evas_List *apps;
|
Evas_Hash *mimes = NULL;
|
||||||
E_Fwin_Apps_Dialog *fad;
|
E_Fwin_Apps_Dialog *fad;
|
||||||
E_Fm2_Config fmc;
|
E_Fm2_Config fmc;
|
||||||
E_Fm2_Icon_Info *ici;
|
E_Fm2_Icon_Info *ici;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
const char *f;
|
const char *f;
|
||||||
int need_dia = 0;
|
int need_dia = 0;
|
||||||
Evas_Hash *mimes = NULL;
|
|
||||||
Evas_List *mlist = NULL;
|
|
||||||
|
|
||||||
if (fwin->fad)
|
if (fwin->fad)
|
||||||
{
|
{
|
||||||
|
@ -985,31 +983,54 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
|
||||||
for (l = files; l; l = l->next)
|
for (l = files; l; l = l->next)
|
||||||
{
|
{
|
||||||
ici = l->data;
|
ici = l->data;
|
||||||
printf("O: %s -- %i\n", ici->link, ici->removable);
|
|
||||||
if ((ici->link) && (ici->mount))
|
if ((ici->link) && (ici->mount))
|
||||||
|
{
|
||||||
|
if (!fileman_config->view.open_dirs_in_place || fwin->zone)
|
||||||
{
|
{
|
||||||
if (fwin->win)
|
if (fwin->win)
|
||||||
fwin2 = _e_fwin_new(fwin->win->container, ici->link, "/");
|
fwin2 = _e_fwin_new(fwin->win->container, ici->link, "/");
|
||||||
else if (fwin->zone)
|
else if (fwin->zone)
|
||||||
fwin2 = _e_fwin_new(fwin->zone->container, ici->link, "/");
|
fwin2 = _e_fwin_new(fwin->zone->container, ici->link, "/");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e_fm2_path_set(fwin->fm_obj, ici->link, "/");
|
||||||
|
_e_fwin_window_title_set(fwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ((ici->link) && (ici->removable))
|
else if ((ici->link) && (ici->removable))
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "removable:%s", ici->link);
|
snprintf(buf, sizeof(buf), "removable:%s", ici->link);
|
||||||
|
if (!fileman_config->view.open_dirs_in_place || fwin->zone)
|
||||||
|
{
|
||||||
if (fwin->win)
|
if (fwin->win)
|
||||||
fwin2 = _e_fwin_new(fwin->win->container, buf, "/");
|
fwin2 = _e_fwin_new(fwin->win->container, buf, "/");
|
||||||
else if (fwin->zone)
|
else if (fwin->zone)
|
||||||
fwin2 = _e_fwin_new(fwin->zone->container, buf, "/");
|
fwin2 = _e_fwin_new(fwin->zone->container, buf, "/");
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e_fm2_path_set(fwin->fm_obj, buf, "/");
|
||||||
|
_e_fwin_window_title_set(fwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (ici->real_link)
|
else if (ici->real_link)
|
||||||
{
|
{
|
||||||
if (S_ISDIR(ici->statinfo.st_mode))
|
if (S_ISDIR(ici->statinfo.st_mode))
|
||||||
|
{
|
||||||
|
if (!fileman_config->view.open_dirs_in_place || fwin->zone)
|
||||||
{
|
{
|
||||||
if (fwin->win)
|
if (fwin->win)
|
||||||
fwin2 = _e_fwin_new(fwin->win->container, NULL, ici->real_link);
|
fwin2 = _e_fwin_new(fwin->win->container, NULL, ici->real_link);
|
||||||
else if (fwin->zone)
|
else if (fwin->zone)
|
||||||
fwin2 = _e_fwin_new(fwin->zone->container, NULL, ici->real_link);
|
fwin2 = _e_fwin_new(fwin->zone->container, NULL, ici->real_link);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e_fm2_path_set(fwin->fm_obj, NULL, ici->real_link);
|
||||||
|
_e_fwin_window_title_set(fwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
need_dia = 1;
|
need_dia = 1;
|
||||||
}
|
}
|
||||||
|
@ -1018,12 +1039,20 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
|
||||||
snprintf(buf, sizeof(buf), "%s/%s",
|
snprintf(buf, sizeof(buf), "%s/%s",
|
||||||
e_fm2_real_path_get(fwin->fm_obj), ici->file);
|
e_fm2_real_path_get(fwin->fm_obj), ici->file);
|
||||||
if (S_ISDIR(ici->statinfo.st_mode))
|
if (S_ISDIR(ici->statinfo.st_mode))
|
||||||
|
{
|
||||||
|
if (!fileman_config->view.open_dirs_in_place || fwin->zone)
|
||||||
{
|
{
|
||||||
if (fwin->win)
|
if (fwin->win)
|
||||||
fwin2 = _e_fwin_new(fwin->win->container, NULL, buf);
|
fwin2 = _e_fwin_new(fwin->win->container, NULL, buf);
|
||||||
else
|
else
|
||||||
fwin2 = _e_fwin_new(fwin->zone->container, NULL, buf);
|
fwin2 = _e_fwin_new(fwin->zone->container, NULL, buf);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e_fm2_path_set(fwin->fm_obj, NULL, buf);
|
||||||
|
_e_fwin_window_title_set(fwin);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
need_dia = 1;
|
need_dia = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue