~ubuntu-branches/ubuntu/saucy/gimp/saucy

« back to all changes in this revision

Viewing changes to app/widgets/gimpcontainertreestore.c

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2012-05-20 19:21:01 UTC
  • mfrom: (1.1.26) (0.4.16 sid)
  • Revision ID: package-import@ubuntu.com-20120520192101-bs7zetx8ffoq2nfv
Tags: 2.8.0-2ubuntu1
* Merge from Debian unstable (LP: #908472). Remaining Changes:
  - debian/patches/02_help-message.patch,
    debian/patches/03_gimp.desktop.in.in.patch:
    + Update some strings for Ubuntu
  - debian/control:
    + Update description
  - debian/rules:
    + Set gettext domain and update translation templates
* Drop the following patches that were applied upstream:
  - debian/patches/ghost-cursor.patch: fix Wacom tablet cursor events
  - debian/patches/embed-page-setup-dialog.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * gimpcontainertreestore.c
 
5
 * Copyright (C) 2010 Michael Natterer <mitch@gimp.org>
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 3 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
 */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
#include <string.h>
 
24
 
 
25
#include <gtk/gtk.h>
 
26
 
 
27
#include "widgets-types.h"
 
28
 
 
29
#include "core/gimpcontainer.h"
 
30
#include "core/gimpviewable.h"
 
31
 
 
32
#include "gimpcellrendererviewable.h"
 
33
#include "gimpcontainertreestore.h"
 
34
#include "gimpcontainerview.h"
 
35
#include "gimpviewrenderer.h"
 
36
 
 
37
 
 
38
enum
 
39
{
 
40
  PROP_0,
 
41
  PROP_CONTAINER_VIEW,
 
42
  PROP_USE_NAME
 
43
};
 
44
 
 
45
 
 
46
typedef struct _GimpContainerTreeStorePrivate GimpContainerTreeStorePrivate;
 
47
 
 
48
struct _GimpContainerTreeStorePrivate
 
49
{
 
50
  GimpContainerView *container_view;
 
51
  GList             *renderer_cells;
 
52
  gboolean           use_name;
 
53
};
 
54
 
 
55
#define GET_PRIVATE(store) \
 
56
        G_TYPE_INSTANCE_GET_PRIVATE (store, \
 
57
                                     GIMP_TYPE_CONTAINER_TREE_STORE, \
 
58
                                     GimpContainerTreeStorePrivate)
 
59
 
 
60
 
 
61
static void   gimp_container_tree_store_constructed     (GObject                *object);
 
62
static void   gimp_container_tree_store_finalize        (GObject                *object);
 
63
static void   gimp_container_tree_store_set_property    (GObject                *object,
 
64
                                                         guint                   property_id,
 
65
                                                         const GValue           *value,
 
66
                                                         GParamSpec             *pspec);
 
67
static void   gimp_container_tree_store_get_property    (GObject                *object,
 
68
                                                         guint                   property_id,
 
69
                                                         GValue                 *value,
 
70
                                                         GParamSpec             *pspec);
 
71
 
 
72
static void   gimp_container_tree_store_set             (GimpContainerTreeStore *store,
 
73
                                                         GtkTreeIter            *iter,
 
74
                                                         GimpViewable           *viewable);
 
75
static void   gimp_container_tree_store_renderer_update (GimpViewRenderer       *renderer,
 
76
                                                         GimpContainerTreeStore *store);
 
77
 
 
78
 
 
79
G_DEFINE_TYPE (GimpContainerTreeStore, gimp_container_tree_store,
 
80
               GTK_TYPE_TREE_STORE)
 
81
 
 
82
#define parent_class gimp_container_tree_store_parent_class
 
83
 
 
84
 
 
85
static void
 
86
gimp_container_tree_store_class_init (GimpContainerTreeStoreClass *klass)
 
87
{
 
88
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
89
 
 
90
  object_class->constructed  = gimp_container_tree_store_constructed;
 
91
  object_class->finalize     = gimp_container_tree_store_finalize;
 
92
  object_class->set_property = gimp_container_tree_store_set_property;
 
93
  object_class->get_property = gimp_container_tree_store_get_property;
 
94
 
 
95
  g_object_class_install_property (object_class, PROP_CONTAINER_VIEW,
 
96
                                   g_param_spec_object ("container-view",
 
97
                                                        NULL, NULL,
 
98
                                                        GIMP_TYPE_CONTAINER_VIEW,
 
99
                                                        GIMP_PARAM_READWRITE |
 
100
                                                        G_PARAM_CONSTRUCT_ONLY));
 
101
 
 
102
  g_object_class_install_property (object_class, PROP_USE_NAME,
 
103
                                   g_param_spec_boolean ("use-name",
 
104
                                                         NULL, NULL,
 
105
                                                         FALSE,
 
106
                                                         GIMP_PARAM_READWRITE));
 
107
 
 
108
  g_type_class_add_private (klass, sizeof (GimpContainerTreeStorePrivate));
 
109
}
 
110
 
 
111
static void
 
112
gimp_container_tree_store_init (GimpContainerTreeStore *store)
 
113
{
 
114
}
 
115
 
 
116
static void
 
117
gimp_container_tree_store_constructed (GObject *object)
 
118
{
 
119
  if (G_OBJECT_CLASS (parent_class)->constructed)
 
120
    G_OBJECT_CLASS (parent_class)->constructed (object);
 
121
}
 
122
 
 
123
static void
 
124
gimp_container_tree_store_finalize (GObject *object)
 
125
{
 
126
  GimpContainerTreeStorePrivate *private = GET_PRIVATE (object);
 
127
 
 
128
  if (private->renderer_cells)
 
129
    {
 
130
      g_list_free (private->renderer_cells);
 
131
      private->renderer_cells = NULL;
 
132
    }
 
133
 
 
134
  G_OBJECT_CLASS (parent_class)->finalize (object);
 
135
}
 
136
 
 
137
static void
 
138
gimp_container_tree_store_set_property (GObject      *object,
 
139
                                        guint         property_id,
 
140
                                        const GValue *value,
 
141
                                        GParamSpec   *pspec)
 
142
{
 
143
  GimpContainerTreeStorePrivate *private = GET_PRIVATE (object);
 
144
 
 
145
  switch (property_id)
 
146
    {
 
147
    case PROP_CONTAINER_VIEW:
 
148
      private->container_view = g_value_get_object (value); /* don't ref */
 
149
      break;
 
150
    case PROP_USE_NAME:
 
151
      private->use_name = g_value_get_boolean (value);
 
152
      break;
 
153
 
 
154
    default:
 
155
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
156
      break;
 
157
    }
 
158
}
 
159
 
 
160
static void
 
161
gimp_container_tree_store_get_property (GObject    *object,
 
162
                                        guint       property_id,
 
163
                                        GValue     *value,
 
164
                                        GParamSpec *pspec)
 
165
{
 
166
  GimpContainerTreeStorePrivate *private = GET_PRIVATE (object);
 
167
 
 
168
  switch (property_id)
 
169
    {
 
170
    case PROP_CONTAINER_VIEW:
 
171
      g_value_set_object (value, private->container_view);
 
172
      break;
 
173
    case PROP_USE_NAME:
 
174
      g_value_set_boolean (value, private->use_name);
 
175
      break;
 
176
 
 
177
    default:
 
178
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
179
      break;
 
180
    }
 
181
}
 
182
 
 
183
 
 
184
/*  public functions  */
 
185
 
 
186
GtkTreeModel *
 
187
gimp_container_tree_store_new (GimpContainerView *container_view,
 
188
                               gint               n_columns,
 
189
                               GType             *types)
 
190
{
 
191
  GimpContainerTreeStore *store;
 
192
 
 
193
  g_return_val_if_fail (GIMP_IS_CONTAINER_VIEW (container_view), NULL);
 
194
  g_return_val_if_fail (n_columns >= GIMP_CONTAINER_TREE_STORE_N_COLUMNS, NULL);
 
195
  g_return_val_if_fail (types != NULL, NULL);
 
196
 
 
197
  store = g_object_new (GIMP_TYPE_CONTAINER_TREE_STORE,
 
198
                        "container-view", container_view,
 
199
                        NULL);
 
200
 
 
201
  gtk_tree_store_set_column_types (GTK_TREE_STORE (store), n_columns, types);
 
202
 
 
203
  return GTK_TREE_MODEL (store);
 
204
}
 
205
 
 
206
void
 
207
gimp_container_tree_store_add_renderer_cell (GimpContainerTreeStore *store,
 
208
                                             GtkCellRenderer        *cell)
 
209
{
 
210
  GimpContainerTreeStorePrivate *private;
 
211
 
 
212
  g_return_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store));
 
213
  g_return_if_fail (GIMP_IS_CELL_RENDERER_VIEWABLE (cell));
 
214
 
 
215
  private = GET_PRIVATE (store);
 
216
 
 
217
  private->renderer_cells = g_list_prepend (private->renderer_cells, cell);
 
218
}
 
219
 
 
220
void
 
221
gimp_container_tree_store_set_use_name (GimpContainerTreeStore *store,
 
222
                                        gboolean                use_name)
 
223
{
 
224
  GimpContainerTreeStorePrivate *private;
 
225
 
 
226
  g_return_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store));
 
227
 
 
228
  private = GET_PRIVATE (store);
 
229
 
 
230
  if (private->use_name != use_name)
 
231
    {
 
232
      private->use_name = use_name ? TRUE : FALSE;
 
233
      g_object_notify (G_OBJECT (store), "use-name");
 
234
    }
 
235
}
 
236
 
 
237
gboolean
 
238
gimp_container_tree_store_get_use_name (GimpContainerTreeStore *store)
 
239
{
 
240
  g_return_val_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store), FALSE);
 
241
 
 
242
  return GET_PRIVATE (store)->use_name;
 
243
}
 
244
 
 
245
static gboolean
 
246
gimp_container_tree_store_set_context_foreach (GtkTreeModel *model,
 
247
                                               GtkTreePath  *path,
 
248
                                               GtkTreeIter  *iter,
 
249
                                               gpointer      data)
 
250
{
 
251
  GimpContext      *context = data;
 
252
  GimpViewRenderer *renderer;
 
253
 
 
254
  gtk_tree_model_get (model, iter,
 
255
                      GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
 
256
                      -1);
 
257
 
 
258
  gimp_view_renderer_set_context (renderer, context);
 
259
 
 
260
  g_object_unref (renderer);
 
261
 
 
262
  return FALSE;
 
263
}
 
264
 
 
265
void
 
266
gimp_container_tree_store_set_context (GimpContainerTreeStore *store,
 
267
                                       GimpContext            *context)
 
268
{
 
269
  g_return_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store));
 
270
 
 
271
  gtk_tree_model_foreach (GTK_TREE_MODEL (store),
 
272
                          gimp_container_tree_store_set_context_foreach,
 
273
                          context);
 
274
}
 
275
 
 
276
GtkTreeIter *
 
277
gimp_container_tree_store_insert_item (GimpContainerTreeStore *store,
 
278
                                       GimpViewable           *viewable,
 
279
                                       GtkTreeIter            *parent,
 
280
                                       gint                    index)
 
281
{
 
282
  GtkTreeIter iter;
 
283
 
 
284
  g_return_val_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store), NULL);
 
285
 
 
286
  if (index == -1)
 
287
    gtk_tree_store_append (GTK_TREE_STORE (store), &iter, parent);
 
288
  else
 
289
    gtk_tree_store_insert (GTK_TREE_STORE (store), &iter, parent, index);
 
290
 
 
291
  gimp_container_tree_store_set (store, &iter, viewable);
 
292
 
 
293
  return gtk_tree_iter_copy (&iter);
 
294
}
 
295
 
 
296
void
 
297
gimp_container_tree_store_remove_item (GimpContainerTreeStore *store,
 
298
                                       GimpViewable           *viewable,
 
299
                                       GtkTreeIter            *iter)
 
300
{
 
301
  if (iter)
 
302
    {
 
303
      gtk_tree_store_remove (GTK_TREE_STORE (store), iter);
 
304
 
 
305
      /*  If the store is empty after this remove, clear out renderers
 
306
       *  from all cells so they don't keep refing the viewables
 
307
       *  (see bug #149906).
 
308
       */
 
309
      if (! gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL))
 
310
        {
 
311
          GimpContainerTreeStorePrivate *private = GET_PRIVATE (store);
 
312
          GList                         *list;
 
313
 
 
314
          for (list = private->renderer_cells; list; list = list->next)
 
315
            g_object_set (list->data, "renderer", NULL, NULL);
 
316
        }
 
317
    }
 
318
}
 
319
 
 
320
void
 
321
gimp_container_tree_store_reorder_item (GimpContainerTreeStore *store,
 
322
                                        GimpViewable           *viewable,
 
323
                                        gint                    new_index,
 
324
                                        GtkTreeIter            *iter)
 
325
{
 
326
  GimpContainerTreeStorePrivate *private;
 
327
  GimpViewable                  *parent;
 
328
  GimpContainer                 *container;
 
329
 
 
330
  g_return_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store));
 
331
 
 
332
  private = GET_PRIVATE (store);
 
333
 
 
334
  if (! iter)
 
335
    return;
 
336
 
 
337
  parent = gimp_viewable_get_parent (viewable);
 
338
 
 
339
  if (parent)
 
340
    container = gimp_viewable_get_children (parent);
 
341
  else
 
342
    container = gimp_container_view_get_container (private->container_view);
 
343
 
 
344
  if (new_index == -1 ||
 
345
      new_index == gimp_container_get_n_children (container) - 1)
 
346
    {
 
347
      gtk_tree_store_move_before (GTK_TREE_STORE (store), iter, NULL);
 
348
    }
 
349
  else if (new_index == 0)
 
350
    {
 
351
      gtk_tree_store_move_after (GTK_TREE_STORE (store), iter, NULL);
 
352
    }
 
353
  else
 
354
    {
 
355
      GtkTreePath *path;
 
356
      GtkTreeIter  place_iter;
 
357
      gint         depth;
 
358
      gint        *indices;
 
359
      gint         old_index;
 
360
 
 
361
      path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter);
 
362
      indices = gtk_tree_path_get_indices (path);
 
363
 
 
364
      depth = gtk_tree_path_get_depth (path);
 
365
 
 
366
      old_index = indices[depth - 1];
 
367
 
 
368
      if (new_index != old_index)
 
369
        {
 
370
          indices[depth - 1] = new_index;
 
371
 
 
372
          gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &place_iter, path);
 
373
 
 
374
          if (new_index > old_index)
 
375
            gtk_tree_store_move_after (GTK_TREE_STORE (store),
 
376
                                       iter, &place_iter);
 
377
          else
 
378
            gtk_tree_store_move_before (GTK_TREE_STORE (store),
 
379
                                        iter, &place_iter);
 
380
        }
 
381
 
 
382
      gtk_tree_path_free (path);
 
383
    }
 
384
}
 
385
 
 
386
gboolean
 
387
gimp_container_tree_store_rename_item (GimpContainerTreeStore *store,
 
388
                                       GimpViewable           *viewable,
 
389
                                       GtkTreeIter            *iter)
 
390
{
 
391
  gboolean new_name_shorter = FALSE;
 
392
 
 
393
  g_return_val_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store), FALSE);
 
394
 
 
395
  if (iter)
 
396
    {
 
397
      GimpContainerTreeStorePrivate *private = GET_PRIVATE (store);
 
398
      gchar                         *name;
 
399
      gchar                         *old_name;
 
400
 
 
401
      if (private->use_name)
 
402
        name = (gchar *) gimp_object_get_name (viewable);
 
403
      else
 
404
        name = gimp_viewable_get_description (viewable, NULL);
 
405
 
 
406
      gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
 
407
                          GIMP_CONTAINER_TREE_STORE_COLUMN_NAME, &old_name,
 
408
                          -1);
 
409
 
 
410
      gtk_tree_store_set (GTK_TREE_STORE (store), iter,
 
411
                          GIMP_CONTAINER_TREE_STORE_COLUMN_NAME, name,
 
412
                          -1);
 
413
 
 
414
      if (name && old_name && strlen (name) < strlen (old_name))
 
415
        new_name_shorter = TRUE;
 
416
 
 
417
      if (! private->use_name)
 
418
        g_free (name);
 
419
 
 
420
      g_free (old_name);
 
421
    }
 
422
 
 
423
  return new_name_shorter;
 
424
}
 
425
 
 
426
void
 
427
gimp_container_tree_store_clear_items (GimpContainerTreeStore *store)
 
428
{
 
429
  g_return_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store));
 
430
 
 
431
  gtk_tree_store_clear (GTK_TREE_STORE (store));
 
432
 
 
433
  /*  If the store is empty after this remove, clear out renderers
 
434
   *  from all cells so they don't keep refing the viewables
 
435
   *  (see bug #149906).
 
436
   */
 
437
  if (! gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL))
 
438
    {
 
439
      GimpContainerTreeStorePrivate *private = GET_PRIVATE (store);
 
440
      GList                         *list;
 
441
 
 
442
      for (list = private->renderer_cells; list; list = list->next)
 
443
        g_object_set (list->data, "renderer", NULL, NULL);
 
444
    }
 
445
}
 
446
 
 
447
typedef struct
 
448
{
 
449
  gint view_size;
 
450
  gint border_width;
 
451
} SetSizeForeachData;
 
452
 
 
453
static gboolean
 
454
gimp_container_tree_store_set_view_size_foreach (GtkTreeModel *model,
 
455
                                                 GtkTreePath  *path,
 
456
                                                 GtkTreeIter  *iter,
 
457
                                                 gpointer      data)
 
458
{
 
459
  SetSizeForeachData *size_data = data;
 
460
  GimpViewRenderer   *renderer;
 
461
 
 
462
  gtk_tree_model_get (model, iter,
 
463
                      GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER, &renderer,
 
464
                      -1);
 
465
 
 
466
  gimp_view_renderer_set_size (renderer,
 
467
                               size_data->view_size,
 
468
                               size_data->border_width);
 
469
 
 
470
  g_object_unref (renderer);
 
471
 
 
472
  return FALSE;
 
473
}
 
474
 
 
475
void
 
476
gimp_container_tree_store_set_view_size (GimpContainerTreeStore *store)
 
477
{
 
478
  GimpContainerTreeStorePrivate *private;
 
479
  SetSizeForeachData             size_data;
 
480
 
 
481
  g_return_if_fail (GIMP_IS_CONTAINER_TREE_STORE (store));
 
482
 
 
483
  private = GET_PRIVATE (store);
 
484
 
 
485
  size_data.view_size =
 
486
    gimp_container_view_get_view_size (private->container_view,
 
487
                                       &size_data.border_width);
 
488
 
 
489
  gtk_tree_model_foreach (GTK_TREE_MODEL (store),
 
490
                          gimp_container_tree_store_set_view_size_foreach,
 
491
                          &size_data);
 
492
}
 
493
 
 
494
 
 
495
/*  private functions  */
 
496
 
 
497
void
 
498
gimp_container_tree_store_columns_init (GType *types,
 
499
                                        gint  *n_types)
 
500
{
 
501
  g_return_if_fail (types != NULL);
 
502
  g_return_if_fail (n_types != NULL);
 
503
  g_return_if_fail (*n_types == 0);
 
504
 
 
505
  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER ==
 
506
            gimp_container_tree_store_columns_add (types, n_types,
 
507
                                                   GIMP_TYPE_VIEW_RENDERER));
 
508
 
 
509
  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME ==
 
510
            gimp_container_tree_store_columns_add (types, n_types,
 
511
                                                   G_TYPE_STRING));
 
512
 
 
513
  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_ATTRIBUTES ==
 
514
            gimp_container_tree_store_columns_add (types, n_types,
 
515
                                                   PANGO_TYPE_ATTR_LIST));
 
516
 
 
517
  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_SENSITIVE ==
 
518
            gimp_container_tree_store_columns_add (types, n_types,
 
519
                                                   G_TYPE_BOOLEAN));
 
520
 
 
521
  g_assert (GIMP_CONTAINER_TREE_STORE_COLUMN_USER_DATA ==
 
522
            gimp_container_tree_store_columns_add (types, n_types,
 
523
                                                   G_TYPE_POINTER));
 
524
}
 
525
 
 
526
gint
 
527
gimp_container_tree_store_columns_add (GType *types,
 
528
                                       gint  *n_types,
 
529
                                       GType  type)
 
530
{
 
531
  g_return_val_if_fail (types != NULL, 0);
 
532
  g_return_val_if_fail (n_types != NULL, 0);
 
533
  g_return_val_if_fail (*n_types >= 0, 0);
 
534
 
 
535
  types[*n_types] = type;
 
536
  (*n_types)++;
 
537
 
 
538
  return *n_types - 1;
 
539
}
 
540
 
 
541
static void
 
542
gimp_container_tree_store_set (GimpContainerTreeStore *store,
 
543
                               GtkTreeIter            *iter,
 
544
                               GimpViewable           *viewable)
 
545
{
 
546
  GimpContainerTreeStorePrivate *private = GET_PRIVATE (store);
 
547
  GimpContext                   *context;
 
548
  GimpViewRenderer              *renderer;
 
549
  gchar                         *name;
 
550
  gint                           view_size;
 
551
  gint                           border_width;
 
552
 
 
553
  context = gimp_container_view_get_context (private->container_view);
 
554
 
 
555
  view_size = gimp_container_view_get_view_size (private->container_view,
 
556
                                                 &border_width);
 
557
 
 
558
  renderer = gimp_view_renderer_new (context,
 
559
                                     G_TYPE_FROM_INSTANCE (viewable),
 
560
                                     view_size, border_width,
 
561
                                     FALSE);
 
562
  gimp_view_renderer_set_viewable (renderer, viewable);
 
563
  gimp_view_renderer_remove_idle (renderer);
 
564
 
 
565
  g_signal_connect (renderer, "update",
 
566
                    G_CALLBACK (gimp_container_tree_store_renderer_update),
 
567
                    store);
 
568
 
 
569
  if (private->use_name)
 
570
    name = (gchar *) gimp_object_get_name (viewable);
 
571
  else
 
572
    name = gimp_viewable_get_description (viewable, NULL);
 
573
 
 
574
  gtk_tree_store_set (GTK_TREE_STORE (store), iter,
 
575
                      GIMP_CONTAINER_TREE_STORE_COLUMN_RENDERER,       renderer,
 
576
                      GIMP_CONTAINER_TREE_STORE_COLUMN_NAME,           name,
 
577
                      GIMP_CONTAINER_TREE_STORE_COLUMN_NAME_SENSITIVE, TRUE,
 
578
                      -1);
 
579
 
 
580
  if (! private->use_name)
 
581
    g_free (name);
 
582
 
 
583
  g_object_unref (renderer);
 
584
}
 
585
 
 
586
static void
 
587
gimp_container_tree_store_renderer_update (GimpViewRenderer       *renderer,
 
588
                                           GimpContainerTreeStore *store)
 
589
{
 
590
  GimpContainerTreeStorePrivate *private = GET_PRIVATE (store);
 
591
  GtkTreeIter                   *iter;
 
592
 
 
593
  iter = gimp_container_view_lookup (private->container_view,
 
594
                                     renderer->viewable);
 
595
 
 
596
  if (iter)
 
597
    {
 
598
      GtkTreePath *path;
 
599
 
 
600
      path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter);
 
601
      gtk_tree_model_row_changed (GTK_TREE_MODEL (store), path, iter);
 
602
      gtk_tree_path_free (path);
 
603
    }
 
604
}