declare default_value as const and allocate a copy.

2005-04-06  Sven Neumann  <sven@gimp.org>

	* 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.
This commit is contained in:
Sven Neumann 2005-04-06 15:14:57 +00:00 committed by Sven Neumann
parent 24cb9a5d7a
commit e79099db0d
7 changed files with 48 additions and 7 deletions

View File

@ -1,3 +1,16 @@
2005-04-06 Sven Neumann <sven@gimp.org>
* 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 <sven@gimp.org>
* docs/Makefile.am: install a link to the gimp(1) man-page for

View File

@ -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),

View File

@ -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",

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;
}