comparison src/preferences.c @ 113:55166d93498d

Fri Nov 24 21:37:01 2006 John Ellis <johne@verizon.net> * configure.in: Add test for lcms (little cms). * Makefile.am: Add color-man.[ch]: * color-man.[ch]: New files for color management support. * globals.c, gqview.h, main.c, rcfile.c, typedefs.h: Add color profile variables and option saving. * image.[ch]: Add color profile functions. * layout.c, layout_image.[ch]: Add color profile icon, popup menu, and fix sort menu to use radio buttons. * menu.c: Use radio buttons for sort menu when appropriate. * preferences.c: Add color profile options to preferences. * ui_menu.[ch]: Add menu_item_add_radio() for radio item menus. * ui_misc.c: Fix gtk_table_attach() arg for vertical expansion. * view_file_icon.c, view_file_list.c: Check for active state in sort menu callbacks. * README: Add info about lcms, and how to disable.
author gqview
date Sat, 25 Nov 2006 03:00:33 +0000
parents d063f97503b7
children 9009856628f7
comparison
equal deleted inserted replaced
112:b15d4c18168f 113:55166d93498d
136 static gint tree_descend_subdirs_c; 136 static gint tree_descend_subdirs_c;
137 137
138 static gint update_on_time_change_c; 138 static gint update_on_time_change_c;
139 static gint exif_rotate_enable_c; 139 static gint exif_rotate_enable_c;
140 140
141 static GtkWidget *color_profile_input_file_entry[COLOR_PROFILE_INPUTS];
142 static GtkWidget *color_profile_input_name_entry[COLOR_PROFILE_INPUTS];
143 static GtkWidget *color_profile_screen_file_entry;
144
141 145
142 /* 146 /*
143 *----------------------------------------------------------------------------- 147 *-----------------------------------------------------------------------------
144 * option widget callbacks (private) 148 * option widget callbacks (private)
145 *----------------------------------------------------------------------------- 149 *-----------------------------------------------------------------------------
286 290
287 dupe_custom_threshold = dupe_custom_threshold_c; 291 dupe_custom_threshold = dupe_custom_threshold_c;
288 292
289 tree_descend_subdirs = tree_descend_subdirs_c; 293 tree_descend_subdirs = tree_descend_subdirs_c;
290 294
295 #ifdef HAVE_LCMS
296 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
297 {
298 g_free(color_profile_input_name[i]);
299 color_profile_input_name[i] = NULL;
300 buf = gtk_entry_get_text(GTK_ENTRY(color_profile_input_name_entry[i]));
301 if (buf && strlen(buf) > 0) color_profile_input_name[i] = g_strdup(buf);
302
303 g_free(color_profile_input_file[i]);
304 color_profile_input_file[i] = NULL;
305 buf = gtk_entry_get_text(GTK_ENTRY(color_profile_input_file_entry[i]));
306 if (buf && strlen(buf) > 0) color_profile_input_file[i] = g_strdup(buf);
307 }
308 g_free(color_profile_screen_file);
309 color_profile_screen_file = NULL;
310 buf = gtk_entry_get_text(GTK_ENTRY(color_profile_screen_file_entry));
311 if (buf && strlen(buf) > 0) color_profile_screen_file = g_strdup(buf);
312 #endif
313
291 l_conf = layout_config_get(layout_widget, &new_style); 314 l_conf = layout_config_get(layout_widget, &new_style);
292 315
293 if (new_style != layout_style || 316 if (new_style != layout_style ||
294 (l_conf == NULL) != (layout_order == NULL) || 317 (l_conf == NULL) != (layout_order == NULL) ||
295 !layout_order || 318 !layout_order ||
401 424
402 g_signal_connect(G_OBJECT(combo), "changed", 425 g_signal_connect(G_OBJECT(combo), "changed",
403 G_CALLBACK(quality_menu_cb), option_c); 426 G_CALLBACK(quality_menu_cb), option_c);
404 427
405 gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, 428 gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1,
406 GTK_EXPAND | GTK_FILL, FALSE, 0, 0); 429 GTK_EXPAND | GTK_FILL, 0, 0, 0);
407 gtk_widget_show(combo); 430 gtk_widget_show(combo);
408 } 431 }
409 432
410 #if 0 433 #if 0
411 static void add_dither_menu(gint option, gint *option_c, gchar *text, GtkWidget *box) 434 static void add_dither_menu(gint option, gint *option_c, gchar *text, GtkWidget *box)
512 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current); 535 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current);
513 g_signal_connect(G_OBJECT(combo), "changed", 536 g_signal_connect(G_OBJECT(combo), "changed",
514 G_CALLBACK(thumb_size_menu_cb), NULL); 537 G_CALLBACK(thumb_size_menu_cb), NULL);
515 538
516 gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1, 539 gtk_table_attach(GTK_TABLE(table), combo, column + 1, column + 2, row, row + 1,
517 GTK_EXPAND | GTK_FILL, FALSE, 0, 0); 540 GTK_EXPAND | GTK_FILL, 0, 0, 0);
518 gtk_widget_show(combo); 541 gtk_widget_show(combo);
519 } 542 }
520 543
521 static void filter_store_populate(void) 544 static void filter_store_populate(void)
522 { 545 {
1101 editor_name_entry[i] = gtk_entry_new(); 1124 editor_name_entry[i] = gtk_entry_new();
1102 gtk_entry_set_max_length(GTK_ENTRY(editor_name_entry[i]), EDITOR_NAME_MAX_LENGTH); 1125 gtk_entry_set_max_length(GTK_ENTRY(editor_name_entry[i]), EDITOR_NAME_MAX_LENGTH);
1103 gtk_widget_set_size_request(editor_name_entry[i],80,-1); 1126 gtk_widget_set_size_request(editor_name_entry[i],80,-1);
1104 if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]); 1127 if (editor_name[i]) gtk_entry_set_text(GTK_ENTRY(editor_name_entry[i]),editor_name[i]);
1105 gtk_table_attach(GTK_TABLE (table),editor_name_entry[i],1,2,i+1,i+2, 1128 gtk_table_attach(GTK_TABLE (table),editor_name_entry[i],1,2,i+1,i+2,
1106 GTK_FILL | GTK_EXPAND, FALSE, 0, 0); 1129 GTK_FILL | GTK_EXPAND, 0, 0, 0);
1107 gtk_widget_show(editor_name_entry[i]); 1130 gtk_widget_show(editor_name_entry[i]);
1108 1131
1109 editor_command_entry[i] = gtk_entry_new(); 1132 editor_command_entry[i] = gtk_entry_new();
1110 gtk_entry_set_max_length(GTK_ENTRY(editor_command_entry[i]), EDITOR_COMMAND_MAX_LENGTH); 1133 gtk_entry_set_max_length(GTK_ENTRY(editor_command_entry[i]), EDITOR_COMMAND_MAX_LENGTH);
1111 gtk_widget_set_size_request(editor_command_entry[i],160,-1); 1134 gtk_widget_set_size_request(editor_command_entry[i],160,-1);
1112 tab_completion_add_to_entry(editor_command_entry[i], NULL, NULL); 1135 tab_completion_add_to_entry(editor_command_entry[i], NULL, NULL);
1113 if (editor_command[i]) gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]), editor_command[i]); 1136 if (editor_command[i]) gtk_entry_set_text(GTK_ENTRY(editor_command_entry[i]), editor_command[i]);
1114 gtk_table_attach(GTK_TABLE (table),editor_command_entry[i],2,3,i+1,i+2, 1137 gtk_table_attach(GTK_TABLE (table),editor_command_entry[i],2,3,i+1,i+2,
1115 GTK_FILL | GTK_EXPAND, FALSE, 0, 0); 1138 GTK_FILL | GTK_EXPAND, 0, 0, 0);
1116 gtk_widget_show(editor_command_entry[i]); 1139 gtk_widget_show(editor_command_entry[i]);
1117 } 1140 }
1118 1141
1119 hbox = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP); 1142 hbox = pref_box_new(vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_BUTTON_GAP);
1120 1143
1225 0, 100, 1, dupe_custom_threshold, &dupe_custom_threshold_c); 1248 0, 100, 1, dupe_custom_threshold, &dupe_custom_threshold_c);
1226 1249
1227 pref_spin_new_int(group, _("Offscreen cache size (Mb per image):"), NULL, 1250 pref_spin_new_int(group, _("Offscreen cache size (Mb per image):"), NULL,
1228 0, 128, 1, tile_cache_max, &tile_cache_max_c); 1251 0, 128, 1, tile_cache_max, &tile_cache_max_c);
1229 1252
1253 group = pref_group_new(vbox, FALSE, _("Color profiles"), GTK_ORIENTATION_VERTICAL);
1254 #ifndef HAVE_LCMS
1255 gtk_widget_set_sensitive(pref_group_parent(group), FALSE);
1256 #endif
1257
1258 table = pref_table_new(group, 3, COLOR_PROFILE_INPUTS + 2, FALSE, FALSE);
1259 gtk_table_set_col_spacings(GTK_TABLE(table), PREF_PAD_GAP);
1260
1261 label = pref_table_label(table, 0, 0, _("Type"), 0.0);
1262 pref_label_bold(label, TRUE, FALSE);
1263
1264 label = pref_table_label(table, 1, 0, _("Menu name"), 0.0);
1265 pref_label_bold(label, TRUE, FALSE);
1266
1267 label = pref_table_label(table, 2, 0, _("File"), 0.0);
1268 pref_label_bold(label, TRUE, FALSE);
1269
1270 for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
1271 {
1272 GtkWidget *entry;
1273 gchar *buf;
1274
1275 buf = g_strdup_printf("Input %d:", i + 1);
1276 pref_table_label(table, 0, i + 1, buf, 1.0);
1277 g_free(buf);
1278
1279 entry = gtk_entry_new();
1280 gtk_entry_set_max_length(GTK_ENTRY(entry), EDITOR_NAME_MAX_LENGTH);
1281 gtk_widget_set_size_request(editor_name_entry[i], 30, -1);
1282 if (color_profile_input_name[i]) gtk_entry_set_text(GTK_ENTRY(entry), color_profile_input_name[i]);
1283 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i + 1, i + 2,
1284 GTK_FILL | GTK_EXPAND, 0, 0, 0);
1285 gtk_widget_show(entry);
1286 color_profile_input_name_entry[i] = entry;
1287
1288 tabcomp = tab_completion_new(&entry, color_profile_input_file[i], NULL, NULL);
1289 tab_completion_add_select_button(entry, _("Select color profile"), FALSE);
1290 gtk_widget_set_size_request(entry, 160, -1);
1291 gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3, i + 1, i + 2,
1292 GTK_FILL | GTK_EXPAND, 0, 0, 0);
1293 gtk_widget_show(tabcomp);
1294 color_profile_input_file_entry[i] = entry;
1295 }
1296
1297 pref_table_label(table, 0, COLOR_PROFILE_INPUTS + 1, _("Screen:"), 1.0);
1298 tabcomp = tab_completion_new(&color_profile_screen_file_entry,
1299 color_profile_screen_file, NULL, NULL);
1300 tab_completion_add_select_button(color_profile_screen_file_entry, _("Select color profile"), FALSE);
1301 gtk_widget_set_size_request(color_profile_screen_file_entry, 160, -1);
1302 gtk_table_attach(GTK_TABLE(table), tabcomp, 2, 3,
1303 COLOR_PROFILE_INPUTS + 1, COLOR_PROFILE_INPUTS + 2,
1304 GTK_FILL | GTK_EXPAND, 0, 0, 0);
1305 gtk_widget_show(tabcomp);
1306
1230 gtk_widget_show(notebook); 1307 gtk_widget_show(notebook);
1231 1308
1232 gtk_widget_show(configwindow); 1309 gtk_widget_show(configwindow);
1233 } 1310 }
1234 1311