94
94
const gchar *filename,
97
static void gimp_levels_tool_export_setup (GimpSettingsBox *settings_box,
98
GtkFileChooserDialog *dialog,
100
GimpLevelsTool *tool);
97
101
static void gimp_levels_tool_config_notify (GObject *object,
98
102
GParamSpec *pspec,
99
103
GimpLevelsTool *tool);
368
g_signal_connect (image_map_tool->settings_box, "file-dialog-setup",
369
G_CALLBACK (gimp_levels_tool_export_setup),
364
372
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
365
373
label_group = gimp_image_map_tool_dialog_get_label_group (image_map_tool);
741
success = gimp_levels_config_load_cruft (tool->config, file, error);
749
if (! fgets (header, sizeof (header), file))
751
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
752
_("Could not read header from '%s': %s"),
753
gimp_filename_to_utf8 (filename),
759
if (g_str_has_prefix (header, "# GIMP Levels File\n"))
765
success = gimp_levels_config_load_cruft (tool->config, file, error);
774
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_import (image_map_tool,
753
784
GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);
757
file = g_fopen (filename, "wt");
786
if (tool->export_old_format)
761
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
762
_("Could not open '%s' for writing: %s"),
763
gimp_filename_to_utf8 (filename),
791
file = g_fopen (filename, "wt");
795
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
796
_("Could not open '%s' for writing: %s"),
797
gimp_filename_to_utf8 (filename),
802
success = gimp_levels_config_save_cruft (tool->config, file, error);
768
success = gimp_levels_config_save_cruft (tool->config, file, error);
809
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_export (image_map_tool,
815
gimp_levels_tool_export_setup (GimpSettingsBox *settings_box,
816
GtkFileChooserDialog *dialog,
818
GimpLevelsTool *tool)
825
button = gtk_check_button_new_with_mnemonic (_("Use _old levels file format"));
826
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
827
tool->export_old_format);
828
gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), button);
829
gtk_widget_show (button);
831
g_signal_connect (button, "toggled",
832
G_CALLBACK (gimp_toggle_button_update),
833
&tool->export_old_format);