From bceba808dfc34b3f4f142160e7132ebd74e01f0b Mon Sep 17 00:00:00 2001 From: Jehan Date: Tue, 10 Sep 2024 12:54:11 +0200 Subject: [PATCH] plug-ins: allow running file-raw-data non-interactively. The code was perfectly working already, yet we were blocking the non-interactive case only to stop automatic runs, such as generating thumbnails. The chosen solution is not perfect either as it would break on the odd case where a given raw data file's expected dimensions were the default. Yet it's a start. --- plug-ins/common/file-raw-data.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c index 73f4e7b5f9..96981029e9 100644 --- a/plug-ins/common/file-raw-data.c +++ b/plug-ins/common/file-raw-data.c @@ -629,11 +629,26 @@ raw_load (GimpProcedure *procedure, } else { - /* we only run interactively due to the nature of this plugin. - * things like generate preview etc like to call us non- - * interactively. here we stop that. + gint width; + gint height; + + g_object_get (config, + "width", &width, + "height", &height, + NULL); + /* This is a very crappy way to stop GIMP from automatic runs, + * e.g. when generating previews (which usually makes no sense on + * raw data files as we can't guess the actual width/height). + * Unfortunately it means that we also break the odd case when one + * had a file which used exactly the PREVIEW_SIZE for both + * dimensions by chance! We will have to handle this better. + * FIXME! */ - status = GIMP_PDB_CALLING_ERROR; + if (width == PREVIEW_SIZE && height == PREVIEW_SIZE) + { + /* TODO: set an error message after the string freeze. */ + status = GIMP_PDB_CALLING_ERROR; + } } /* we are okay, and the user clicked OK in the load dialog */