[gimp/metadata-browser] app: always use gimp_item_peek_node() to check if the item has a graph



commit 5a10c53e437799ed369087508ce31d5fe051bf44
Author: Michael Natterer <mitch gimp org>
Date:   Tue May 15 21:57:40 2012 +0200

    app: always use gimp_item_peek_node() to check if the item has a graph
    
    instead of checking different things in each item subclass, which is
    confusing to the reader.

 app/core/gimpchannel.c |    4 ++--
 app/core/gimplayer.c   |   21 ++++++++++++---------
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 24f8830..8a44de7 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -1762,7 +1762,7 @@ gimp_channel_set_color (GimpChannel   *channel,
 
       channel->color = *color;
 
-      if (channel->color_node)
+      if (gimp_item_peek_node (GIMP_ITEM (channel)))
         {
           GeglColor *gegl_color = gimp_gegl_color_new (&channel->color);
 
@@ -1821,7 +1821,7 @@ gimp_channel_set_opacity (GimpChannel *channel,
 
       channel->color.a = opacity;
 
-      if (channel->color_node)
+      if (gimp_item_peek_node (GIMP_ITEM (channel)))
         {
           GeglColor *gegl_color = gimp_gegl_color_new (&channel->color);
 
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index 747bb82..16c568d 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1251,7 +1251,7 @@ gimp_layer_add_mask (GimpLayer      *layer,
 
   gimp_layer_mask_set_layer (mask, layer);
 
-  if (layer->opacity_node)
+  if (gimp_item_peek_node (GIMP_ITEM (layer)))
     {
       GeglNode *mask;
 
@@ -1584,7 +1584,7 @@ gimp_layer_apply_mask (GimpLayer         *layer,
   if (push_undo)
     gimp_image_undo_group_end (image);
 
-  if (layer->opacity_node)
+  if (gimp_item_peek_node (item))
     {
       if (layer->show_mask)
         {
@@ -1640,7 +1640,8 @@ gimp_layer_set_apply_mask (GimpLayer *layer,
 
       layer->apply_mask = apply ? TRUE : FALSE;
 
-      if (layer->opacity_node && ! gimp_layer_get_show_mask (layer))
+      if (gimp_item_peek_node (GIMP_ITEM (layer)) &&
+          ! gimp_layer_get_show_mask (layer))
         {
           GeglNode *mask;
 
@@ -1718,7 +1719,7 @@ gimp_layer_set_show_mask (GimpLayer *layer,
 
       layer->show_mask = show ? TRUE : FALSE;
 
-      if (layer->opacity_node)
+      if (gimp_item_peek_node (GIMP_ITEM (layer)))
         {
           GeglNode *mask;
 
@@ -1923,10 +1924,12 @@ gimp_layer_set_opacity (GimpLayer *layer,
       g_signal_emit (layer, layer_signals[OPACITY_CHANGED], 0);
       g_object_notify (G_OBJECT (layer), "opacity");
 
-      if (layer->opacity_node)
-        gegl_node_set (layer->opacity_node,
-                       "value", layer->opacity,
-                       NULL);
+      if (gimp_item_peek_node (GIMP_ITEM (layer)))
+        {
+          gegl_node_set (layer->opacity_node,
+                         "value", layer->opacity,
+                         NULL);
+        }
 
       gimp_drawable_update (GIMP_DRAWABLE (layer),
                             0, 0,
@@ -1964,7 +1967,7 @@ gimp_layer_set_mode (GimpLayer            *layer,
       g_signal_emit (layer, layer_signals[MODE_CHANGED], 0);
       g_object_notify (G_OBJECT (layer), "mode");
 
-      if (layer->opacity_node)
+      if (gimp_item_peek_node (GIMP_ITEM (layer)))
         {
           GeglNode *mode_node;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]