Mercurial > geeqie.yaz
comparison src/preferences.c @ 1436:d7a6fb7a90dd
completely separated global and layout window options
layout window configuration is available under separate menu entry
author | nadvornik |
---|---|
date | Sat, 14 Mar 2009 23:26:42 +0000 |
parents | 67573155210c |
children | a3d3208b0c50 |
comparison
equal
deleted
inserted
replaced
1435:8355da717c68 | 1436:d7a6fb7a90dd |
---|---|
95 static gint debug_c; | 95 static gint debug_c; |
96 #endif | 96 #endif |
97 | 97 |
98 static GtkWidget *configwindow = NULL; | 98 static GtkWidget *configwindow = NULL; |
99 static GtkWidget *startup_path_entry; | 99 static GtkWidget *startup_path_entry; |
100 static GtkWidget *home_path_entry; | |
101 static GtkListStore *filter_store = NULL; | 100 static GtkListStore *filter_store = NULL; |
102 | |
103 static GtkWidget *layout_widget; | |
104 | 101 |
105 static GtkWidget *safe_delete_path_entry; | 102 static GtkWidget *safe_delete_path_entry; |
106 | 103 |
107 static GtkWidget *color_profile_input_file_entry[COLOR_PROFILE_INPUTS]; | 104 static GtkWidget *color_profile_input_file_entry[COLOR_PROFILE_INPUTS]; |
108 static GtkWidget *color_profile_input_name_entry[COLOR_PROFILE_INPUTS]; | 105 static GtkWidget *color_profile_input_name_entry[COLOR_PROFILE_INPUTS]; |
123 static void startup_path_set_current(GtkWidget *widget, gpointer data) | 120 static void startup_path_set_current(GtkWidget *widget, gpointer data) |
124 { | 121 { |
125 gtk_entry_set_text(GTK_ENTRY(startup_path_entry), layout_get_path(NULL)); | 122 gtk_entry_set_text(GTK_ENTRY(startup_path_entry), layout_get_path(NULL)); |
126 } | 123 } |
127 | 124 |
128 static void home_path_set_current(GtkWidget *widget, gpointer data) | |
129 { | |
130 gtk_entry_set_text(GTK_ENTRY(home_path_entry), layout_get_path(NULL)); | |
131 } | |
132 | |
133 static void zoom_mode_cb(GtkWidget *widget, gpointer data) | 125 static void zoom_mode_cb(GtkWidget *widget, gpointer data) |
134 { | 126 { |
135 if (GTK_TOGGLE_BUTTON (widget)->active) | 127 if (GTK_TOGGLE_BUTTON (widget)->active) |
136 c_options->image.zoom_mode = GPOINTER_TO_INT(data); | 128 c_options->image.zoom_mode = GPOINTER_TO_INT(data); |
137 } | 129 } |
157 *----------------------------------------------------------------------------- | 149 *----------------------------------------------------------------------------- |
158 * sync progam to config window routine (private) | 150 * sync progam to config window routine (private) |
159 *----------------------------------------------------------------------------- | 151 *----------------------------------------------------------------------------- |
160 */ | 152 */ |
161 | 153 |
162 static void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(const gchar *)) | 154 void config_entry_to_option(GtkWidget *entry, gchar **option, gchar *(*func)(const gchar *)) |
163 { | 155 { |
164 const gchar *buf; | 156 const gchar *buf; |
165 | 157 |
166 g_free(*option); | 158 g_free(*option); |
167 *option = NULL; | 159 *option = NULL; |
224 } | 216 } |
225 #endif | 217 #endif |
226 | 218 |
227 static void config_window_apply(void) | 219 static void config_window_apply(void) |
228 { | 220 { |
229 gint new_style; | |
230 gint i; | 221 gint i; |
231 gint refresh = FALSE; | 222 gint refresh = FALSE; |
232 | 223 |
233 // config_parse_editor_entries(editor_name_entry, editor_command_entry); | 224 // config_parse_editor_entries(editor_name_entry, editor_command_entry); |
234 // layout_edit_update_all(); | 225 // layout_edit_update_all(); |
241 if (options->file_filter.disable != c_options->file_filter.disable) refresh = TRUE; | 232 if (options->file_filter.disable != c_options->file_filter.disable) refresh = TRUE; |
242 | 233 |
243 options->startup.restore_path = c_options->startup.restore_path; | 234 options->startup.restore_path = c_options->startup.restore_path; |
244 options->startup.use_last_path = c_options->startup.use_last_path; | 235 options->startup.use_last_path = c_options->startup.use_last_path; |
245 config_entry_to_option(startup_path_entry, &options->startup.path, remove_trailing_slash); | 236 config_entry_to_option(startup_path_entry, &options->startup.path, remove_trailing_slash); |
246 config_entry_to_option(home_path_entry, &options->layout.home_path, remove_trailing_slash); | |
247 | 237 |
248 options->file_ops.confirm_delete = c_options->file_ops.confirm_delete; | 238 options->file_ops.confirm_delete = c_options->file_ops.confirm_delete; |
249 options->file_ops.enable_delete_key = c_options->file_ops.enable_delete_key; | 239 options->file_ops.enable_delete_key = c_options->file_ops.enable_delete_key; |
250 options->file_ops.safe_delete_enable = c_options->file_ops.safe_delete_enable; | 240 options->file_ops.safe_delete_enable = c_options->file_ops.safe_delete_enable; |
251 options->file_ops.safe_delete_folder_maxsize = c_options->file_ops.safe_delete_folder_maxsize; | 241 options->file_ops.safe_delete_folder_maxsize = c_options->file_ops.safe_delete_folder_maxsize; |
252 options->layout.tools_restore_state = c_options->layout.tools_restore_state; | 242 options->tools_restore_state = c_options->tools_restore_state; |
253 options->layout.save_window_positions = c_options->layout.save_window_positions; | 243 options->save_window_positions = c_options->save_window_positions; |
254 options->image.zoom_mode = c_options->image.zoom_mode; | 244 options->image.zoom_mode = c_options->image.zoom_mode; |
255 options->image.scroll_reset_method = c_options->image.scroll_reset_method; | 245 options->image.scroll_reset_method = c_options->image.scroll_reset_method; |
256 options->image.zoom_2pass = c_options->image.zoom_2pass; | 246 options->image.zoom_2pass = c_options->image.zoom_2pass; |
257 options->image.fit_window_to_image = c_options->image.fit_window_to_image; | 247 options->image.fit_window_to_image = c_options->image.fit_window_to_image; |
258 options->image.limit_window_size = c_options->image.limit_window_size; | 248 options->image.limit_window_size = c_options->image.limit_window_size; |
366 { | 356 { |
367 ExifUIList[i].current = ExifUIList[i].temp; | 357 ExifUIList[i].current = ExifUIList[i].temp; |
368 } | 358 } |
369 | 359 |
370 #endif | 360 #endif |
371 { | |
372 gchar *layout_order = layout_config_get(layout_widget, &new_style); | |
373 | |
374 if (new_style != options->layout.style || | |
375 (layout_order == NULL) != (options->layout.order == NULL) || | |
376 !options->layout.order || | |
377 strcmp(layout_order, options->layout.order) != 0) | |
378 { | |
379 if (refresh) filter_rebuild(); | |
380 refresh = FALSE; | |
381 | |
382 g_free(options->layout.order); | |
383 options->layout.order = layout_order; | |
384 layout_order = NULL; /* g_free() later */ | |
385 | |
386 options->layout.style = new_style; | |
387 | |
388 layout_styles_update(); | |
389 } | |
390 | |
391 g_free(layout_order); | |
392 } | |
393 | |
394 if (options->layout.show_directory_date != c_options->layout.show_directory_date) | |
395 { | |
396 options->layout.show_directory_date = c_options->layout.show_directory_date; | |
397 refresh = TRUE; | |
398 } | |
399 | |
400 image_options_sync(); | 361 image_options_sync(); |
401 | 362 |
402 if (refresh) | 363 if (refresh) |
403 { | 364 { |
404 filter_rebuild(); | 365 filter_rebuild(); |
445 /* | 406 /* |
446 *----------------------------------------------------------------------------- | 407 *----------------------------------------------------------------------------- |
447 * config window setup (private) | 408 * config window setup (private) |
448 *----------------------------------------------------------------------------- | 409 *----------------------------------------------------------------------------- |
449 */ | 410 */ |
450 | |
451 static void exif_item_cb(GtkWidget *combo, gpointer data) | |
452 { | |
453 gint *option = data; | |
454 *option = gtk_combo_box_get_active(GTK_COMBO_BOX(combo)); | |
455 } | |
456 | |
457 static void exif_item(GtkWidget *table, gint column, gint row, | |
458 const gchar *text, gint option, gint *option_c) | |
459 { | |
460 GtkWidget *combo; | |
461 | |
462 *option_c = option; | |
463 | |
464 pref_table_label(table, column, row, text, 0.0); | |
465 | |
466 combo = gtk_combo_box_new_text(); | |
467 | |
468 /* note: the order is important, it must match the values of | |
469 * EXIF_UI_OFF, _IFSET, _ON */ | |
470 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Never")); | |
471 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("If set")); | |
472 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Always")); | |
473 | |
474 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), option); | |
475 | |
476 g_signal_connect(G_OBJECT(combo), "changed", | |
477 G_CALLBACK(exif_item_cb), option_c); | |
478 | |
479 gtk_table_attach(GTK_TABLE(table), combo, | |
480 column + 1, column + 2, row, row + 1, | |
481 GTK_EXPAND | GTK_FILL, 0, 0, 0); | |
482 gtk_widget_show(combo); | |
483 } | |
484 | 411 |
485 static void quality_menu_cb(GtkWidget *combo, gpointer data) | 412 static void quality_menu_cb(GtkWidget *combo, gpointer data) |
486 { | 413 { |
487 gint *option = data; | 414 gint *option = data; |
488 | 415 |
1196 vbox = scrolled_notebook_page(notebook, _("Windows")); | 1123 vbox = scrolled_notebook_page(notebook, _("Windows")); |
1197 | 1124 |
1198 group = pref_group_new(vbox, FALSE, _("State"), GTK_ORIENTATION_VERTICAL); | 1125 group = pref_group_new(vbox, FALSE, _("State"), GTK_ORIENTATION_VERTICAL); |
1199 | 1126 |
1200 pref_checkbox_new_int(group, _("Remember window positions"), | 1127 pref_checkbox_new_int(group, _("Remember window positions"), |
1201 options->layout.save_window_positions, &c_options->layout.save_window_positions); | 1128 options->save_window_positions, &c_options->save_window_positions); |
1202 pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"), | 1129 pref_checkbox_new_int(group, _("Remember tool state (float/hidden)"), |
1203 options->layout.tools_restore_state, &c_options->layout.tools_restore_state); | 1130 options->tools_restore_state, &c_options->tools_restore_state); |
1204 | 1131 |
1205 group = pref_group_new(vbox, FALSE, _("Size"), GTK_ORIENTATION_VERTICAL); | 1132 group = pref_group_new(vbox, FALSE, _("Size"), GTK_ORIENTATION_VERTICAL); |
1206 | 1133 |
1207 pref_checkbox_new_int(group, _("Fit window to image when tools are hidden/floating"), | 1134 pref_checkbox_new_int(group, _("Fit window to image when tools are hidden/floating"), |
1208 options->image.fit_window_to_image, &c_options->image.fit_window_to_image); | 1135 options->image.fit_window_to_image, &c_options->image.fit_window_to_image); |
1212 options->image.limit_window_size, &c_options->image.limit_window_size); | 1139 options->image.limit_window_size, &c_options->image.limit_window_size); |
1213 spin = pref_spin_new_int(hbox, NULL, NULL, | 1140 spin = pref_spin_new_int(hbox, NULL, NULL, |
1214 10, 150, 1, | 1141 10, 150, 1, |
1215 options->image.max_window_size, &c_options->image.max_window_size); | 1142 options->image.max_window_size, &c_options->image.max_window_size); |
1216 pref_checkbox_link_sensitivity(ct_button, spin); | 1143 pref_checkbox_link_sensitivity(ct_button, spin); |
1217 | |
1218 group = pref_group_new(vbox, FALSE, _("Layout"), GTK_ORIENTATION_VERTICAL); | |
1219 | |
1220 layout_widget = layout_config_new(); | |
1221 layout_config_set(layout_widget, options->layout.style, options->layout.order); | |
1222 gtk_box_pack_start(GTK_BOX(group), layout_widget, FALSE, FALSE, 0); | |
1223 gtk_widget_show(layout_widget); | |
1224 } | 1144 } |
1225 | 1145 |
1226 static GtkTreeModel *create_class_model(void) | 1146 static GtkTreeModel *create_class_model(void) |
1227 { | 1147 { |
1228 GtkListStore *model; | 1148 GtkListStore *model; |
1632 options->collections.rectangular_selection, &c_options->collections.rectangular_selection); | 1552 options->collections.rectangular_selection, &c_options->collections.rectangular_selection); |
1633 | 1553 |
1634 pref_checkbox_new_int(group, _("Descend folders in tree view"), | 1554 pref_checkbox_new_int(group, _("Descend folders in tree view"), |
1635 options->tree_descend_subdirs, &c_options->tree_descend_subdirs); | 1555 options->tree_descend_subdirs, &c_options->tree_descend_subdirs); |
1636 | 1556 |
1637 pref_checkbox_new_int(group, _("Show date in directories list view"), | |
1638 options->layout.show_directory_date, &c_options->layout.show_directory_date); | |
1639 | |
1640 pref_checkbox_new_int(group, _("In place renaming"), | 1557 pref_checkbox_new_int(group, _("In place renaming"), |
1641 options->file_ops.enable_in_place_rename, &c_options->file_ops.enable_in_place_rename); | 1558 options->file_ops.enable_in_place_rename, &c_options->file_ops.enable_in_place_rename); |
1642 | 1559 |
1643 pref_checkbox_new_int(group, _("Show \"Copy path\" menu item which write the path of selected files to clipboard"), | 1560 pref_checkbox_new_int(group, _("Show \"Copy path\" menu item which write the path of selected files to clipboard"), |
1644 options->show_copy_path, &c_options->show_copy_path); | 1561 options->show_copy_path, &c_options->show_copy_path); |
1653 | 1570 |
1654 pref_checkbox_new_int(group, _("Progressive keyboard scrolling"), | 1571 pref_checkbox_new_int(group, _("Progressive keyboard scrolling"), |
1655 options->progressive_key_scrolling, &c_options->progressive_key_scrolling); | 1572 options->progressive_key_scrolling, &c_options->progressive_key_scrolling); |
1656 pref_checkbox_new_int(group, _("Mouse wheel scrolls image"), | 1573 pref_checkbox_new_int(group, _("Mouse wheel scrolls image"), |
1657 options->mousewheel_scrolls, &c_options->mousewheel_scrolls); | 1574 options->mousewheel_scrolls, &c_options->mousewheel_scrolls); |
1658 | |
1659 pref_label_new(group, _("Home button path (empty to use your home directory)")); | |
1660 hbox = pref_box_new(group, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE); | |
1661 | |
1662 tabcomp = tab_completion_new(&home_path_entry, options->layout.home_path, NULL, NULL); | |
1663 tab_completion_add_select_button(home_path_entry, NULL, TRUE); | |
1664 gtk_box_pack_start(GTK_BOX(hbox), tabcomp, TRUE, TRUE, 0); | |
1665 gtk_widget_show(tabcomp); | |
1666 | |
1667 button = pref_button_new(hbox, NULL, _("Use current"), FALSE, | |
1668 G_CALLBACK(home_path_set_current), NULL); | |
1669 | |
1670 | 1575 |
1671 group = pref_group_new(vbox, FALSE, _("Metadata"), GTK_ORIENTATION_VERTICAL); | 1576 group = pref_group_new(vbox, FALSE, _("Metadata"), GTK_ORIENTATION_VERTICAL); |
1672 | 1577 |
1673 pref_checkbox_new_int(group, _("Store metadata and cache files in source image's directory"), | 1578 pref_checkbox_new_int(group, _("Store metadata and cache files in source image's directory"), |
1674 options->metadata.enable_metadata_dirs, &c_options->metadata.enable_metadata_dirs); | 1579 options->metadata.enable_metadata_dirs, &c_options->metadata.enable_metadata_dirs); |