! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Move network to the bottom of tree view
Status:
RESOLVED: FIXED

Comments

Description Yousuf 'Jay' Philips 2020-03-09 11:16:53 CET
In order to unify the location of Network in shortcut and tree views, the position of it in tree view should be moved to the bottom and any connected network shares should appear below it.
Comment 1 alexxcons editbugs 2020-03-09 23:00:20 CET
agreed, that would be nice to have !
Comment 2 Yousuf 'Jay' Philips 2020-03-10 12:22:11 CET
Created attachment 9562 
patch
Comment 3 Yousuf 'Jay' Philips 2020-03-10 12:29:18 CET
this patch works, but then network shares are still appearing above devices

https://imgur.com/uSQ1kP9.png
Comment 4 Theo Linkspfeifer editbugs 2020-03-14 22:10:58 CET
Created attachment 9600 
experimental diff
Comment 5 Yousuf 'Jay' Philips 2020-03-17 14:14:50 CET
patch worked for me.
https://imgur.com/80WsGGm.png
Comment 6 Yousuf 'Jay' Philips 2020-03-17 14:44:59 CET
same as in shortcut view
https://imgur.com/pZhll0t.png
Comment 7 alexxcons editbugs 2020-03-19 00:43:36 CET
Works fine here, thanks !

> if (thunar_device_sort (item->device, device) > 0)
You switched from "lesss than" to "greater than" for a special reason ?

  for (node2 = node->next; node2 != NULL; node2 = node2->next)
    {
      item = THUNAR_TREE_MODEL_ITEM (node2->data);
      if (item->device == NULL)
        break;

      /* sort devices by timestamp */
      if (thunar_device_sort (item->device, device) > 0)
        break;

      node = node2;
  }

Think that loop can be done with only one "node" variable:

  /* determine the position for the new node in the item list */
  for (;node->next != NULL; node = node->next)
    {
      item = THUNAR_TREE_MODEL_ITEM (node->data);
      if (item->device == NULL)
        break;

      /* sort devices by timestamp */
      if (thunar_device_sort (item->device, device) > 0)
        break;
    }

... or do I miss something ?
Comment 8 Theo Linkspfeifer editbugs 2020-03-19 10:34:11 CET
> You switched from "lesss than" to "greater than" for a special reason ?
The loop now goes in the other direction (node = node->next).

> Think that loop can be done with only one "node" variable:
That was my initial plan, but there were corner cases. When a volume is added to the list, the loop will break after finding the Network node (item->device == NULL). Therefore, the new entry will be added below the Network one -> wrong.
Comment 9 alexxcons editbugs 2020-03-19 22:40:41 CET
(In reply to Theo Linkspfeifer from comment #8)
> > You switched from "lesss than" to "greater than" for a special reason ?
> The loop now goes in the other direction (node = node->next).
Uh, I somehow failed toseee that there was "->prev" before

> > Think that loop can be done with only one "node" variable:
> That was my initial plan, but there were corner cases. When a volume is
> added to the list, the loop will break after finding the Network node
> (item->device == NULL). Therefore, the new entry will be added below the
> Network one -> wrong.
I see ... though I at least would rename "node2" to something like "node_iter".

Besides that, I think it is good to get pushed.
Comment 10 Theo Linkspfeifer editbugs 2020-03-20 13:19:01 CET
Created attachment 9619 
diff

Actually, the following change was missing in your suggestion:

item = THUNAR_TREE_MODEL_ITEM (node->next->data);
Comment 11 alexxcons editbugs 2020-03-20 23:03:26 CET
Nice !  Haha, looks like I gave up to early by the word "corner cases"  ;)
Seems to work fine ...  good to get pushed ?
Comment 12 Theo Linkspfeifer editbugs 2020-03-24 12:52:19 CET
Sure.
Comment 13 Git Bot editbugs 2020-03-24 18:59:07 CET
Theo Linkspfeifer referenced this bugreport in commit b7129722f881e6d9b190e28323773882f22fdf04

Move 'network' to the bottom of tree view (Bug #16516)

https://git.xfce.org/xfce/thunar/commit?id=b7129722f881e6d9b190e28323773882f22fdf04
Comment 14 alexxcons editbugs 2020-03-24 18:59:48 CET
ok, pushed to master.

Thanks alot for your effort !

Bug #16516

Reported by:
Yousuf 'Jay' Philips
Reported on: 2020-03-09
Last modified on: 2020-03-24

People

Assignee:
Xfce Bug Triage
CC List:
2 users

Version

Version:
1.8.11

Attachments

patch (1.26 KB, patch)
2020-03-10 12:22 CET , Yousuf 'Jay' Philips
no flags
experimental diff (4.65 KB, patch)
2020-03-14 22:10 CET , Theo Linkspfeifer
no flags
diff (4.32 KB, patch)
2020-03-20 13:19 CET , Theo Linkspfeifer
no flags

Additional information