davemds pushed a commit to branch master.

http://git.enlightenment.org/enlightenment/modules/places.git/commit/?id=765c10c183089e715af064c12aab1f8ca1cd146f

commit 765c10c183089e715af064c12aab1f8ca1cd146f
Author: Dave Andreoli <d...@gurumeditation.it>
Date:   Sun Apr 18 14:33:13 2021 +0200

    Fix ordering for network devices
---
 src/e_mod_mount.c   |  1 +
 src/e_mod_places.c  | 26 ++++++++++++++++++--------
 src/e_mod_places.h  |  1 +
 src/e_mod_udisks2.c |  9 ++++-----
 4 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/e_mod_mount.c b/src/e_mod_mount.c
index 88b6a28..8415968 100644
--- a/src/e_mod_mount.c
+++ b/src/e_mod_mount.c
@@ -103,6 +103,7 @@ _places_mount_volume_add(const char *mpoint, const char 
*fstype)
    vol->free_func = _places_mount_free_func;
 
    know_mounts = eina_list_append(know_mounts, vol);
+   places_volume_update(vol);
 }
 
 char *
diff --git a/src/e_mod_places.c b/src/e_mod_places.c
index bb8eabf..aabf848 100644
--- a/src/e_mod_places.c
+++ b/src/e_mod_places.c
@@ -241,18 +241,21 @@ _places_volume_sort_cb(const void *d1, const void *d2)
    const Volume *v1 = d1;
    const Volume *v2 = d2;
 
-   if(!v1) return(1);
-   if(!v2) return(-1);
+   if(!v1) return 1;
+   if(!v2) return -1;
 
    // removable after interal
-   if (v1->removable && !v2->removable) return(1);
-   if (v2->removable && !v1->removable) return(-1);
+   if (v1->removable && !v2->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
-   if (v1->mount_point && !strcmp(v1->mount_point, "/")) return -1;
-   if (v2->mount_point && !strcmp(v2->mount_point, "/")) return 1;
+   if (eina_streq(v1->mount_point, "/")) return -1;
+   if (eina_streq(v2->mount_point, "/")) return 1;
    // order by label
-   if(!v1->label) return(1);
-   if(!v2->label) return(-1);
+   if(!v1->label) return 1;
+   if(!v2->label) return -1;
    return strcmp(v1->label, v2->label);
 }
 
@@ -273,6 +276,12 @@ places_volume_update(Volume *vol)
    Evas_Object *obj;
    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)
      _places_volume_object_update(vol, obj);
 
@@ -544,6 +553,7 @@ places_print_volume(Volume *v)
    printf("  removable: %d\n", v->removable);
    printf("  requires eject: %d\n", v->requires_eject);
    printf("  media_available: %d\n", v->media_available);
+   printf("  remote: %d\n", v->remote);
    size = _places_human_size_get(v->size);
    free = _places_human_size_get(v->free_space);
    printf("  size: %s\n", size);
diff --git a/src/e_mod_places.h b/src/e_mod_places.h
index fd9f3e7..f862ca2 100644
--- a/src/e_mod_places.h
+++ b/src/e_mod_places.h
@@ -31,6 +31,7 @@ struct _Volume
    Eina_Bool removable;
    Eina_Bool requires_eject;
    Eina_Bool media_available;
+   Eina_Bool remote;
    Eina_Bool unlocked;
    Eina_Bool encrypted;
 
diff --git a/src/e_mod_udisks2.c b/src/e_mod_udisks2.c
index 66979ed..603049f 100644
--- a/src/e_mod_udisks2.c
+++ b/src/e_mod_udisks2.c
@@ -544,17 +544,16 @@ _places_ud2_volume_finalize(Volume *vol)
       is_valid = EINA_FALSE;
    }
 
+
+   // the update is always needed to trigger auto_mount/auto_open
+   places_volume_update(vol);
+
    if (is_valid != vol->valid)
    {
       // trigger a full redraw, is the only way to show/hide a new device
       vol->valid = is_valid;
       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
 }
 
 

-- 


Reply via email to