[gimp/wip/Jehan/classy-GIMP: 45/64] plug-ins: port file-compressor to GimpImage/GimpDrawable.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/classy-GIMP: 45/64] plug-ins: port file-compressor to GimpImage/GimpDrawable.
- Date: Sun, 18 Aug 2019 20:00:04 +0000 (UTC)
commit 675605b331ae349694603997e2731295b407973a
Author: Jehan <jehan girinstud io>
Date: Wed Aug 14 16:32:06 2019 +0200
plug-ins: port file-compressor to GimpImage/GimpDrawable.
plug-ins/common/Makefile.am | 2 --
plug-ins/common/file-compressor.c | 60 +++++++++++++++++++--------------------
plug-ins/common/plugin-defs.pl | 2 +-
3 files changed, 31 insertions(+), 33 deletions(-)
---
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index ef79d982c2..8b67e89a7d 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -593,8 +593,6 @@ file_cel_LDADD = \
file_compressor_CFLAGS = $(LZMA_CFLAGS)
-file_compressor_CPPFLAGS = $(AM_CPPFLAGS) -DGIMP_DEPRECATED_REPLACE_NEW_API
-
file_compressor_SOURCES = \
file-compressor.c
diff --git a/plug-ins/common/file-compressor.c b/plug-ins/common/file-compressor.c
index 2b129622b1..b1ffd726a3 100644
--- a/plug-ins/common/file-compressor.c
+++ b/plug-ins/common/file-compressor.c
@@ -155,8 +155,8 @@ static GimpProcedure * compressor_create_procedure (GimpPlugIn *plug_
static GimpValueArray * compressor_save (GimpProcedure *procedure,
GimpRunMode run_mode,
- gint32 image_id,
- gint32 drawable_id,
+ GimpImage *image,
+ GimpDrawable *drawable,
GFile *file,
const GimpValueArray *args,
gpointer run_data);
@@ -166,15 +166,15 @@ static GimpValueArray * compressor_load (GimpProcedure *proce
const GimpValueArray *args,
gpointer run_data);
-static gint32 load_image (const CompressorEntry *compressor,
- const gchar *filename,
- gint32 run_mode,
- GimpPDBStatusType *status,
- GError **error);
+static GimpImage * load_image (const CompressorEntry *compressor,
+ const gchar *filename,
+ gint32 run_mode,
+ GimpPDBStatusType *status,
+ GError **error);
static GimpPDBStatusType save_image (const CompressorEntry *compressor,
const gchar *filename,
- gint32 image_ID,
- gint32 drawable_ID,
+ GimpImage *image,
+ GimpDrawable *drawable,
gint32 run_mode,
GError **error);
@@ -368,7 +368,7 @@ compressor_load (GimpProcedure *procedure,
GimpValueArray *return_vals;
GimpPDBStatusType status;
gchar *filename;
- gint32 image_ID;
+ GimpImage *image;
GError *error = NULL;
/* We handle PDB errors by forwarding them to the caller in
@@ -379,16 +379,16 @@ compressor_load (GimpProcedure *procedure,
filename = g_file_get_path (file);
- image_ID = load_image (compressor, filename, run_mode,
- &status, &error);
+ image = load_image (compressor, filename, run_mode,
+ &status, &error);
g_free (filename);
return_vals = gimp_procedure_new_return_values (procedure, status, error);
- if (image_ID != -1 && status == GIMP_PDB_SUCCESS)
- gimp_value_set_image_id (gimp_value_array_index (return_vals, 1),
- image_ID);
+ if (image && status == GIMP_PDB_SUCCESS)
+ g_value_set_object (gimp_value_array_index (return_vals, 1),
+ image);
return return_vals;
}
@@ -396,8 +396,8 @@ compressor_load (GimpProcedure *procedure,
static GimpValueArray *
compressor_save (GimpProcedure *procedure,
GimpRunMode run_mode,
- gint32 image_id,
- gint32 drawable_id,
+ GimpImage *image,
+ GimpDrawable *drawable,
GFile *file,
const GimpValueArray *args,
gpointer run_data)
@@ -415,7 +415,7 @@ compressor_save (GimpProcedure *procedure,
filename = g_file_get_path (file);
- status = save_image (compressor, filename, image_id, drawable_id, run_mode,
+ status = save_image (compressor, filename, image, drawable, run_mode,
&error);
g_free (filename);
@@ -426,8 +426,8 @@ compressor_save (GimpProcedure *procedure,
static GimpPDBStatusType
save_image (const CompressorEntry *compressor,
const gchar *filename,
- gint32 image_ID,
- gint32 drawable_ID,
+ GimpImage *image,
+ GimpDrawable *drawable,
gint32 run_mode,
GError **error)
{
@@ -447,8 +447,8 @@ save_image (const CompressorEntry *compressor,
tmpname = gimp_temp_name (ext + 1);
if (! (gimp_file_save (run_mode,
- image_ID,
- drawable_ID,
+ image,
+ drawable,
tmpname,
tmpname) && valid_file (tmpname)))
{
@@ -478,19 +478,19 @@ save_image (const CompressorEntry *compressor,
/* ask the core to save a thumbnail for compressed XCF files */
if (strcmp (ext, ".xcf") == 0)
- gimp_file_save_thumbnail (image_ID, filename);
+ gimp_file_save_thumbnail (image, filename);
return GIMP_PDB_SUCCESS;
}
-static gint32
+static GimpImage *
load_image (const CompressorEntry *compressor,
const gchar *filename,
gint32 run_mode,
GimpPDBStatusType *status,
GError **error)
{
- gint32 image_ID;
+ GimpImage *image;
const gchar *ext;
gchar *tmpname;
@@ -510,21 +510,21 @@ load_image (const CompressorEntry *compressor,
{
g_free (tmpname);
*status = GIMP_PDB_EXECUTION_ERROR;
- return -1;
+ return NULL;
}
/* now that we uncompressed it, load the temp file */
- image_ID = gimp_file_load (run_mode, tmpname, tmpname);
+ image = gimp_file_load (run_mode, tmpname, tmpname);
g_unlink (tmpname);
g_free (tmpname);
- if (image_ID != -1)
+ if (image)
{
*status = GIMP_PDB_SUCCESS;
- gimp_image_set_filename (image_ID, filename);
+ gimp_image_set_filename (image, filename);
}
else
{
@@ -537,7 +537,7 @@ load_image (const CompressorEntry *compressor,
"%s", gimp_pdb_get_last_error (gimp_get_pdb ()));
}
- return image_ID;
+ return image;
}
static gboolean
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index b02e0da782..bdf05de766 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -19,7 +19,7 @@
'file-aa' => { ui => 1, gegl => 1, optional => 1, libs => 'AA_LIBS', old_api => 1 },
'file-cel' => { ui => 1, gegl => 1, old_api => 1 },
'file-csource' => { ui => 1, gegl => 1, old_api => 1 },
- 'file-compressor' => { gio => 1, libdep => 'Z:BZIP2:LZMA', cflags => 'LZMA_CFLAGS', old_api => 1 },
+ 'file-compressor' => { gio => 1, libdep => 'Z:BZIP2:LZMA', cflags => 'LZMA_CFLAGS' },
'file-desktop-link' => { gio => 1 },
'file-dicom' => { ui => 1, gegl => 1, cflags => '-fno-strict-aliasing', old_api => 1 },
'file-gbr' => { ui => 1, gegl => 1 },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]