Skip to content

Commit

Permalink
Issue #329 easier way to get cwd when copying
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
Colin Clark committed Apr 11, 2016
1 parent 6e3b2ed commit 1797b9e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/docbook/GuideImageManagementCopyMove.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 22 additions & 1 deletion src/ui_bookmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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);
}
Expand All @@ -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();
Expand Down

0 comments on commit 1797b9e

Please sign in to comment.