diff --git a/ChangeLog b/ChangeLog index 3f9fd59614..47495b2d0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-04-06 Sven Neumann + + * libgimpconfig/gimpconfig-path.[ch] (gimp_param_spec_config_path): + declare default_value as const and allocate a copy. + + * app/config/gimpbaseconfig.[ch]: gives access to the default values + for temp and swap path. + + * app/base/base.c (base_init): create the temp directory if it + doesn't exist (bug #172682). + + * plug-ins/uri/uri-backend-gnomevfs.c: fixed path in error message. + 2005-04-06 Sven Neumann * docs/Makefile.am: install a link to the gimp(1) man-page for diff --git a/app/base/base.c b/app/base/base.c index 37de7ec612..1e4e2270ee 100644 --- a/app/base/base.c +++ b/app/base/base.c @@ -72,6 +72,7 @@ base_init (GimpBaseConfig *config, gboolean use_cpu_accel) { gboolean swap_is_ok; + gchar *temp_dir; g_return_val_if_fail (GIMP_IS_BASE_CONFIG (config), FALSE); g_return_val_if_fail (base_config == NULL, FALSE); @@ -87,12 +88,30 @@ base_init (GimpBaseConfig *config, /* Add the swap file */ if (! config->swap_path) - g_object_set (config, "swap_path", "${gimp_dir}", NULL); + g_object_set (config, + "swap-path", gimp_base_config_default_swap_path, + NULL); tile_swap_init (config->swap_path); swap_is_ok = tile_swap_test (); + /* create the temp directory if it doesn't exist */ + if (! config->temp_path) + g_object_set (config, + "temp-path", gimp_base_config_default_temp_path, + NULL); + + temp_dir = gimp_config_path_expand (config->temp_path, TRUE, NULL); + + if (! g_file_test (temp_dir, G_FILE_TEST_EXISTS)) + g_mkdir (temp_dir, + S_IRUSR | S_IXUSR | S_IWUSR | + S_IRGRP | S_IXGRP | + S_IROTH | S_IXOTH); + + g_free (temp_dir); + pixel_processor_init (config->num_processors); g_signal_connect (config, "notify::num-processors", G_CALLBACK (base_num_processors_notify), diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c index 2cf7927f1f..eadc15fdca 100644 --- a/app/config/gimpbaseconfig.c +++ b/app/config/gimpbaseconfig.c @@ -36,6 +36,11 @@ #include "gimp-intl.h" +const gchar *gimp_base_config_default_swap_path = "${gimp_dir}"; +const gchar *gimp_base_config_default_temp_path = + "${gimp_dir}" G_DIR_SEPARATOR_S "tmp"; + + static void gimp_base_config_class_init (GimpBaseConfigClass *klass); static void gimp_base_config_finalize (GObject *object); static void gimp_base_config_set_property (GObject *object, @@ -105,12 +110,12 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass) GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TEMP_PATH, "temp-path", TEMP_PATH_BLURB, GIMP_CONFIG_PATH_DIR, - "${gimp_dir}" G_DIR_SEPARATOR_S "tmp", + gimp_base_config_default_temp_path, GIMP_CONFIG_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_SWAP_PATH, "swap-path", SWAP_PATH_BLURB, GIMP_CONFIG_PATH_DIR, - "${gimp_dir}", + gimp_base_config_default_swap_path, GIMP_CONFIG_PARAM_RESTART); GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE, "stingy-memory-use", diff --git a/app/config/gimpbaseconfig.h b/app/config/gimpbaseconfig.h index 2f48769ae6..20266f058f 100644 --- a/app/config/gimpbaseconfig.h +++ b/app/config/gimpbaseconfig.h @@ -51,6 +51,10 @@ struct _GimpBaseConfigClass }; +extern const gchar *gimp_base_config_default_swap_path; +extern const gchar *gimp_base_config_default_temp_path; + + GType gimp_base_config_get_type (void) G_GNUC_CONST; diff --git a/libgimpconfig/gimpconfig-path.c b/libgimpconfig/gimpconfig-path.c index 8790750350..b8001a3165 100644 --- a/libgimpconfig/gimpconfig-path.c +++ b/libgimpconfig/gimpconfig-path.c @@ -138,7 +138,7 @@ gimp_param_spec_config_path (const gchar *name, const gchar *nick, const gchar *blurb, GimpConfigPathType type, - gchar *default_value, + const gchar *default_value, GParamFlags flags) { GParamSpecString *pspec; @@ -146,7 +146,7 @@ gimp_param_spec_config_path (const gchar *name, pspec = g_param_spec_internal (GIMP_TYPE_PARAM_CONFIG_PATH, name, nick, blurb, flags); - pspec->default_value = default_value; + pspec->default_value = g_strdup (default_value); GIMP_PARAM_SPEC_CONFIG_PATH (pspec)->type = type; diff --git a/libgimpconfig/gimpconfig-path.h b/libgimpconfig/gimpconfig-path.h index 3f49ad1b9c..d74628f627 100644 --- a/libgimpconfig/gimpconfig-path.h +++ b/libgimpconfig/gimpconfig-path.h @@ -57,7 +57,7 @@ GParamSpec * gimp_param_spec_config_path (const gchar *name, const gchar *nick, const gchar *blurb, GimpConfigPathType type, - gchar *default_value, + const gchar *default_value, GParamFlags flags); GimpConfigPathType gimp_param_spec_config_path_type (GParamSpec *pspec); diff --git a/plug-ins/uri/uri-backend-gnomevfs.c b/plug-ins/uri/uri-backend-gnomevfs.c index 78eef62468..5b36e8bf6f 100644 --- a/plug-ins/uri/uri-backend-gnomevfs.c +++ b/plug-ins/uri/uri-backend-gnomevfs.c @@ -213,7 +213,7 @@ copy_uri (const gchar *src_uri, { g_set_error (error, 0, 0, _("Could not open '%s' for writing: %s"), - src_uri, gnome_vfs_result_to_string (result)); + dest_uri, gnome_vfs_result_to_string (result)); gnome_vfs_close (read_handle); return FALSE; }