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

« back to all changes in this revision

Viewing changes to app/core/gimplist.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:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * gimplist.c
39
39
};
40
40
 
41
41
 
42
 
static void         gimp_list_class_init         (GimpListClass       *klass);
43
 
static void         gimp_list_init               (GimpList            *list);
44
 
 
45
42
static void         gimp_list_set_property       (GObject             *object,
46
43
                                                  guint                property_id,
47
44
                                                  const GValue        *value,
80
77
                                                  GimpList            *list);
81
78
 
82
79
 
83
 
static GimpContainerClass *parent_class = NULL;
84
 
 
85
 
 
86
 
GType
87
 
gimp_list_get_type (void)
88
 
{
89
 
  static GType list_type = 0;
90
 
 
91
 
  if (! list_type)
92
 
    {
93
 
      static const GTypeInfo list_info =
94
 
      {
95
 
        sizeof (GimpListClass),
96
 
        (GBaseInitFunc) NULL,
97
 
        (GBaseFinalizeFunc) NULL,
98
 
        (GClassInitFunc) gimp_list_class_init,
99
 
        NULL,           /* class_finalize */
100
 
        NULL,           /* class_data     */
101
 
        sizeof (GimpList),
102
 
        0,              /* n_preallocs    */
103
 
        (GInstanceInitFunc) gimp_list_init,
104
 
      };
105
 
 
106
 
      list_type = g_type_register_static (GIMP_TYPE_CONTAINER,
107
 
                                          "GimpList",
108
 
                                          &list_info, 0);
109
 
    }
110
 
 
111
 
  return list_type;
112
 
}
 
80
G_DEFINE_TYPE (GimpList, gimp_list, GIMP_TYPE_CONTAINER)
 
81
 
 
82
#define parent_class gimp_list_parent_class
 
83
 
113
84
 
114
85
static void
115
86
gimp_list_class_init (GimpListClass *klass)
118
89
  GimpObjectClass    *gimp_object_class = GIMP_OBJECT_CLASS (klass);
119
90
  GimpContainerClass *container_class   = GIMP_CONTAINER_CLASS (klass);
120
91
 
121
 
  parent_class = g_type_class_peek_parent (klass);
122
 
 
123
92
  object_class->set_property          = gimp_list_set_property;
124
93
  object_class->get_property          = gimp_list_get_property;
125
94
 
136
105
  container_class->get_child_index    = gimp_list_get_child_index;
137
106
 
138
107
  g_object_class_install_property (object_class, PROP_UNIQUE_NAMES,
139
 
                                   g_param_spec_boolean ("unique-names",
 
108
                                   g_param_spec_boolean ("unique-names",
140
109
                                                         NULL, NULL,
141
110
                                                         FALSE,
142
 
                                                         G_PARAM_READWRITE |
 
111
                                                         GIMP_PARAM_READWRITE |
143
112
                                                         G_PARAM_CONSTRUCT_ONLY));
144
113
 
145
114
  g_object_class_install_property (object_class, PROP_SORT_FUNC,
146
 
                                   g_param_spec_pointer ("sort-func",
 
115
                                   g_param_spec_pointer ("sort-func",
147
116
                                                         NULL, NULL,
148
 
                                                         G_PARAM_READWRITE |
 
117
                                                         GIMP_PARAM_READWRITE |
149
118
                                                         G_PARAM_CONSTRUCT));
150
119
}
151
120
 
226
195
 
227
196
static void
228
197
gimp_list_add (GimpContainer *container,
229
 
               GimpObject    *object)
 
198
               GimpObject    *object)
230
199
{
231
200
  GimpList *list = GIMP_LIST (container);
232
201
 
246
215
 
247
216
static void
248
217
gimp_list_remove (GimpContainer *container,
249
 
                  GimpObject    *object)
 
218
                  GimpObject    *object)
250
219
{
251
220
  GimpList *list = GIMP_LIST (container);
252
221
 
260
229
 
261
230
static void
262
231
gimp_list_reorder (GimpContainer *container,
263
 
                   GimpObject    *object,
264
 
                   gint           new_index)
 
232
                   GimpObject    *object,
 
233
                   gint           new_index)
265
234
{
266
235
  GimpList *list = GIMP_LIST (container);
267
236
 
284
253
 
285
254
static gboolean
286
255
gimp_list_have (const GimpContainer *container,
287
 
                const GimpObject    *object)
 
256
                const GimpObject    *object)
288
257
{
289
258
  GimpList *list = GIMP_LIST (container);
290
259
 
293
262
 
294
263
static void
295
264
gimp_list_foreach (const GimpContainer *container,
296
 
                   GFunc                func,
297
 
                   gpointer             user_data)
 
265
                   GFunc                func,
 
266
                   gpointer             user_data)
298
267
{
299
268
  GimpList *list = GIMP_LIST (container);
300
269
 
303
272
 
304
273
static GimpObject *
305
274
gimp_list_get_child_by_name (const GimpContainer *container,
306
 
                             const gchar         *name)
 
275
                             const gchar         *name)
307
276
{
308
277
  GimpList *list = GIMP_LIST (container);
309
278
  GList    *glist;
313
282
      GimpObject *object = glist->data;
314
283
 
315
284
      if (! strcmp (object->name, name))
316
 
        return object;
 
285
        return object;
317
286
    }
318
287
 
319
288
  return NULL;
321
290
 
322
291
static GimpObject *
323
292
gimp_list_get_child_by_index (const GimpContainer *container,
324
 
                              gint                 index)
 
293
                              gint                 index)
325
294
{
326
295
  GimpList *list = GIMP_LIST (container);
327
296
  GList    *glist;
336
305
 
337
306
static gint
338
307
gimp_list_get_child_index (const GimpContainer *container,
339
 
                           const GimpObject    *object)
 
308
                           const GimpObject    *object)
340
309
{
341
310
  GimpList *list = GIMP_LIST (container);
342
311
 
366
335
  g_return_val_if_fail (g_type_is_a (children_type, GIMP_TYPE_OBJECT), NULL);
367
336
 
368
337
  list = g_object_new (GIMP_TYPE_LIST,
369
 
                       "children_type", children_type,
 
338
                       "children-type", children_type,
370
339
                       "policy",        GIMP_CONTAINER_POLICY_STRONG,
371
340
                       "unique-names",  unique_names ? TRUE : FALSE,
372
341
                       NULL);
373
342
 
 
343
  /* for debugging purposes only */
 
344
  gimp_object_set_static_name (GIMP_OBJECT (list), g_type_name (children_type));
 
345
 
374
346
  return GIMP_CONTAINER (list);
375
347
}
376
348
 
397
369
  g_return_val_if_fail (g_type_is_a (children_type, GIMP_TYPE_OBJECT), NULL);
398
370
 
399
371
  list = g_object_new (GIMP_TYPE_LIST,
400
 
                       "children_type", children_type,
 
372
                       "children-type", children_type,
401
373
                       "policy",        GIMP_CONTAINER_POLICY_WEAK,
402
374
                       "unique-names",  unique_names ? TRUE : FALSE,
403
375
                       NULL);
404
376
 
 
377
  /* for debugging purposes only */
 
378
  gimp_object_set_static_name (GIMP_OBJECT (list), g_type_name (children_type));
 
379
 
405
380
  return GIMP_CONTAINER (list);
406
381
}
407
382
 
507
482
      GimpObject *object2 = GIMP_OBJECT (list->data);
508
483
 
509
484
      if (object != object2 &&
510
 
          strcmp (gimp_object_get_name (GIMP_OBJECT (object)),
511
 
                  gimp_object_get_name (GIMP_OBJECT (object2))) == 0)
512
 
        {
 
485
          strcmp (gimp_object_get_name (GIMP_OBJECT (object)),
 
486
                  gimp_object_get_name (GIMP_OBJECT (object2))) == 0)
 
487
        {
513
488
          ext = strrchr (object->name, '#');
514
489
 
515
490
          if (ext)
553
528
                    continue;
554
529
 
555
530
                  if (! strcmp (object2->name, new_name))
556
 
                    break;
 
531
                    break;
557
532
                }
558
533
            }
559
534
          while (list2);
560
535
 
561
 
          gimp_object_set_name (object, new_name);
562
 
          g_free (new_name);
563
 
          break;
564
 
        }
 
536
          gimp_object_take_name (object, new_name);
 
537
          break;
 
538
        }
565
539
    }
566
540
}
567
541