From 99d6d6c7a61dfae4e5d48f5b7599e61d46286953 Mon Sep 17 00:00:00 2001
From: Theo Linkspfeifer <lastonestanding@tutanota.com>
Date: Wed, 11 Mar 2020 12:56:26 +0100
Subject: [PATCH] Add new bookmarks to bottom of list in shortcuts view (Bug
 #16526)

---
 thunar/thunar-shortcuts-model.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 6a98e9a44..9e954d212 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -1960,6 +1960,8 @@ thunar_shortcuts_model_add (ThunarShortcutsModel *model,
 {
   ThunarShortcut *shortcut;
   GFile          *location;
+  GList          *lp;
+  guint           position = 0;
 
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (model));
   _thunar_return_if_fail (dst_path == NULL || gtk_tree_path_get_depth (dst_path) > 0);
@@ -1987,6 +1989,16 @@ thunar_shortcuts_model_add (ThunarShortcutsModel *model,
       shortcut->gicon = g_themed_icon_new ("folder-remote");
     }
 
+  /* if no position was given, place the shortcut at the bottom */
+  if (dst_path == NULL)
+    {
+      for (lp = model->shortcuts; lp != NULL; lp = lp->next)
+        if (THUNAR_SHORTCUT (lp->data)->group == THUNAR_SHORTCUT_GROUP_PLACES_BOOKMARKS)
+          position++;
+
+      shortcut->sort_id = ++position;
+    }
+
   /* add the shortcut to the list at the given position */
   thunar_shortcuts_model_add_shortcut_with_path (model, shortcut, dst_path);
 
-- 
GitLab