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->safe_delete_path);
- options->safe_delete_path = NULL;
+ 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));
- if (buf && strlen(buf) > 0) options->safe_delete_path = remove_trailing_slash(buf);
+ if (buf && strlen(buf) > 0) options->file_ops.safe_delete_path = remove_trailing_slash(buf);
if (options->file_filter.show_dot_files != c_options->file_filter.show_dot_files) refresh = TRUE;
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_path_enable = c_options->startup_path_enable;
- options->confirm_delete = c_options->confirm_delete;
- options->enable_delete_key = c_options->enable_delete_key;
- options->safe_delete_enable = c_options->safe_delete_enable;
- options->safe_delete_size = c_options->safe_delete_size;
+ 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;
+ options->file_ops.safe_delete_folder_maxsize = c_options->file_ops.safe_delete_folder_maxsize;
options->layout.tools_restore_state = c_options->layout.tools_restore_state;
options->layout.save_window_positions = c_options->layout.save_window_positions;
options->image.zoom_mode = c_options->image.zoom_mode;
options->mousewheel_scrolls = c_options->mousewheel_scrolls;
- options->enable_in_place_rename = c_options->enable_in_place_rename;
+ options->file_ops.enable_in_place_rename = c_options->file_ops.enable_in_place_rename;
options->collections.rectangular_selection = c_options->collections.rectangular_selection;
entry = gtk_entry_new();
GTK_WIDGET_UNSET_FLAGS(entry, GTK_CAN_FOCUS);
gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
- if (options->safe_delete_path) gtk_entry_set_text(GTK_ENTRY(entry), options->safe_delete_path);
+ if (options->file_ops.safe_delete_path) gtk_entry_set_text(GTK_ENTRY(entry), options->file_ops.safe_delete_path);
gtk_box_pack_start(GTK_BOX(gd->vbox), entry, FALSE, FALSE, 0);
gtk_widget_show(entry);
gtk_widget_show(gd->dialog);
group = pref_group_new(vbox, FALSE, _("Delete"), GTK_ORIENTATION_VERTICAL);
pref_checkbox_new_int(group, _("Confirm file delete"),
- options->confirm_delete, &c_options->confirm_delete);
+ options->file_ops.confirm_delete, &c_options->file_ops.confirm_delete);
pref_checkbox_new_int(group, _("Enable Delete key"),
- options->enable_delete_key, &c_options->enable_delete_key);
+ options->file_ops.enable_delete_key, &c_options->file_ops.enable_delete_key);
ct_button = pref_checkbox_new_int(group, _("Safe delete"),
- options->safe_delete_enable, &c_options->safe_delete_enable);
+ options->file_ops.safe_delete_enable, &c_options->file_ops.safe_delete_enable);
hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
pref_checkbox_link_sensitivity(ct_button, hbox);
pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_SPACE);
pref_label_new(hbox, _("Folder:"));
- tabcomp = tab_completion_new(&safe_delete_path_entry, options->safe_delete_path, NULL, NULL);
+ tabcomp = tab_completion_new(&safe_delete_path_entry, options->file_ops.safe_delete_path, NULL, NULL);
tab_completion_add_select_button(safe_delete_path_entry, NULL, TRUE);
gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0);
gtk_widget_show(tabcomp);
pref_spacer(hbox, PREF_PAD_INDENT - PREF_PAD_GAP);
spin = pref_spin_new_int(hbox, _("Maximum size:"), _("MB"),
- 0, 2048, 1, options->safe_delete_size, &c_options->safe_delete_size);
+ 0, 2048, 1, options->file_ops.safe_delete_folder_maxsize, &c_options->file_ops.safe_delete_folder_maxsize);
#if GTK_CHECK_VERSION(2,12,0)
gtk_widget_set_tooltip_markup(spin, _("Set to 0 for unlimited size"));
#endif
options->tree_descend_subdirs, &c_options->tree_descend_subdirs);
pref_checkbox_new_int(group, _("In place renaming"),
- options->enable_in_place_rename, &c_options->enable_in_place_rename);
+ options->file_ops.enable_in_place_rename, &c_options->file_ops.enable_in_place_rename);
group = pref_group_new(vbox, FALSE, _("Navigation"), GTK_ORIENTATION_VERTICAL);
write_bool_option(ssi, "progressive_keyboard_scrolling", options->progressive_key_scrolling);
write_bool_option(ssi, "local_metadata", options->enable_metadata_dirs);
- write_bool_option(ssi, "confirm_delete", options->confirm_delete);
- write_bool_option(ssi, "enable_delete_key", options->enable_delete_key);
- write_bool_option(ssi, "safe_delete", options->safe_delete_enable);
- write_char_option(ssi, "safe_delete_path", options->safe_delete_path);
- write_int_option(ssi, "safe_delete_size", options->safe_delete_size);
- secure_fputc(ssi, '\n');
-
write_int_option(ssi, "custom_similarity_threshold", options->dupe_custom_threshold);
secure_fputc(ssi, '\n');
write_bool_option(ssi, "mouse_wheel_scrolls", options->mousewheel_scrolls);
- write_bool_option(ssi, "in_place_rename", options->enable_in_place_rename);
write_int_option(ssi, "open_recent_max", options->recent_list_max);
write_bool_option(ssi, "display_dialogs_under_mouse", options->place_dialogs_under_mouse);
-
+
+ secure_fprintf(ssi, "\n##### File operations Options #####\n\n");
+
+ write_bool_option(ssi, "file_ops.enable_in_place_rename", options->file_ops.enable_in_place_rename);
+ write_bool_option(ssi, "file_ops.confirm_delete", options->file_ops.confirm_delete);
+ write_bool_option(ssi, "file_ops.enable_delete_key", options->file_ops.enable_delete_key);
+ write_bool_option(ssi, "file_ops.safe_delete_enable", options->file_ops.safe_delete_enable);
+ write_char_option(ssi, "file_ops.safe_delete_path", options->file_ops.safe_delete_path);
+ write_int_option(ssi, "file_ops.safe_delete_folder_maxsize", options->file_ops.safe_delete_folder_maxsize);
+
+
secure_fprintf(ssi, "\n##### Layout Options #####\n\n");
write_int_option(ssi, "layout.style", options->layout.style);
strncpy(option, s_buf, sizeof(option));
strncpy(value, s_buf_ptr, sizeof(value));
+
+ /* general options */
+ options->show_icon_names = read_bool_option(f, option,
+ "show_icon_names", value, options->show_icon_names);
+
+ options->tree_descend_subdirs = read_bool_option(f, option,
+ "tree_descend_folders", value, options->tree_descend_subdirs);
+ options->lazy_image_sync = read_bool_option(f, option,
+ "lazy_image_sync", value, options->lazy_image_sync);
+ options->update_on_time_change = read_bool_option(f, option,
+ "update_on_time_change", value, options->update_on_time_change);
+
+ options->startup_path_enable = read_bool_option(f, option,
+ "enable_startup_path", value, options->startup_path_enable);
+ options->startup_path = read_char_option(f, option,
+ "startup_path", value_all, options->startup_path);
+
+ options->dupe_custom_threshold = read_int_option(f, option,
+ "custom_similarity_threshold", value, options->dupe_custom_threshold);
+
+ options->progressive_key_scrolling = read_bool_option(f, option,
+ "progressive_keyboard_scrolling", value, options->progressive_key_scrolling);
+
+ options->enable_metadata_dirs = read_bool_option(f, option,
+ "local_metadata", value, options->enable_metadata_dirs);
+
+ options->mousewheel_scrolls = read_bool_option(f, option,
+ "mouse_wheel_scrolls", value, options->mousewheel_scrolls);
+
+ options->recent_list_max = read_int_option(f, option,
+ "open_recent_max", value, options->recent_list_max);
+
+ options->place_dialogs_under_mouse = read_bool_option(f, option,
+ "display_dialogs_under_mouse", value, options->place_dialogs_under_mouse);
+
+
/* layout options */
options->layout.style = read_int_option(f, option,
"layout.toolbar_hidden", value, options->layout.toolbar_hidden);
- /* general options */
- options->show_icon_names = read_bool_option(f, option,
- "show_icon_names", value, options->show_icon_names);
-
- options->tree_descend_subdirs = read_bool_option(f, option,
- "tree_descend_folders", value, options->tree_descend_subdirs);
- options->lazy_image_sync = read_bool_option(f, option,
- "lazy_image_sync", value, options->lazy_image_sync);
- options->update_on_time_change = read_bool_option(f, option,
- "update_on_time_change", value, options->update_on_time_change);
-
- options->startup_path_enable = read_bool_option(f, option,
- "enable_startup_path", value, options->startup_path_enable);
- options->startup_path = read_char_option(f, option,
- "startup_path", value_all, options->startup_path);
-
/* image options */
if (strcasecmp(option, "image.zoom_mode") == 0)
{
read_color_option(f, option,
"image.border_color", value, &options->image.border_color);
- options->progressive_key_scrolling = read_bool_option(f, option,
- "progressive_keyboard_scrolling", value, options->progressive_key_scrolling);
-
/* thumbnails options */
options->thumbnails.max_width = read_int_option(f, option,
options->thumbnails.quality = CLAMP(read_int_option(f, option,
"thumbnails.quality", value, options->thumbnails.quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER);
- options->enable_metadata_dirs = read_bool_option(f, option,
- "local_metadata", value, options->enable_metadata_dirs);
-
/* file sorting options */
options->file_sort.method = (SortType)read_int_option(f, option,
"file_sort.method", value, (gint)options->file_sort.method);
options->file_sort.case_sensitive = read_bool_option(f, option,
"file_sort.case_sensitive", value, options->file_sort.case_sensitive);
- options->confirm_delete = read_bool_option(f, option,
- "confirm_delete", value, options->confirm_delete);
- options->enable_delete_key = read_bool_option(f, option,
- "enable_delete_key", value, options->enable_delete_key);
- options->safe_delete_enable = read_bool_option(f, option,
- "safe_delete", value, options->safe_delete_enable);
- options->safe_delete_path = read_char_option(f, option,
- "safe_delete_path", value, options->safe_delete_path);
- options->safe_delete_size = read_int_option(f, option,
- "safe_delete_size", value,options->safe_delete_size);
-
- options->mousewheel_scrolls = read_bool_option(f, option,
- "mouse_wheel_scrolls", value, options->mousewheel_scrolls);
- options->enable_in_place_rename = read_bool_option(f, option,
- "in_place_rename", value, options->enable_in_place_rename);
-
- options->recent_list_max = read_int_option(f, option,
- "open_recent_max", value, options->recent_list_max);
-
- options->place_dialogs_under_mouse = read_bool_option(f, option,
- "display_dialogs_under_mouse", value, options->place_dialogs_under_mouse);
-
+ /* file operations options */
+ options->file_ops.enable_in_place_rename = read_bool_option(f, option,
+ "file_ops.enable_in_place_rename", value, options->file_ops.enable_in_place_rename);
+ options->file_ops.confirm_delete = read_bool_option(f, option,
+ "file_ops.confirm_delete", value, options->file_ops.confirm_delete);
+ options->file_ops.enable_delete_key = read_bool_option(f, option,
+ "file_ops.enable_delete_key", value, options->file_ops.enable_delete_key);
+ options->file_ops.safe_delete_enable = read_bool_option(f, option,
+ "file_ops.safe_delete_enable", value, options->file_ops.safe_delete_enable);
+ options->file_ops.safe_delete_path = read_char_option(f, option,
+ "file_ops.safe_delete_path", value, options->file_ops.safe_delete_path);
+ options->file_ops.safe_delete_folder_maxsize = read_int_option(f, option,
+ "file_ops.safe_delete_folder_maxsize", value,options->file_ops.safe_delete_folder_maxsize);
+
+ /* fullscreen options */
options->fullscreen.screen = read_int_option(f, option,
"fullscreen.screen", value, options->fullscreen.screen);
options->fullscreen.clean_flip = read_bool_option(f, option,
options->fullscreen.info = read_char_option(f, option,
"fullscreen.info", value_all, options->fullscreen.info);
- options->dupe_custom_threshold = read_int_option(f, option,
- "custom_similarity_threshold", value, options->dupe_custom_threshold);
-
/* slideshow options */
options->slideshow.delay = read_int_unit_option(f, option,
gint sorted = FALSE;
gint warned = FALSE;
- if (!filelist_read(options->safe_delete_path, &list, NULL)) return 0;
+ if (!filelist_read(options->file_ops.safe_delete_path, &list, NULL)) return 0;
work = list;
while (work)
total += fd->size;
}
- while (options->safe_delete_size > 0 && list &&
- (free_space < 0 || total + free_space > (gint64)options->safe_delete_size * 1048576) )
+ while (options->file_ops.safe_delete_folder_maxsize > 0 && list &&
+ (free_space < 0 || total + free_space > (gint64)options->file_ops.safe_delete_folder_maxsize * 1048576) )
{
FileData *fd;
gint n;
n = file_util_safe_number(filesize(path));
- return g_strdup_printf("%s/%06d_%s", options->safe_delete_path, n, filename_from_path(path));
+ return g_strdup_printf("%s/%06d_%s", options->file_ops.safe_delete_path, n, filename_from_path(path));
}
static void file_util_safe_del_toggle_cb(GtkWidget *button, gpointer data)
{
- options->safe_delete_enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
+ options->file_ops.safe_delete_enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
}
static void file_util_safe_del_close_cb(GtkWidget *dialog, gpointer data)
if (!isfile(fd->path)) return FALSE;
- if (!options->safe_delete_enable)
+ if (!options->file_ops.safe_delete_enable)
{
return unlink_file(fd->path);
}
- if (!isdir(options->safe_delete_path))
+ if (!isdir(options->file_ops.safe_delete_path))
{
- if (debug) printf("creating trash: %s\n", options->safe_delete_path);
- if (!options->safe_delete_path || !mkdir_utf8(options->safe_delete_path, 0755))
+ if (debug) printf("creating trash: %s\n", options->file_ops.safe_delete_path);
+ if (!options->file_ops.safe_delete_path || !mkdir_utf8(options->file_ops.safe_delete_path, 0755))
{
result = _("Could not create folder");
success = FALSE;
GtkWidget *button;
gchar *buf;
- buf = g_strdup_printf(_("Unable to access or create the trash folder.\n\"%s\""), options->safe_delete_path);
+ buf = g_strdup_printf(_("Unable to access or create the trash folder.\n\"%s\""), options->file_ops.safe_delete_path);
gd = file_util_warning_dialog(result, buf, GTK_STOCK_DIALOG_WARNING, NULL);
g_free(buf);
}
else
{
- if (options->safe_delete_enable)
+ if (options->file_ops.safe_delete_enable)
{
gchar *buf2;
- if (options->safe_delete_size > 0)
- buf2 = g_strdup_printf(_(" (max. %d MB)"), options->safe_delete_size);
+ if (options->file_ops.safe_delete_folder_maxsize > 0)
+ buf2 = g_strdup_printf(_(" (max. %d MB)"), options->file_ops.safe_delete_folder_maxsize);
else
buf2 = g_strdup("");
- buf = g_strdup_printf(_("Safe delete: %s%s\nTrash: %s"), _("on"), buf2, options->safe_delete_path);
+ buf = g_strdup_printf(_("Safe delete: %s%s\nTrash: %s"), _("on"), buf2, options->file_ops.safe_delete_path);
g_free(buf2);
}
else
static void file_util_delete_multiple(GList *source_list, GtkWidget *parent)
{
- if (!options->confirm_delete)
+ if (!options->file_ops.confirm_delete)
{
file_util_delete_multiple_ok_cb(NULL, source_list);
}
static void file_util_delete_single(FileData *fd, GtkWidget *parent)
{
- if (!options->confirm_delete)
+ if (!options->file_ops.confirm_delete)
{
file_util_delete_ok_cb(NULL, file_data_ref(fd));
}