Remove "dot" entry from shortcuts pane
authorColin Clark <colin.clark@cclark.uk>
Sun, 7 May 2023 13:02:12 +0000 (14:02 +0100)
committerColin Clark <colin.clark@cclark.uk>
Sun, 7 May 2023 13:02:12 +0000 (14:02 +0100)
The "dot" entry had no meaning in the shortcuts pane, so is removed from
the defaults.
Current users can now delete the entry with a right-click.

src/history-list.cc
src/ui-bookmark.cc

index bd7dbae..90312b9 100644 (file)
@@ -460,16 +460,26 @@ void history_list_item_change(const gchar *key, const gchar *oldpath, const gcha
        while (work)
                {
                gchar *buf = static_cast<gchar *>(work->data);
-               if (strcmp(buf, oldpath) == 0)
+
+               if (!(g_str_has_prefix(buf, ".") && !newpath))
                        {
-                       if (newpath)
+                       if (strcmp(buf, oldpath) == 0)
                                {
-                               work->data = g_strdup(newpath);
-                               }
-                       else
-                               {
-                               hd->list = g_list_remove(hd->list, buf);
+                               if (newpath)
+                                       {
+                                       work->data = g_strdup(newpath);
+                                       }
+                               else
+                                       {
+                                       hd->list = g_list_remove(hd->list, buf);
+                                       }
+                               g_free(buf);
+                               return;
                                }
+                       }
+               else
+                       {
+                       hd->list = g_list_remove(hd->list, buf);
                        g_free(buf);
                        return;
                        }
index 55f23ee..ac2798c 100644 (file)
@@ -539,9 +539,12 @@ static void bookmark_populate(BookMarkData *bm)
                        history_list_add_to_key(bm->key, buf, 0);
                        g_free(buf);
 
-                       buf = bookmark_string(".", g_strdup(history_list_find_last_path_by_key("path_list")), NULL);
-                       history_list_add_to_key(bm->key, buf, 0);
-                       g_free(buf);
+                       if (!g_strcmp0(bm->key, "shortcuts") == 0)
+                               {
+                               buf = bookmark_string(".", g_strdup(history_list_find_last_path_by_key("path_list")), NULL);
+                               history_list_add_to_key(bm->key, buf, 0);
+                               g_free(buf);
+                               }
 
                        path = g_build_filename(homedir(), "Desktop", NULL);
                        if (isname(path))
@@ -565,7 +568,14 @@ static void bookmark_populate(BookMarkData *bm)
 
                        if (strcmp(name, ".") == 0)
                                {
-                               buf = bookmark_string(name, g_strdup(history_list_find_last_path_by_key("path_list")), NULL);
+                               if (!g_strcmp0(bm->key, "shortcuts") == 0)
+                                       {
+                                       buf = bookmark_string(name, g_strdup(history_list_find_last_path_by_key("path_list")), NULL);
+                                       }
+                               else
+                                       {
+                                       continue;
+                                       }
                                }
                        else
                                {