[gimp] pdb: change paths and URIs in the "plug_in" group to GFiles
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb: change paths and URIs in the "plug_in" group to GFiles
- Date: Wed, 11 Sep 2019 21:55:40 +0000 (UTC)
commit 6de4af4adeeb2583cbe2e25626ddd88e5e1b4484
Author: Michael Natterer <mitch gimp org>
Date: Wed Sep 11 23:54:53 2019 +0200
pdb: change paths and URIs in the "plug_in" group to GFiles
app/pdb/image-color-profile-cmds.c | 2 +-
app/pdb/plug-in-cmds.c | 38 +++++++++++++++++++++----------------
app/plug-in/gimppluginprocedure.c | 2 +-
libgimp/gimpimagecolorprofile_pdb.c | 2 +-
libgimp/gimpplugin.c | 15 ++-------------
libgimp/gimpplugin_pdb.c | 12 ++++++------
libgimp/gimpplugin_pdb.h | 4 ++--
pdb/groups/image_color_profile.pdb | 2 +-
pdb/groups/plug_in.pdb | 15 +++++++++++----
9 files changed, 47 insertions(+), 45 deletions(-)
---
diff --git a/app/pdb/image-color-profile-cmds.c b/app/pdb/image-color-profile-cmds.c
index 4d144ca9fa..96a4d90b59 100644
--- a/app/pdb/image-color-profile-cmds.c
+++ b/app/pdb/image-color-profile-cmds.c
@@ -433,7 +433,7 @@ register_image_color_profile_procs (GimpPDB *pdb)
"gimp-image-set-color-profile-from-file");
gimp_procedure_set_static_help (procedure,
"Sets the image's color profile from an ICC file",
- "This procedure sets the image's color profile from a file containing an
ICC profile, or unsets it if NULL is passed as 'uri'. This procedure does no color conversion. However, it
will change the pixel format of all layers to contain the babl space matching the profile. You must call this
procedure before adding layers to the image.",
+ "This procedure sets the image's color profile from a file containing an
ICC profile, or unsets it if NULL is passed as 'file'. This procedure does no color conversion. However, it
will change the pixel format of all layers to contain the babl space matching the profile. You must call this
procedure before adding layers to the image.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Michael Natterer <mitch gimp org>",
diff --git a/app/pdb/plug-in-cmds.c b/app/pdb/plug-in-cmds.c
index 7b8502e12f..0c8b108ad9 100644
--- a/app/pdb/plug-in-cmds.c
+++ b/app/pdb/plug-in-cmds.c
@@ -102,10 +102,10 @@ plugin_domain_register_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
const gchar *domain_name;
- const gchar *domain_path;
+ GFile *domain_file;
domain_name = g_value_get_string (gimp_value_array_index (args, 0));
- domain_path = g_value_get_string (gimp_value_array_index (args, 1));
+ domain_file = g_value_get_object (gimp_value_array_index (args, 1));
if (success)
{
@@ -113,8 +113,12 @@ plugin_domain_register_invoker (GimpProcedure *procedure,
if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
{
+ gchar *domain_path = domain_file ? g_file_get_path (domain_file) : NULL;
+
gimp_plug_in_def_set_locale_domain (plug_in->plug_in_def,
domain_name, domain_path);
+
+ g_free (domain_path);
}
else
success = FALSE;
@@ -134,10 +138,10 @@ plugin_help_register_invoker (GimpProcedure *procedure,
{
gboolean success = TRUE;
const gchar *domain_name;
- const gchar *domain_uri;
+ GFile *domain_file;
domain_name = g_value_get_string (gimp_value_array_index (args, 0));
- domain_uri = g_value_get_string (gimp_value_array_index (args, 1));
+ domain_file = g_value_get_object (gimp_value_array_index (args, 1));
if (success)
{
@@ -145,8 +149,12 @@ plugin_help_register_invoker (GimpProcedure *procedure,
if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
{
+ gchar *domain_uri = domain_file ? g_file_get_uri (domain_file) : NULL;
+
gimp_plug_in_def_set_help_domain (plug_in->plug_in_def,
domain_name, domain_uri);
+
+ g_free (domain_uri);
}
else
success = FALSE;
@@ -342,12 +350,11 @@ register_plug_in_procs (GimpPDB *pdb)
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
- gimp_param_spec_string ("domain-path",
- "domain path",
- "The absolute path to the compiled message catalog
(may be NULL)",
- FALSE, FALSE, FALSE,
- NULL,
- GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
+ g_param_spec_object ("domain-file",
+ "domain file",
+ "The path to the locally installed compiled message
catalog (may be NULL)",
+ G_TYPE_FILE,
+ GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
@@ -373,12 +380,11 @@ register_plug_in_procs (GimpPDB *pdb)
NULL,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
- gimp_param_spec_string ("domain-uri",
- "domain uri",
- "The root URI of the plug-in's help pages",
- FALSE, FALSE, FALSE,
- NULL,
- GIMP_PARAM_READWRITE));
+ g_param_spec_object ("domain-file",
+ "domain file",
+ "The root URI of the plug-in's help pages",
+ G_TYPE_FILE,
+ GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);
diff --git a/app/plug-in/gimppluginprocedure.c b/app/plug-in/gimppluginprocedure.c
index 85975335ae..21a6b524b9 100644
--- a/app/plug-in/gimppluginprocedure.c
+++ b/app/plug-in/gimppluginprocedure.c
@@ -446,13 +446,13 @@ gimp_plug_in_procedure_validate_args (GimpPlugInProcedure *proc,
GimpValueArray *args,
GError **error)
{
+#if 0
GimpProcedure *procedure = GIMP_PROCEDURE (proc);
GValue *uri_value = NULL;
if (! proc->file_proc)
return TRUE;
-#if 0
/* make sure that the passed strings are actually URIs, not just a
* file path (bug 758685)
*/
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
index 3b1d8d2073..aa259f68ce 100644
--- a/libgimp/gimpimagecolorprofile_pdb.c
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -183,7 +183,7 @@ _gimp_image_set_color_profile (GimpImage *image,
* Sets the image's color profile from an ICC file
*
* This procedure sets the image's color profile from a file containing
- * an ICC profile, or unsets it if NULL is passed as 'uri'. This
+ * an ICC profile, or unsets it if NULL is passed as 'file'. This
* procedure does no color conversion. However, it will change the
* pixel format of all layers to contain the babl space matching the
* profile. You must call this procedure before adding layers to the
diff --git a/libgimp/gimpplugin.c b/libgimp/gimpplugin.c
index 5e76a253cb..fcab3aa80e 100644
--- a/libgimp/gimpplugin.c
+++ b/libgimp/gimpplugin.c
@@ -921,25 +921,14 @@ gimp_plug_in_register (GimpPlugIn *plug_in,
if (plug_in->priv->translation_domain_name)
{
- gchar *path = NULL;
-
- if (plug_in->priv->translation_domain_path)
- path = g_file_get_path (plug_in->priv->translation_domain_path);
-
_gimp_plugin_domain_register (plug_in->priv->translation_domain_name,
- path);
-
- g_free (path);
+ plug_in->priv->translation_domain_path);
}
if (plug_in->priv->help_domain_name)
{
- gchar *uri = g_file_get_uri (plug_in->priv->help_domain_uri);
-
_gimp_plugin_help_register (plug_in->priv->help_domain_name,
- uri);
-
- g_free (uri);
+ plug_in->priv->help_domain_uri);
}
for (list = plug_in->priv->menu_branches; list; list = g_list_next (list))
diff --git a/libgimp/gimpplugin_pdb.c b/libgimp/gimpplugin_pdb.c
index 114c4a7b64..86bbbcbe77 100644
--- a/libgimp/gimpplugin_pdb.c
+++ b/libgimp/gimpplugin_pdb.c
@@ -28,7 +28,7 @@
/**
* _gimp_plugin_domain_register:
* @domain_name: The name of the textdomain (must be unique).
- * @domain_path: The absolute path to the compiled message catalog (may be NULL).
+ * @domain_file: The path to the locally installed compiled message catalog (may be NULL).
*
* Registers a textdomain for localisation.
*
@@ -45,7 +45,7 @@
**/
gboolean
_gimp_plugin_domain_register (const gchar *domain_name,
- const gchar *domain_path)
+ GFile *domain_file)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@@ -53,7 +53,7 @@ _gimp_plugin_domain_register (const gchar *domain_name,
args = gimp_value_array_new_from_types (NULL,
G_TYPE_STRING, domain_name,
- G_TYPE_STRING, domain_path,
+ G_TYPE_FILE, domain_file,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
@@ -71,7 +71,7 @@ _gimp_plugin_domain_register (const gchar *domain_name,
/**
* _gimp_plugin_help_register:
* @domain_name: The XML namespace of the plug-in's help pages.
- * @domain_uri: The root URI of the plug-in's help pages.
+ * @domain_file: The root URI of the plug-in's help pages.
*
* Register a help path for a plug-in.
*
@@ -85,7 +85,7 @@ _gimp_plugin_domain_register (const gchar *domain_name,
**/
gboolean
_gimp_plugin_help_register (const gchar *domain_name,
- const gchar *domain_uri)
+ GFile *domain_file)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@@ -93,7 +93,7 @@ _gimp_plugin_help_register (const gchar *domain_name,
args = gimp_value_array_new_from_types (NULL,
G_TYPE_STRING, domain_name,
- G_TYPE_STRING, domain_uri,
+ G_TYPE_FILE, domain_file,
G_TYPE_NONE);
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
diff --git a/libgimp/gimpplugin_pdb.h b/libgimp/gimpplugin_pdb.h
index e5dcd1b289..16ed45e4f7 100644
--- a/libgimp/gimpplugin_pdb.h
+++ b/libgimp/gimpplugin_pdb.h
@@ -33,9 +33,9 @@ G_BEGIN_DECLS
G_GNUC_INTERNAL gboolean _gimp_plugin_domain_register (const gchar *domain_name,
- const gchar *domain_path);
+ GFile *domain_file);
G_GNUC_INTERNAL gboolean _gimp_plugin_help_register (const gchar *domain_name,
- const gchar *domain_uri);
+ GFile *domain_file);
G_GNUC_INTERNAL gboolean _gimp_plugin_menu_branch_register (const gchar *menu_path,
const gchar *menu_name);
G_GNUC_INTERNAL gboolean _gimp_plugin_set_pdb_error_handler (GimpPDBErrorHandler handler);
diff --git a/pdb/groups/image_color_profile.pdb b/pdb/groups/image_color_profile.pdb
index 107749a29a..d6ae7aa941 100644
--- a/pdb/groups/image_color_profile.pdb
+++ b/pdb/groups/image_color_profile.pdb
@@ -169,7 +169,7 @@ sub image_set_color_profile_from_file {
$help = <<'HELP';
This procedure sets the image's color profile from a file containing
-an ICC profile, or unsets it if NULL is passed as 'uri'. This
+an ICC profile, or unsets it if NULL is passed as 'file'. This
procedure does no color conversion. However, it will change the pixel
format of all layers to contain the babl space matching the
profile. You must call this procedure before adding layers to the
diff --git a/pdb/groups/plug_in.pdb b/pdb/groups/plug_in.pdb
index f0eba5b1dd..17380c0481 100644
--- a/pdb/groups/plug_in.pdb
+++ b/pdb/groups/plug_in.pdb
@@ -87,9 +87,8 @@ HELP
@inargs = (
{ name => 'domain_name', type => 'string',
desc => 'The name of the textdomain (must be unique)' },
- { name => 'domain_path', type => 'string', no_validate => 1,
- desc => 'The absolute path to the compiled message catalog (may be
- NULL)' }
+ { name => 'domain_file', type => 'file',
+ desc => 'The path to the locally installed compiled message catalog (may be NULL)' }
);
%invoke = (
@@ -99,8 +98,12 @@ HELP
if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
{
+ gchar *domain_path = domain_file ? g_file_get_path (domain_file) : NULL;
+
gimp_plug_in_def_set_locale_domain (plug_in->plug_in_def,
domain_name, domain_path);
+
+ g_free (domain_path);
}
else
success = FALSE;
@@ -128,7 +131,7 @@ HELP
@inargs = (
{ name => 'domain_name', type => 'string',
desc => "The XML namespace of the plug-in's help pages" },
- { name => 'domain_uri', type => 'string',
+ { name => 'domain_file', type => 'file',
desc => "The root URI of the plug-in's help pages" }
);
@@ -139,8 +142,12 @@ HELP
if (plug_in && plug_in->call_mode == GIMP_PLUG_IN_CALL_QUERY)
{
+ gchar *domain_uri = domain_file ? g_file_get_uri (domain_file) : NULL;
+
gimp_plug_in_def_set_help_domain (plug_in->plug_in_def,
domain_name, domain_uri);
+
+ g_free (domain_uri);
}
else
success = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]