[gimp] pdb, libgimp: hide more functions that have new API in gimplegacy.[ch]



commit 0ccb40f89b5f6f40789b518c159d317a24a84ae9
Author: Michael Natterer <mitch gimp org>
Date:   Thu Aug 1 12:24:51 2019 +0200

    pdb, libgimp: hide more functions that have new API in gimplegacy.[ch]
    
    Also reorder some functions in plug_in.pdb

 app/pdb/plug-in-cmds.c   | 102 ++++++++++++++++++++++-----------------------
 libgimp/gimplegacy.c     | 105 +++++++++++++++++++++++++++++++++++++++++++++++
 libgimp/gimplegacy.h     |  21 +++++++---
 libgimp/gimpplugin_pdb.c |  64 ++++++++++++++---------------
 libgimp/gimpplugin_pdb.h |  10 ++---
 pdb/groups/plug_in.pdb   |  12 +++---
 6 files changed, 215 insertions(+), 99 deletions(-)
---
diff --git a/app/pdb/plug-in-cmds.c b/app/pdb/plug-in-cmds.c
index 2fa928f14a..b168ce1c83 100644
--- a/app/pdb/plug-in-cmds.c
+++ b/app/pdb/plug-in-cmds.c
@@ -162,19 +162,19 @@ plugin_help_register_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
-plugin_menu_register_invoker (GimpProcedure         *procedure,
-                              Gimp                  *gimp,
-                              GimpContext           *context,
-                              GimpProgress          *progress,
-                              const GimpValueArray  *args,
-                              GError               **error)
+plugin_menu_branch_register_invoker (GimpProcedure         *procedure,
+                                     Gimp                  *gimp,
+                                     GimpContext           *context,
+                                     GimpProgress          *progress,
+                                     const GimpValueArray  *args,
+                                     GError               **error)
 {
   gboolean success = TRUE;
-  const gchar *procedure_name;
   const gchar *menu_path;
+  const gchar *menu_name;
 
-  procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
-  menu_path = g_value_get_string (gimp_value_array_index (args, 1));
+  menu_path = g_value_get_string (gimp_value_array_index (args, 0));
+  menu_name = g_value_get_string (gimp_value_array_index (args, 1));
 
   if (success)
     {
@@ -182,9 +182,8 @@ plugin_menu_register_invoker (GimpProcedure         *procedure,
 
       if (plug_in)
         {
-          gchar *canonical = gimp_canonicalize_identifier (procedure_name);
-          success = gimp_plug_in_menu_register (plug_in, canonical, menu_path);
-          g_free (canonical);
+          gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
+                                                plug_in->file, menu_path, menu_name);
         }
       else
         {
@@ -197,19 +196,19 @@ plugin_menu_register_invoker (GimpProcedure         *procedure,
 }
 
 static GimpValueArray *
-plugin_menu_branch_register_invoker (GimpProcedure         *procedure,
-                                     Gimp                  *gimp,
-                                     GimpContext           *context,
-                                     GimpProgress          *progress,
-                                     const GimpValueArray  *args,
-                                     GError               **error)
+plugin_menu_register_invoker (GimpProcedure         *procedure,
+                              Gimp                  *gimp,
+                              GimpContext           *context,
+                              GimpProgress          *progress,
+                              const GimpValueArray  *args,
+                              GError               **error)
 {
   gboolean success = TRUE;
+  const gchar *procedure_name;
   const gchar *menu_path;
-  const gchar *menu_name;
 
-  menu_path = g_value_get_string (gimp_value_array_index (args, 0));
-  menu_name = g_value_get_string (gimp_value_array_index (args, 1));
+  procedure_name = g_value_get_string (gimp_value_array_index (args, 0));
+  menu_path = g_value_get_string (gimp_value_array_index (args, 1));
 
   if (success)
     {
@@ -217,8 +216,9 @@ plugin_menu_branch_register_invoker (GimpProcedure         *procedure,
 
       if (plug_in)
         {
-          gimp_plug_in_manager_add_menu_branch (gimp->plug_in_manager,
-                                                plug_in->file, menu_path, menu_name);
+          gchar *canonical = gimp_canonicalize_identifier (procedure_name);
+          success = gimp_plug_in_menu_register (plug_in, canonical, menu_path);
+          g_free (canonical);
         }
       else
         {
@@ -502,30 +502,30 @@ register_plug_in_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
-   * gimp-plugin-menu-register
+   * gimp-plugin-menu-branch-register
    */
-  procedure = gimp_procedure_new (plugin_menu_register_invoker);
+  procedure = gimp_procedure_new (plugin_menu_branch_register_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-plugin-menu-register");
+                               "gimp-plugin-menu-branch-register");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-plugin-menu-register",
-                                     "Register an additional menu path for a plug-in procedure.",
-                                     "This procedure installs an additional menu entry for the given 
procedure.",
+                                     "gimp-plugin-menu-branch-register",
+                                     "Register a sub-menu.",
+                                     "This procedure installs a sub-menu which does not belong to any 
procedure. The menu-name should be the untranslated menu label. GIMP will look up the translation in the 
textdomain registered for the plug-in.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
-                                     "2004",
+                                     "2005",
                                      NULL);
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_string ("procedure-name",
-                                                       "procedure name",
-                                                       "The procedure for which to install the menu path",
-                                                       FALSE, FALSE, TRUE,
+                               gimp_param_spec_string ("menu-path",
+                                                       "menu path",
+                                                       "The sub-menu's menu path",
+                                                       FALSE, FALSE, FALSE,
                                                        NULL,
                                                        GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_string ("menu-path",
-                                                       "menu path",
-                                                       "The procedure's additional menu path",
+                               gimp_param_spec_string ("menu-name",
+                                                       "menu name",
+                                                       "The name of the sub-menu",
                                                        FALSE, FALSE, FALSE,
                                                        NULL,
                                                        GIMP_PARAM_READWRITE));
@@ -533,30 +533,30 @@ register_plug_in_procs (GimpPDB *pdb)
   g_object_unref (procedure);
 
   /*
-   * gimp-plugin-menu-branch-register
+   * gimp-plugin-menu-register
    */
-  procedure = gimp_procedure_new (plugin_menu_branch_register_invoker);
+  procedure = gimp_procedure_new (plugin_menu_register_invoker);
   gimp_object_set_static_name (GIMP_OBJECT (procedure),
-                               "gimp-plugin-menu-branch-register");
+                               "gimp-plugin-menu-register");
   gimp_procedure_set_static_strings (procedure,
-                                     "gimp-plugin-menu-branch-register",
-                                     "Register a sub-menu.",
-                                     "This procedure installs a sub-menu which does not belong to any 
procedure. The menu-name should be the untranslated menu label. GIMP will look up the translation in the 
textdomain registered for the plug-in.",
+                                     "gimp-plugin-menu-register",
+                                     "Register an additional menu path for a plug-in procedure.",
+                                     "This procedure installs an additional menu entry for the given 
procedure.",
                                      "Michael Natterer <mitch gimp org>",
                                      "Michael Natterer",
-                                     "2005",
+                                     "2004",
                                      NULL);
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_string ("menu-path",
-                                                       "menu path",
-                                                       "The sub-menu's menu path",
-                                                       FALSE, FALSE, FALSE,
+                               gimp_param_spec_string ("procedure-name",
+                                                       "procedure name",
+                                                       "The procedure for which to install the menu path",
+                                                       FALSE, FALSE, TRUE,
                                                        NULL,
                                                        GIMP_PARAM_READWRITE));
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_string ("menu-name",
-                                                       "menu name",
-                                                       "The name of the sub-menu",
+                               gimp_param_spec_string ("menu-path",
+                                                       "menu path",
+                                                       "The procedure's additional menu path",
                                                        FALSE, FALSE, FALSE,
                                                        NULL,
                                                        GIMP_PARAM_READWRITE));
diff --git a/libgimp/gimplegacy.c b/libgimp/gimplegacy.c
index 00e20d3d47..88ad4ed1cd 100644
--- a/libgimp/gimplegacy.c
+++ b/libgimp/gimplegacy.c
@@ -887,6 +887,111 @@ G_DEFINE_BOXED_TYPE (GimpParam, gimp_param,
 
 /*  old gimp_plugin cruft  */
 
+/**
+ * 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).
+ *
+ * Registers a textdomain for localisation.
+ *
+ * This procedure adds a textdomain to the list of domains Gimp
+ * searches for strings when translating its menu entries. There is no
+ * need to call this function for plug-ins that have their strings
+ * included in the 'gimp-std-plugins' domain as that is used by
+ * default. If the compiled message catalog is not in the standard
+ * location, you may specify an absolute path to another location. This
+ * procedure can only be called in the query function of a plug-in and
+ * it has to be called before any procedure is installed.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_plugin_domain_register (const gchar *domain_name,
+                             const gchar *domain_path)
+{
+  return _gimp_plugin_domain_register (domain_name, domain_path);
+}
+
+/**
+ * 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.
+ *
+ * Register a help path for a plug-in.
+ *
+ * This procedure registers user documentation for the calling plug-in
+ * with the GIMP help system. The domain_uri parameter points to the
+ * root directory where the plug-in help is installed. For each
+ * supported language there should be a file called 'gimp-help.xml'
+ * that maps the help IDs to the actual help files.
+ *
+ * Returns: TRUE on success.
+ **/
+gboolean
+gimp_plugin_help_register (const gchar *domain_name,
+                           const gchar *domain_uri)
+{
+  return _gimp_plugin_help_register (domain_name, domain_uri);
+}
+
+/**
+ * gimp_plugin_menu_branch_register:
+ * @menu_path: The sub-menu's menu path.
+ * @menu_name: The name of the sub-menu.
+ *
+ * Register a sub-menu.
+ *
+ * This procedure installs a sub-menu which does not belong to any
+ * procedure. The menu-name should be the untranslated menu label. GIMP
+ * will look up the translation in the textdomain registered for the
+ * plug-in.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.4
+ **/
+gboolean
+gimp_plugin_menu_branch_register (const gchar *menu_path,
+                                  const gchar *menu_name)
+{
+  return _gimp_plugin_menu_branch_register (menu_path, menu_name);
+}
+
+/**
+ * gimp_plugin_menu_register:
+ * @procedure_name: The procedure for which to install the menu path.
+ * @menu_path: The procedure's additional menu path.
+ *
+ * Register an additional menu path for a plug-in procedure.
+ *
+ * This procedure installs an additional menu entry for the given
+ * procedure.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gimp_plugin_menu_register (const gchar *procedure_name,
+                           const gchar *menu_path)
+{
+  return _gimp_plugin_menu_register (procedure_name, menu_path);
+}
+
+/**
+ * gimp_plugin_icon_register:
+ * @procedure_name: The procedure for which to install the icon.
+ * @icon_type: The type of the icon.
+ * @icon_data: (element-type guint8): The procedure's icon. The format depends on the 'icon_type' parameter.
+ *
+ * Register an icon for a plug-in procedure.
+ *
+ * This procedure installs an icon for the given procedure.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.2
+ **/
 gboolean
 gimp_plugin_icon_register (const gchar  *procedure_name,
                            GimpIconType  icon_type,
diff --git a/libgimp/gimplegacy.h b/libgimp/gimplegacy.h
index f44319d2aa..13a77b2ace 100644
--- a/libgimp/gimplegacy.h
+++ b/libgimp/gimplegacy.h
@@ -293,13 +293,24 @@ void           gimp_destroy_paramdefs   (GimpParamDef    *paramdefs,
                                          gint             n_params);
 
 
-/* gimp_plugin API that should now be done by using GimpPlugIn and
- * GimpProcedure
+/* gimp_plugin API that should now be done by using GimpPlugIn
  */
 
-gboolean   gimp_plugin_icon_register (const gchar  *procedure_name,
-                                      GimpIconType  icon_type,
-                                      const guint8 *icon_data);
+gboolean   gimp_plugin_domain_register      (const gchar  *domain_name,
+                                             const gchar  *domain_path);
+gboolean   gimp_plugin_help_register        (const gchar  *domain_name,
+                                             const gchar  *domain_uri);
+gboolean   gimp_plugin_menu_branch_register (const gchar  *menu_path,
+                                             const gchar  *menu_name);
+
+/* gimp_plugin API that should now be done by using GimpProcedure
+ */
+
+gboolean   gimp_plugin_menu_register        (const gchar  *procedure_name,
+                                             const gchar  *menu_path);
+gboolean   gimp_plugin_icon_register        (const gchar  *procedure_name,
+                                             GimpIconType  icon_type,
+                                             const guint8 *icon_data);
 
 
 G_END_DECLS
diff --git a/libgimp/gimpplugin_pdb.c b/libgimp/gimpplugin_pdb.c
index f5faf94509..756a9b53be 100644
--- a/libgimp/gimpplugin_pdb.c
+++ b/libgimp/gimpplugin_pdb.c
@@ -36,7 +36,7 @@
 
 
 /**
- * gimp_plugin_domain_register:
+ * _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).
  *
@@ -54,8 +54,8 @@
  * Returns: TRUE on success.
  **/
 gboolean
-gimp_plugin_domain_register (const gchar *domain_name,
-                             const gchar *domain_path)
+_gimp_plugin_domain_register (const gchar *domain_name,
+                              const gchar *domain_path)
 {
   GimpValueArray *args;
   GimpValueArray *return_vals;
@@ -79,7 +79,7 @@ gimp_plugin_domain_register (const gchar *domain_name,
 }
 
 /**
- * gimp_plugin_help_register:
+ * _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.
  *
@@ -94,8 +94,8 @@ gimp_plugin_domain_register (const gchar *domain_name,
  * Returns: TRUE on success.
  **/
 gboolean
-gimp_plugin_help_register (const gchar *domain_name,
-                           const gchar *domain_uri)
+_gimp_plugin_help_register (const gchar *domain_name,
+                            const gchar *domain_uri)
 {
   GimpValueArray *args;
   GimpValueArray *return_vals;
@@ -119,22 +119,24 @@ gimp_plugin_help_register (const gchar *domain_name,
 }
 
 /**
- * gimp_plugin_menu_register:
- * @procedure_name: The procedure for which to install the menu path.
- * @menu_path: The procedure's additional menu path.
+ * _gimp_plugin_menu_branch_register:
+ * @menu_path: The sub-menu's menu path.
+ * @menu_name: The name of the sub-menu.
  *
- * Register an additional menu path for a plug-in procedure.
+ * Register a sub-menu.
  *
- * This procedure installs an additional menu entry for the given
- * procedure.
+ * This procedure installs a sub-menu which does not belong to any
+ * procedure. The menu-name should be the untranslated menu label. GIMP
+ * will look up the translation in the textdomain registered for the
+ * plug-in.
  *
  * Returns: TRUE on success.
  *
- * Since: 2.2
+ * Since: 2.4
  **/
 gboolean
-gimp_plugin_menu_register (const gchar *procedure_name,
-                           const gchar *menu_path)
+_gimp_plugin_menu_branch_register (const gchar *menu_path,
+                                   const gchar *menu_name)
 {
   GimpValueArray *args;
   GimpValueArray *return_vals;
@@ -143,10 +145,10 @@ gimp_plugin_menu_register (const gchar *procedure_name,
   args = gimp_value_array_new_from_types (G_TYPE_STRING,
                                           G_TYPE_STRING,
                                           G_TYPE_NONE);
-  g_value_set_string (gimp_value_array_index (args, 0), procedure_name);
-  g_value_set_string (gimp_value_array_index (args, 1), menu_path);
+  g_value_set_string (gimp_value_array_index (args, 0), menu_path);
+  g_value_set_string (gimp_value_array_index (args, 1), menu_name);
 
-  return_vals = gimp_run_procedure_with_array ("gimp-plugin-menu-register",
+  return_vals = gimp_run_procedure_with_array ("gimp-plugin-menu-branch-register",
                                                args);
   gimp_value_array_unref (args);
 
@@ -158,24 +160,22 @@ gimp_plugin_menu_register (const gchar *procedure_name,
 }
 
 /**
- * gimp_plugin_menu_branch_register:
- * @menu_path: The sub-menu's menu path.
- * @menu_name: The name of the sub-menu.
+ * _gimp_plugin_menu_register:
+ * @procedure_name: The procedure for which to install the menu path.
+ * @menu_path: The procedure's additional menu path.
  *
- * Register a sub-menu.
+ * Register an additional menu path for a plug-in procedure.
  *
- * This procedure installs a sub-menu which does not belong to any
- * procedure. The menu-name should be the untranslated menu label. GIMP
- * will look up the translation in the textdomain registered for the
- * plug-in.
+ * This procedure installs an additional menu entry for the given
+ * procedure.
  *
  * Returns: TRUE on success.
  *
- * Since: 2.4
+ * Since: 2.2
  **/
 gboolean
-gimp_plugin_menu_branch_register (const gchar *menu_path,
-                                  const gchar *menu_name)
+_gimp_plugin_menu_register (const gchar *procedure_name,
+                            const gchar *menu_path)
 {
   GimpValueArray *args;
   GimpValueArray *return_vals;
@@ -184,10 +184,10 @@ gimp_plugin_menu_branch_register (const gchar *menu_path,
   args = gimp_value_array_new_from_types (G_TYPE_STRING,
                                           G_TYPE_STRING,
                                           G_TYPE_NONE);
-  g_value_set_string (gimp_value_array_index (args, 0), menu_path);
-  g_value_set_string (gimp_value_array_index (args, 1), menu_name);
+  g_value_set_string (gimp_value_array_index (args, 0), procedure_name);
+  g_value_set_string (gimp_value_array_index (args, 1), menu_path);
 
-  return_vals = gimp_run_procedure_with_array ("gimp-plugin-menu-branch-register",
+  return_vals = gimp_run_procedure_with_array ("gimp-plugin-menu-register",
                                                args);
   gimp_value_array_unref (args);
 
diff --git a/libgimp/gimpplugin_pdb.h b/libgimp/gimpplugin_pdb.h
index 0f08e8158b..1c0a5ec8d8 100644
--- a/libgimp/gimpplugin_pdb.h
+++ b/libgimp/gimpplugin_pdb.h
@@ -32,14 +32,14 @@ G_BEGIN_DECLS
 /* For information look into the C source or the html documentation */
 
 
-gboolean                 gimp_plugin_domain_register       (const gchar         *domain_name,
+G_GNUC_INTERNAL gboolean _gimp_plugin_domain_register      (const gchar         *domain_name,
                                                             const gchar         *domain_path);
-gboolean                 gimp_plugin_help_register         (const gchar         *domain_name,
+G_GNUC_INTERNAL gboolean _gimp_plugin_help_register        (const gchar         *domain_name,
                                                             const gchar         *domain_uri);
-gboolean                 gimp_plugin_menu_register         (const gchar         *procedure_name,
-                                                            const gchar         *menu_path);
-gboolean                 gimp_plugin_menu_branch_register  (const gchar         *menu_path,
+G_GNUC_INTERNAL gboolean _gimp_plugin_menu_branch_register (const gchar         *menu_path,
                                                             const gchar         *menu_name);
+G_GNUC_INTERNAL gboolean _gimp_plugin_menu_register        (const gchar         *procedure_name,
+                                                            const gchar         *menu_path);
 G_GNUC_INTERNAL gboolean _gimp_plugin_icon_register        (const gchar         *procedure_name,
                                                             GimpIconType         icon_type,
                                                             gint                 icon_data_length,
diff --git a/pdb/groups/plug_in.pdb b/pdb/groups/plug_in.pdb
index 9fbf572370..235be7bf88 100644
--- a/pdb/groups/plug_in.pdb
+++ b/pdb/groups/plug_in.pdb
@@ -28,7 +28,7 @@ sub plugins_query {
     );
 
     @outargs = (
-       { name => 'menu_path', type => 'stringarray',
+       { name => 'menu_path', type => 'stringarray', wrap => 1,
          desc => 'The menu path of the plug-in',
          array => { name => 'num_plugins',
                     desc => 'The number of plug-ins' } },
@@ -88,7 +88,7 @@ HELP
     &neo_pdb_misc('2000');
 
     @inargs = (
-       { name => 'domain_name', type => 'string',
+       { name => 'domain_name', type => 'string', wrap => 1,
          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
@@ -129,7 +129,7 @@ HELP
     &mitch_pdb_misc('2000');
 
     @inargs = (
-       { name => 'domain_name', type => 'string',
+       { name => 'domain_name', type => 'string', wrap => 1,
          desc => "The XML namespace of the plug-in's help pages" },
        { name => 'domain_uri', type => 'string',
          desc => "The root URI of the plug-in's help pages" }
@@ -164,7 +164,7 @@ HELP
     &mitch_pdb_misc('2004', '2.2');
 
     @inargs = (
-       { name => 'procedure_name', type => 'string', non_empty => 1,
+       { name => 'procedure_name', type => 'string', wrap => 1, non_empty => 1,
          desc => 'The procedure for which to install the menu path' },
        { name => 'menu_path', type => 'string',
          desc => "The procedure's additional menu path" }
@@ -202,7 +202,7 @@ HELP
     &mitch_pdb_misc('2005', '2.4');
 
     @inargs = (
-       { name => 'menu_path', type => 'string',
+       { name => 'menu_path', type => 'string', wrap => 1,
          desc => "The sub-menu's menu path" },
        { name => 'menu_name', type => 'string',
          desc => 'The name of the sub-menu' }
@@ -367,8 +367,8 @@ CODE
 @procs = qw(plugins_query
            plugin_domain_register
             plugin_help_register
-            plugin_menu_register
             plugin_menu_branch_register
+            plugin_menu_register
             plugin_icon_register
             plugin_set_pdb_error_handler
             plugin_get_pdb_error_handler);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]