[gimp] app: move the plug-in procedure setters to gimpplugin-proc.[ch]
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: move the plug-in procedure setters to gimpplugin-proc.[ch]
- Date: Sun, 8 Sep 2019 14:38:41 +0000 (UTC)
commit d75a25c565ec20e9e8bae4afc51f7671e710bdd2
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 8 16:35:47 2019 +0200
app: move the plug-in procedure setters to gimpplugin-proc.[ch]
because there are going to be much more more.
app/pdb/pdb-cmds.c | 2 +-
app/plug-in/Makefile.am | 2 +
app/plug-in/gimpplugin-proc.c | 162 ++++++++++++++++++++++++++++++++++++++++++
app/plug-in/gimpplugin-proc.h | 34 +++++++++
app/plug-in/gimpplugin.c | 125 --------------------------------
app/plug-in/gimpplugin.h | 71 ++++++++----------
pdb/groups/pdb.pdb | 2 +-
7 files changed, 231 insertions(+), 167 deletions(-)
---
diff --git a/app/pdb/pdb-cmds.c b/app/pdb/pdb-cmds.c
index e7f277ea83..e60aedd98f 100644
--- a/app/pdb/pdb-cmds.c
+++ b/app/pdb/pdb-cmds.c
@@ -34,7 +34,7 @@
#include "core/gimpparamspecs.h"
#include "gimp-pdb-compat.h"
#include "gimppdb-query.h"
-#include "plug-in/gimpplugin.h"
+#include "plug-in/gimpplugin-proc.h"
#include "plug-in/gimppluginmanager-data.h"
#include "plug-in/gimppluginmanager.h"
#include "plug-in/gimppluginprocedure.h"
diff --git a/app/plug-in/Makefile.am b/app/plug-in/Makefile.am
index 45dfcc3654..950783f420 100644
--- a/app/plug-in/Makefile.am
+++ b/app/plug-in/Makefile.am
@@ -33,6 +33,8 @@ libappplug_in_a_SOURCES = \
gimpplugin-context.h \
gimpplugin-message.c \
gimpplugin-message.h \
+ gimpplugin-proc.c \
+ gimpplugin-proc.h \
gimpplugin-progress.c \
gimpplugin-progress.h \
gimpplugindef.c \
diff --git a/app/plug-in/gimpplugin-proc.c b/app/plug-in/gimpplugin-proc.c
new file mode 100644
index 0000000000..c523b8a58e
--- /dev/null
+++ b/app/plug-in/gimpplugin-proc.c
@@ -0,0 +1,162 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpplugin-proc.c
+ *
+ * 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 <gdk-pixbuf/gdk-pixbuf.h>
+#include <gegl.h>
+
+#include "libgimpbase/gimpbase.h"
+
+#include "plug-in-types.h"
+
+#include "core/gimp.h"
+
+#include "gimpplugin.h"
+#include "gimpplugin-proc.h"
+#include "gimpplugindef.h"
+#include "gimppluginmanager.h"
+#include "gimptemporaryprocedure.h"
+
+#include "gimp-intl.h"
+
+
+gboolean
+gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
+ const gchar *proc_name,
+ const gchar *menu_path)
+{
+ GimpPlugInProcedure *proc = NULL;
+ GError *error = NULL;
+
+ g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
+ g_return_val_if_fail (proc_name != NULL, FALSE);
+ g_return_val_if_fail (menu_path != NULL, FALSE);
+
+ if (plug_in->plug_in_def)
+ proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
+ proc_name);
+
+ if (! proc)
+ proc = gimp_plug_in_procedure_find (plug_in->temp_procedures, proc_name);
+
+ if (! proc)
+ {
+ gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
+ "Plug-in \"%s\"\n(%s)\n"
+ "attempted to register the menu item \"%s\" "
+ "for the procedure \"%s\".\n"
+ "It has however not installed that procedure. "
+ "This is not allowed.",
+ gimp_object_get_name (plug_in),
+ gimp_file_get_utf8_name (plug_in->file),
+ menu_path, proc_name);
+
+ return FALSE;
+ }
+
+ switch (GIMP_PROCEDURE (proc)->proc_type)
+ {
+ case GIMP_PDB_PROC_TYPE_INTERNAL:
+ return FALSE;
+
+ case GIMP_PDB_PROC_TYPE_PLUGIN:
+ case GIMP_PDB_PROC_TYPE_EXTENSION:
+ if (plug_in->call_mode != GIMP_PLUG_IN_CALL_QUERY &&
+ plug_in->call_mode != GIMP_PLUG_IN_CALL_INIT)
+ return FALSE;
+
+ case GIMP_PDB_PROC_TYPE_TEMPORARY:
+ break;
+ }
+
+ if (! gimp_plug_in_procedure_add_menu_path (proc, menu_path, &error))
+ {
+ gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
+ error->message);
+ g_clear_error (&error);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
+ const gchar *proc_name,
+ GimpIconType type,
+ const guint8 *data,
+ gint data_length)
+{
+ GimpPlugInProcedure *proc = NULL;
+ GError *error = NULL;
+
+ g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
+ g_return_val_if_fail (proc_name != NULL, FALSE);
+
+ if (plug_in->plug_in_def)
+ proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
+ proc_name);
+
+ if (! proc)
+ proc = gimp_plug_in_procedure_find (plug_in->temp_procedures, proc_name);
+
+ if (! proc)
+ {
+ gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
+ "Plug-in \"%s\"\n(%s)\n"
+ "attempted to set the icon "
+ "for the procedure \"%s\".\n"
+ "It has however not installed that procedure. "
+ "This is not allowed.",
+ gimp_object_get_name (plug_in),
+ gimp_file_get_utf8_name (plug_in->file),
+ proc_name);
+
+ return FALSE;
+ }
+
+ switch (GIMP_PROCEDURE (proc)->proc_type)
+ {
+ case GIMP_PDB_PROC_TYPE_INTERNAL:
+ return FALSE;
+
+ case GIMP_PDB_PROC_TYPE_PLUGIN:
+ case GIMP_PDB_PROC_TYPE_EXTENSION:
+ if (plug_in->call_mode != GIMP_PLUG_IN_CALL_QUERY &&
+ plug_in->call_mode != GIMP_PLUG_IN_CALL_INIT)
+ return FALSE;
+
+ case GIMP_PDB_PROC_TYPE_TEMPORARY:
+ break;
+ }
+
+ if (! gimp_plug_in_procedure_set_icon (proc, type, data, data_length,
+ &error))
+ {
+ gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
+ error->message);
+ g_clear_error (&error);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/app/plug-in/gimpplugin-proc.h b/app/plug-in/gimpplugin-proc.h
new file mode 100644
index 0000000000..9308aff43f
--- /dev/null
+++ b/app/plug-in/gimpplugin-proc.h
@@ -0,0 +1,34 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpplugin-proc.h
+ *
+ * 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 __GIMP_PLUG_IN_PROC_H__
+#define __GIMP_PLUG_IN_PROC_H__
+
+
+gboolean gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
+ const gchar *proc_name,
+ const gchar *menu_path);
+gboolean gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
+ const gchar *proc_name,
+ GimpIconType type,
+ const guint8 *data,
+ gint data_length);
+
+
+#endif /* __GIMP_PLUG_IN_PROC_H__ */
diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c
index aa181fa2ba..d117812ad6 100644
--- a/app/plug-in/gimpplugin.c
+++ b/app/plug-in/gimpplugin.c
@@ -874,131 +874,6 @@ gimp_plug_in_get_undo_desc (GimpPlugIn *plug_in)
return undo_desc ? undo_desc : gimp_object_get_name (plug_in);
}
-/* called from the PDB (gimp_pdb_add_proc_menu_path) */
-gboolean
-gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
- const gchar *proc_name,
- const gchar *menu_path)
-{
- GimpPlugInProcedure *proc = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
- g_return_val_if_fail (proc_name != NULL, FALSE);
- g_return_val_if_fail (menu_path != NULL, FALSE);
-
- if (plug_in->plug_in_def)
- proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
- proc_name);
-
- if (! proc)
- proc = gimp_plug_in_procedure_find (plug_in->temp_procedures, proc_name);
-
- if (! proc)
- {
- gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
- "Plug-in \"%s\"\n(%s)\n"
- "attempted to register the menu item \"%s\" "
- "for the procedure \"%s\".\n"
- "It has however not installed that procedure. "
- "This is not allowed.",
- gimp_object_get_name (plug_in),
- gimp_file_get_utf8_name (plug_in->file),
- menu_path, proc_name);
-
- return FALSE;
- }
-
- switch (GIMP_PROCEDURE (proc)->proc_type)
- {
- case GIMP_PDB_PROC_TYPE_INTERNAL:
- return FALSE;
-
- case GIMP_PDB_PROC_TYPE_PLUGIN:
- case GIMP_PDB_PROC_TYPE_EXTENSION:
- if (plug_in->call_mode != GIMP_PLUG_IN_CALL_QUERY &&
- plug_in->call_mode != GIMP_PLUG_IN_CALL_INIT)
- return FALSE;
-
- case GIMP_PDB_PROC_TYPE_TEMPORARY:
- break;
- }
-
- if (! gimp_plug_in_procedure_add_menu_path (proc, menu_path, &error))
- {
- gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
- error->message);
- g_clear_error (&error);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
- const gchar *proc_name,
- GimpIconType type,
- const guint8 *data,
- gint data_length)
-{
- GimpPlugInProcedure *proc = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
- g_return_val_if_fail (proc_name != NULL, FALSE);
-
- if (plug_in->plug_in_def)
- proc = gimp_plug_in_procedure_find (plug_in->plug_in_def->procedures,
- proc_name);
-
- if (! proc)
- proc = gimp_plug_in_procedure_find (plug_in->temp_procedures, proc_name);
-
- if (! proc)
- {
- gimp_message (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
- "Plug-in \"%s\"\n(%s)\n"
- "attempted to set the icon "
- "for the procedure \"%s\".\n"
- "It has however not installed that procedure. "
- "This is not allowed.",
- gimp_object_get_name (plug_in),
- gimp_file_get_utf8_name (plug_in->file),
- proc_name);
-
- return FALSE;
- }
-
- switch (GIMP_PROCEDURE (proc)->proc_type)
- {
- case GIMP_PDB_PROC_TYPE_INTERNAL:
- return FALSE;
-
- case GIMP_PDB_PROC_TYPE_PLUGIN:
- case GIMP_PDB_PROC_TYPE_EXTENSION:
- if (plug_in->call_mode != GIMP_PLUG_IN_CALL_QUERY &&
- plug_in->call_mode != GIMP_PLUG_IN_CALL_INIT)
- return FALSE;
-
- case GIMP_PDB_PROC_TYPE_TEMPORARY:
- break;
- }
-
- if (! gimp_plug_in_procedure_set_icon (proc, type, data, data_length,
- &error))
- {
- gimp_message_literal (plug_in->manager->gimp, NULL, GIMP_MESSAGE_ERROR,
- error->message);
- g_clear_error (&error);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
void
gimp_plug_in_add_temp_proc (GimpPlugIn *plug_in,
GimpTemporaryProcedure *proc)
diff --git a/app/plug-in/gimpplugin.h b/app/plug-in/gimpplugin.h
index 82949061d5..400be77056 100644
--- a/app/plug-in/gimpplugin.h
+++ b/app/plug-in/gimpplugin.h
@@ -76,53 +76,44 @@ struct _GimpPlugInClass
};
-GType gimp_plug_in_get_type (void) G_GNUC_CONST;
+GType gimp_plug_in_get_type (void) G_GNUC_CONST;
-GimpPlugIn * gimp_plug_in_new (GimpPlugInManager *manager,
- GimpContext *context,
- GimpProgress *progress,
- GimpPlugInProcedure *procedure,
- GFile *file);
+GimpPlugIn * gimp_plug_in_new (GimpPlugInManager *manager,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpPlugInProcedure *procedure,
+ GFile *file);
-gboolean gimp_plug_in_open (GimpPlugIn *plug_in,
- GimpPlugInCallMode call_mode,
- gboolean synchronous);
-void gimp_plug_in_close (GimpPlugIn *plug_in,
- gboolean kill_it);
+gboolean gimp_plug_in_open (GimpPlugIn *plug_in,
+ GimpPlugInCallMode call_mode,
+ gboolean synchronous);
+void gimp_plug_in_close (GimpPlugIn *plug_in,
+ gboolean kill_it);
GimpPlugInProcFrame *
- gimp_plug_in_get_proc_frame (GimpPlugIn *plug_in);
+ gimp_plug_in_get_proc_frame (GimpPlugIn *plug_in);
GimpPlugInProcFrame *
- gimp_plug_in_proc_frame_push (GimpPlugIn *plug_in,
- GimpContext *context,
- GimpProgress *progress,
- GimpTemporaryProcedure *procedure);
-void gimp_plug_in_proc_frame_pop (GimpPlugIn *plug_in);
-
-void gimp_plug_in_main_loop (GimpPlugIn *plug_in);
-void gimp_plug_in_main_loop_quit (GimpPlugIn *plug_in);
-
-const gchar * gimp_plug_in_get_undo_desc (GimpPlugIn *plug_in);
-
-gboolean gimp_plug_in_add_proc_menu_path (GimpPlugIn *plug_in,
- const gchar *proc_name,
- const gchar *menu_path);
-gboolean gimp_plug_in_set_proc_icon (GimpPlugIn *plug_in,
- const gchar *proc_name,
- GimpIconType type,
- const guint8 *data,
- gint data_length);
-
-void gimp_plug_in_add_temp_proc (GimpPlugIn *plug_in,
- GimpTemporaryProcedure *procedure);
-void gimp_plug_in_remove_temp_proc (GimpPlugIn *plug_in,
- GimpTemporaryProcedure *procedure);
-
-void gimp_plug_in_set_error_handler (GimpPlugIn *plug_in,
- GimpPDBErrorHandler handler);
+ gimp_plug_in_proc_frame_push (GimpPlugIn *plug_in,
+ GimpContext *context,
+ GimpProgress *progress,
+ GimpTemporaryProcedure *procedure);
+void gimp_plug_in_proc_frame_pop (GimpPlugIn *plug_in);
+
+void gimp_plug_in_main_loop (GimpPlugIn *plug_in);
+void gimp_plug_in_main_loop_quit (GimpPlugIn *plug_in);
+
+const gchar * gimp_plug_in_get_undo_desc (GimpPlugIn *plug_in);
+
+void gimp_plug_in_add_temp_proc (GimpPlugIn *plug_in,
+ GimpTemporaryProcedure *procedure);
+void gimp_plug_in_remove_temp_proc (GimpPlugIn *plug_in,
+ GimpTemporaryProcedure *procedure);
+
+void gimp_plug_in_set_error_handler (GimpPlugIn *plug_in,
+ GimpPDBErrorHandler handler);
GimpPDBErrorHandler
- gimp_plug_in_get_error_handler (GimpPlugIn *plug_in);
+ gimp_plug_in_get_error_handler (GimpPlugIn *plug_in);
#endif /* __GIMP_PLUG_IN_H__ */
diff --git a/pdb/groups/pdb.pdb b/pdb/groups/pdb.pdb
index d000e8d4e1..dade635db9 100644
--- a/pdb/groups/pdb.pdb
+++ b/pdb/groups/pdb.pdb
@@ -836,7 +836,7 @@ CODE
@headers = qw("libgimpbase/gimpbase.h"
"core/gimp.h"
"core/gimpparamspecs-desc.h"
- "plug-in/gimpplugin.h"
+ "plug-in/gimpplugin-proc.h"
"plug-in/gimppluginmanager.h"
"plug-in/gimppluginmanager-data.h"
"plug-in/gimppluginprocedure.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]