Fix ordering for network devices
This commit is contained in:
parent
ffabb2149c
commit
765c10c183
|
@ -103,6 +103,7 @@ _places_mount_volume_add(const char *mpoint, const char *fstype)
|
||||||
vol->free_func = _places_mount_free_func;
|
vol->free_func = _places_mount_free_func;
|
||||||
|
|
||||||
know_mounts = eina_list_append(know_mounts, vol);
|
know_mounts = eina_list_append(know_mounts, vol);
|
||||||
|
places_volume_update(vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -241,18 +241,21 @@ _places_volume_sort_cb(const void *d1, const void *d2)
|
||||||
const Volume *v1 = d1;
|
const Volume *v1 = d1;
|
||||||
const Volume *v2 = d2;
|
const Volume *v2 = d2;
|
||||||
|
|
||||||
if(!v1) return(1);
|
if(!v1) return 1;
|
||||||
if(!v2) return(-1);
|
if(!v2) return -1;
|
||||||
|
|
||||||
// removable after interal
|
// removable after interal
|
||||||
if (v1->removable && !v2->removable) return(1);
|
if (v1->removable && !v2->removable) return 1;
|
||||||
if (v2->removable && !v1->removable) return(-1);
|
if (v2->removable && !v1->removable) return -1;
|
||||||
|
// network after local
|
||||||
|
if (v1->remote && !v2->remote) return 1;
|
||||||
|
if (v2->remote && !v1->remote) return -1;
|
||||||
// filesystem root on top
|
// filesystem root on top
|
||||||
if (v1->mount_point && !strcmp(v1->mount_point, "/")) return -1;
|
if (eina_streq(v1->mount_point, "/")) return -1;
|
||||||
if (v2->mount_point && !strcmp(v2->mount_point, "/")) return 1;
|
if (eina_streq(v2->mount_point, "/")) return 1;
|
||||||
// order by label
|
// order by label
|
||||||
if(!v1->label) return(1);
|
if(!v1->label) return 1;
|
||||||
if(!v2->label) return(-1);
|
if(!v2->label) return -1;
|
||||||
return strcmp(v1->label, v2->label);
|
return strcmp(v1->label, v2->label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +276,12 @@ places_volume_update(Volume *vol)
|
||||||
Evas_Object *obj;
|
Evas_Object *obj;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
|
if (eina_streq(vol->fstype, "nfs") ||
|
||||||
|
eina_streq(vol->fstype, "cifs"))
|
||||||
|
vol->remote = EINA_TRUE;
|
||||||
|
else
|
||||||
|
vol->remote = EINA_FALSE;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(vol->objs, l, obj)
|
EINA_LIST_FOREACH(vol->objs, l, obj)
|
||||||
_places_volume_object_update(vol, obj);
|
_places_volume_object_update(vol, obj);
|
||||||
|
|
||||||
|
@ -544,6 +553,7 @@ places_print_volume(Volume *v)
|
||||||
printf(" removable: %d\n", v->removable);
|
printf(" removable: %d\n", v->removable);
|
||||||
printf(" requires eject: %d\n", v->requires_eject);
|
printf(" requires eject: %d\n", v->requires_eject);
|
||||||
printf(" media_available: %d\n", v->media_available);
|
printf(" media_available: %d\n", v->media_available);
|
||||||
|
printf(" remote: %d\n", v->remote);
|
||||||
size = _places_human_size_get(v->size);
|
size = _places_human_size_get(v->size);
|
||||||
free = _places_human_size_get(v->free_space);
|
free = _places_human_size_get(v->free_space);
|
||||||
printf(" size: %s\n", size);
|
printf(" size: %s\n", size);
|
||||||
|
|
|
@ -31,6 +31,7 @@ struct _Volume
|
||||||
Eina_Bool removable;
|
Eina_Bool removable;
|
||||||
Eina_Bool requires_eject;
|
Eina_Bool requires_eject;
|
||||||
Eina_Bool media_available;
|
Eina_Bool media_available;
|
||||||
|
Eina_Bool remote;
|
||||||
Eina_Bool unlocked;
|
Eina_Bool unlocked;
|
||||||
Eina_Bool encrypted;
|
Eina_Bool encrypted;
|
||||||
|
|
||||||
|
|
|
@ -544,17 +544,16 @@ _places_ud2_volume_finalize(Volume *vol)
|
||||||
is_valid = EINA_FALSE;
|
is_valid = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// the update is always needed to trigger auto_mount/auto_open
|
||||||
|
places_volume_update(vol);
|
||||||
|
|
||||||
if (is_valid != vol->valid)
|
if (is_valid != vol->valid)
|
||||||
{
|
{
|
||||||
// trigger a full redraw, is the only way to show/hide a new device
|
// trigger a full redraw, is the only way to show/hide a new device
|
||||||
vol->valid = is_valid;
|
vol->valid = is_valid;
|
||||||
places_update_all_gadgets();
|
places_update_all_gadgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
// the update is always needed to trigger auto_mount/auto_open
|
|
||||||
places_volume_update(vol);
|
|
||||||
|
|
||||||
places_print_volume(vol); // TODO REMOVEME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue