From 1bca89163d6c2c8593d8748d9977498fa6d56706 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 21 Sep 2019 18:08:13 +0200 Subject: [PATCH] libgimpbase: remove gimp_personal_rc_file() and port its remaining users to gimp_directory_file(). --- app/gui/splash.c | 47 ++---- app/menus/menus.c | 16 +- app/tests/gimp-test-session-utils.c | 60 ++++--- app/widgets/gimppropwidgets.c | 8 +- app/widgets/gimptemplateeditor.c | 17 +- libgimpbase/gimpbase.def | 1 - libgimpbase/gimpenv.c | 21 +-- libgimpbase/gimpenv.h | 19 +-- .../fractal-explorer-dialogs.c | 6 +- plug-ins/gfig/gfig-dialog.c | 6 +- plug-ins/gimpressionist/utils.c | 6 +- plug-ins/gradient-flare/gradient-flare.c | 20 +-- plug-ins/imagemap/imap_preferences.c | 150 ++++++++++-------- 13 files changed, 181 insertions(+), 196 deletions(-) diff --git a/app/gui/splash.c b/app/gui/splash.c index 151c84d48f..74520ac826 100644 --- a/app/gui/splash.c +++ b/app/gui/splash.c @@ -90,15 +90,10 @@ static GdkPixbufAnimation * gint max_height, gboolean be_verbose); static GdkPixbufAnimation * - splash_image_load_from_path (const gchar *filename, + splash_image_load_from_file (GFile *file, gint max_width, gint max_height, gboolean be_verbose); -static GdkPixbufAnimation * - splash_image_load_from_file (GFile *file, - gint max_width, - gint max_height, - gboolean be_verbose); static GdkPixbufAnimation * splash_image_pick_from_dirs (GList *dirs, gint max_width, @@ -485,7 +480,6 @@ splash_image_load (Gimp *gimp, gboolean be_verbose) { GdkPixbufAnimation *animation = NULL; - gchar *filename; GFile *file; GList *list; @@ -500,18 +494,16 @@ splash_image_load (Gimp *gimp, return animation; /* File "gimp-splash.png" in personal configuration directory. */ - filename = gimp_personal_rc_file ("gimp-splash.png"); - animation = splash_image_load_from_path (filename, + file = gimp_directory_file ("gimp-splash.png", NULL); + animation = splash_image_load_from_file (file, max_width, max_height, be_verbose); - g_free (filename); + g_object_unref (file); if (animation) return animation; /* Random image under splashes/ directory in personal config dir. */ - filename = gimp_personal_rc_file ("splashes"); - file = g_file_new_for_path (filename); - g_free (filename); + file = gimp_directory_file ("splashes", NULL); list = NULL; list = g_list_prepend (list, file); animation = splash_image_pick_from_dirs (list, @@ -522,19 +514,16 @@ splash_image_load (Gimp *gimp, return animation; /* Release splash image. */ - filename = g_build_filename (gimp_data_directory (), - "images", "gimp-splash.png", NULL); - animation = splash_image_load_from_path (filename, + file = gimp_data_directory_file ("images", "gimp-splash.png", NULL); + animation = splash_image_load_from_file (file, max_width, max_height, be_verbose); - g_free (filename); + g_object_unref (file); if (animation) return animation; /* Random release image in installed splashes/ directory. */ - filename = g_build_filename (gimp_data_directory (), "splashes", NULL); - file = g_file_new_for_path (filename); - g_free (filename); + file = gimp_data_directory_file ("splashes", NULL); list = NULL; list = g_list_prepend (list, file); animation = splash_image_pick_from_dirs (list, @@ -545,24 +534,6 @@ splash_image_load (Gimp *gimp, return animation; } -static GdkPixbufAnimation * -splash_image_load_from_path (const gchar *filename, - gint max_width, - gint max_height, - gboolean be_verbose) -{ - GdkPixbufAnimation *animation; - GFile *file; - - file = g_file_new_for_path (filename); - animation = splash_image_load_from_file (file, - max_width, max_height, - be_verbose); - g_object_unref (file); - - return animation; -} - static GdkPixbufAnimation * splash_image_load_from_file (GFile *file, gint max_width, diff --git a/app/menus/menus.c b/app/menus/menus.c index 79a3f25caf..4ca8b4b843 100644 --- a/app/menus/menus.c +++ b/app/menus/menus.c @@ -414,23 +414,28 @@ menus_exit (Gimp *gimp) void menus_restore (Gimp *gimp) { + GFile *file; gchar *filename; g_return_if_fail (GIMP_IS_GIMP (gimp)); - filename = gimp_personal_rc_file ("menurc"); + file = gimp_directory_file ("menurc", NULL); if (gimp->be_verbose) - g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename)); + g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); + filename = g_file_get_path (file); gtk_accel_map_load (filename); g_free (filename); + + g_object_unref (file); } void menus_save (Gimp *gimp, gboolean always_save) { + GFile *file; gchar *filename; g_return_if_fail (GIMP_IS_GIMP (gimp)); @@ -438,14 +443,17 @@ menus_save (Gimp *gimp, if (menurc_deleted && ! always_save) return; - filename = gimp_personal_rc_file ("menurc"); + file = gimp_directory_file ("menurc", NULL); if (gimp->be_verbose) - g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename)); + g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); + filename = g_file_get_path (file); gtk_accel_map_save (filename); g_free (filename); + g_object_unref (file); + menurc_deleted = FALSE; } diff --git a/app/tests/gimp-test-session-utils.c b/app/tests/gimp-test-session-utils.c index e5b0b01ab9..ffc9f0fc3a 100644 --- a/app/tests/gimp-test-session-utils.c +++ b/app/tests/gimp-test-session-utils.c @@ -42,30 +42,34 @@ typedef struct { - gchar *filename; + GFile *file; gchar *md5; GTimeVal modtime; } GimpTestFileState; static gboolean -gimp_test_get_file_state_verbose (const gchar *filename, +gimp_test_get_file_state_verbose (GFile *file, GimpTestFileState *filestate) { gboolean success = TRUE; - filestate->filename = g_strdup (filename); + filestate->file = g_object_ref (file); /* Get checksum */ if (success) { + gchar *filename; gchar *contents = NULL; gsize length = 0; + filename = g_file_get_path (file); success = g_file_get_contents (filename, &contents, &length, NULL); + g_free (filename); + if (success) { filestate->md5 = g_compute_checksum_for_string (G_CHECKSUM_MD5, @@ -79,7 +83,6 @@ gimp_test_get_file_state_verbose (const gchar *filename, /* Get modification time */ if (success) { - GFile *file = g_file_new_for_path (filename); GFileInfo *info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED, 0, NULL, NULL); @@ -93,25 +96,25 @@ gimp_test_get_file_state_verbose (const gchar *filename, { success = FALSE; } - - g_object_unref (file); } if (! success) - g_printerr ("Failed to get initial file info for '%s'\n", filename); + g_printerr ("Failed to get initial file info for '%s'\n", + gimp_file_get_utf8_name (file)); return success; } static gboolean -gimp_test_file_state_changes (const gchar *filename, +gimp_test_file_state_changes (GFile *file, GimpTestFileState *state1, GimpTestFileState *state2) { if (state1->modtime.tv_sec == state2->modtime.tv_sec && state1->modtime.tv_usec == state2->modtime.tv_usec) { - g_printerr ("A new '%s' was not created\n", filename); + g_printerr ("A new '%s' was not created\n", + gimp_file_get_utf8_name (file)); return FALSE; } @@ -120,13 +123,14 @@ gimp_test_file_state_changes (const gchar *filename, char *diff_argv[5] = { "diff", "-u", - state1->filename, - state2->filename, + g_file_get_path (state1->file), + g_file_get_path (state2->file), NULL }; g_printerr ("'%s' was changed but should not have been. Reason, using " - "`diff -u $expected $actual`\n", filename); + "`diff -u $expected $actual`\n", + gimp_file_get_utf8_name (file)); g_spawn_sync (NULL /*working_directory*/, diff_argv, @@ -139,6 +143,9 @@ gimp_test_file_state_changes (const gchar *filename, NULL /*exist_status*/, NULL /*error*/); + g_free (diff_argv[2]); + g_free (diff_argv[3]); + return FALSE; } @@ -171,8 +178,8 @@ gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc, GimpTestFileState initial_dockrc_state = { NULL, NULL, { 0, 0 } }; GimpTestFileState final_sessionrc_state = { NULL, NULL, { 0, 0 } }; GimpTestFileState final_dockrc_state = { NULL, NULL, { 0, 0 } }; - gchar *sessionrc_filename = NULL; - gchar *dockrc_filename = NULL; + GFile *sessionrc_file = NULL; + GFile *dockrc_file = NULL; /* Make sure to run this before we use any GIMP functions */ gimp_test_utils_set_gimp3_directory ("GIMP_TESTING_ABS_TOP_SRCDIR", @@ -183,13 +190,13 @@ gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc, * the read file, which is why we check the MD5 of the -expected * variant */ - sessionrc_filename = gimp_personal_rc_file (expected_sessionrc); - dockrc_filename = gimp_personal_rc_file (expected_dockrc); + sessionrc_file = gimp_directory_file (expected_sessionrc, NULL); + dockrc_file = gimp_directory_file (expected_dockrc, NULL); /* Remember the modtimes and MD5s */ - g_assert (gimp_test_get_file_state_verbose (sessionrc_filename, + g_assert (gimp_test_get_file_state_verbose (sessionrc_file, &initial_sessionrc_state)); - g_assert (gimp_test_get_file_state_verbose (dockrc_filename, + g_assert (gimp_test_get_file_state_verbose (dockrc_file, &initial_dockrc_state)); /* Use specific input files when restoring the session */ @@ -215,18 +222,19 @@ gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc, g_unsetenv ("GIMP_TESTING_SESSIONRC_NAME"); g_unsetenv ("GIMP_TESTING_DOCKRC_NAME"); - g_free (sessionrc_filename); - g_free (dockrc_filename); - sessionrc_filename = gimp_personal_rc_file ("sessionrc"); - dockrc_filename = gimp_personal_rc_file ("dockrc"); + g_object_unref (sessionrc_file); + g_object_unref (dockrc_file); + + sessionrc_file = gimp_directory_file ("sessionrc", NULL); + dockrc_file = gimp_directory_file ("dockrc", NULL); /* Exit. This includes writing sessionrc and dockrc*/ gimp_exit (gimp, TRUE); /* Now get the new modtimes and MD5s */ - g_assert (gimp_test_get_file_state_verbose (sessionrc_filename, + g_assert (gimp_test_get_file_state_verbose (sessionrc_file, &final_sessionrc_state)); - g_assert (gimp_test_get_file_state_verbose (dockrc_filename, + g_assert (gimp_test_get_file_state_verbose (dockrc_file, &final_dockrc_state)); /* If things have gone our way, GIMP will have deserialized @@ -235,10 +243,10 @@ gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc, * to make sure that their content remains the same we compare their * MD5 */ - g_assert (gimp_test_file_state_changes ("sessionrc", + g_assert (gimp_test_file_state_changes (g_file_new_for_path ("sessionrc"), &initial_sessionrc_state, &final_sessionrc_state)); - g_assert (gimp_test_file_state_changes ("dockrc", + g_assert (gimp_test_file_state_changes (g_file_new_for_path ("dockrc"), &initial_dockrc_state, &final_dockrc_state)); } diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c index 81d187e34f..afc5b76d9c 100644 --- a/app/widgets/gimppropwidgets.c +++ b/app/widgets/gimppropwidgets.c @@ -1628,11 +1628,11 @@ gimp_prop_profile_combo_box_new (GObject *config, } else { - gchar *filename; + GFile *file; - filename = gimp_personal_rc_file ("profilerc"); - combo = gimp_color_profile_combo_box_new (dialog, filename); - g_free (filename); + file = gimp_directory_file ("profilerc", NULL); + combo = gimp_color_profile_combo_box_new (dialog, file); + g_object_unref (file); } gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (combo), diff --git a/app/widgets/gimptemplateeditor.c b/app/widgets/gimptemplateeditor.c index 834988558b..75e9e8f6b4 100644 --- a/app/widgets/gimptemplateeditor.c +++ b/app/widgets/gimptemplateeditor.c @@ -799,12 +799,11 @@ gimp_template_editor_template_notify (GimpTemplate *template, ! strcmp (param_spec->name, "precision")) { GtkListStore *profile_store; - GFile *profile; - gchar *filename; + GFile *file; - filename = gimp_personal_rc_file ("profilerc"); - profile_store = gimp_color_profile_store_new (filename); - g_free (filename); + file = gimp_directory_file ("profilerc", NULL); + profile_store = gimp_color_profile_store_new (file); + g_object_unref (file); gimp_color_profile_store_add_defaults (GIMP_COLOR_PROFILE_STORE (profile_store), private->gimp->config->color_management, @@ -817,13 +816,13 @@ gimp_template_editor_template_notify (GimpTemplate *template, g_object_unref (profile_store); g_object_get (template, - "color-profile", &profile, + "color-profile", &file, NULL); gimp_color_profile_combo_box_set_active_file (GIMP_COLOR_PROFILE_COMBO_BOX (private->profile_combo), - profile, NULL); + file, NULL); - if (profile) - g_object_unref (profile); + if (file) + g_object_unref (file); } } diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def index 1e5156c119..88dbb641c3 100644 --- a/libgimpbase/gimpbase.def +++ b/libgimpbase/gimpbase.def @@ -151,7 +151,6 @@ EXPORTS gimp_pdb_error_handler_get_type gimp_pdb_proc_type_get_type gimp_pdb_status_type_get_type - gimp_personal_rc_file gimp_pixels_to_units gimp_pixpipe_params_build gimp_pixpipe_params_free diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c index 4e09ab3db9..7af87009f2 100644 --- a/libgimpbase/gimpenv.c +++ b/libgimpbase/gimpenv.c @@ -736,7 +736,7 @@ gimp_child_file (const gchar *parent, * @...: a %NULL terminated list of the remaining elements of the path * to the file. * - * Returns a #GFile in the user's GIMP directory, or the data + * Returns a #GFile in the user's GIMP directory, or the GIMP * directory itself if @first_element is %NULL. * * See also: gimp_directory(). @@ -915,25 +915,6 @@ gimp_plug_in_directory_file (const gchar *first_element, return file; } -/** - * gimp_personal_rc_file: - * @basename: The basename of a rc_file. - * - * Returns the name of a file in the user-specific GIMP settings directory. - * - * The returned string is newly allocated and should be freed with - * g_free() after use. The returned string is in the encoding used for - * filenames by GLib, which isn't necessarily UTF-8. (On Windows it - * always is UTF-8.) - * - * Returns: The name of a file in the user-specific GIMP settings directory. - **/ -gchar * -gimp_personal_rc_file (const gchar *basename) -{ - return g_build_filename (gimp_directory (), basename, NULL); -} - /** * gimp_path_runtime_fix: * @path: A pointer to a string (allocated with g_malloc) that is diff --git a/libgimpbase/gimpenv.h b/libgimpbase/gimpenv.h index 78cd6591d9..a9077be055 100644 --- a/libgimpbase/gimpenv.h +++ b/libgimpbase/gimpenv.h @@ -26,7 +26,6 @@ #ifndef __GIMP_ENV_H__ #define __GIMP_ENV_H__ - G_BEGIN_DECLS /* For information look into the C source or the html documentation */ @@ -69,20 +68,18 @@ GFile * gimp_sysconf_directory_file (const gchar *first_element, GFile * gimp_plug_in_directory_file (const gchar *first_element, ...) G_GNUC_MALLOC; -gchar * gimp_personal_rc_file (const gchar *basename) G_GNUC_MALLOC; +GList * gimp_path_parse (const gchar *path, + gint max_paths, + gboolean check, + GList **check_failed); +gchar * gimp_path_to_str (GList *path) G_GNUC_MALLOC; +void gimp_path_free (GList *path); -GList * gimp_path_parse (const gchar *path, - gint max_paths, - gboolean check, - GList **check_failed); -gchar * gimp_path_to_str (GList *path) G_GNUC_MALLOC; -void gimp_path_free (GList *path); - -gchar * gimp_path_get_user_writable_dir (GList *path) G_GNUC_MALLOC; +gchar * gimp_path_get_user_writable_dir (GList *path) G_GNUC_MALLOC; /* should be considered private, don't use! */ -void gimp_env_init (gboolean plug_in); +void gimp_env_init (gboolean plug_in); G_END_DECLS diff --git a/plug-ins/fractal-explorer/fractal-explorer-dialogs.c b/plug-ins/fractal-explorer/fractal-explorer-dialogs.c index e84f70f89c..ddd8a93ff1 100644 --- a/plug-ins/fractal-explorer/fractal-explorer-dialogs.c +++ b/plug-ins/fractal-explorer/fractal-explorer-dialogs.c @@ -537,7 +537,7 @@ explorer_dialog (void) } else { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); + GFile *gimprc = gimp_directory_file ("gimprc", NULL); gchar *full_path = gimp_config_build_data_path ("fractalexplorer"); gchar *esc_path = g_strescape (full_path, NULL); g_free (full_path); @@ -548,9 +548,9 @@ explorer_dialog (void) "to your %s file."), "fractalexplorer-path", "fractalexplorer-path", - esc_path, gimp_filename_to_utf8 (gimprc)); + esc_path, gimp_file_get_utf8_name (gimprc)); - g_free (gimprc); + g_object_unref (gimprc); g_free (esc_path); } diff --git a/plug-ins/gfig/gfig-dialog.c b/plug-ins/gfig/gfig-dialog.c index 2032a8c904..7ce2b6cb7d 100644 --- a/plug-ins/gfig/gfig-dialog.c +++ b/plug-ins/gfig/gfig-dialog.c @@ -267,7 +267,7 @@ gfig_dialog (void) } else { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); + GFile *gimprc = gimp_directory_file ("gimprc", NULL); gchar *full_path = gimp_config_build_data_path ("gfig"); gchar *esc_path = g_strescape (full_path, NULL); g_free (full_path); @@ -277,9 +277,9 @@ gfig_dialog (void) "(%s \"%s\")\n" "to your %s file."), "gfig-path", "gfig-path", esc_path, - gimp_filename_to_utf8 (gimprc)); + gimp_file_get_utf8_name (gimprc)); - g_free (gimprc); + g_object_unref (gimprc); g_free (esc_path); } diff --git a/plug-ins/gimpressionist/utils.c b/plug-ins/gimpressionist/utils.c index 24f95089f2..90002e5226 100644 --- a/plug-ins/gimpressionist/utils.c +++ b/plug-ins/gimpressionist/utils.c @@ -132,7 +132,7 @@ parsepath (void) } else { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); + GFile *gimprc = gimp_directory_file ("gimprc", NULL); gchar *full_path = gimp_config_build_data_path ("gimpressionist"); gchar *esc_path = g_strescape (full_path, NULL); @@ -141,9 +141,9 @@ parsepath (void) "(%s \"%s\")\n" "to your %s file."), "gflare-path", "gflare-path", - esc_path, gimp_filename_to_utf8 (gimprc)); + esc_path, gimp_file_get_utf8_name (gimprc)); - g_free (gimprc); + g_object_unref (gimprc); g_free (esc_path); rc_path = gimp_config_path_expand (full_path, TRUE, NULL); diff --git a/plug-ins/gradient-flare/gradient-flare.c b/plug-ins/gradient-flare/gradient-flare.c index f4b5124dfa..12f82a6fac 100644 --- a/plug-ins/gradient-flare/gradient-flare.c +++ b/plug-ins/gradient-flare/gradient-flare.c @@ -967,7 +967,7 @@ gflare_run (GimpProcedure *procedure, } else { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); + GFile *gimprc = gimp_directory_file ("gimprc", NULL); gchar *full_path = gimp_config_build_data_path ("gflare"); gchar *esc_path = g_strescape (full_path, NULL); g_free (full_path); @@ -977,9 +977,9 @@ gflare_run (GimpProcedure *procedure, "(%s \"%s\")\n" "to your %s file."), "gflare-path", "gflare-path", - esc_path, gimp_filename_to_utf8 (gimprc)); + esc_path, gimp_file_get_utf8_name (gimprc)); - g_free (gimprc); + g_object_unref (gimprc); g_free (esc_path); } @@ -1529,8 +1529,8 @@ gflare_save (GFlare *gflare) { if (! message_ok) { - gchar *gimprc = gimp_personal_rc_file ("gimprc"); - gchar *dir = gimp_personal_rc_file ("gflare"); + GFile *gimprc = gimp_directory_file ("gimprc", NULL); + GFile *dir = gimp_directory_file ("gflare", NULL); gchar *gflare_dir; gflare_dir = @@ -1541,12 +1541,14 @@ gflare_save (GFlare *gflare) "(gflare-path \"%s\")\n" "and make a folder '%s', then you can save " "your own GFlares into that folder."), - gflare->name, gimprc, gflare_dir, - gimp_filename_to_utf8 (dir)); + gflare->name, + gimp_file_get_utf8_name (gimprc), + gflare_dir, + gimp_file_get_utf8_name (dir)); - g_free (gimprc); + g_object_unref (gimprc); + g_object_unref (dir); g_free (gflare_dir); - g_free (dir); message_ok = TRUE; } diff --git a/plug-ins/imagemap/imap_preferences.c b/plug-ins/imagemap/imap_preferences.c index 6cef7ed568..22942b94ec 100644 --- a/plug-ins/imagemap/imap_preferences.c +++ b/plug-ins/imagemap/imap_preferences.c @@ -167,93 +167,113 @@ parse_line(PreferencesData_t *data, char *line) gboolean preferences_load(PreferencesData_t *data) { - FILE *in; - char buf[256]; - gchar *filename; + FILE *in; + char buf[256]; + GFile *file; + gchar *filename; - filename = gimp_personal_rc_file ("imagemaprc"); + file = gimp_directory_file ("imagemaprc", NULL); + + filename = g_file_get_path (file); + in = g_fopen (filename, "rb"); + g_free (filename); + + g_object_unref (file); + + if (in) + { + while (fgets (buf, sizeof (buf), in)) + { + if (*buf != '\n' && *buf != '#') + { + parse_line (data, buf); + } + } + + fclose (in); - in = g_fopen(filename, "rb"); - g_free(filename); - if (in) { - while (fgets(buf, sizeof(buf), in)) { - if (*buf != '\n' && *buf != '#') { - parse_line(data, buf); - } - } - fclose(in); return TRUE; - } - return FALSE; + } + + return FALSE; } void preferences_save(PreferencesData_t *data) { FILE *out; + GFile *file; gchar *filename; ColorSelData_t *colors = &data->colors; - filename = gimp_personal_rc_file ("imagemaprc"); + file = gimp_directory_file ("imagemaprc", NULL); + filename = g_file_get_path (file); out = g_fopen(filename, "wb"); - if (out) { - fprintf(out, "# Image map plug-in resource file\n\n"); - if (data->default_map_type == NCSA) + g_free (filename); + + if (out) + { + fprintf(out, "# Image map plug-in resource file\n\n"); + if (data->default_map_type == NCSA) fprintf(out, "(default-map-type ncsa)\n"); - else if (data->default_map_type == CERN) + else if (data->default_map_type == CERN) fprintf(out, "(default-map-type cern)\n"); - else + else fprintf(out, "(default-map-type csim)\n"); - fprintf(out, "(prompt-for-area-info %s)\n", - (data->prompt_for_area_info) ? "yes" : "no"); - fprintf(out, "(require-default-url %s)\n", - (data->require_default_url) ? "yes" : "no"); - fprintf(out, "(show-area-handle %s)\n", - (data->show_area_handle) ? "yes" : "no"); - fprintf(out, "(keep-circles-round %s)\n", - (data->keep_circles_round) ? "yes" : "no"); - fprintf(out, "(show-url-tip %s)\n", - (data->show_url_tip) ? "yes" : "no"); - fprintf(out, "(use-doublesized %s)\n", - (data->use_doublesized) ? "yes" : "no"); + fprintf(out, "(prompt-for-area-info %s)\n", + (data->prompt_for_area_info) ? "yes" : "no"); + fprintf(out, "(require-default-url %s)\n", + (data->require_default_url) ? "yes" : "no"); + fprintf(out, "(show-area-handle %s)\n", + (data->show_area_handle) ? "yes" : "no"); + fprintf(out, "(keep-circles-round %s)\n", + (data->keep_circles_round) ? "yes" : "no"); + fprintf(out, "(show-url-tip %s)\n", + (data->show_url_tip) ? "yes" : "no"); + fprintf(out, "(use-doublesized %s)\n", + (data->use_doublesized) ? "yes" : "no"); - fprintf(out, "(undo-levels %d)\n", data->undo_levels); - fprintf(out, "(mru-size %d)\n", data->mru_size); + fprintf(out, "(undo-levels %d)\n", data->undo_levels); + fprintf(out, "(mru-size %d)\n", data->mru_size); - fprintf(out, "(normal-fg-color %d %d %d)\n", - ROUND (colors->normal_fg.red * 255.0), - ROUND (colors->normal_fg.green * 255.0), - ROUND (colors->normal_fg.blue * 255.0)); - fprintf(out, "(normal-bg-color %d %d %d)\n", - ROUND (colors->normal_bg.red * 255.0), - ROUND (colors->normal_bg.green * 255.0), - ROUND (colors->normal_bg.blue * 255.0)); - fprintf(out, "(selected-fg-color %d %d %d)\n", - ROUND (colors->selected_fg.red * 255.0), - ROUND (colors->selected_fg.green * 255.0), - ROUND (colors->selected_fg.blue * 255.0)); - fprintf(out, "(selected-bg-color %d %d %d)\n", - ROUND (colors->selected_bg.red * 255.0), - ROUND (colors->selected_bg.green * 255.0), - ROUND (colors->selected_bg.blue * 255.0)); - fprintf(out, "(interactive-fg-color %d %d %d)\n", - ROUND (colors->interactive_fg.red * 255.0), - ROUND (colors->interactive_fg.green * 255.0), - ROUND (colors->interactive_fg.blue * 255.0)); - fprintf(out, "(interactive-bg-color %d %d %d)\n", - ROUND (colors->interactive_bg.red * 255.0), - ROUND (colors->interactive_bg.green * 255.0), - ROUND (colors->interactive_bg.blue * 255.0)); + fprintf(out, "(normal-fg-color %d %d %d)\n", + ROUND (colors->normal_fg.red * 255.0), + ROUND (colors->normal_fg.green * 255.0), + ROUND (colors->normal_fg.blue * 255.0)); + fprintf(out, "(normal-bg-color %d %d %d)\n", + ROUND (colors->normal_bg.red * 255.0), + ROUND (colors->normal_bg.green * 255.0), + ROUND (colors->normal_bg.blue * 255.0)); + fprintf(out, "(selected-fg-color %d %d %d)\n", + ROUND (colors->selected_fg.red * 255.0), + ROUND (colors->selected_fg.green * 255.0), + ROUND (colors->selected_fg.blue * 255.0)); + fprintf(out, "(selected-bg-color %d %d %d)\n", + ROUND (colors->selected_bg.red * 255.0), + ROUND (colors->selected_bg.green * 255.0), + ROUND (colors->selected_bg.blue * 255.0)); + fprintf(out, "(interactive-fg-color %d %d %d)\n", + ROUND (colors->interactive_fg.red * 255.0), + ROUND (colors->interactive_fg.green * 255.0), + ROUND (colors->interactive_fg.blue * 255.0)); + fprintf(out, "(interactive-bg-color %d %d %d)\n", + ROUND (colors->interactive_bg.red * 255.0), + ROUND (colors->interactive_bg.green * 255.0), + ROUND (colors->interactive_bg.blue * 255.0)); - mru_write(get_mru(), out); + mru_write(get_mru(), out); - fclose(out); - } else { - do_file_error_dialog( _("Couldn't save resource file:"), filename); - } - g_free(filename); + fclose(out); + } + else + { + do_file_error_dialog (_("Couldn't save resource file:"), + gimp_file_get_utf8_name (file)); + } + + g_object_unref (file); } static void