[Xfce4-commits] [xfce/thunar] 01/01: Sort device entries in tree view (Bug #16471)
noreply at xfce.org
noreply at xfce.org
Fri Feb 28 22:50:19 CET 2020
This is an automated email from the git hooks/post-receive script.
a l e x p u s h e d a c o m m i t t o b r a n c h x f c e - 4 . 1 4
in repository xfce/thunar.
commit 1d46702563be0418cc3a18e413f958bb86ba30c8
Author: Theo Linkspfeifer <lastonestanding at tutanota.com>
Date: Fri Feb 28 11:40:04 2020 +0100
Sort device entries in tree view (Bug #16471)
---
thunar/thunar-tree-model.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/thunar/thunar-tree-model.c b/thunar/thunar-tree-model.c
index 32bcc0d..17d9bf5 100644
--- a/thunar/thunar-tree-model.c
+++ b/thunar/thunar-tree-model.c
@@ -1075,12 +1075,26 @@ thunar_tree_model_device_added (ThunarDeviceMonitor *device_monitor,
_thunar_return_if_fail (THUNAR_IS_DEVICE (device));
_thunar_return_if_fail (THUNAR_IS_TREE_MODEL (model));
+ /* lookup the last child of the root (the "File System" node) */
+ node = g_node_last_child (model->root);
+
+ /* determine the position for the new node in the item list */
+ for (node = node->prev; node != NULL; node = node->prev)
+ {
+ 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;
+ }
+
/* allocate a new item for the volume */
item = thunar_tree_model_item_new_with_device (model, device);
- /* insert before the last child of the root (the "File System" node) */
- node = g_node_last_child (model->root);
- node = g_node_insert_data_before (model->root, node, item);
+ /* insert the new node */
+ node = g_node_insert_data_after (model->root, node, item);
/* determine the iterator for the new node */
GTK_TREE_ITER_INIT (iter, model->stamp, node);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list