[gimp] app: Add hidden --dump-pdb-procedures-deprecated option



commit ed011014297bc507399d138b0b30ad3f986109cf
Author: Martin Nordholts <martinn src gnome org>
Date:   Thu May 5 00:33:19 2011 +0200

    app: Add hidden --dump-pdb-procedures-deprecated option
    
    Allow to dump the names of all internal deprecated PDB
    procedures. This enables us to do static analysis on *.scm files and
    look for usage of deprecated procedures.

 app/main.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/app/main.c b/app/main.c
index 5ccfb6c..03466d0 100644
--- a/app/main.c
+++ b/app/main.c
@@ -43,7 +43,7 @@
 
 #include "libgimpbase/gimpbase.h"
 
-#include "core/core-types.h"
+#include "pdb/pdb-types.h"
 
 #include "base/tile.h"
 
@@ -51,6 +51,10 @@
 
 #include "core/gimp.h"
 
+#include "pdb/gimppdb.h"
+#include "pdb/gimpprocedure.h"
+#include "pdb/internal-procs.h"
+
 #include "about.h"
 #include "app.h"
 #include "sanity.h"
@@ -88,6 +92,11 @@ static gboolean  gimp_option_dump_gimprc      (const gchar  *option_name,
                                                const gchar  *value,
                                                gpointer      data,
                                                GError      **error);
+static gboolean  gimp_option_dump_pdb_procedures_deprecated
+                                              (const gchar  *option_name,
+                                               const gchar  *value,
+                                               gpointer      data,
+                                               GError      **error);
 
 static void      gimp_show_version_and_exit   (void) G_GNUC_NORETURN;
 static void      gimp_show_license_and_exit   (void) G_GNUC_NORETURN;
@@ -256,6 +265,12 @@ static const GOptionEntry main_entries[] =
     NULL, NULL
   },
   {
+    "dump-pdb-procedures-deprecated", 0,
+    G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN,
+    G_OPTION_ARG_CALLBACK, gimp_option_dump_pdb_procedures_deprecated,
+    N_("Output a gimprc file with default settings"), NULL
+  },
+  {
     G_OPTION_REMAINING, 0, 0,
     G_OPTION_ARG_FILENAME_ARRAY, &filenames,
     NULL, NULL
@@ -594,6 +609,43 @@ gimp_option_dump_gimprc (const gchar  *option_name,
   return FALSE;
 }
 
+static gboolean
+gimp_option_dump_pdb_procedures_deprecated (const gchar  *option_name,
+                                            const gchar  *value,
+                                            gpointer      data,
+                                            GError      **error)
+{
+  Gimp  *gimp;
+  GList *deprecated_procs;
+  GList *iter;
+
+  gimp = g_object_new (GIMP_TYPE_GIMP, NULL);
+
+  /* Make sure to turn of on compatibility mode so deprecated
+   * procedure are included
+   */
+  gimp->pdb_compat_mode = GIMP_PDB_COMPAT_ON;
+
+  internal_procs_init (gimp->pdb);
+
+  deprecated_procs = gimp_pdb_get_deprecated_procedures (gimp->pdb);
+
+  for (iter = deprecated_procs; iter; iter = g_list_next (iter))
+    {
+      GimpProcedure *procedure = GIMP_PROCEDURE (iter->data);
+
+      g_print ("%s\n", procedure->original_name);
+    }
+
+  g_list_free (deprecated_procs);
+
+  g_object_unref (gimp);
+
+  app_exit (EXIT_SUCCESS);
+
+  return FALSE;
+}
+
 static void
 gimp_show_version_and_exit (void)
 {



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