Mercurial > geeqie.yaz
changeset 630:83d3ded39e49
An option to save and restore the last path used was added.
This option appears as startup.use_last_path in rc file.
Preferences > General > Startup was modified accordingly.
author | zas_ |
---|---|
date | Sun, 11 May 2008 13:14:58 +0000 |
parents | 1fa2cb6d9d65 |
children | 026f8f97361c |
files | src/main.c src/options.c src/options.h src/preferences.c src/rcfile.c |
diffstat | 5 files changed, 30 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main.c Sun May 11 12:23:26 2008 +0000 +++ b/src/main.c Sun May 11 13:14:58 2008 +0000 @@ -1229,6 +1229,12 @@ &options->color_profile.screen_type, &options->color_profile.use_image); + if (options->startup.restore_path && options->startup.use_last_path) + { + g_free(options->startup.path); + options->startup.path = g_strdup(layout_get_path(NULL)); + } + save_options(); keys_save(); @@ -1302,7 +1308,7 @@ exit_program_final(); } -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { LayoutWindow *lw; gchar *path = NULL;
--- a/src/options.c Sun May 11 12:23:26 2008 +0000 +++ b/src/options.c Sun May 11 13:14:58 2008 +0000 @@ -127,8 +127,9 @@ options->slideshow.random = FALSE; options->slideshow.repeat = FALSE; + options->startup.path = NULL; options->startup.restore_path = FALSE; - options->startup.path = NULL; + options->startup.use_last_path = FALSE; options->thumbnails.cache_into_dirs = FALSE; options->thumbnails.enable_caching = TRUE;
--- a/src/options.h Sun May 11 12:23:26 2008 +0000 +++ b/src/options.h Sun May 11 13:14:58 2008 +0000 @@ -41,6 +41,7 @@ struct { gboolean restore_path; + gboolean use_last_path; gchar *path; } startup;
--- a/src/preferences.c Sun May 11 12:23:26 2008 +0000 +++ b/src/preferences.c Sun May 11 13:14:58 2008 +0000 @@ -173,11 +173,6 @@ } layout_edit_update_all(); - g_free(options->startup.path); - options->startup.path = NULL; - buf = gtk_entry_get_text(GTK_ENTRY(startup_path_entry)); - if (buf && strlen(buf) > 0) options->startup.path = remove_trailing_slash(buf); - g_free(options->file_ops.safe_delete_path); options->file_ops.safe_delete_path = NULL; buf = gtk_entry_get_text(GTK_ENTRY(safe_delete_path_entry)); @@ -189,6 +184,12 @@ if (options->file_filter.disable != c_options->file_filter.disable) refresh = TRUE; options->startup.restore_path = c_options->startup.restore_path; + options->startup.use_last_path = c_options->startup.use_last_path; + g_free(options->startup.path); + options->startup.path = NULL; + buf = gtk_entry_get_text(GTK_ENTRY(startup_path_entry)); + if (buf && strlen(buf) > 0) options->startup.path = remove_trailing_slash(buf); + options->file_ops.confirm_delete = c_options->file_ops.confirm_delete; options->file_ops.enable_delete_key = c_options->file_ops.enable_delete_key; options->file_ops.safe_delete_enable = c_options->file_ops.safe_delete_enable; @@ -841,6 +842,7 @@ GtkWidget *label; GtkWidget *hbox; GtkWidget *vbox; + GtkWidget *subvbox; GtkWidget *group; GtkWidget *subgroup; GtkWidget *button; @@ -857,11 +859,13 @@ group = pref_group_new(vbox, FALSE, _("Startup"), GTK_ORIENTATION_VERTICAL); - button = pref_checkbox_new_int(group, _("Change to folder:"), + button = pref_checkbox_new_int(group, _("Restore folder on startup"), options->startup.restore_path, &c_options->startup.restore_path); - hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); - pref_checkbox_link_sensitivity(button, hbox); + subvbox = pref_box_new(group, FALSE, GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE); + pref_checkbox_link_sensitivity(button, subvbox); + + hbox = pref_box_new(subvbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); tabcomp = tab_completion_new(&startup_path_entry, options->startup.path, NULL, NULL); tab_completion_add_select_button(startup_path_entry, NULL, TRUE); @@ -871,6 +875,11 @@ button = pref_button_new(hbox, NULL, _("Use current"), FALSE, G_CALLBACK(startup_path_set_current), NULL); + button = pref_checkbox_new_int(subvbox, _("Use last path"), + options->startup.use_last_path, &c_options->startup.use_last_path); + pref_checkbox_link_sensitivity_swap(button, hbox); + + group = pref_group_new(vbox, FALSE, _("Thumbnails"), GTK_ORIENTATION_VERTICAL); table = pref_table_new(group, 2, 2, FALSE, FALSE);
--- a/src/rcfile.c Sun May 11 12:23:26 2008 +0000 +++ b/src/rcfile.c Sun May 11 13:14:58 2008 +0000 @@ -325,6 +325,7 @@ WRITE_SUBTITLE("Startup Options"); WRITE_BOOL(startup.restore_path); + WRITE_BOOL(startup.use_last_path); WRITE_CHAR(startup.path); @@ -646,6 +647,8 @@ COMPAT_READ_BOOL(startup_path_enable, startup.restore_path); /* 2008/05/11 */ READ_BOOL(startup.restore_path); + READ_BOOL(startup.use_last_path); + COMPAT_READ_CHAR(startup_path, startup.path); /* 2008/05/11 */ READ_CHAR(startup.path);