[gimp] libgimp: add gimp_procedure_extension_ready()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: add gimp_procedure_extension_ready()
- Date: Thu, 1 Aug 2019 21:26:07 +0000 (UTC)
commit 0601b7f9a880afc5e29cc905054d5a70ad6fce83
Author: Michael Natterer <mitch gimp org>
Date: Thu Aug 1 23:24:49 2019 +0200
libgimp: add gimp_procedure_extension_ready()
which must be called by GIMP_EXTENSION procedures when they are ready
to run their temporary procedures. Move gimp_extension_ack() to
gimpobsolete.[ch].
libgimp/gimp.c | 22 ----------------------
libgimp/gimp.h | 4 ----
libgimp/gimplegacy.c | 22 ++++++++++++++++++++++
libgimp/gimplegacy.h | 4 ++++
libgimp/gimpprocedure-private.c | 7 +++++++
libgimp/gimpprocedure-private.h | 5 +++--
libgimp/gimpprocedure.c | 41 +++++++++++++++++++++++++++++++++++------
libgimp/gimpprocedure.h | 2 ++
8 files changed, 73 insertions(+), 34 deletions(-)
---
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 80233509fd..bd56c4194b 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -1228,28 +1228,6 @@ gimp_get_progname (void)
return progname;
}
-/**
- * gimp_extension_ack:
- *
- * Notify the main GIMP application that the extension has been properly
- * initialized and is ready to run.
- *
- * This function <emphasis>must</emphasis> be called from every
- * procedure that was registered as #GIMP_EXTENSION.
- *
- * Subsequently, extensions can process temporary procedure run
- * requests using either gimp_extension_enable() or
- * gimp_extension_process().
- *
- * See also: gimp_install_procedure(), gimp_install_temp_proc()
- **/
-void
-gimp_extension_ack (void)
-{
- if (! gp_extension_ack_write (_gimp_writechannel, NULL))
- gimp_quit ();
-}
-
/**
* gimp_extension_enable:
*
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 66c0f7b0f7..5ea89b02be 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -149,10 +149,6 @@ gint gimp_main (GType plug_in_type,
*/
void gimp_quit (void) G_GNUC_NORETURN;
-/* Notify the main GIMP application that the extension is ready to run
- */
-void gimp_extension_ack (void);
-
/* Enable asynchronous processing of temp_procs
*/
void gimp_extension_enable (void);
diff --git a/libgimp/gimplegacy.c b/libgimp/gimplegacy.c
index 88ad4ed1cd..c65ad2541d 100644
--- a/libgimp/gimplegacy.c
+++ b/libgimp/gimplegacy.c
@@ -443,6 +443,28 @@ gimp_uninstall_temp_proc (const gchar *name)
}
}
+/**
+ * gimp_extension_ack:
+ *
+ * Notify the main GIMP application that the extension has been properly
+ * initialized and is ready to run.
+ *
+ * This function <emphasis>must</emphasis> be called from every
+ * procedure that was registered as #GIMP_EXTENSION.
+ *
+ * Subsequently, extensions can process temporary procedure run
+ * requests using either gimp_extension_enable() or
+ * gimp_extension_process().
+ *
+ * See also: gimp_install_procedure(), gimp_install_temp_proc()
+ **/
+void
+gimp_extension_ack (void)
+{
+ if (! gp_extension_ack_write (_gimp_writechannel, NULL))
+ gimp_quit ();
+}
+
/**
* gimp_run_procedure: (skip)
* @name: the name of the procedure to run
diff --git a/libgimp/gimplegacy.h b/libgimp/gimplegacy.h
index 13a77b2ace..a714dd09c3 100644
--- a/libgimp/gimplegacy.h
+++ b/libgimp/gimplegacy.h
@@ -261,6 +261,10 @@ void gimp_install_temp_proc (const gchar *name,
*/
void gimp_uninstall_temp_proc (const gchar *name);
+/* Notify the main GIMP application that the extension is ready to run
+ */
+void gimp_extension_ack (void);
+
/* Run a procedure in the procedure database. The parameters are
* specified via the variable length argument list. The return
* values are returned in the 'GimpParam*' array.
diff --git a/libgimp/gimpprocedure-private.c b/libgimp/gimpprocedure-private.c
index f0a7e5660d..3d1958a436 100644
--- a/libgimp/gimpprocedure-private.c
+++ b/libgimp/gimpprocedure-private.c
@@ -114,3 +114,10 @@ _gimp_procedure_unregister (GimpProcedure *procedure)
if (! gp_proc_uninstall_write (_gimp_writechannel, &proc_uninstall, NULL))
gimp_quit ();
}
+
+void
+_gimp_procedure_extension_ready (GimpProcedure *procedure)
+{
+ if (! gp_extension_ack_write (_gimp_writechannel, NULL))
+ gimp_quit ();
+}
diff --git a/libgimp/gimpprocedure-private.h b/libgimp/gimpprocedure-private.h
index ddb8e5584f..4e8907ad7d 100644
--- a/libgimp/gimpprocedure-private.h
+++ b/libgimp/gimpprocedure-private.h
@@ -25,8 +25,9 @@
G_BEGIN_DECLS
-void _gimp_procedure_register (GimpProcedure *procedure);
-void _gimp_procedure_unregister (GimpProcedure *procedure);
+void _gimp_procedure_register (GimpProcedure *procedure);
+void _gimp_procedure_unregister (GimpProcedure *procedure);
+void _gimp_procedure_extension_ready (GimpProcedure *procedure);
G_END_DECLS
diff --git a/libgimp/gimpprocedure.c b/libgimp/gimpprocedure.c
index 8179b9f4e1..6cc83c6348 100644
--- a/libgimp/gimpprocedure.c
+++ b/libgimp/gimpprocedure.c
@@ -29,6 +29,7 @@
#include "libgimpbase/gimpbase.h"
#include "gimp.h"
+#include "gimpprocedure-private.h"
#include "libgimp-intl.h"
@@ -173,15 +174,17 @@ gimp_procedure_finalize (GObject *object)
* overwrite an already existing procedure (overwrite procedures only
* if you know what you're doing).
*
- * @proc_type should be %GIMP_PLUGIN for "normal" plug-ins. Using
- * %GIMP_EXTENSION means that the plug-in will add temporary
+ * @proc_type should be %GIMP_PLUGIN for "normal" plug-ins.
+ *
+ * Using %GIMP_EXTENSION means that the plug-in will add temporary
* procedures. Therefore, the GIMP core will wait until the
* %GIMP_EXTENSION procedure has called gimp_extension_ack(), which
* means that the procedure has done its initialization, installed its
- * temporary procedures and is ready to run. %GIMP_TEMPORARY must be
- * used for temporary procedures that are created during a plug-ins
- * lifetime. They must be added to the #GimpPlugIn using
- * gimp_plug_in_add_temp_procedure().
+ * temporary procedures and is ready to run.
+ *
+ * %GIMP_TEMPORARY must be used for temporary procedures that are
+ * created during a plug-ins lifetime. They must be added to the
+ * #GimpPlugIn using gimp_plug_in_add_temp_procedure().
*
* Returns: a new #GimpProcedure.
**/
@@ -646,6 +649,32 @@ gimp_procedure_run (GimpProcedure *procedure,
return return_vals;
}
+/**
+ * gimp_procedure_extension_ready:
+ *
+ * Notify the main GIMP application that the extension has been
+ * properly initialized and is ready to run.
+ *
+ * This function <emphasis>must</emphasis> be called from every
+ * procedure's #GimpRunFunc that was created as #GIMP_EXTENSION.
+ *
+ * Subsequently, extensions can process temporary procedure run
+ * requests using either gimp_extension_enable() or
+ * gimp_extension_process().
+ *
+ * See also: gimp_procedure_new().
+ *
+ * Since: 3.0
+ **/
+void
+gimp_procedure_extension_ready (GimpProcedure *procedure)
+{
+ g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
+ g_return_if_fail (procedure->priv->proc_type == GIMP_EXTENSION);
+
+ _gimp_procedure_extension_ready (procedure);
+}
+
/* private functions */
diff --git a/libgimp/gimpprocedure.h b/libgimp/gimpprocedure.h
index 9f4a7f1620..187480fbc1 100644
--- a/libgimp/gimpprocedure.h
+++ b/libgimp/gimpprocedure.h
@@ -123,6 +123,8 @@ GimpValueArray * gimp_procedure_new_return_values (GimpProcedure *procedure
GimpValueArray * gimp_procedure_run (GimpProcedure *procedure,
GimpValueArray *args);
+void gimp_procedure_extension_ready (GimpProcedure *procedure);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]