40
40
static GType memsize_type = 0;
44
static const GTypeInfo type_info = { 0, };
44
const GTypeInfo type_info = { 0, };
46
46
memsize_type = g_type_register_static (G_TYPE_UINT64, "GimpMemsize",
175
175
if (memsize < 1024)
177
return g_strdup_printf (_("%d Bytes"), (gint) memsize);
177
gint bytes = (gint) memsize;
179
return g_strdup_printf (dngettext (GETTEXT_PACKAGE "-libgimp",
181
"%d Bytes", bytes), bytes);
180
184
if (memsize < 1024 * 10)
246
250
g_value_set_uint64 (dest_value, memsize);
255
* GIMP_TYPE_PARAM_MEMSIZE
258
static void gimp_param_memsize_class_init (GParamSpecClass *class);
261
* gimp_param_memsize_get_type:
263
* Reveals the object type
265
* Returns: the #GType for a memsize object
270
gimp_param_memsize_get_type (void)
272
static GType spec_type = 0;
276
const GTypeInfo type_info =
278
sizeof (GParamSpecClass),
280
(GClassInitFunc) gimp_param_memsize_class_init,
282
sizeof (GParamSpecUInt64),
286
spec_type = g_type_register_static (G_TYPE_PARAM_UINT64,
295
gimp_param_memsize_class_init (GParamSpecClass *class)
297
class->value_type = GIMP_TYPE_MEMSIZE;
301
* gimp_param_spec_memsize:
302
* @name: Canonical name of the param
303
* @nick: Nickname of the param
304
* @blurb: Brief desciption of param.
305
* @minimum: Smallest allowed value of the parameter.
306
* @maximum: Largest allowed value of the parameter.
307
* @default_value: Value to use if none is assigned.
308
* @flags: a combination of #GParamFlags
310
* Creates a param spec to hold a memory size value.
311
* See g_param_spec_internal() for more information.
313
* Returns: a newly allocated #GParamSpec instance
318
gimp_param_spec_memsize (const gchar *name,
323
guint64 default_value,
326
GParamSpecUInt64 *pspec;
328
pspec = g_param_spec_internal (GIMP_TYPE_PARAM_MEMSIZE,
329
name, nick, blurb, flags);
331
pspec->minimum = minimum;
332
pspec->maximum = maximum;
333
pspec->default_value = default_value;
335
return G_PARAM_SPEC (pspec);