[gimp/wip/Jehan/test-ci-cache] app: WIP for CI cache now configured in GNOME gitlab.



commit 91c23dafe98adcab90200467927385c76d38f64d
Author: Jehan <jehan girinstud io>
Date:   Thu May 28 19:51:50 2020 +0200

    app: WIP for CI cache now configured in GNOME gitlab.

 .gitlab-ci.yml                   | 24 +++++++++--
 app/actions/filters-actions.c    | 18 ++++++++-
 app/actions/filters-commands.c   |  5 ++-
 app/actions/procedure-commands.c |  6 +--
 app/tools/gimpfiltertool.c       | 87 ++++++++++++++++++++--------------------
 5 files changed, 87 insertions(+), 53 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ae39e238df..9a252f0b1c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ variables:
   GIT_DEPTH: "1"
   INSTALL_DIR: "_install"
   INSTALL_PREFIX: "${CI_PROJECT_DIR}/${INSTALL_DIR}"
-  PACMAN_CACHE:   "${CI_PROJECT_DIR}/_pacman_cache"
+  APT_CACHE: "${CI_PROJECT_DIR}/apt-cache"
 
 ## GNU/Linux 64-bit CIs ##
 
@@ -17,7 +17,7 @@ deps-debian/testing:
   stage: dependencies
   cache:
     paths:
-    - _pacman_cache
+    - apt-cache
   artifacts:
     expire_in: 2 hours
     when: always
@@ -27,7 +27,7 @@ deps-debian/testing:
     - _gegl/_build
   before_script:
     - apt-get update
-    - apt-get install -y --no-install-recommends
+    - apt-get install -y --no-install-recommends -o dir::cache::archives="$APT_CACHE"
         build-essential
         git
         ffmpeg
@@ -47,6 +47,7 @@ deps-debian/testing:
         meson
         python3
         valac
+    - ls $APT_CACHE
     - apt-get install -y --reinstall ca-certificates
     - git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/babl.git _babl
     - git clone --depth=${GIT_DEPTH} https://gitlab.gnome.org/GNOME/gegl.git _gegl
@@ -69,6 +70,9 @@ deps-debian/testing:
   stage: gimp
   dependencies:
     - deps-debian/testing
+  cache:
+    paths:
+    - apt-cache
   artifacts:
     expire_in: 1 days
     when: always
@@ -78,7 +82,7 @@ deps-debian/testing:
     #- "${INSTALL_DIR}"
   before_script:
     - apt-get update
-    - apt-get install -y --no-install-recommends
+    - apt-get install -y --no-install-recommends -o dir::cache::archives="$APT_CACHE"
         at-spi2-core
         build-essential
         desktop-file-utils
@@ -177,6 +181,9 @@ gimp-debian/testing-clang:
 
 deps-win64:
   stage: dependencies
+  cache:
+    paths:
+    - /var/cache/apt/
   variables:
     XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache/"
     XDG_DATA_HOME:  "$CI_PROJECT_DIR/.local/share/"
@@ -216,6 +223,9 @@ deps-win64:
 
 gimp-win64:
   stage: gimp
+  cache:
+    paths:
+    - /var/cache/apt/
   dependencies:
     - deps-win64
   variables:
@@ -263,6 +273,9 @@ gimp-win64:
 
 deps-win32:
   stage: dependencies
+  cache:
+    paths:
+    - /var/cache/apt/
   variables:
     XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache/"
     XDG_DATA_HOME:  "$CI_PROJECT_DIR/.local/share/"
@@ -302,6 +315,9 @@ deps-win32:
 
 gimp-win32:
   stage: gimp
+  cache:
+    paths:
+    - /var/cache/apt/
   dependencies:
     - deps-win32
   variables:
diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c
index a1ad0e8025..bd7921e145 100644
--- a/app/actions/filters-actions.c
+++ b/app/actions/filters-actions.c
@@ -858,6 +858,9 @@ filters_actions_update (GimpActionGroup *group,
 {
   GimpImage    *image;
   GimpDrawable *drawable       = NULL;
+  GList        *drawables      = NULL;
+  GList        *iter           = NULL;
+  gboolean      all_writable   = TRUE;
   gboolean      writable       = FALSE;
   gboolean      gray           = FALSE;
   gboolean      alpha          = FALSE;
@@ -868,6 +871,17 @@ filters_actions_update (GimpActionGroup *group,
   if (image)
     {
       drawable = gimp_image_get_active_drawable (image);
+      drawables = gimp_image_get_selected_drawables (image);
+
+      for (iter = drawables; iter; iter = iter->next)
+        {
+          if (gimp_item_is_content_locked (iter->data) ||
+              gimp_viewable_get_children (iter->data))
+            {
+              all_writable = FALSE;
+              break;
+            }
+        }
 
       if (drawable)
         {
@@ -935,7 +949,7 @@ filters_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("filters-fattal-2002",             writable);
   SET_SENSITIVE ("filters-focus-blur",              writable);
   SET_SENSITIVE ("filters-fractal-trace",           writable);
-  SET_SENSITIVE ("filters-gaussian-blur",           writable);
+  SET_SENSITIVE ("filters-gaussian-blur",           drawables && all_writable);
   SET_SENSITIVE ("filters-gaussian-blur-selective", writable);
   SET_SENSITIVE ("filters-gegl-graph",              writable);
   SET_SENSITIVE ("filters-grid",                    writable);
@@ -1053,6 +1067,8 @@ filters_actions_update (GimpActionGroup *group,
         g_free (name);
       }
   }
+
+  g_list_free (drawables);
 }
 
 static void
diff --git a/app/actions/filters-commands.c b/app/actions/filters-commands.c
index 6ca05292d5..dd4dec039a 100644
--- a/app/actions/filters-commands.c
+++ b/app/actions/filters-commands.c
@@ -104,9 +104,9 @@ filters_apply_interactive_cmd_callback (GimpAction *action,
                                         gpointer    data)
 {
   GimpImage     *image;
-  GimpDrawable  *drawable;
+  GList         *drawables;
   GimpProcedure *procedure;
-  return_if_no_drawable (image, drawable, data);
+  return_if_no_drawables (image, drawables, data);
 
   procedure = gimp_gegl_procedure_new (image->gimp,
                                        GIMP_RUN_INTERACTIVE, NULL,
@@ -123,6 +123,7 @@ filters_apply_interactive_cmd_callback (GimpAction *action,
                                 data);
 
   g_object_unref (procedure);
+  g_list_free (drawables);
 }
 
 void
diff --git a/app/actions/procedure-commands.c b/app/actions/procedure-commands.c
index c96c5b918a..a163fcdabf 100644
--- a/app/actions/procedure-commands.c
+++ b/app/actions/procedure-commands.c
@@ -251,18 +251,18 @@ procedure_commands_get_display_args (GimpProcedure *procedure,
             {
               GimpDrawable *drawable = gimp_image_get_active_drawable (image);
 
-              if (drawable)
+              /*if (drawable)*/
                 {
                   g_value_set_object (gimp_value_array_index (args, n_args),
                                       drawable);
                   n_args++;
                 }
-              else
+              /*else
                 {
                   g_warning ("Uh-oh, no active drawable for the plug-in!");
                   gimp_value_array_unref (args);
                   return NULL;
-                }
+                }*/
             }
         }
     }
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index db877673b1..7ff9231e1d 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -285,49 +285,47 @@ gimp_filter_tool_initialize (GimpTool     *tool,
   GimpImage        *image       = gimp_display_get_image (display);
   GimpDisplayShell *shell       = gimp_display_get_shell (display);
   GList            *drawables   = gimp_image_get_selected_drawables (image);
-  GimpDrawable     *drawable;
+  GList            *iter;
 
-  if (g_list_length (drawables) != 1)
+  if (! drawables)
     {
-      if (g_list_length (drawables) > 1)
-        g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
-                                   _("Cannot modify multiple drawables. Select only one."));
-      else
-        g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("No selected drawables."));
-
-      g_list_free (drawables);
+      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, _("No selected drawables."));
       return FALSE;
     }
-  drawable = drawables->data;
 
-  if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+  for (iter = drawables; iter; iter = iter->next)
     {
-      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
-                           _("Cannot modify the pixels of layer groups."));
+      GimpDrawable *drawable = iter->data;
 
-      g_list_free (drawables);
-      return FALSE;
-    }
+      if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
+        {
+          g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+                               _("Cannot modify the pixels of layer groups."));
 
-  if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
-    {
-      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
-                           _("A selected layer's pixels are locked."));
-      if (error)
-        gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
+          g_list_free (drawables);
+          return FALSE;
+        }
 
-      g_list_free (drawables);
-      return FALSE;
-    }
+      if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
+        {
+          g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+                               _("A selected layer's pixels are locked."));
+          if (error)
+            gimp_tools_blink_lock_box (display->gimp, GIMP_ITEM (drawable));
 
-  if (! gimp_item_is_visible (GIMP_ITEM (drawable)) &&
-      ! config->edit_non_visible)
-    {
-      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
-                           _("A selected layer is not visible."));
+          g_list_free (drawables);
+          return FALSE;
+        }
 
-      g_list_free (drawables);
-      return FALSE;
+      if (! gimp_item_is_visible (GIMP_ITEM (drawable)) &&
+          ! config->edit_non_visible)
+        {
+          g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
+                               _("A selected layer is not visible."));
+
+          g_list_free (drawables);
+          return FALSE;
+        }
     }
 
   gimp_filter_tool_get_operation (filter_tool);
@@ -440,13 +438,14 @@ gimp_filter_tool_initialize (GimpTool     *tool,
     }
 
   gimp_tool_gui_set_shell (filter_tool->gui, shell);
-  gimp_tool_gui_set_viewable (filter_tool->gui, GIMP_VIEWABLE (drawable));
+  gimp_tool_gui_set_viewables (filter_tool->gui, drawables);
 
   gimp_tool_gui_show (filter_tool->gui);
 
-  g_signal_connect_object (drawable, "lock-position-changed",
-                           G_CALLBACK (gimp_filter_tool_lock_position_changed),
-                           filter_tool, 0);
+  for (iter = drawables; iter; iter = iter->next)
+    g_signal_connect_object (iter->data, "lock-position-changed",
+                             G_CALLBACK (gimp_filter_tool_lock_position_changed),
+                             filter_tool, 0);
 
   g_signal_connect_object (image, "mask-changed",
                            G_CALLBACK (gimp_filter_tool_mask_changed),
@@ -811,7 +810,8 @@ gimp_filter_tool_pick_color (GimpColorTool     *color_tool,
   gint            off_x, off_y;
   gboolean        picked;
 
-  g_return_val_if_fail (g_list_length (tool->drawables) == 1, FALSE);
+  /*g_return_val_if_fail (g_list_length (tool->drawables) == 1,
+   * FALSE);*/
 
   gimp_item_get_offset (GIMP_ITEM (tool->drawables->data), &off_x, &off_y);
 
@@ -1218,7 +1218,7 @@ gimp_filter_tool_create_filter (GimpFilterTool *filter_tool)
     }
 
   gimp_assert (filter_tool->operation);
-  g_return_if_fail (g_list_length (tool->drawables) == 1);
+  /*g_return_if_fail (g_list_length (tool->drawables) == 1);*/
 
   filter_tool->filter = gimp_drawable_filter_new (tool->drawables->data,
                                                   gimp_tool_get_undo_desc (tool),
@@ -1250,7 +1250,7 @@ gimp_filter_tool_update_dialog (GimpFilterTool *filter_tool)
       GimpChannel *mask  = gimp_image_get_mask (image);
       const Babl  *format;
 
-      g_return_if_fail (g_list_length (tool->drawables) == 1);
+      /*g_return_if_fail (g_list_length (tool->drawables) == 1);*/
 
       if (filter_tool->filter)
         format = gimp_drawable_filter_get_format (filter_tool->filter);
@@ -1353,7 +1353,7 @@ gimp_filter_tool_add_guide (GimpFilterTool *filter_tool)
   GimpOrientationType  orientation;
   gint                 position;
 
-  g_return_if_fail (g_list_length (tool->drawables) == 1);
+  /*g_return_if_fail (g_list_length (tool->drawables) == 1);*/
 
   if (filter_tool->preview_guide)
     return;
@@ -1417,7 +1417,7 @@ gimp_filter_tool_move_guide (GimpFilterTool *filter_tool)
   GimpOrientationType  orientation;
   gint                 position;
 
-  g_return_if_fail (g_list_length (tool->drawables) == 1);
+  /*g_return_if_fail (g_list_length (tool->drawables) == 1);*/
 
   if (! filter_tool->preview_guide)
     return;
@@ -1481,7 +1481,7 @@ gimp_filter_tool_guide_moved (GimpGuide        *guide,
   GimpItem          *item;
   gdouble            position;
 
-  g_return_if_fail (g_list_length (tool->drawables) == 1);
+  /*g_return_if_fail (g_list_length (tool->drawables) == 1);*/
 
   item = GIMP_ITEM (tool->drawables->data);
 
@@ -2026,7 +2026,8 @@ gimp_filter_tool_get_drawable_area (GimpFilterTool *filter_tool,
   tool     = GIMP_TOOL (filter_tool);
   settings = GIMP_OPERATION_SETTINGS (filter_tool->config);
 
-  g_return_val_if_fail (g_list_length (tool->drawables) == 1, FALSE);
+  /*g_return_val_if_fail (g_list_length (tool->drawables) == 1,
+   * FALSE);*/
 
   *drawable_offset_x = 0;
   *drawable_offset_y = 0;


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