22
22
#include "config.h"
24
28
#include <glib-object.h>
26
30
#include "libgimpbase/gimpbase.h"
31
#include "libgimpconfig/gimpconfig.h"
28
33
#include "config-types.h"
30
#include "gimpconfig-params.h"
35
#include "base/pixel-processor.h"
32
37
#include "gimprc-blurbs.h"
33
38
#include "gimpbaseconfig.h"
35
40
#include "gimp-intl.h"
38
static void gimp_base_config_class_init (GimpBaseConfigClass *klass);
39
static void gimp_base_config_finalize (GObject *object);
40
static void gimp_base_config_set_property (GObject *object,
44
static void gimp_base_config_get_property (GObject *object,
42
#define NUM_PROCESSORS_DEFAULT 1
55
PROP_STINGY_MEMORY_USE,
56
50
PROP_NUM_PROCESSORS,
53
/* ignored, only for backward compatibility: */
54
PROP_STINGY_MEMORY_USE
60
static GObjectClass *parent_class = NULL;
64
gimp_base_config_get_type (void)
66
static GType config_type = 0;
70
static const GTypeInfo config_info =
72
sizeof (GimpBaseConfigClass),
74
NULL, /* base_finalize */
75
(GClassInitFunc) gimp_base_config_class_init,
76
NULL, /* class_finalize */
77
NULL, /* class_data */
78
sizeof (GimpBaseConfig),
80
NULL /* instance_init */
83
config_type = g_type_register_static (G_TYPE_OBJECT,
58
static void gimp_base_config_finalize (GObject *object);
59
static void gimp_base_config_set_property (GObject *object,
63
static void gimp_base_config_get_property (GObject *object,
69
G_DEFINE_TYPE (GimpBaseConfig, gimp_base_config, G_TYPE_OBJECT)
71
#define parent_class gimp_base_config_parent_class
92
75
gimp_base_config_class_init (GimpBaseConfigClass *klass)
94
GObjectClass *object_class;
96
parent_class = g_type_class_peek_parent (klass);
98
object_class = G_OBJECT_CLASS (klass);
77
GObjectClass *object_class = G_OBJECT_CLASS (klass);
100
80
object_class->finalize = gimp_base_config_finalize;
101
81
object_class->set_property = gimp_base_config_set_property;
104
84
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TEMP_PATH,
105
85
"temp-path", TEMP_PATH_BLURB,
107
87
"${gimp_dir}" G_DIR_SEPARATOR_S "tmp",
88
GIMP_PARAM_STATIC_STRINGS |
89
GIMP_CONFIG_PARAM_RESTART);
109
90
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_SWAP_PATH,
110
91
"swap-path", SWAP_PATH_BLURB,
114
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE,
115
"stingy-memory-use", STINGY_MEMORY_USE_BLURB,
94
GIMP_PARAM_STATIC_STRINGS |
95
GIMP_CONFIG_PARAM_RESTART);
97
#if defined(HAVE_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN)
98
num_processors = sysconf (_SC_NPROCESSORS_ONLN);
100
num_processors = NUM_PROCESSORS_DEFAULT;
104
num_processors = num_processors * 2;
118
107
GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_NUM_PROCESSORS,
119
108
"num-processors", NUM_PROCESSORS_BLURB,
109
1, GIMP_MAX_NUM_THREADS, num_processors,
110
GIMP_PARAM_STATIC_STRINGS);
122
111
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_TILE_CACHE_SIZE,
123
112
"tile-cache-size", TILE_CACHE_SIZE_BLURB,
124
113
0, MIN (G_MAXULONG, GIMP_MAX_MEMSIZE),
115
GIMP_PARAM_STATIC_STRINGS |
116
GIMP_CONFIG_PARAM_CONFIRM);
118
/* only for backward compatibility: */
119
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE,
120
"stingy-memory-use", NULL,
122
GIMP_CONFIG_PARAM_IGNORE);
126
gimp_base_config_init (GimpBaseConfig *config)
155
156
g_free (base_config->swap_path);
156
157
base_config->swap_path = g_value_dup_string (value);
158
case PROP_STINGY_MEMORY_USE:
159
base_config->stingy_memory_use = g_value_get_boolean (value);
161
159
case PROP_NUM_PROCESSORS:
162
160
base_config->num_processors = g_value_get_uint (value);
164
162
case PROP_TILE_CACHE_SIZE:
165
163
base_config->tile_cache_size = g_value_get_uint64 (value);
166
case PROP_STINGY_MEMORY_USE:
168
171
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
186
189
case PROP_SWAP_PATH:
187
190
g_value_set_string (value, base_config->swap_path);
189
case PROP_STINGY_MEMORY_USE:
190
g_value_set_boolean (value, base_config->stingy_memory_use);
192
192
case PROP_NUM_PROCESSORS:
193
193
g_value_set_uint (value, base_config->num_processors);
195
195
case PROP_TILE_CACHE_SIZE:
196
196
g_value_set_uint64 (value, base_config->tile_cache_size);
199
case PROP_STINGY_MEMORY_USE:
199
204
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);