libgimp: new gimp_plug_in_error_quark() / GIMP_PLUG_IN_ERROR.

We heavily rely on GError in libgimp to retrieve plug-in error messages.
In a lot of our code, we just use domain=0 for g_set_error*() functions
and alike, but this is actually forbidden and results in GLib warnings.

Some plug-ins instead create their own domain, other use G_FILE_ERROR
nearly everywhere, even in some cases where the choice is really
questionable. Since anyway this is mostly useful for passing the error
message through, it is much nicer to provide a generic domain
GIMP_PLUG_IN_ERROR, which can be used by all plug-ins when they don't
want to bother with the error domain.

Note: basically a copy-paste from commit 3f9c736592 which could not be
cherry-picked as surrounding code is completely different.
This commit is contained in:
Jehan
2022-01-19 14:52:06 +01:00
parent d0690f3c40
commit ab582b0e56
2 changed files with 18 additions and 0 deletions

View File

@ -24,6 +24,20 @@
#include "gimp.h"
/**
* gimp_plug_in_error_quark:
*
* Generic #GQuark error domain for plug-ins. Plug-ins are welcome to
* create their own domain when they want to handle advanced error
* handling. Often, you just want to pass an error message to the core.
* This domain can be used for such simple usage.
*
* See #GError for information on error domains.
*/
G_DEFINE_QUARK (gimp-plug-in-error-quark, gimp_plug_in_error)
gboolean
gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,

View File

@ -29,6 +29,10 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
#define GIMP_PLUG_IN_ERROR (gimp_plug_in_error_quark ())
GQuark gimp_plug_in_error_quark (void);
gboolean gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,