[gimp/wip/Jehan/layers-dockable-refresh: 104/126] app: get rid of all "*-linked" actions.




commit deaf27b1d1dacb807ea146227ab7ef94962b0a4a
Author: Jehan <jehan girinstud io>
Date:   Thu Oct 21 19:09:48 2021 +0200

    app: get rid of all "*-linked" actions.
    
    I.e.: "layers-linked", "channels-linked", "vectors-linked" and
    "drawable-linked".

 app/actions/channels-actions.c  |  6 ----
 app/actions/channels-commands.c | 12 -------
 app/actions/channels-commands.h |  3 --
 app/actions/drawable-actions.c  | 14 +-------
 app/actions/drawable-commands.c | 74 -----------------------------------------
 app/actions/drawable-commands.h |  3 --
 app/actions/items-actions.c     |  8 +----
 app/actions/items-commands.c    | 24 -------------
 app/actions/items-commands.h    |  4 ---
 app/actions/layers-actions.c    |  6 ----
 app/actions/layers-commands.c   | 12 -------
 app/actions/layers-commands.h   |  3 --
 app/actions/vectors-actions.c   |  6 ----
 app/actions/vectors-commands.c  | 12 -------
 app/actions/vectors-commands.h  |  3 --
 15 files changed, 2 insertions(+), 188 deletions(-)
---
diff --git a/app/actions/channels-actions.c b/app/actions/channels-actions.c
index 9e6efdfe79..7ed6e12402 100644
--- a/app/actions/channels-actions.c
+++ b/app/actions/channels-actions.c
@@ -115,12 +115,6 @@ static const GimpToggleActionEntry channels_toggle_actions[] =
     FALSE,
     GIMP_HELP_CHANNEL_VISIBLE },
 
-  { "channels-linked", GIMP_ICON_LINKED,
-    NC_("channels-action", "Toggle Channel _Linked State"), NULL, NULL,
-    channels_linked_cmd_callback,
-    FALSE,
-    GIMP_HELP_CHANNEL_LINKED },
-
   { "channels-lock-content", NULL /* GIMP_ICON_LOCK */,
     NC_("channels-action", "L_ock Pixels of Channel"), NULL, NULL,
     channels_lock_content_cmd_callback,
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 54014fc8ee..22bde162e6 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -496,18 +496,6 @@ channels_visible_cmd_callback (GimpAction *action,
   items_visible_cmd_callback (action, value, image, GIMP_ITEM (channel));
 }
 
-void
-channels_linked_cmd_callback (GimpAction *action,
-                              GVariant   *value,
-                              gpointer    data)
-{
-  GimpImage   *image;
-  GimpChannel *channel;
-  return_if_no_channel (image, channel, data);
-
-  items_linked_cmd_callback (action, value, image, GIMP_ITEM (channel));
-}
-
 void
 channels_lock_content_cmd_callback (GimpAction *action,
                                     GVariant   *value,
diff --git a/app/actions/channels-commands.h b/app/actions/channels-commands.h
index 6dd7d79a48..a7d6283cce 100644
--- a/app/actions/channels-commands.h
+++ b/app/actions/channels-commands.h
@@ -55,9 +55,6 @@ void   channels_to_selection_cmd_callback    (GimpAction *action,
 void   channels_visible_cmd_callback         (GimpAction *action,
                                               GVariant   *value,
                                               gpointer    data);
-void   channels_linked_cmd_callback          (GimpAction *action,
-                                              GVariant   *value,
-                                              gpointer    data);
 void   channels_lock_content_cmd_callback    (GimpAction *action,
                                               GVariant   *value,
                                               gpointer    data);
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index 4148e75afd..8c3d67b342 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -62,12 +62,6 @@ static const GimpToggleActionEntry drawable_toggle_actions[] =
     FALSE,
     GIMP_HELP_LAYER_VISIBLE },
 
-  { "drawable-linked", GIMP_ICON_LINKED,
-    NC_("drawable-action", "Toggle Drawable _Linked State"), NULL, NULL,
-    drawable_linked_cmd_callback,
-    FALSE,
-    GIMP_HELP_LAYER_LINKED },
-
   { "drawable-lock-content", NULL /* GIMP_ICON_LOCK */,
     NC_("drawable-action", "L_ock Pixels of Drawable"), NULL,
     NC_("drawable-action",
@@ -161,7 +155,6 @@ drawable_actions_update (GimpActionGroup *group,
   GimpDrawable *drawable     = NULL;
   GList        *drawables    = NULL;
   gboolean      has_visible  = FALSE;
-  gboolean      has_linked   = FALSE;
   gboolean      is_rgb       = FALSE;
   gboolean      locked       = FALSE;
   gboolean      can_lock     = FALSE;
@@ -184,10 +177,7 @@ drawable_actions_update (GimpActionGroup *group,
           if (gimp_item_get_visible (iter->data))
             has_visible = TRUE;
 
-          if (gimp_item_get_linked (iter->data))
-            has_linked = TRUE;
-
-          if (has_visible && has_linked)
+          if (has_visible)
             break;
         }
 
@@ -223,12 +213,10 @@ drawable_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("drawable-levels-stretch", writable && !children && is_rgb);
 
   SET_SENSITIVE ("drawable-visible",       drawables);
-  SET_SENSITIVE ("drawable-linked",        drawables);
   SET_SENSITIVE ("drawable-lock-content",  can_lock);
   SET_SENSITIVE ("drawable-lock-position", can_lock_pos);
 
   SET_ACTIVE ("drawable-visible",       has_visible);
-  SET_ACTIVE ("drawable-linked",        has_linked);
   SET_ACTIVE ("drawable-lock-content",  locked);
   SET_ACTIVE ("drawable-lock-position", locked_pos);
 
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index 720c40fb58..c89fc08451 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -84,80 +84,6 @@ drawable_levels_stretch_cmd_callback (GimpAction *action,
   gimp_image_flush (image);
 }
 
-void
-drawable_linked_cmd_callback (GimpAction *action,
-                              GVariant   *value,
-                              gpointer    data)
-{
-  GimpImage    *image;
-  GList        *drawables;
-  GList        *iter;
-  GimpUndo     *undo      = NULL;
-  gboolean      push_undo = TRUE;
-  gboolean      linked;
-
-  return_if_no_drawables (image, drawables, data);
-
-  linked = g_variant_get_boolean (value);
-
-  if (GIMP_IS_LAYER_MASK (drawables->data))
-    {
-      GimpLayerMask *mask = GIMP_LAYER_MASK (drawables->data);
-
-      g_list_free (drawables);
-      drawables = g_list_prepend (NULL, gimp_layer_mask_get_layer (mask));
-    }
-
-  for (iter = drawables; iter; iter = iter->next)
-    {
-      if (linked && gimp_item_get_linked (iter->data))
-        {
-          /* If any of the drawables are already linked, we don't
-           * toggle the link. This prevents the SET_ACTIVE() in
-           * drawables-actions.c to toggle links unexpectedly.
-           */
-          g_list_free (drawables);
-          return;
-        }
-    }
-
-  for (iter = drawables; iter; iter = iter->next)
-    if (linked != gimp_item_get_linked (iter->data))
-      break;
-
-  if (! iter)
-    {
-      g_list_free (drawables);
-      return;
-    }
-
-  if (g_list_length (drawables) == 1)
-    {
-      undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
-                                           GIMP_UNDO_ITEM_LINKED);
-
-
-      if (undo && GIMP_ITEM_UNDO (undo)->item == GIMP_ITEM (drawables->data))
-        push_undo = FALSE;
-    }
-  else
-    {
-      /* TODO: undo groups cannot be compressed so far. */
-      gimp_image_undo_group_start (image,
-                                   GIMP_UNDO_GROUP_ITEM_LINKED,
-                                   "Link/Unlink items");
-    }
-
-  for (; iter; iter = iter->next)
-    if (linked != gimp_item_get_linked (iter->data))
-      gimp_item_set_linked (iter->data, linked, push_undo);
-
-  if (g_list_length (drawables) != 1)
-    gimp_image_undo_group_end (image);
-
-  gimp_image_flush (image);
-}
-
 void
 drawable_visible_cmd_callback (GimpAction *action,
                                GVariant   *value,
diff --git a/app/actions/drawable-commands.h b/app/actions/drawable-commands.h
index 1f8ae79ded..a115f77ff5 100644
--- a/app/actions/drawable-commands.h
+++ b/app/actions/drawable-commands.h
@@ -26,9 +26,6 @@ void   drawable_levels_stretch_cmd_callback (GimpAction *action,
                                              GVariant   *value,
                                              gpointer    data);
 
-void   drawable_linked_cmd_callback         (GimpAction *action,
-                                             GVariant   *value,
-                                             gpointer    data);
 void   drawable_visible_cmd_callback        (GimpAction *action,
                                              GVariant   *value,
                                              gpointer    data);
diff --git a/app/actions/items-actions.c b/app/actions/items-actions.c
index 8dc398f346..2dcfe06a5a 100644
--- a/app/actions/items-actions.c
+++ b/app/actions/items-actions.c
@@ -77,7 +77,6 @@ items_actions_update (GimpActionGroup *group,
   GEnumValue *value;
   gchar       action[32];
   gboolean    visible       = FALSE;
-  gboolean    linked        = FALSE;
   gboolean    has_color_tag = FALSE;
   gboolean    lock_content      = TRUE;
   gboolean    can_lock_content  = FALSE;
@@ -98,8 +97,7 @@ items_actions_update (GimpActionGroup *group,
        * It's mostly arbitrary and doesn't actually change much to the
        * action.
        */
-      visible      = (visible || gimp_item_get_visible (item));
-      linked       = (linked || gimp_item_get_linked (item));
+      visible = (visible || gimp_item_get_visible (item));
 
       if (gimp_item_can_lock_content (item))
         {
@@ -131,10 +129,6 @@ items_actions_update (GimpActionGroup *group,
   SET_SENSITIVE (action, items);
   SET_ACTIVE    (action, visible);
 
-  g_snprintf (action, sizeof (action), "%s-linked", prefix);
-  SET_SENSITIVE (action, items);
-  SET_ACTIVE    (action, linked);
-
   g_snprintf (action, sizeof (action), "%s-lock-content", prefix);
   SET_SENSITIVE (action, can_lock_content);
   SET_ACTIVE    (action, lock_content);
diff --git a/app/actions/items-commands.c b/app/actions/items-commands.c
index 8b65521965..fc6f49b4a6 100644
--- a/app/actions/items-commands.c
+++ b/app/actions/items-commands.c
@@ -85,30 +85,6 @@ items_visible_cmd_callback (GimpAction *action,
     }
 }
 
-void
-items_linked_cmd_callback (GimpAction *action,
-                           GVariant   *value,
-                           GimpImage  *image,
-                           GimpItem   *item)
-{
-  gboolean linked = g_variant_get_boolean (value);
-
-  if (linked != gimp_item_get_linked (item))
-    {
-      GimpUndo *undo;
-      gboolean  push_undo = TRUE;
-
-      undo = gimp_image_undo_can_compress (image, GIMP_TYPE_ITEM_UNDO,
-                                           GIMP_UNDO_ITEM_LINKED);
-
-      if (undo && GIMP_ITEM_UNDO (undo)->item == item)
-        push_undo = FALSE;
-
-      gimp_item_set_linked (item, linked, push_undo);
-      gimp_image_flush (image);
-    }
-}
-
 void
 items_lock_content_cmd_callback (GimpAction *action,
                                  GVariant   *value,
diff --git a/app/actions/items-commands.h b/app/actions/items-commands.h
index f7c87b5ed5..69f4629f59 100644
--- a/app/actions/items-commands.h
+++ b/app/actions/items-commands.h
@@ -23,10 +23,6 @@ void   items_visible_cmd_callback          (GimpAction   *action,
                                             GVariant     *value,
                                             GimpImage    *image,
                                             GimpItem     *item);
-void   items_linked_cmd_callback           (GimpAction   *action,
-                                            GVariant     *value,
-                                            GimpImage    *image,
-                                            GimpItem     *item);
 void   items_lock_content_cmd_callback     (GimpAction   *action,
                                             GVariant     *value,
                                             GimpImage    *image,
diff --git a/app/actions/layers-actions.c b/app/actions/layers-actions.c
index 1a1db57e5c..4a421492be 100644
--- a/app/actions/layers-actions.c
+++ b/app/actions/layers-actions.c
@@ -323,12 +323,6 @@ static const GimpToggleActionEntry layers_toggle_actions[] =
     FALSE,
     GIMP_HELP_LAYER_VISIBLE },
 
-  { "layers-linked", GIMP_ICON_LINKED,
-    NC_("layers-action", "Toggle Layer _Linked State"), NULL, NULL,
-    layers_linked_cmd_callback,
-    FALSE,
-    GIMP_HELP_LAYER_LINKED },
-
   { "layers-lock-content", NULL /* GIMP_ICON_LOCK */,
     NC_("layers-action", "L_ock Pixels of Layer"), NULL, NULL,
     layers_lock_content_cmd_callback,
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 6d0339bd92..29da45f223 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -2026,18 +2026,6 @@ layers_visible_cmd_callback (GimpAction *action,
   items_visible_cmd_callback (action, value, image, GIMP_ITEM (layer));
 }
 
-void
-layers_linked_cmd_callback (GimpAction *action,
-                            GVariant   *value,
-                            gpointer    data)
-{
-  GimpImage *image;
-  GimpLayer *layer;
-  return_if_no_layer (image, layer, data);
-
-  items_linked_cmd_callback (action, value, image, GIMP_ITEM (layer));
-}
-
 void
 layers_lock_content_cmd_callback (GimpAction *action,
                                   GVariant   *value,
diff --git a/app/actions/layers-commands.h b/app/actions/layers-commands.h
index 7a8b1819f7..6e28d641e5 100644
--- a/app/actions/layers-commands.h
+++ b/app/actions/layers-commands.h
@@ -152,9 +152,6 @@ void   layers_composite_mode_cmd_callback     (GimpAction *action,
 void   layers_visible_cmd_callback            (GimpAction *action,
                                                GVariant   *value,
                                                gpointer    data);
-void   layers_linked_cmd_callback             (GimpAction *action,
-                                               GVariant   *value,
-                                               gpointer    data);
 void   layers_lock_content_cmd_callback       (GimpAction *action,
                                                GVariant   *value,
                                                gpointer    data);
diff --git a/app/actions/vectors-actions.c b/app/actions/vectors-actions.c
index f0ebe5e63b..344534fa16 100644
--- a/app/actions/vectors-actions.c
+++ b/app/actions/vectors-actions.c
@@ -168,12 +168,6 @@ static const GimpToggleActionEntry vectors_toggle_actions[] =
     FALSE,
     GIMP_HELP_PATH_VISIBLE },
 
-  { "vectors-linked", GIMP_ICON_LINKED,
-    NC_("vectors-action", "Toggle Path _Linked State"), NULL, NULL,
-    vectors_linked_cmd_callback,
-    FALSE,
-    GIMP_HELP_PATH_LINKED },
-
   { "vectors-lock-content", NULL /* GIMP_ICON_LOCK */,
     NC_("vectors-action", "L_ock Strokes of Path"), NULL, NULL,
     vectors_lock_content_cmd_callback,
diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c
index 43f524bcec..6dd7845afa 100644
--- a/app/actions/vectors-commands.c
+++ b/app/actions/vectors-commands.c
@@ -627,18 +627,6 @@ vectors_visible_cmd_callback (GimpAction *action,
   items_visible_cmd_callback (action, value, image, GIMP_ITEM (vectors));
 }
 
-void
-vectors_linked_cmd_callback (GimpAction *action,
-                             GVariant   *value,
-                             gpointer    data)
-{
-  GimpImage   *image;
-  GimpVectors *vectors;
-  return_if_no_vectors (image, vectors, data);
-
-  items_linked_cmd_callback (action, value, image, GIMP_ITEM (vectors));
-}
-
 void
 vectors_lock_content_cmd_callback (GimpAction *action,
                                    GVariant   *value,
diff --git a/app/actions/vectors-commands.h b/app/actions/vectors-commands.h
index 5ce88b93af..25383dd8e6 100644
--- a/app/actions/vectors-commands.h
+++ b/app/actions/vectors-commands.h
@@ -90,9 +90,6 @@ void   vectors_import_cmd_callback               (GimpAction *action,
 void   vectors_visible_cmd_callback              (GimpAction *action,
                                                   GVariant   *value,
                                                   gpointer    data);
-void   vectors_linked_cmd_callback               (GimpAction *action,
-                                                  GVariant   *value,
-                                                  gpointer    data);
 void   vectors_lock_content_cmd_callback         (GimpAction *action,
                                                   GVariant   *value,
                                                   gpointer    data);


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