~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to libgimpbase/gimpmemsize.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
{
40
40
  static GType memsize_type = 0;
41
41
 
42
 
  if (!memsize_type)
 
42
  if (! memsize_type)
43
43
    {
44
 
      static const GTypeInfo type_info = { 0, };
 
44
      const GTypeInfo type_info = { 0, };
45
45
 
46
46
      memsize_type = g_type_register_static (G_TYPE_UINT64, "GimpMemsize",
47
47
                                             &type_info, 0);
174
174
 
175
175
  if (memsize < 1024)
176
176
    {
177
 
      return g_strdup_printf (_("%d Bytes"), (gint) memsize);
 
177
      gint bytes = (gint) memsize;
 
178
 
 
179
      return g_strdup_printf (dngettext (GETTEXT_PACKAGE "-libgimp",
 
180
                                         "%d Byte",
 
181
                                         "%d Bytes", bytes), bytes);
178
182
    }
179
183
 
180
184
  if (memsize < 1024 * 10)
245
249
 
246
250
  g_value_set_uint64 (dest_value, memsize);
247
251
}
 
252
 
 
253
 
 
254
/*
 
255
 * GIMP_TYPE_PARAM_MEMSIZE
 
256
 */
 
257
 
 
258
static void  gimp_param_memsize_class_init (GParamSpecClass *class);
 
259
 
 
260
/**
 
261
 * gimp_param_memsize_get_type:
 
262
 *
 
263
 * Reveals the object type
 
264
 *
 
265
 * Returns: the #GType for a memsize object
 
266
 *
 
267
 * Since: GIMP 2.4
 
268
 **/
 
269
GType
 
270
gimp_param_memsize_get_type (void)
 
271
{
 
272
  static GType spec_type = 0;
 
273
 
 
274
  if (! spec_type)
 
275
    {
 
276
      const GTypeInfo type_info =
 
277
      {
 
278
        sizeof (GParamSpecClass),
 
279
        NULL, NULL,
 
280
        (GClassInitFunc) gimp_param_memsize_class_init,
 
281
        NULL, NULL,
 
282
        sizeof (GParamSpecUInt64),
 
283
        0, NULL, NULL
 
284
      };
 
285
 
 
286
      spec_type = g_type_register_static (G_TYPE_PARAM_UINT64,
 
287
                                          "GimpParamMemsize",
 
288
                                          &type_info, 0);
 
289
    }
 
290
 
 
291
  return spec_type;
 
292
}
 
293
 
 
294
static void
 
295
gimp_param_memsize_class_init (GParamSpecClass *class)
 
296
{
 
297
  class->value_type = GIMP_TYPE_MEMSIZE;
 
298
}
 
299
 
 
300
/**
 
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
 
309
 *
 
310
 * Creates a param spec to hold a memory size value.
 
311
 * See g_param_spec_internal() for more information.
 
312
 *
 
313
 * Returns: a newly allocated #GParamSpec instance
 
314
 *
 
315
 * Since: GIMP 2.4
 
316
 **/
 
317
GParamSpec *
 
318
gimp_param_spec_memsize (const gchar *name,
 
319
                         const gchar *nick,
 
320
                         const gchar *blurb,
 
321
                         guint64      minimum,
 
322
                         guint64      maximum,
 
323
                         guint64      default_value,
 
324
                         GParamFlags  flags)
 
325
{
 
326
  GParamSpecUInt64 *pspec;
 
327
 
 
328
  pspec = g_param_spec_internal (GIMP_TYPE_PARAM_MEMSIZE,
 
329
                                 name, nick, blurb, flags);
 
330
 
 
331
  pspec->minimum       = minimum;
 
332
  pspec->maximum       = maximum;
 
333
  pspec->default_value = default_value;
 
334
 
 
335
  return G_PARAM_SPEC (pspec);
 
336
}
 
337