gtk_entry_set_text(GTK_ENTRY(lc->home_path_entry), layout_get_path(lc->lw));
}
+static void startup_path_set_current_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutConfig *lc = data;
+ lc->options.startup_path = STARTUP_PATH_CURRENT;
+}
+
+static void startup_path_set_last_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutConfig *lc = data;
+ lc->options.startup_path = STARTUP_PATH_LAST;
+}
+
+static void startup_path_set_home_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutConfig *lc = data;
+ lc->options.startup_path = STARTUP_PATH_HOME;
+}
+
+
/*
static void layout_config_save_cb(GtkWidget *widget, gpointer data)
{
gtk_container_add(GTK_CONTAINER(frame), vbox);
gtk_widget_show(vbox);
+
group = pref_group_new(vbox, FALSE, _("General options"), GTK_ORIENTATION_VERTICAL);
- pref_label_new(group, _("Home button path (empty to use your home directory)"));
+ pref_label_new(group, _("Home path (empty to use your home directory)"));
hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
tabcomp = tab_completion_new(&lc->home_path_entry, lc->options.home_path, NULL, NULL);
button = pref_button_new(hbox, NULL, _("Use current"), FALSE,
G_CALLBACK(home_path_set_current_cb), lc);
- group = pref_group_new(vbox, FALSE, _("Behavior"), GTK_ORIENTATION_VERTICAL);
-
pref_checkbox_new_int(group, _("Show date in directories list view"),
lc->options.show_directory_date, &lc->options.show_directory_date);
+ group = pref_group_new(vbox, FALSE, _("Start-up directory:"), GTK_ORIENTATION_VERTICAL);
+
+ button = pref_radiobutton_new(group, NULL, _("No change"),
+ (lc->options.startup_path == STARTUP_PATH_CURRENT),
+ G_CALLBACK(startup_path_set_current_cb), lc);
+ button = pref_radiobutton_new(group, button, _("Restore last path"),
+ (lc->options.startup_path == STARTUP_PATH_LAST),
+ G_CALLBACK(startup_path_set_last_cb), lc);
+ button = pref_radiobutton_new(group, button, _("Home path"),
+ (lc->options.startup_path == STARTUP_PATH_HOME),
+ G_CALLBACK(startup_path_set_home_cb), lc);
+
group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL);
lc->layout_widget = layout_config_new();
lw->options.image_overlay.histogram_channel = histogram->histogram_channel;
lw->options.image_overlay.histogram_mode = histogram->histogram_mode;
-// if (options->startup.restore_path && options->startup.use_last_path)
-// {
-// g_free(options->startup.path);
-// options->startup.path = g_strdup(layout_get_path(NULL));
-// }
+ g_free(lw->options.last_path);
+ lw->options.last_path = g_strdup(layout_get_path(lw));
}
void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop)
WRITE_NL(); WRITE_BOOL(*layout, show_thumbnails);
WRITE_NL(); WRITE_BOOL(*layout, show_directory_date);
WRITE_NL(); WRITE_CHAR(*layout, home_path);
+ WRITE_NL(); WRITE_CHAR(*layout, last_path);
+ WRITE_NL(); WRITE_UINT(*layout, startup_path);
WRITE_SEPARATOR();
WRITE_NL(); WRITE_INT(*layout, main_window.x);
if (READ_BOOL(*layout, show_thumbnails)) continue;
if (READ_BOOL(*layout, show_directory_date)) continue;
if (READ_CHAR(*layout, home_path)) continue;
+ if (READ_CHAR(*layout, last_path)) continue;
+ if (READ_UINT_CLAMP(*layout, startup_path, 0, STARTUP_PATH_HOME)) continue;
/* window positions */
}
}
+static void layout_config_startup_path(LayoutOptions *lop, gchar **path)
+{
+ switch (lop->startup_path)
+ {
+ case STARTUP_PATH_LAST:
+ *path = (lop->last_path && isdir(lop->last_path)) ? g_strdup(lop->last_path) : get_current_dir();
+ break;
+ case STARTUP_PATH_HOME:
+ *path = (lop->home_path && isdir(lop->home_path)) ? g_strdup(lop->home_path) : g_strdup(homedir());
+ break;
+ default:
+ *path = get_current_dir();
+ break;
+ }
+}
+
+
static void layout_config_commandline(LayoutOptions *lop, gchar **path)
{
if (command_line->startup_blank)
{
*path = g_strdup(command_line->path);
}
- else if (options->startup.restore_path && options->startup.path && isdir(options->startup.path))
- {
- *path = g_strdup(options->startup.path);
- }
- else
- {
- *path = get_current_dir();
- }
+ else layout_config_startup_path(lop, path);
if (command_line->tools_show)
{
{
layout_config_commandline(&lop, &path);
}
- else if (options->startup.restore_path && options->startup.path && isdir(options->startup.path))
- {
- path = g_strdup(options->startup.path);
- }
- else
+ else
{
- path = get_current_dir();
+ layout_config_startup_path(&lop, &path);
}
lw = layout_new_with_geometry(NULL, &lop, use_commandline ? command_line->geometry : NULL);
options->slideshow.random = FALSE;
options->slideshow.repeat = FALSE;
- options->startup.path = NULL;
- options->startup.restore_path = FALSE;
- options->startup.use_last_path = FALSE;
-
options->thumbnails.cache_into_dirs = FALSE;
options->thumbnails.enable_caching = TRUE;
options->thumbnails.fast = TRUE;
dest->id = g_strdup(src->id);
dest->order = g_strdup(src->order);
dest->home_path = g_strdup(src->home_path);
+ dest->last_path = g_strdup(src->last_path);
}
void free_layout_options_content(LayoutOptions *dest)
g_free(dest->id);
g_free(dest->order);
g_free(dest->home_path);
+ g_free(dest->last_path);
}
LayoutOptions *init_layout_options(LayoutOptions *options)
&options->color_profile.input_type,
&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(lw));
- }
}
}
#endif
static GtkWidget *configwindow = NULL;
-static GtkWidget *startup_path_entry;
static GtkListStore *filter_store = NULL;
static GtkWidget *safe_delete_path_entry;
*-----------------------------------------------------------------------------
*/
-static void startup_path_set_current(GtkWidget *widget, gpointer data)
-{
- gtk_entry_set_text(GTK_ENTRY(startup_path_entry), layout_get_path(NULL));
-}
-
static void zoom_mode_cb(GtkWidget *widget, gpointer data)
{
if (GTK_TOGGLE_BUTTON (widget)->active)
if (options->file_sort.case_sensitive != c_options->file_sort.case_sensitive) refresh = TRUE;
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;
- config_entry_to_option(startup_path_entry, &options->startup.path, remove_trailing_slash);
-
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;
/* general options tab */
static void config_tab_general(GtkWidget *notebook)
{
- GtkWidget *hbox;
GtkWidget *vbox;
- GtkWidget *subvbox;
GtkWidget *group;
GtkWidget *subgroup;
GtkWidget *button;
- GtkWidget *tabcomp;
GtkWidget *ct_button;
GtkWidget *table;
GtkWidget *spin;
vbox = scrolled_notebook_page(notebook, _("General"));
- group = pref_group_new(vbox, FALSE, _("Startup"), GTK_ORIENTATION_VERTICAL);
-
- button = pref_checkbox_new_int(group, _("Restore folder on startup"),
- options->startup.restore_path, &c_options->startup.restore_path);
-
- 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);
- gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
- gtk_widget_show(tabcomp);
-
- 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);
WRITE_NL(); WRITE_BOOL(*options, save_window_positions);
WRITE_NL(); WRITE_BOOL(*options, tools_restore_state);
-// WRITE_SUBTITLE("Startup Options");
-
- WRITE_NL(); WRITE_BOOL(*options, startup.restore_path);
- WRITE_NL(); WRITE_BOOL(*options, startup.use_last_path);
- WRITE_NL(); WRITE_CHAR(*options, startup.path);
-
-
// WRITE_SUBTITLE("File operations Options");
WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename);
if (READ_BOOL(*options, save_window_positions)) continue;
if (READ_BOOL(*options, tools_restore_state)) continue;
- /* startup options */
-
- if (READ_BOOL(*options, startup.restore_path)) continue;
-
- if (READ_BOOL(*options, startup.use_last_path)) continue;
-
- if (READ_CHAR(*options, startup.path)) continue;
-
-
/* properties dialog options */
if (READ_CHAR(*options, properties.tabs_order)) continue;