[gimp/wip/Jehan/classy-GIMP: 63/64] plug-ins: port print to GimpImage/GimpDrawable/etc.



commit c698ee8f290ffd0689a5894a7a565779818dee08
Author: Jehan <jehan girinstud io>
Date:   Sun Aug 18 19:22:26 2019 +0200

    plug-ins: port print to GimpImage/GimpDrawable/etc.

 plug-ins/print/Makefile.am         |  1 -
 plug-ins/print/print-draw-page.c   | 20 ++++----
 plug-ins/print/print-page-layout.c | 12 ++---
 plug-ins/print/print-page-setup.c  |  8 ++--
 plug-ins/print/print-page-setup.h  |  4 +-
 plug-ins/print/print-preview.c     | 26 +++++------
 plug-ins/print/print-preview.h     |  2 +-
 plug-ins/print/print-settings.c    | 14 +++---
 plug-ins/print/print-utils.c       |  8 ++--
 plug-ins/print/print-utils.h       |  4 +-
 plug-ins/print/print.c             | 94 +++++++++++++++++++-------------------
 plug-ins/print/print.h             |  4 +-
 12 files changed, 98 insertions(+), 99 deletions(-)
---
diff --git a/plug-ins/print/Makefile.am b/plug-ins/print/Makefile.am
index cdff74d19b..fed7f8ef44 100644
--- a/plug-ins/print/Makefile.am
+++ b/plug-ins/print/Makefile.am
@@ -20,7 +20,6 @@ endif
 AM_LDFLAGS = $(mwindows)
 
 AM_CPPFLAGS = \
-       -DGIMP_DEPRECATED_REPLACE_NEW_API \
        -I$(top_srcdir)         \
        $(GTK_CFLAGS)           \
        $(GEGL_CFLAGS) \
diff --git a/plug-ins/print/print-draw-page.c b/plug-ins/print/print-draw-page.c
index 7fb023971b..b53ab038ef 100644
--- a/plug-ins/print/print-draw-page.c
+++ b/plug-ins/print/print-draw-page.c
@@ -28,8 +28,8 @@
 #include "libgimp/stdplugins-intl.h"
 
 
-static cairo_surface_t * print_surface_from_drawable (gint32        drawable_ID,
-                                                      GError      **error);
+static cairo_surface_t * print_surface_from_drawable (GimpDrawable    *drawable,
+                                                      GError         **error);
 
 static void              print_draw_crop_marks       (GtkPrintContext *context,
                                                       gdouble          x,
@@ -45,7 +45,7 @@ print_draw_page (GtkPrintContext *context,
   cairo_t         *cr = gtk_print_context_get_cairo_context (context);
   cairo_surface_t *surface;
 
-  surface = print_surface_from_drawable (data->drawable_id, error);
+  surface = print_surface_from_drawable (data->drawable, error);
 
   if (surface)
     {
@@ -86,27 +86,27 @@ print_draw_page (GtkPrintContext *context,
 }
 
 static cairo_surface_t *
-print_surface_from_drawable (gint32   drawable_ID,
-                             GError **error)
+print_surface_from_drawable (GimpDrawable  *drawable,
+                             GError       **error)
 {
-  GeglBuffer         *buffer   = gimp_drawable_get_buffer (drawable_ID);
+  GeglBuffer         *buffer   = gimp_drawable_get_buffer (drawable);
   const Babl         *format;
   cairo_surface_t    *surface;
   cairo_status_t      status;
-  const gint          width    = gimp_drawable_width  (drawable_ID);
-  const gint          height   = gimp_drawable_height (drawable_ID);
+  const gint          width    = gimp_drawable_width  (drawable);
+  const gint          height   = gimp_drawable_height (drawable);
   GeglBufferIterator *iter;
   guchar             *pixels;
   gint                stride;
   guint               count    = 0;
   guint               done     = 0;
 
-  if (gimp_drawable_has_alpha (drawable_ID))
+  if (gimp_drawable_has_alpha (drawable))
     format = babl_format ("cairo-ARGB32");
   else
     format = babl_format ("cairo-RGB24");
 
-  surface = cairo_image_surface_create (gimp_drawable_has_alpha (drawable_ID) ?
+  surface = cairo_image_surface_create (gimp_drawable_has_alpha (drawable) ?
                                         CAIRO_FORMAT_ARGB32 :
                                         CAIRO_FORMAT_RGB24,
                                         width, height);
diff --git a/plug-ins/print/print-page-layout.c b/plug-ins/print/print-page-layout.c
index 159d46aaca..4a5dd57e7e 100644
--- a/plug-ins/print/print-page-layout.c
+++ b/plug-ins/print/print-page-layout.c
@@ -101,7 +101,7 @@ static PrintSizeInfo  info;
 
 GtkWidget *
 print_page_layout_gui (PrintData   *data,
-                       const gchar *help_id)
+                       const gchar *help)
 {
   GtkWidget    *main_hbox;
   GtkWidget    *main_vbox;
@@ -114,8 +114,8 @@ print_page_layout_gui (PrintData   *data,
   memset (&info, 0, sizeof (PrintSizeInfo));
 
   info.data         = data;
-  info.image_width  = gimp_drawable_width (data->drawable_id);
-  info.image_height = gimp_drawable_height (data->drawable_id);
+  info.image_width  = gimp_drawable_width (data->drawable);
+  info.image_height = gimp_drawable_height (data->drawable);
 
   setup = gtk_print_operation_get_default_page_setup (data->operation);
   if (! setup)
@@ -181,7 +181,7 @@ print_page_layout_gui (PrintData   *data,
   gtk_box_pack_start (GTK_BOX (main_hbox), frame, TRUE, TRUE, 0);
   gtk_widget_show (frame);
 
-  info.preview = print_preview_new (setup, data->drawable_id);
+  info.preview = print_preview_new (setup, data->drawable);
   print_preview_set_use_full_page (PRINT_PREVIEW (info.preview),
                                    data->use_full_page);
   gtk_container_add (GTK_CONTAINER (frame), info.preview);
@@ -200,7 +200,7 @@ print_page_layout_gui (PrintData   *data,
                            G_CALLBACK (update_custom_widget),
                            main_hbox, 0);
 
-  gimp_help_connect (main_hbox, gimp_standard_help_func, help_id, NULL, NULL);
+  gimp_help_connect (main_hbox, gimp_standard_help_func, help, NULL, NULL);
 
   return main_hbox;
 }
@@ -937,7 +937,7 @@ print_resolution_load_defaults (PrintSizeInfo *info)
   gdouble xres;
   gdouble yres;
 
-  gimp_image_get_resolution (info->data->image_id, &xres, &yres);
+  gimp_image_get_resolution (info->data->image, &xres, &yres);
 
   gimp_size_entry_set_refval (info->resolution_entry, 0, xres);
   gimp_size_entry_set_refval (info->resolution_entry, 1, yres);
diff --git a/plug-ins/print/print-page-setup.c b/plug-ins/print/print-page-setup.c
index f80e014ff7..319e3b2e16 100644
--- a/plug-ins/print/print-page-setup.c
+++ b/plug-ins/print/print-page-setup.c
@@ -48,13 +48,13 @@ print_page_setup_dialog (GtkPrintOperation *operation)
 
 void
 print_page_setup_load (GtkPrintOperation *operation,
-                       gint32             image_ID)
+                       GimpImage         *image)
 {
   GKeyFile *key_file;
 
   g_return_if_fail (GTK_IS_PRINT_OPERATION (operation));
 
-  key_file = print_utils_key_file_load_from_parasite (image_ID,
+  key_file = print_utils_key_file_load_from_parasite (image,
                                                       PRINT_PAGE_SETUP_NAME);
 
   if (! key_file)
@@ -79,7 +79,7 @@ print_page_setup_load (GtkPrintOperation *operation,
 
 void
 print_page_setup_save (GtkPrintOperation *operation,
-                       gint32             image_ID)
+                       GimpImage         *image)
 {
   GtkPageSetup *setup;
   GKeyFile     *key_file;
@@ -93,7 +93,7 @@ print_page_setup_save (GtkPrintOperation *operation,
   gtk_page_setup_to_key_file (setup, key_file, PRINT_PAGE_SETUP_NAME);
 
   print_utils_key_file_save_as_parasite (key_file,
-                                         image_ID, PRINT_PAGE_SETUP_NAME);
+                                         image, PRINT_PAGE_SETUP_NAME);
   print_utils_key_file_save_as_rcfile (key_file,
                                        PRINT_PAGE_SETUP_NAME);
 
diff --git a/plug-ins/print/print-page-setup.h b/plug-ins/print/print-page-setup.h
index 8440e10f3b..2642b42851 100644
--- a/plug-ins/print/print-page-setup.h
+++ b/plug-ins/print/print-page-setup.h
@@ -20,8 +20,8 @@
 void   print_page_setup_dialog (GtkPrintOperation *operation);
 #endif
 void   print_page_setup_load   (GtkPrintOperation *operation,
-                                gint32             image_ID);
+                                GimpImage         *image);
 void   print_page_setup_save   (GtkPrintOperation *operation,
-                                gint32             image_ID);
+                                GimpImage         *image);
 
 
diff --git a/plug-ins/print/print-preview.c b/plug-ins/print/print-preview.c
index 47c0e2bca9..fcc0985b9d 100644
--- a/plug-ins/print/print-preview.c
+++ b/plug-ins/print/print-preview.c
@@ -44,7 +44,7 @@ struct _PrintPreview
   gboolean         dragging;
   gboolean         inside;
 
-  gint32           drawable_id;
+  GimpDrawable    *drawable;
 
   gdouble          image_offset_x;
   gdouble          image_offset_y;
@@ -111,7 +111,7 @@ static void      print_preview_get_page_margins     (PrintPreview     *preview,
                                                      gdouble          *right_margin,
                                                      gdouble          *top_margin,
                                                      gdouble          *bottom_margin);
-static cairo_surface_t * print_preview_get_thumbnail (gint32           drawable_id,
+static cairo_surface_t * print_preview_get_thumbnail (GimpDrawable    *drawable,
                                                       gint             width,
                                                       gint             height);
 
@@ -509,10 +509,10 @@ print_preview_draw (GtkWidget *widget,
     }
 
   if (preview->thumbnail == NULL &&
-      gimp_item_is_valid (preview->drawable_id))
+      gimp_item_is_valid (GIMP_ITEM (preview->drawable)))
     {
       preview->thumbnail =
-        print_preview_get_thumbnail (preview->drawable_id,
+        print_preview_get_thumbnail (preview->drawable,
                                      MIN (allocation.width,  1024),
                                      MIN (allocation.height, 1024));
     }
@@ -541,7 +541,7 @@ print_preview_draw (GtkWidget *widget,
 /**
  * print_preview_new:
  * @page: page setup
- * @drawable_id: the drawable to print
+ * @drawable: the drawable to print
  *
  * Creates a new #PrintPreview widget.
  *
@@ -549,7 +549,7 @@ print_preview_draw (GtkWidget *widget,
  **/
 GtkWidget *
 print_preview_new (GtkPageSetup *page,
-                   gint32        drawable_id)
+                   GimpDrawable *drawable)
 {
   PrintPreview *preview;
 
@@ -557,7 +557,7 @@ print_preview_new (GtkPageSetup *page,
 
   preview = g_object_new (PRINT_TYPE_PREVIEW, NULL);
 
-  preview->drawable_id = drawable_id;
+  preview->drawable = drawable;
 
   print_preview_set_page_setup (preview, page);
 
@@ -584,8 +584,8 @@ print_preview_set_image_dpi (PrintPreview *preview,
   g_return_if_fail (PRINT_IS_PREVIEW (preview));
   g_return_if_fail (xres > 0.0 && yres > 0.0);
 
-  width  = gimp_drawable_width  (preview->drawable_id) * 72.0 / xres;
-  height = gimp_drawable_height (preview->drawable_id) * 72.0 / yres;
+  width  = gimp_drawable_width  (preview->drawable) * 72.0 / xres;
+  height = gimp_drawable_height (preview->drawable) * 72.0 / yres;
 
   if (width != preview->image_width || height != preview->image_height)
     {
@@ -810,9 +810,9 @@ print_preview_get_page_margins (PrintPreview *preview,
 /*  This thumbnail code should eventually end up in libgimpui.  */
 
 static cairo_surface_t *
-print_preview_get_thumbnail (gint32 drawable_id,
-                             gint   width,
-                             gint   height)
+print_preview_get_thumbnail (GimpDrawable *drawable,
+                             gint          width,
+                             gint          height)
 {
   cairo_surface_t *surface;
   cairo_format_t   format;
@@ -827,7 +827,7 @@ print_preview_get_thumbnail (gint32 drawable_id,
   g_return_val_if_fail (width  > 0 && width  <= 1024, NULL);
   g_return_val_if_fail (height > 0 && height <= 1024, NULL);
 
-  data = gimp_drawable_get_thumbnail_data (drawable_id,
+  data = gimp_drawable_get_thumbnail_data (drawable,
                                            &width, &height, &bpp);
 
   switch (bpp)
diff --git a/plug-ins/print/print-preview.h b/plug-ins/print/print-preview.h
index dc4e172a91..64e1884543 100644
--- a/plug-ins/print/print-preview.h
+++ b/plug-ins/print/print-preview.h
@@ -35,7 +35,7 @@ typedef struct _PrintPreviewClass  PrintPreviewClass;
 GType       print_preview_get_type              (void) G_GNUC_CONST;
 
 GtkWidget * print_preview_new                   (GtkPageSetup *page,
-                                                 gint32        drawable_id);
+                                                 GimpDrawable *drawable);
 
 void        print_preview_set_image_dpi         (PrintPreview *preview,
                                                  gdouble       xres,
diff --git a/plug-ins/print/print-settings.c b/plug-ins/print/print-settings.c
index 617282fc29..bab69fb95d 100644
--- a/plug-ins/print/print-settings.c
+++ b/plug-ins/print/print-settings.c
@@ -39,7 +39,7 @@ static void       print_settings_add_to_key_file             (const gchar
 
 static GKeyFile * print_settings_key_file_from_resource_file (void);
 
-static GKeyFile * print_settings_key_file_from_parasite      (gint32             image_ID);
+static GKeyFile * print_settings_key_file_from_parasite      (GimpImage         *image);
 
 static gboolean   print_settings_load_from_key_file          (PrintData         *data,
                                                               GKeyFile          *key_file);
@@ -54,7 +54,7 @@ static gboolean   print_settings_check_version               (GKeyFile
 gboolean
 print_settings_load (PrintData *data)
 {
-  GKeyFile *key_file = print_settings_key_file_from_parasite (data->image_id);
+  GKeyFile *key_file = print_settings_key_file_from_parasite (data->image);
 
   if (! key_file)
     key_file = print_settings_key_file_from_resource_file ();
@@ -79,12 +79,12 @@ print_settings_save (PrintData *data)
   GKeyFile *key_file = print_settings_key_file_from_settings (data);
 
   /* image setup */
-  if (gimp_image_is_valid (data->image_id))
+  if (gimp_image_is_valid (data->image))
     {
       gdouble xres;
       gdouble yres;
 
-      gimp_image_get_resolution (data->image_id, &xres, &yres);
+      gimp_image_get_resolution (data->image, &xres, &yres);
 
       g_key_file_set_integer (key_file, "image-setup",
                               "unit", data->unit);
@@ -114,7 +114,7 @@ print_settings_save (PrintData *data)
                               "crop-marks", data->draw_crop_marks);
 
       print_utils_key_file_save_as_parasite (key_file,
-                                             data->image_id,
+                                             data->image,
                                              PRINT_SETTINGS_NAME);
     }
 
@@ -197,11 +197,11 @@ print_settings_key_file_from_resource_file (void)
  * NULL otherwise
  */
 static GKeyFile *
-print_settings_key_file_from_parasite (gint32 image_ID)
+print_settings_key_file_from_parasite (GimpImage *image)
 {
   GKeyFile *key_file;
 
-  key_file = print_utils_key_file_load_from_parasite (image_ID,
+  key_file = print_utils_key_file_load_from_parasite (image,
                                                       PRINT_SETTINGS_NAME);
 
   if (key_file && ! print_settings_check_version (key_file))
diff --git a/plug-ins/print/print-utils.c b/plug-ins/print/print-utils.c
index a1b057b68d..0e921a2296 100644
--- a/plug-ins/print/print-utils.c
+++ b/plug-ins/print/print-utils.c
@@ -46,7 +46,7 @@ print_utils_key_file_load_from_rcfile (const gchar *basename)
 }
 
 GKeyFile *
-print_utils_key_file_load_from_parasite (gint32       image_ID,
+print_utils_key_file_load_from_parasite (GimpImage   *image,
                                          const gchar *parasite_name)
 {
   GimpParasite *parasite;
@@ -55,7 +55,7 @@ print_utils_key_file_load_from_parasite (gint32       image_ID,
 
   g_return_val_if_fail (parasite_name != NULL, NULL);
 
-  parasite = gimp_image_get_parasite (image_ID, parasite_name);
+  parasite = gimp_image_get_parasite (image, parasite_name);
 
   if (! parasite)
     return NULL;
@@ -117,7 +117,7 @@ print_utils_key_file_save_as_rcfile (GKeyFile    *key_file,
 
 void
 print_utils_key_file_save_as_parasite (GKeyFile    *key_file,
-                                       gint32       image_ID,
+                                       GimpImage   *image,
                                        const gchar *parasite_name)
 {
   GimpParasite *parasite;
@@ -140,6 +140,6 @@ print_utils_key_file_save_as_parasite (GKeyFile    *key_file,
   parasite = gimp_parasite_new (parasite_name, 0, length, contents);
   g_free (contents);
 
-  gimp_image_attach_parasite (image_ID, parasite);
+  gimp_image_attach_parasite (image, parasite);
   gimp_parasite_free (parasite);
 }
diff --git a/plug-ins/print/print-utils.h b/plug-ins/print/print-utils.h
index 78aa12affa..7e18a8391c 100644
--- a/plug-ins/print/print-utils.h
+++ b/plug-ins/print/print-utils.h
@@ -16,11 +16,11 @@
  */
 
 GKeyFile * print_utils_key_file_load_from_rcfile   (const gchar *basename);
-GKeyFile * print_utils_key_file_load_from_parasite (gint32       image_ID,
+GKeyFile * print_utils_key_file_load_from_parasite (GimpImage   *image,
                                                     const gchar *parasite_name);
 
 void       print_utils_key_file_save_as_rcfile     (GKeyFile    *key_file,
                                                     const gchar *basename);
 void       print_utils_key_file_save_as_parasite   (GKeyFile    *key_file,
-                                                    gint32       image_ID,
+                                                    GimpImage   *image,
                                                     const gchar *parasite_name);
diff --git a/plug-ins/print/print.c b/plug-ins/print/print.c
index c6338eaebf..2366efb568 100644
--- a/plug-ins/print/print.c
+++ b/plug-ins/print/print.c
@@ -69,28 +69,28 @@ static GimpProcedure    * print_create_procedure (GimpPlugIn           *plug_in,
 
 static GimpValueArray   * print_run              (GimpProcedure        *procedure,
                                                   GimpRunMode           run_mode,
-                                                  gint32                image_id,
-                                                  gint32                drawable_id,
+                                                  GimpImage            *image,
+                                                  GimpDrawable         *drawable,
                                                   const GimpValueArray *args,
                                                   gpointer              run_data);
 
-static GimpPDBStatusType  print_image            (gint32             image_ID,
+static GimpPDBStatusType  print_image            (GimpImage         *image,
                                                   gboolean           interactive,
                                                   GError           **error);
 #ifndef EMBED_PAGE_SETUP
-static GimpPDBStatusType  page_setup             (gint32             image_ID);
+static GimpPDBStatusType  page_setup             (GimpImage         *image);
 #endif
 
 static void        print_show_error         (const gchar       *message);
 static void        print_operation_set_name (GtkPrintOperation *operation,
-                                             gint               image_ID);
+                                             GimpImage         *image);
 
 static void        begin_print              (GtkPrintOperation *operation,
                                              GtkPrintContext   *context,
                                              PrintData         *data);
 static void        end_print                (GtkPrintOperation *operation,
                                              GtkPrintContext   *context,
-                                             gint32            *layer_ID);
+                                             GimpLayer        **layer);
 static void        draw_page                (GtkPrintOperation *print,
                                              GtkPrintContext   *context,
                                              gint               page_nr,
@@ -100,8 +100,8 @@ static GtkWidget * create_custom_widget     (GtkPrintOperation *operation,
                                              PrintData         *data);
 
 #ifndef EMBED_PAGE_SETUP
-static gchar     * print_temp_proc_name     (gint32             image_ID);
-static gchar     * print_temp_proc_install  (gint32             image_ID);
+static gchar     * print_temp_proc_name     (GimpImage         *image);
+static gchar     * print_temp_proc_install  (GimpImage         *image);
 
 /*  Keep a reference to the current GtkPrintOperation
  *  for access by the temporary procedure.
@@ -203,8 +203,8 @@ print_create_procedure (GimpPlugIn  *plug_in,
 static GimpValueArray *
 print_run (GimpProcedure        *procedure,
            GimpRunMode           run_mode,
-           gint32                image_id,
-           gint32                drawable_id,
+           GimpImage            *image,
+           GimpDrawable         *drawable,
            const GimpValueArray *args,
            gpointer              run_data)
 {
@@ -217,7 +217,7 @@ print_run (GimpProcedure        *procedure,
   if (strcmp (gimp_procedure_get_name (procedure),
               PRINT_PROC_NAME) == 0)
     {
-      status = print_image (image_id, run_mode == GIMP_RUN_INTERACTIVE, &error);
+      status = print_image (image, run_mode == GIMP_RUN_INTERACTIVE, &error);
 
       if (error && run_mode == GIMP_RUN_INTERACTIVE)
         {
@@ -230,7 +230,7 @@ print_run (GimpProcedure        *procedure,
     {
       if (run_mode == GIMP_RUN_INTERACTIVE)
         {
-          status = page_setup (image_id);
+          status = page_setup (image);
         }
       else
         {
@@ -247,33 +247,33 @@ print_run (GimpProcedure        *procedure,
 }
 
 static GimpPDBStatusType
-print_image (gint32     image_ID,
+print_image (GimpImage *image,
              gboolean   interactive,
              GError   **error)
 {
   GtkPrintOperation       *operation;
   GtkPrintOperationResult  result;
-  gint32                   layer;
+  GimpLayer               *layer;
   PrintData                data;
 #ifndef EMBED_PAGE_SETUP
   gchar                   *temp_proc;
 #endif
 
   /*  create a print layer from the projection  */
-  layer = gimp_layer_new_from_visible (image_ID, image_ID, PRINT_PROC_NAME);
+  layer = gimp_layer_new_from_visible (image, image, PRINT_PROC_NAME);
 
   operation = gtk_print_operation_new ();
 
   gtk_print_operation_set_n_pages (operation, 1);
-  print_operation_set_name (operation, image_ID);
+  print_operation_set_name (operation, image);
 
-  print_page_setup_load (operation, image_ID);
+  print_page_setup_load (operation, image);
 
   /* fill in the PrintData struct */
-  data.image_id        = image_ID;
-  data.drawable_id     = layer;
+  data.image           = image;
+  data.drawable        = GIMP_DRAWABLE (layer);
   data.unit            = gimp_get_default_unit ();
-  data.image_unit      = gimp_image_get_unit (image_ID);
+  data.image_unit      = gimp_image_get_unit (image);
   data.offset_x        = 0;
   data.offset_y        = 0;
   data.center          = CENTER_BOTH;
@@ -281,7 +281,7 @@ print_image (gint32     image_ID,
   data.draw_crop_marks = FALSE;
   data.operation       = operation;
 
-  gimp_image_get_resolution (image_ID, &data.xres, &data.yres);
+  gimp_image_get_resolution (image, &data.xres, &data.yres);
 
   print_settings_load (&data);
 
@@ -299,7 +299,7 @@ print_image (gint32     image_ID,
 
 #ifndef EMBED_PAGE_SETUP
   print_operation = operation;
-  temp_proc = print_temp_proc_install (image_ID);
+  temp_proc = print_temp_proc_install (image);
   gimp_plug_in_extension_enable (gimp_get_plug_in ());
 #endif
 
@@ -328,7 +328,7 @@ print_image (gint32     image_ID,
       if (result == GTK_PRINT_OPERATION_RESULT_APPLY ||
           result == GTK_PRINT_OPERATION_RESULT_IN_PROGRESS)
         {
-          print_page_setup_save (operation, image_ID);
+          print_page_setup_save (operation, image);
         }
     }
   else
@@ -346,8 +346,8 @@ print_image (gint32     image_ID,
 
   g_object_unref (operation);
 
-  if (gimp_item_is_valid (layer))
-    gimp_item_delete (layer);
+  if (gimp_item_is_valid (GIMP_ITEM (layer)))
+    gimp_item_delete (GIMP_ITEM (layer));
 
   switch (result)
     {
@@ -367,7 +367,7 @@ print_image (gint32     image_ID,
 
 #ifndef EMBED_PAGE_SETUP
 static GimpPDBStatusType
-page_setup (gint32 image_ID)
+page_setup (GimpImage *image)
 {
   GtkPrintOperation  *operation;
   GimpValueArray     *return_vals;
@@ -377,14 +377,14 @@ page_setup (gint32 image_ID)
 
   operation = gtk_print_operation_new ();
 
-  print_page_setup_load (operation, image_ID);
+  print_page_setup_load (operation, image);
   print_page_setup_dialog (operation);
-  print_page_setup_save (operation, image_ID);
+  print_page_setup_save (operation, image);
 
   g_object_unref (operation);
 
   /* now notify a running print procedure about this change */
-  name = print_temp_proc_name (image_ID);
+  name = print_temp_proc_name (image);
 
   /* we don't want the core to show an error message if the
    * temporary procedure does not exist
@@ -394,7 +394,7 @@ page_setup (gint32 image_ID)
 
   return_vals = gimp_pdb_run_procedure (gimp_get_pdb (),
                                         name,
-                                        GIMP_TYPE_IMAGE_ID, image_ID,
+                                        GIMP_TYPE_IMAGE, image,
                                         G_TYPE_NONE);
   gimp_value_array_unref (return_vals);
 
@@ -424,9 +424,9 @@ print_show_error (const gchar *message)
 
 static void
 print_operation_set_name (GtkPrintOperation *operation,
-                          gint               image_ID)
+                          GimpImage         *image)
 {
-  gchar *name = gimp_image_get_name (image_ID);
+  gchar *name = gimp_image_get_name (image);
 
   gtk_print_operation_set_job_name (operation, name);
 
@@ -446,13 +446,13 @@ begin_print (GtkPrintOperation *operation,
 static void
 end_print (GtkPrintOperation *operation,
            GtkPrintContext   *context,
-           gint32            *layer_ID)
+           GimpLayer        **layer)
 {
   /* we don't need the print layer any longer, delete it */
-  if (gimp_item_is_valid (*layer_ID))
+  if (gimp_item_is_valid (GIMP_ITEM (*layer)))
     {
-      gimp_item_delete (*layer_ID);
-      *layer_ID = -1;
+      gimp_item_delete (GIMP_ITEM (*layer));
+      *layer = NULL;
     }
 
   gimp_progress_end ();
@@ -498,25 +498,25 @@ print_temp_proc_run (GimpProcedure        *procedure,
                      const GimpValueArray *args,
                      gpointer              run_data)
 {
-  gint32 image_ID = gimp_value_get_image_id (gimp_value_array_index (args, 0));
+  GimpImage *image = g_value_get_object (gimp_value_array_index (args, 0));
 
   if (print_operation)
-    print_page_setup_load (print_operation, image_ID);
+    print_page_setup_load (print_operation, image);
 
   return gimp_procedure_new_return_values (procedure, GIMP_PDB_SUCCESS, NULL);
 }
 
 static gchar *
-print_temp_proc_name (gint32 image_ID)
+print_temp_proc_name (GimpImage *image)
 {
-  return g_strdup_printf (PRINT_TEMP_PROC_NAME "-%d", image_ID);
+  return g_strdup_printf (PRINT_TEMP_PROC_NAME "-%d", image);
 }
 
 static gchar *
-print_temp_proc_install (gint32  image_ID)
+print_temp_proc_install (GimpImage *image)
 {
   GimpPlugIn    *plug_in = gimp_get_plug_in ();
-  gchar         *name    = print_temp_proc_name (image_ID);
+  gchar         *name    = print_temp_proc_name (image);
   GimpProcedure *procedure;
 
   procedure = gimp_procedure_new (plug_in, name, GIMP_TEMPORARY,
@@ -534,11 +534,11 @@ print_temp_proc_install (gint32  image_ID)
                                   "2008");
 
   gimp_procedure_add_argument (procedure,
-                               gimp_param_spec_image_id ("image",
-                                                         "Image",
-                                                         "The image to save",
-                                                         FALSE,
-                                                         G_PARAM_READWRITE));
+                               g_param_spec_object ("image",
+                                                    "Image",
+                                                    "The image to save",
+                                                    GIMP_TYPE_IMAGE,
+                                                    G_PARAM_READWRITE));
 
   gimp_plug_in_add_temp_procedure (plug_in, procedure);
   g_object_unref (procedure);
diff --git a/plug-ins/print/print.h b/plug-ins/print/print.h
index 7a863e49ee..db084c6a6b 100644
--- a/plug-ins/print/print.h
+++ b/plug-ins/print/print.h
@@ -39,8 +39,8 @@ typedef enum
 
 typedef struct
 {
-  gint32              image_id;
-  gint32              drawable_id;
+  GimpImage          *image;
+  GimpDrawable       *drawable;
   GimpUnit            unit;
   gdouble             xres;
   gdouble             yres;


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