Mercurial > hg > forks > geeqie
changeset 2291:eccae4bd9d18
Issue #329 easier way to get cwd when copying
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.
author | Colin Clark <cclark@mcb.net> |
---|---|
date | Mon, 11 Apr 2016 19:14:29 +0100 |
parents | e16280b66879 |
children | 4a120a00f3d7 |
files | doc/docbook/GuideImageManagementCopyMove.xml src/options.c src/ui_bookmark.c |
diffstat | 3 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/docbook/GuideImageManagementCopyMove.xml Thu Mar 31 16:58:51 2016 +0100 +++ b/doc/docbook/GuideImageManagementCopyMove.xml Mon Apr 11 19:14:29 2016 +0100 @@ -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>
--- a/src/options.c Thu Mar 31 16:58:51 2016 +0100 +++ b/src/options.c Mon Apr 11 19:14:29 2016 +0100 @@ -141,6 +141,7 @@ 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);
--- a/src/ui_bookmark.c Thu Mar 31 16:58:51 2016 +0100 +++ b/src/ui_bookmark.c Mon Apr 11 19:14:29 2016 +0100 @@ -550,6 +550,10 @@ 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 @@ 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 @@ 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();