Issue #329 easier way to get cwd when copying
authorColin Clark <cclark@mcb.net>
Mon, 11 Apr 2016 18:14:29 +0000 (19:14 +0100)
committerColin Clark <cclark@mcb.net>
Mon, 11 Apr 2016 18:14:29 +0000 (19:14 +0100)
https://github.com/BestImageViewer/geeqie/issues/329

A bookmark with the name "." (a single full-stop) is treated as a
special case. Each time it is displayed, its path is loaded with
Geeqie's current working folder. This bookmark, like any other, can be
deleted and re-created at any time.

doc/docbook/GuideImageManagementCopyMove.xml
src/options.c
src/ui_bookmark.c

index 00884fe..1e8adf6 100644 (file)
@@ -35,6 +35,8 @@
       </term><listitem><para>
         This list on the left side of the window allows you to save links to folders that are frequently used. Activating a bookmark will change the active path to that pointed to by the link. To add items to the bookmark list highlight a folder and press Ctrl + B, select “Add bookmark” from the folder's context menu, or drag a folder onto the bookmark list.<?db2html element="br"?>
         The bookmark has a context menu that can be displayed by clicking the right mouse button, or pressing the Menu key when a bookmark has the focus. From the context menu you can edit a bookmark, move it up or down in the list, or remove the bookmark from the list. A bookmark can also be moved by pressing Shift + Up or Shift + Down while it has the focus.
+      </para><para>
+        A bookmark with the name "." is treated as a special case. Each time this bookmark is displayed, its path is loaded with Geeqie's current working folder. This bookmark, like any other, can be deleted and re-created at any time.
       </para></listitem></varlistentry><varlistentry><term>
         Folder list
       </term><listitem><para>
index 1c02f94..fa6c23f 100644 (file)
@@ -141,6 +141,7 @@ void setup_default_options(ConfOptions *options)
        gchar *path;
        gint i;
 
+       bookmark_add_default(".", get_current_dir());
        bookmark_add_default(_("Home"), homedir());
        path = g_build_filename(homedir(), "Desktop", NULL);
        bookmark_add_default(_("Desktop"), path);
index b9b5639..842b947 100644 (file)
@@ -550,6 +550,10 @@ 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);
+
                        path = g_build_filename(homedir(), "Desktop", NULL);
                        if (isname(path))
                                {
@@ -570,7 +574,14 @@ static void bookmark_populate(BookMarkData *bm)
                        path = work->data;
                        work = work->next;
 
-                       buf = bookmark_string(name, path, NULL);
+                       if (strcmp(name, ".") == 0)
+                               {
+                               buf = bookmark_string(name, g_strdup(history_list_find_last_path_by_key("path_list")), NULL);
+                               }
+                       else
+                               {
+                               buf = bookmark_string(name, path, NULL);
+                               }
                        history_list_add_to_key(bm->key, buf, 0);
                        g_free(buf);
                        }
@@ -585,6 +596,16 @@ static void bookmark_populate(BookMarkData *bm)
                b = bookmark_from_string(work->data);
                if (b)
                        {
+                       if (strcmp(b->name, ".") == 0)
+                               {
+                               gchar *buf;
+
+                               b->path = g_strdup(history_list_find_last_path_by_key("path_list"));
+                               buf = bookmark_string(".", b->path, b->icon);
+                               history_list_item_change("bookmarks", b->key, buf);
+                               b->key = g_strdup(buf);
+                               g_free(buf);
+                               }
                        GtkWidget *box;
 
                        b->button = gtk_button_new();