[gimp/metadata-wip-rebased] plug-ins: load metadata in file-jp2-load



commit 004a767e610c3e0c8726bf81318dd70eddbd2f34
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 22 20:53:38 2013 +0200

    plug-ins: load metadata in file-jp2-load

 plug-ins/common/Makefile.am     |    6 ++++--
 plug-ins/common/file-jp2-load.c |   27 ++++++++++++++++++++++++++-
 plug-ins/common/plugin-defs.pl  |    2 +-
 3 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 6da3ca3..06db0d2 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -1091,13 +1091,15 @@ file_jp2_load_SOURCES = \
        file-jp2-load.c
 
 file_jp2_load_LDADD = \
+       $(libgimpui)            \
+       $(libgimpwidgets)       \
+       $(libgimpmodule)        \
        $(libgimp)              \
        $(libgimpmath)          \
        $(libgimpconfig)        \
        $(libgimpcolor)         \
        $(libgimpbase)          \
-       $(CAIRO_LIBS)           \
-       $(GDK_PIXBUF_LIBS)      \
+       $(GTK_LIBS)             \
        $(GEGL_LIBS)            \
        $(JP2_LIBS)             \
        $(RT_LIBS)              \
diff --git a/plug-ins/common/file-jp2-load.c b/plug-ins/common/file-jp2-load.c
index e89b860..f346c29 100644
--- a/plug-ins/common/file-jp2-load.c
+++ b/plug-ins/common/file-jp2-load.c
@@ -46,7 +46,8 @@
 #include <jasper/jasper.h>
 
 
-#define LOAD_PROC "file-jp2-load"
+#define LOAD_PROC      "file-jp2-load"
+#define PLUG_IN_BINARY "file-jp2-load"
 
 
 static void     query             (void);
@@ -120,10 +121,13 @@ run (const gchar      *name,
      GimpParam       **return_vals)
 {
   static GimpParam   values[2];
+  GimpRunMode        run_mode;
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
   gint               image_ID;
   GError            *error = NULL;
 
+  run_mode = param[0].data.d_int32;
+
   INIT_I18N ();
   gegl_init (NULL, NULL);
 
@@ -135,10 +139,31 @@ run (const gchar      *name,
 
   if (strcmp (name, LOAD_PROC) == 0)
     {
+      gboolean interactive;
+
+      switch (run_mode)
+        {
+        case GIMP_RUN_INTERACTIVE:
+        case GIMP_RUN_WITH_LAST_VALS:
+          gimp_ui_init (PLUG_IN_BINARY, FALSE);
+          interactive = TRUE;
+          break;
+        default:
+          interactive = FALSE;
+          break;
+        }
+
       image_ID = load_image (param[1].data.d_string, &error);
 
       if (image_ID != -1)
         {
+          GFile *file = g_file_new_for_path (param[1].data.d_string);
+
+          gimp_image_metadata_load (image_ID, "image/jp2", file,
+                                    interactive);
+
+          g_object_unref (file);
+
           *nreturn_vals = 2;
           values[1].type         = GIMP_PDB_IMAGE;
           values[1].data.d_image = image_ID;
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 9456e23..4f363be 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -51,7 +51,7 @@
     'file-glob' => {},
     'file-header' => { ui => 1, gegl => 1 },
     'file-html-table' => { ui => 1, gegl => 1 },
-    'file-jp2-load' => { optional => 1, gegl => 1, libs => 'JP2_LIBS' },
+    'file-jp2-load' => { ui => 1, optional => 1, gegl => 1, libs => 'JP2_LIBS' },
     'file-mng' => { ui => 1, gegl => 1, optional => 1, libs => 'MNG_LIBS', cflags => 'MNG_CFLAGS' },
     'file-pat' => { ui => 1, gegl => 1 },
     'file-pcx' => { ui => 1, gegl => 1 },


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