# HG changeset patch # User zas_ # Date 1207987544 0 # Node ID 049d6b00cc14c7368ac5d59a9c0f28d98dd2c11f # Parent 509b84801d66f84567de16f27c33622754740f9f Rename color profile options. diff -r 509b84801d66 -r 049d6b00cc14 src/globals.c --- a/src/globals.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/globals.c Sat Apr 12 08:05:44 2008 +0000 @@ -112,11 +112,11 @@ options->file_sort_case_sensitive = FALSE; /* layout */ - options->layout_order = NULL; - options->layout_style = 0; + options->layout.order = NULL; + options->layout.style = 0; - options->layout_view_icons = FALSE; - options->layout_view_tree = FALSE; + options->layout.view_as_icons = FALSE; + options->layout.view_as_tree = FALSE; options->show_icon_names = TRUE; @@ -127,11 +127,11 @@ options->exif_rotate_enable = 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->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; diff -r 509b84801d66 -r 049d6b00cc14 src/image.c --- a/src/image.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/image.c Sat Apr 12 08:05:44 2008 +0000 @@ -335,10 +335,10 @@ gint n; n = imd->color_profile_input - 1; - if (!options->color_profile_input_file[n]) return FALSE; + if (!options->color_profile.input_file[n]) return FALSE; input_type = COLOR_PROFILE_FILE; - input_file = options->color_profile_input_file[n]; + input_file = options->color_profile.input_file[n]; } else if (imd->color_profile_input == 0) { @@ -351,10 +351,10 @@ } if (imd->color_profile_screen == 1 && - options->color_profile_screen_file) + options->color_profile.screen_file) { screen_type = COLOR_PROFILE_FILE; - screen_file = options->color_profile_screen_file; + screen_file = options->color_profile.screen_file; } else if (imd->color_profile_screen == 0) { diff -r 509b84801d66 -r 049d6b00cc14 src/layout.c --- a/src/layout.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/layout.c Sat Apr 12 08:05:44 2008 +0000 @@ -411,7 +411,7 @@ buf = g_strdup_printf("%s %s", front, "sRGB"); g_free(front); item = menu_item_add_radio(menu, NULL, - buf, (options->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)); @@ -421,8 +421,8 @@ { const gchar *name; - name = options->color_profile_input_name[i]; - if (!name) name = filename_from_path(options->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); @@ -435,7 +435,7 @@ 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 && options->color_profile_input_file[i]); + gtk_widget_set_sensitive(item, active && options->color_profile.input_file[i]); } menu_item_add_divider(menu); @@ -452,7 +452,7 @@ _("_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 && options->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 */ @@ -1704,7 +1704,7 @@ LayoutWindow *lw = work->data; work = work->next; - layout_style_set(lw, options->layout_style, options->layout_order); + layout_style_set(lw, options->layout.style, options->layout.order); } } @@ -1900,10 +1900,10 @@ /* default layout */ - layout_config_parse(options->layout_style, options->layout_order, + layout_config_parse(options->layout.style, options->layout.order, &lw->dir_location, &lw->file_location, &lw->image_location); - lw->tree_view = options->layout_view_tree; - lw->icon_view = options->layout_view_icons; + lw->tree_view = options->layout.view_as_tree; + lw->icon_view = options->layout.view_as_icons; /* divider positions */ diff -r 509b84801d66 -r 049d6b00cc14 src/layout_image.c --- a/src/layout_image.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/layout_image.c Sat Apr 12 08:05:44 2008 +0000 @@ -1704,10 +1704,10 @@ layout_image_dnd_init(lw, i); image_color_profile_set(lw->split_images[i], - 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); + 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; diff -r 509b84801d66 -r 049d6b00cc14 src/main.c --- a/src/main.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/main.c Sat Apr 12 08:05:44 2008 +0000 @@ -1174,8 +1174,8 @@ for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { - options->color_profile_input_file[i] = NULL; - options->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%) %name%\n" @@ -1209,7 +1209,7 @@ layout_geometry_get_dividers(NULL, &options->window_hdivider_pos, &options->window_vdivider_pos); - layout_views_get(NULL, &options->layout_view_tree, &options->layout_view_icons); + layout_views_get(NULL, &options->layout.view_as_tree, &options->layout.view_as_icons); options->thumbnails_enabled = layout_thumb_get(NULL); layout_sort_get(NULL, &options->file_sort_method, &options->file_sort_ascending); @@ -1219,11 +1219,11 @@ layout_tools_float_get(NULL, &options->tools_float, &options->tools_hidden); options->toolbar_hidden = layout_toolbar_hidden(NULL); - options->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, - &options->color_profile_input_type, - &options->color_profile_screen_type, - &options->color_profile_use_image); + &options->color_profile.input_type, + &options->color_profile.screen_type, + &options->color_profile.use_image); save_options(); keys_save(); @@ -1324,7 +1324,7 @@ printf("%s %s, This is an alpha release.\n", GQ_APPNAME, VERSION); #endif options = init_options(NULL); - options->layout_order = g_strdup("123"); /* TODO: move to init_options() */ + options->layout.order = g_strdup("123"); /* TODO: move to init_options() */ setup_default_options(); load_options(); diff -r 509b84801d66 -r 049d6b00cc14 src/preferences.c --- a/src/preferences.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/preferences.c Sat Apr 12 08:05:44 2008 +0000 @@ -266,20 +266,20 @@ #ifdef HAVE_LCMS for (i = 0; i < COLOR_PROFILE_INPUTS; i++) { - g_free(options->color_profile_input_name[i]); - options->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) options->color_profile_input_name[i] = g_strdup(buf); + if (buf && strlen(buf) > 0) options->color_profile.input_name[i] = g_strdup(buf); - g_free(options->color_profile_input_file[i]); - options->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) options->color_profile_input_file[i] = g_strdup(buf); + if (buf && strlen(buf) > 0) options->color_profile.input_file[i] = g_strdup(buf); } - g_free(options->color_profile_screen_file); - options->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) options->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++) @@ -289,19 +289,19 @@ l_conf = layout_config_get(layout_widget, &new_style); - if (new_style != options->layout_style || - (l_conf == NULL) != (options->layout_order == NULL) || - !options->layout_order || - strcmp(buf, options->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(options->layout_order); - options->layout_order = l_conf; + g_free(options->layout.order); + options->layout.order = l_conf; l_conf = NULL; - options->layout_style = new_style; + options->layout.style = new_style; layout_styles_update(); } @@ -974,7 +974,7 @@ group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); layout_widget = layout_config_new(); - layout_config_set(layout_widget, options->layout_style, options->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); } @@ -1405,16 +1405,16 @@ 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 (options->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_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, options->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, @@ -1425,7 +1425,7 @@ pref_table_label(table, 0, COLOR_PROFILE_INPUTS + 1, _("Screen:"), 1.0); tabcomp = tab_completion_new(&color_profile_screen_file_entry, - options->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, diff -r 509b84801d66 -r 049d6b00cc14 src/rcfile.c --- a/src/rcfile.c Sat Apr 12 07:46:01 2008 +0000 +++ b/src/rcfile.c Sat Apr 12 08:05:44 2008 +0000 @@ -275,12 +275,12 @@ secure_fprintf(ssi, "##### General Options #####\n\n"); - write_int_option(ssi, "layout_style", options->layout_style); - write_char_option(ssi, "layout_order", options->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", options->layout_view_icons); - write_bool_option(ssi, "layout_view_as_tree", options->layout_view_tree); + write_bool_option(ssi, "layout.view_as_icons", options->layout.view_as_icons); + write_bool_option(ssi, "layout.view_as_tree", options->layout.view_as_tree); write_bool_option(ssi, "show_icon_names", options->show_icon_names); secure_fputc(ssi, '\n'); @@ -393,24 +393,24 @@ "# color profile options will have no effect.\n\n", GQ_APPNAME); #endif - 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); + 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, options->color_profile_input_file[i]); + buf = g_strdup_printf("color_profile.input_file_%d", i + 1); + 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, options->color_profile_input_name[i]); + buf = g_strdup_printf("color_profile.input_name_%d", i + 1); + 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", options->color_profile_screen_type); - write_char_option(ssi, "color_profile_screen_file_1", options->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", 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"); @@ -527,14 +527,14 @@ /* general options */ - 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->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_as_icons = read_bool_option(f, option, + "layout.view_as_icons", value, options->layout.view_as_icons); + options->layout.view_as_tree = read_bool_option(f, option, + "layout.view_as_tree", value, options->layout.view_as_tree); options->show_icon_names = read_bool_option(f, option, "show_icon_names", value, options->show_icon_names); @@ -704,36 +704,36 @@ /* Color Profiles */ - 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); + 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) + if (strncasecmp(option, "color_profile.input_file_", 25) == 0) { i = strtol(option + 25, NULL, 0) - 1; if (i >= 0 && i < COLOR_PROFILE_INPUTS) { - options->color_profile_input_file[i] = read_char_option(f, option, - option, value, options->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) + if (strncasecmp(option, "color_profile.input_name_", 25) == 0) { i = strtol(option + 25, NULL, 0) - 1; if (i >= 0 && i < COLOR_PROFILE_INPUTS) { - options->color_profile_input_name[i] = read_char_option(f, option, - option, value, options->color_profile_input_name[i]); + options->color_profile.input_name[i] = read_char_option(f, option, + option, value, options->color_profile.input_name[i]); } } - 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); + 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", value, options->color_profile.screen_file); /* External Programs */ diff -r 509b84801d66 -r 049d6b00cc14 src/typedefs.h --- a/src/typedefs.h Sat Apr 12 07:46:01 2008 +0000 +++ b/src/typedefs.h Sat Apr 12 08:05:44 2008 +0000 @@ -827,11 +827,13 @@ gint file_sort_case_sensitive; /* file sorting method (case) */ /* layout */ - gchar *layout_order; - gint layout_style; + struct { + gchar *order; + gint style; - gint layout_view_icons; - gint layout_view_tree; + gint view_as_icons; + gint view_as_tree; + } layout; gint show_icon_names; @@ -841,13 +843,16 @@ 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; + struct { + gint enabled; + gint input_type; + gchar *input_file[COLOR_PROFILE_INPUTS]; + gchar *input_name[COLOR_PROFILE_INPUTS]; + gint screen_type; + gchar *screen_file; + gint use_image; + + } color_profile; GList *filename_filter; };