ScriptFu: hide "Refresh Scripts"

It is broken and throws critical, see #10596.

Expedient to hide it instead of fixing it, to not block 3.0rc1.

As discussed in #10652, a user can simply restart GIMP instead.
"Refresh Scripts" is a poor design, a bandaid.
There are plans for better alternatives to install/remove scripts.

The MR for #10652 shows the reason it throws critical,
and could fix it,
but completing the MR requires time we don't have.
Note the MR is not on these files, but on core plugin machinery.

The change is to extract functions to a separate file,
and still build them, but not call them or link them.
They also are not translated while not being called.

Eventually, the extracted files can be deleted (or restored when they work.)
There is other related cruft that needs deletion in scheme-wrapper.c.
This commit is contained in:
bootchk 2024-04-06 14:33:13 -04:00
parent 0b9ec0e8b9
commit 2df7874216
5 changed files with 128 additions and 59 deletions

View File

@ -24,6 +24,7 @@ executable_name = 'script-fu'
plugin_sources = [
'script-fu-eval.c',
'script-fu-text-console.c',
'script-fu-refresh.c',
'script-fu.c',
]

View File

@ -0,0 +1,100 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <string.h>
#include <libgimp/gimp.h>
#include "libscriptfu/script-fu-lib.h"
#include "libscriptfu/script-fu-intl.h"
/* The "Refresh Scripts" menu item is not in v3.
*
* Code is built, but the linker omits it,
* since one call is commented out.
*
* This is not the only cruft, scheme_wrapper.c references
* the PDB procedure by name.
*
* See #10596 and #10652.
* When used, it throws CRITICAL.
* There is also an MR that fixes the reason for the CRITICAL,
* but #10652 suggests better alternatives.
*/
static GimpValueArray *
script_fu_refresh_proc (GimpProcedure *procedure,
GimpProcedureConfig *config,
gpointer run_data)
{
if (script_fu_extension_is_busy ())
{
g_message (_("You can not use \"Refresh Scripts\" while a "
"Script-Fu dialog box is open. Please close "
"all Script-Fu windows and try again."));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
else
{
/* Reload all of the available scripts */
GList *path = script_fu_search_path ();
script_fu_find_and_register_scripts (gimp_procedure_get_plug_in (procedure), path);
g_list_free_full (path, (GDestroyNotify) g_object_unref);
}
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
}
void
script_fu_register_refresh_procedure (GimpPlugIn *plug_in)
{
GimpProcedure *procedure;
procedure = gimp_procedure_new (plug_in, "script-fu-refresh",
GIMP_PDB_PROC_TYPE_TEMPORARY,
script_fu_refresh_proc, NULL, NULL);
gimp_procedure_set_menu_label (procedure, _("_Refresh Scripts"));
gimp_procedure_add_menu_path (procedure,
"<Image>/Filters/Development/Script-Fu");
gimp_procedure_set_documentation (procedure,
_("Re-read all available Script-Fu scripts"),
"Re-read all available Script-Fu scripts",
"script-fu-refresh");
gimp_procedure_set_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997");
GIMP_PROC_ARG_ENUM (procedure, "run-mode",
"Run mode",
"The run mode",
GIMP_TYPE_RUN_MODE,
GIMP_RUN_INTERACTIVE,
G_PARAM_READWRITE);
gimp_plug_in_add_temp_procedure (plug_in, procedure);
g_object_unref (procedure);
}

View File

@ -0,0 +1,23 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __SCRIPT_FU_REFRESH_H__
#define __SCRIPT_FU_REFRESH_H__
void script_fu_register_refresh_procedure (GimpPlugIn *plug_in);
#endif /* __SCRIPT_FU_REFRESH_H__ */

View File

@ -52,9 +52,6 @@ static GimpValueArray * script_fu_batch_run (GimpProcedure *proced
static void script_fu_run_init (GimpProcedure *procedure,
GimpRunMode run_mode);
static void script_fu_extension_init (GimpPlugIn *plug_in);
static GimpValueArray * script_fu_refresh_proc (GimpProcedure *procedure,
GimpProcedureConfig *config,
gpointer run_data);
G_DEFINE_TYPE (ScriptFu, script_fu, GIMP_TYPE_PLUG_IN)
@ -309,8 +306,6 @@ script_fu_run_init (GimpProcedure *procedure,
static void
script_fu_extension_init (GimpPlugIn *plug_in)
{
GimpProcedure *procedure;
gimp_plug_in_add_menu_branch (plug_in, "<Image>/Help", N_("_GIMP Online"));
gimp_plug_in_add_menu_branch (plug_in, "<Image>/Help", N_("_User Manual"));
@ -338,58 +333,7 @@ script_fu_extension_init (GimpPlugIn *plug_in)
gimp_plug_in_add_menu_branch (plug_in, "<Image>/Filters",
N_("Alpha to _Logo"));
procedure = gimp_procedure_new (plug_in, "script-fu-refresh",
GIMP_PDB_PROC_TYPE_TEMPORARY,
script_fu_refresh_proc, NULL, NULL);
gimp_procedure_set_menu_label (procedure, _("_Refresh Scripts"));
gimp_procedure_add_menu_path (procedure,
"<Image>/Filters/Development/Script-Fu");
gimp_procedure_set_documentation (procedure,
_("Re-read all available Script-Fu scripts"),
"Re-read all available Script-Fu scripts",
"script-fu-refresh");
gimp_procedure_set_attribution (procedure,
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1997");
GIMP_PROC_ARG_ENUM (procedure, "run-mode",
"Run mode",
"The run mode",
GIMP_TYPE_RUN_MODE,
GIMP_RUN_INTERACTIVE,
G_PARAM_READWRITE);
gimp_plug_in_add_temp_procedure (plug_in, procedure);
g_object_unref (procedure);
}
static GimpValueArray *
script_fu_refresh_proc (GimpProcedure *procedure,
GimpProcedureConfig *config,
gpointer run_data)
{
if (script_fu_extension_is_busy ())
{
g_message (_("You can not use \"Refresh Scripts\" while a "
"Script-Fu dialog box is open. Please close "
"all Script-Fu windows and try again."));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
NULL);
}
else
{
/* Reload all of the available scripts */
GList *path = script_fu_search_path ();
script_fu_find_and_register_scripts (gimp_procedure_get_plug_in (procedure), path);
g_list_free_full (path, (GDestroyNotify) g_object_unref);
}
return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
/* Commented out until fixed or replaced.
* script_fu_register_refresh_procedure (plug_in);
*/
}

View File

@ -49,6 +49,7 @@ plug-ins/pagecurl
plug-ins/print
plug-ins/python
plug-ins/screenshot
plug-ins/script-fu/script-fu-refresh.c
plug-ins/script-fu/scripts/contactsheet.scm
plug-ins/script-fu/scripts/clothify-v3.scm
plug-ins/script-fu/scripts/test-v3.scm