static void collection_table_toggle_filenames(CollectTable *ct)
{
ct->show_text = !ct->show_text;
- show_icon_names = ct->show_text;
+ options->show_icon_names = ct->show_text;
collection_table_populate_at_new_size(ct, ct->listview->allocation.width, ct->listview->allocation.height, TRUE);
}
ct->focus_column = 0;
ct->focus_info = NULL;
- ct->show_text = show_icon_names;
+ ct->show_text = options->show_icon_names;
ct->sync_idle_id = -1;
ct->drop_idle_id = -1;
#include "main.h"
-GList *filename_filter = NULL;
+#ifdef DEBUG
+gint debug = FALSE;
+#endif
+
ConfOptions *init_options(ConfOptions *options)
{
options->file_sort_case_sensitive = FALSE;
- return options;
-}
-
-/* -- options -- */
-#ifdef DEBUG
-gint debug = FALSE;
-#endif
-
+ /* layout */
+ options->layout_order = NULL;
+ options->layout_style = 0;
-/* layout */
-gchar *layout_order = NULL;
-gint layout_style = 0;
+ options->layout_view_icons = FALSE;
+ options->layout_view_tree = FALSE;
-gint layout_view_icons = FALSE;
-gint layout_view_tree = FALSE;
+ options->show_icon_names = TRUE;
-gint show_icon_names = TRUE;
+ options->tree_descend_subdirs = FALSE;
-gint tree_descend_subdirs = FALSE;
+ options->lazy_image_sync = FALSE;
+ options->update_on_time_change = TRUE;
+ options->exif_rotate_enable = TRUE;
-gint lazy_image_sync = FALSE;
-gint update_on_time_change = TRUE;
-gint exif_rotate_enable = TRUE;
-
-/* color profiles */
-gint color_profile_enabled = FALSE;
-gint color_profile_input_type = 0;
-gchar *color_profile_input_file[COLOR_PROFILE_INPUTS];
-gchar *color_profile_input_name[COLOR_PROFILE_INPUTS];
-gint color_profile_screen_type = 0;
-gchar *color_profile_screen_file = NULL;
-gint color_profile_use_image = TRUE;
+ /* color profiles */
+ options->color_profile_enabled = FALSE;
+ options->color_profile_input_type = 0;
+ options->color_profile_screen_type = 0;
+ options->color_profile_screen_file = NULL;
+ options->color_profile_use_image = TRUE;
+ options->filename_filter = NULL;
+ return options;
+}
gint n;
n = imd->color_profile_input - 1;
- if (!color_profile_input_file[n]) return FALSE;
+ if (!options->color_profile_input_file[n]) return FALSE;
input_type = COLOR_PROFILE_FILE;
- input_file = color_profile_input_file[n];
+ input_file = options->color_profile_input_file[n];
}
else if (imd->color_profile_input == 0)
{
}
if (imd->color_profile_screen == 1 &&
- color_profile_screen_file)
+ options->color_profile_screen_file)
{
screen_type = COLOR_PROFILE_FILE;
- screen_file = color_profile_screen_file;
+ screen_file = options->color_profile_screen_file;
}
else if (imd->color_profile_screen == 0)
{
if (!image_get_pixbuf(imd)) return;
- if (exif_rotate_enable ||
+ if (options->exif_rotate_enable ||
(imd->color_profile_enable && imd->color_profile_use_image) )
{
exif = exif_read_fd(imd->image_fd, (imd->color_profile_enable && imd->color_profile_use_image));
}
- if (exif_rotate_enable && exif)
+ if (options->exif_rotate_enable && exif)
{
gint orientation;
if (!imd || !image_get_pixbuf(imd) ||
imd->il || !imd->image_fd ||
- !update_on_time_change) return TRUE;
+ !options->update_on_time_change) return TRUE;
newtime = filetime(imd->image_fd->path);
if (newtime > 0 && newtime != imd->mtime)
buf = g_strdup_printf("%s %s", front, "sRGB");
g_free(front);
item = menu_item_add_radio(menu, NULL,
- buf, (color_profile_input_type == 0),
+ buf, (options->color_profile_input_type == 0),
G_CALLBACK(layout_color_menu_input_cb), lw);
g_free(buf);
g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0));
{
const gchar *name;
- name = color_profile_input_name[i];
- if (!name) name = filename_from_path(color_profile_input_file[i]);
+ name = options->color_profile_input_name[i];
+ if (!name) name = filename_from_path(options->color_profile_input_file[i]);
front = g_strdup_printf(_("Input _%d:"), i + 1);
end = layout_color_name_parse(name);
G_CALLBACK(layout_color_menu_input_cb), lw);
g_free(buf);
g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(i + 1));
- gtk_widget_set_sensitive(item, active && color_profile_input_file[i]);
+ gtk_widget_set_sensitive(item, active && options->color_profile_input_file[i]);
}
menu_item_add_divider(menu);
_("_Screen profile"), (screen == 1),
G_CALLBACK(layout_color_menu_screen_cb), lw);
g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(1));
- gtk_widget_set_sensitive(item, active && color_profile_screen_file);
+ gtk_widget_set_sensitive(item, active && options->color_profile_screen_file);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME);
#endif /* HAVE_LCMS */
layout_image_set_fd(lw, file_data_new_simple(path));
}
}
- else if (!lazy_image_sync)
+ else if (!options->lazy_image_sync)
{
layout_image_set_index(lw, 0);
}
{
LayoutWindow *lw = data;
- if (!update_on_time_change) return TRUE;
+ if (!options->update_on_time_change) return TRUE;
if (lw->path)
{
LayoutWindow *lw = work->data;
work = work->next;
- layout_style_set(lw, layout_style, layout_order);
+ layout_style_set(lw, options->layout_style, options->layout_order);
}
}
/* default layout */
- layout_config_parse(layout_style, layout_order,
+ layout_config_parse(options->layout_style, options->layout_order,
&lw->dir_location, &lw->file_location, &lw->image_location);
- lw->tree_view = layout_view_tree;
- lw->icon_view = layout_view_icons;
+ lw->tree_view = options->layout_view_tree;
+ lw->icon_view = options->layout_view_icons;
/* divider positions */
layout_image_dnd_init(lw, i);
image_color_profile_set(lw->split_images[i],
- color_profile_input_type, color_profile_screen_type,
- color_profile_use_image);
- image_color_profile_set_use(lw->split_images[i], color_profile_enabled);
+ options->color_profile_input_type,
+ options->color_profile_screen_type,
+ options->color_profile_use_image);
+ image_color_profile_set_use(lw->split_images[i], options->color_profile_enabled);
}
return lw->split_images[i]->widget;
for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
{
- color_profile_input_file[i] = NULL;
- color_profile_input_name[i] = NULL;
+ options->color_profile_input_file[i] = NULL;
+ options->color_profile_input_name[i] = NULL;
}
options->fullscreen_info = g_strdup("%collection%(%number%/%total%) <b>%name%</b>\n"
layout_geometry_get_dividers(NULL, &options->window_hdivider_pos, &options->window_vdivider_pos);
- layout_views_get(NULL, &layout_view_tree, &layout_view_icons);
+ layout_views_get(NULL, &options->layout_view_tree, &options->layout_view_icons);
options->thumbnails_enabled = layout_thumb_get(NULL);
layout_sort_get(NULL, &options->file_sort_method, &options->file_sort_ascending);
layout_tools_float_get(NULL, &options->tools_float, &options->tools_hidden);
options->toolbar_hidden = layout_toolbar_hidden(NULL);
- color_profile_enabled = layout_image_color_profile_get_use(NULL);
+ options->color_profile_enabled = layout_image_color_profile_get_use(NULL);
layout_image_color_profile_get(NULL,
- &color_profile_input_type, &color_profile_screen_type,
- &color_profile_use_image);
+ &options->color_profile_input_type,
+ &options->color_profile_screen_type,
+ &options->color_profile_use_image);
save_options();
keys_save();
printf("%s %s, This is an alpha release.\n", GQ_APPNAME, VERSION);
#endif
options = init_options(NULL);
- layout_order = g_strdup("123");
+ options->layout_order = g_strdup("123"); /* TODO: move to init_options() */
setup_default_options();
load_options();
ConfOptions *options;
-/*
- * Since globals are used everywhere,
- * it is easier to define them here.
- */
-
-extern GList *filename_filter;
-
-/* -- options -- */
#ifdef DEBUG
#endif
-/* layout */
-extern gchar *layout_order;
-extern gint layout_style;
-
-extern gint layout_view_icons;
-extern gint layout_view_tree;
-
-extern gint show_icon_names;
-
-extern gint tree_descend_subdirs;
-
-extern gint lazy_image_sync;
-extern gint update_on_time_change;
-extern gint exif_rotate_enable;
-
-extern gint color_profile_enabled;
-extern gint color_profile_input_type;
-extern gchar *color_profile_input_file[];
-extern gchar *color_profile_input_name[];
-extern gint color_profile_screen_type;
-extern gchar *color_profile_screen_file;
-extern gint color_profile_use_image;
/*
*----------------------------------------------------------------------------
options->fullscreen_info = g_strdup(options_c->fullscreen_info);
}
- update_on_time_change = update_on_time_change_c;
- exif_rotate_enable = exif_rotate_enable_c;
+ options->update_on_time_change = update_on_time_change_c;
+ options->exif_rotate_enable = exif_rotate_enable_c;
options->dupe_custom_threshold = options_c->dupe_custom_threshold;
- tree_descend_subdirs = tree_descend_subdirs_c;
+ options->tree_descend_subdirs = tree_descend_subdirs_c;
#ifdef DEBUG
debug = debug_c;
#endif
#ifdef HAVE_LCMS
for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
{
- g_free(color_profile_input_name[i]);
- color_profile_input_name[i] = NULL;
+ g_free(options->color_profile_input_name[i]);
+ options->color_profile_input_name[i] = NULL;
buf = gtk_entry_get_text(GTK_ENTRY(color_profile_input_name_entry[i]));
- if (buf && strlen(buf) > 0) color_profile_input_name[i] = g_strdup(buf);
+ if (buf && strlen(buf) > 0) options->color_profile_input_name[i] = g_strdup(buf);
- g_free(color_profile_input_file[i]);
- color_profile_input_file[i] = NULL;
+ g_free(options->color_profile_input_file[i]);
+ options->color_profile_input_file[i] = NULL;
buf = gtk_entry_get_text(GTK_ENTRY(color_profile_input_file_entry[i]));
- if (buf && strlen(buf) > 0) color_profile_input_file[i] = g_strdup(buf);
+ if (buf && strlen(buf) > 0) options->color_profile_input_file[i] = g_strdup(buf);
}
- g_free(color_profile_screen_file);
- color_profile_screen_file = NULL;
+ g_free(options->color_profile_screen_file);
+ options->color_profile_screen_file = NULL;
buf = gtk_entry_get_text(GTK_ENTRY(color_profile_screen_file_entry));
- if (buf && strlen(buf) > 0) color_profile_screen_file = g_strdup(buf);
+ if (buf && strlen(buf) > 0) options->color_profile_screen_file = g_strdup(buf);
#endif
for (i=0; ExifUIList[i].key; i++)
l_conf = layout_config_get(layout_widget, &new_style);
- if (new_style != layout_style ||
- (l_conf == NULL) != (layout_order == NULL) ||
- !layout_order ||
- strcmp(buf, layout_order) != 0)
+ if (new_style != options->layout_style ||
+ (l_conf == NULL) != (options->layout_order == NULL) ||
+ !options->layout_order ||
+ strcmp(buf, options->layout_order) != 0)
{
if (refresh) filter_rebuild();
refresh = FALSE;
- g_free(layout_order);
- layout_order = l_conf;
+ g_free(options->layout_order);
+ options->layout_order = l_conf;
l_conf = NULL;
- layout_style = new_style;
+ options->layout_style = new_style;
layout_styles_update();
}
group = pref_group_new(vbox, FALSE, _("Convenience"), GTK_ORIENTATION_VERTICAL);
pref_checkbox_new_int(group, _("Refresh on file change"),
- update_on_time_change, &update_on_time_change_c);
+ options->update_on_time_change, &update_on_time_change_c);
pref_checkbox_new_int(group, _("Preload next image"),
options->enable_read_ahead, &options_c->enable_read_ahead);
pref_checkbox_new_int(group, _("Auto rotate image using Exif information"),
- exif_rotate_enable, &exif_rotate_enable_c);
+ options->exif_rotate_enable, &exif_rotate_enable_c);
}
/* windows tab */
group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL);
layout_widget = layout_config_new();
- layout_config_set(layout_widget, layout_style, layout_order);
+ layout_config_set(layout_widget, options->layout_style, options->layout_order);
gtk_box_pack_start(GTK_BOX(group), layout_widget, FALSE, FALSE, 0);
gtk_widget_show(layout_widget);
}
options->collection_rectangular_selection, &options_c->collection_rectangular_selection);
pref_checkbox_new_int(group, _("Descend folders in tree view"),
- tree_descend_subdirs, &tree_descend_subdirs_c);
+ options->tree_descend_subdirs, &tree_descend_subdirs_c);
pref_checkbox_new_int(group, _("In place renaming"),
options->enable_in_place_rename, &options_c->enable_in_place_rename);
entry = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_NAME_MAX_LENGTH);
gtk_widget_set_size_request(editor_name_entry[i], 30, -1);
- if (color_profile_input_name[i]) gtk_entry_set_text(GTK_ENTRY(entry), color_profile_input_name[i]);
+ if (options->color_profile_input_name[i])
+ {
+ gtk_entry_set_text(GTK_ENTRY(entry), options->color_profile_input_name[i]);
+ }
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i + 1, i + 2,
GTK_FILL | GTK_EXPAND, 0, 0, 0);
gtk_widget_show(entry);
color_profile_input_name_entry[i] = entry;
- tabcomp = tab_completion_new(&entry, color_profile_input_file[i], NULL, NULL);
+ tabcomp = tab_completion_new(&entry, options->color_profile_input_file[i], NULL, NULL);
tab_completion_add_select_button(entry, _("Select color profile"), FALSE);
gtk_widget_set_size_request(entry, 160, -1);
gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, i + 1, i + 2,
pref_table_label(table, 0, COLOR_PROFILE_INPUTS + 1, _("Screen:"), 1.0);
tabcomp = tab_completion_new(&color_profile_screen_file_entry,
- color_profile_screen_file, NULL, NULL);
+ options->color_profile_screen_file, NULL, NULL);
tab_completion_add_select_button(color_profile_screen_file_entry, _("Select color profile"), FALSE);
gtk_widget_set_size_request(color_profile_screen_file_entry, 160, -1);
gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3,
secure_fprintf(ssi, "##### General Options #####\n\n");
- write_int_option(ssi, "layout_style", layout_style);
- write_char_option(ssi, "layout_order", layout_order);
+ write_int_option(ssi, "layout_style", options->layout_style);
+ write_char_option(ssi, "layout_order", options->layout_order);
secure_fputc(ssi, '\n');
- write_bool_option(ssi, "layout_view_as_icons", layout_view_icons);
- write_bool_option(ssi, "layout_view_as_tree", layout_view_tree);
- write_bool_option(ssi, "show_icon_names", show_icon_names);
+ write_bool_option(ssi, "layout_view_as_icons", options->layout_view_icons);
+ write_bool_option(ssi, "layout_view_as_tree", options->layout_view_tree);
+ write_bool_option(ssi, "show_icon_names", options->show_icon_names);
secure_fputc(ssi, '\n');
- write_bool_option(ssi, "tree_descend_folders", tree_descend_subdirs);
- write_bool_option(ssi, "lazy_image_sync", lazy_image_sync);
- write_bool_option(ssi, "update_on_time_change", update_on_time_change);
- write_bool_option(ssi, "exif_auto_rotate", exif_rotate_enable);
+ write_bool_option(ssi, "tree_descend_folders", options->tree_descend_subdirs);
+ write_bool_option(ssi, "lazy_image_sync", options->lazy_image_sync);
+ write_bool_option(ssi, "update_on_time_change", options->update_on_time_change);
+ write_bool_option(ssi, "exif_auto_rotate", options->exif_rotate_enable);
secure_fputc(ssi, '\n');
write_bool_option(ssi, "enable_startup_path", options->startup_path_enable);
"# color profile options will have no effect.\n\n", GQ_APPNAME);
#endif
- write_bool_option(ssi, "color_profile_enabled", color_profile_enabled);
- write_bool_option(ssi, "color_profile_use_image", color_profile_use_image);
- write_int_option(ssi, "color_profile_input_type", color_profile_input_type);
+ write_bool_option(ssi, "color_profile_enabled", options->color_profile_enabled);
+ write_bool_option(ssi, "color_profile_use_image", options->color_profile_use_image);
+ write_int_option(ssi, "color_profile_input_type", options->color_profile_input_type);
for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
{
gchar *buf;
buf = g_strdup_printf("color_profile_input_file_%d", i + 1);
- write_char_option(ssi, buf, color_profile_input_file[i]);
+ write_char_option(ssi, buf, options->color_profile_input_file[i]);
g_free(buf);
buf = g_strdup_printf("color_profile_input_name_%d", i + 1);
- write_char_option(ssi, buf, color_profile_input_name[i]);
+ write_char_option(ssi, buf, options->color_profile_input_name[i]);
g_free(buf);
}
secure_fputc(ssi, '\n');
- write_int_option(ssi, "color_profile_screen_type", color_profile_screen_type);
- write_char_option(ssi, "color_profile_screen_file_1", color_profile_screen_file);
+ write_int_option(ssi, "color_profile_screen_type", options->color_profile_screen_type);
+ write_char_option(ssi, "color_profile_screen_file_1", options->color_profile_screen_file);
secure_fprintf(ssi, "\n##### External Programs #####\n");
secure_fprintf(ssi, "# Maximum of 10 programs (external_1 through external_10)\n");
/* general options */
- layout_style = read_int_option(f, option,
- "layout_style", value, layout_style);
- layout_order = read_char_option(f, option,
- "layout_order", value, layout_order);
- layout_view_icons = read_bool_option(f, option,
- "layout_view_as_icons", value, layout_view_icons);
- layout_view_tree = read_bool_option(f, option,
- "layout_view_as_tree", value, layout_view_tree);
- show_icon_names = read_bool_option(f, option,
- "show_icon_names", value, show_icon_names);
-
- tree_descend_subdirs = read_bool_option(f, option,
- "tree_descend_folders", value, tree_descend_subdirs);
- lazy_image_sync = read_bool_option(f, option,
- "lazy_image_sync", value, lazy_image_sync);
- update_on_time_change = read_bool_option(f, option,
- "update_on_time_change", value, update_on_time_change);
- exif_rotate_enable = read_bool_option(f, option,
- "exif_auto_rotate", value, exif_rotate_enable);
+ options->layout_style = read_int_option(f, option,
+ "layout_style", value, options->layout_style);
+ options->layout_order = read_char_option(f, option,
+ "layout_order", value, options->layout_order);
+ options->layout_view_icons = read_bool_option(f, option,
+ "layout_view_as_icons", value, options->layout_view_icons);
+ options->layout_view_tree = read_bool_option(f, option,
+ "layout_view_as_tree", value, options->layout_view_tree);
+ 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->exif_rotate_enable = read_bool_option(f, option,
+ "exif_auto_rotate", value, options->exif_rotate_enable);
options->startup_path_enable = read_bool_option(f, option,
"enable_startup_path", value, options->startup_path_enable);
/* Color Profiles */
- color_profile_enabled = read_bool_option(f, option,
- "color_profile_enabled", value, color_profile_enabled);
- color_profile_use_image = read_bool_option(f, option,
- "color_profile_use_image", value, color_profile_use_image);
- color_profile_input_type = read_int_option(f, option,
- "color_profile_input_type", value, color_profile_input_type);
+ options->color_profile_enabled = read_bool_option(f, option,
+ "color_profile_enabled", value, options->color_profile_enabled);
+ options->color_profile_use_image = read_bool_option(f, option,
+ "color_profile_use_image", value, options->color_profile_use_image);
+ options->color_profile_input_type = read_int_option(f, option,
+ "color_profile_input_type", value, options->color_profile_input_type);
if (strncasecmp(option, "color_profile_input_file_", 25) == 0)
{
i = strtol(option + 25, NULL, 0) - 1;
if (i >= 0 && i < COLOR_PROFILE_INPUTS)
{
- color_profile_input_file[i] = read_char_option(f, option,
- option, value, color_profile_input_file[i]);
+ options->color_profile_input_file[i] = read_char_option(f, option,
+ option, value, options->color_profile_input_file[i]);
}
}
if (strncasecmp(option, "color_profile_input_name_", 25) == 0)
i = strtol(option + 25, NULL, 0) - 1;
if (i >= 0 && i < COLOR_PROFILE_INPUTS)
{
- color_profile_input_name[i] = read_char_option(f, option,
- option, value, color_profile_input_name[i]);
+ options->color_profile_input_name[i] = read_char_option(f, option,
+ option, value, options->color_profile_input_name[i]);
}
}
- color_profile_screen_type = read_int_option(f, option,
- "color_profile_screen_type", value, color_profile_screen_type);
- color_profile_screen_file = read_char_option(f, option,
- "color_profile_screen_file_1", value, color_profile_screen_file);
+ options->color_profile_screen_type = read_int_option(f, option,
+ "color_profile_screen_type", value, options->color_profile_screen_type);
+ options->color_profile_screen_file = read_char_option(f, option,
+ "color_profile_screen_file_1", value, options->color_profile_screen_file);
/* External Programs */
gint file_sort_case_sensitive; /* file sorting method (case) */
+ /* layout */
+ gchar *layout_order;
+ gint layout_style;
+
+ gint layout_view_icons;
+ gint layout_view_tree;
+
+ gint show_icon_names;
+
+ gint tree_descend_subdirs;
+
+ gint lazy_image_sync;
+ gint update_on_time_change;
+ gint exif_rotate_enable;
+
+ gint color_profile_enabled;
+ gint color_profile_input_type;
+ gchar *color_profile_input_file[COLOR_PROFILE_INPUTS];
+ gchar *color_profile_input_name[COLOR_PROFILE_INPUTS];
+ gint color_profile_screen_type;
+ gchar *color_profile_screen_file;
+ gint color_profile_use_image;
+
+ GList *filename_filter;
};
#endif
gtk_tree_model_get(GTK_TREE_MODEL(store), parent, DIR_COLUMN_POINTER, &pnd, -1);
tpath = gtk_tree_model_get_path(GTK_TREE_MODEL(store), parent);
- if (tree_descend_subdirs &&
+ if (options->tree_descend_subdirs &&
gtk_tree_view_row_expanded(GTK_TREE_VIEW(vdt->treeview), tpath) &&
!nd->expanded)
{
static void vficon_toggle_filenames(ViewFileIcon *vfi)
{
vfi->show_text = !vfi->show_text;
- show_icon_names = vfi->show_text;
+ options->show_icon_names = vfi->show_text;
vficon_populate_at_new_size(vfi, vfi->listview->allocation.width, vfi->listview->allocation.height, TRUE);
}
vfi->focus_column = 0;
vfi->focus_id = NULL;
- vfi->show_text = show_icon_names;
+ vfi->show_text = options->show_icon_names;
vfi->sync_idle_id = -1;