[gimp/wip/Jehan/classy-GIMP: 35/58] plug-ins: port file-raw plug-ins to GimpImage/GimpDrawable.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/Jehan/classy-GIMP: 35/58] plug-ins: port file-raw plug-ins to GimpImage/GimpDrawable.
- Date: Tue, 20 Aug 2019 08:46:35 +0000 (UTC)
commit 0081a0268b3318477b2114999026fa21ccb5081e
Author: Jehan <jehan girinstud io>
Date: Wed Aug 14 16:51:03 2019 +0200
plug-ins: port file-raw plug-ins to GimpImage/GimpDrawable.
plug-ins/file-raw/Makefile.am | 1 -
plug-ins/file-raw/file-darktable.c | 71 ++++++++++++++++++------------------
plug-ins/file-raw/file-rawtherapee.c | 66 ++++++++++++++++-----------------
3 files changed, 69 insertions(+), 69 deletions(-)
---
diff --git a/plug-ins/file-raw/Makefile.am b/plug-ins/file-raw/Makefile.am
index c2d88fae0c..934ae6187a 100644
--- a/plug-ins/file-raw/Makefile.am
+++ b/plug-ins/file-raw/Makefile.am
@@ -25,7 +25,6 @@ rt_libexecdir = $(gimpplugindir)/plug-ins/file-rawtherapee
rp_libexecdir = $(gimpplugindir)/plug-ins/file-raw-placeholder
AM_CPPFLAGS = \
- -DGIMP_DEPRECATED_REPLACE_NEW_API \
-I$(top_srcdir) \
-I$(includedir) \
$(GTK_CFLAGS) \
diff --git a/plug-ins/file-raw/file-darktable.c b/plug-ins/file-raw/file-darktable.c
index 814230e15a..20c859944c 100644
--- a/plug-ins/file-raw/file-darktable.c
+++ b/plug-ins/file-raw/file-darktable.c
@@ -69,10 +69,10 @@ static GimpValueArray * darktable_load_thumb (GimpProcedure *proced
const GimpValueArray *args,
gpointer run_data);
-static gint32 load_image (const gchar *filename,
+static GimpImage * load_image (const gchar *filename,
GimpRunMode run_mode,
GError **error);
-static gint32 load_thumbnail_image (const gchar *filename,
+static GimpImage * load_thumbnail_image (const gchar *filename,
gint thumb_size,
gint *width,
gint *height,
@@ -306,18 +306,18 @@ darktable_load (GimpProcedure *procedure,
{
GimpValueArray *return_vals;
gchar *filename;
- gint32 image_id;
+ GimpImage *image;
GError *error = NULL;
INIT_I18N ();
filename = g_file_get_path (file);
- image_id = load_image (filename, run_mode, &error);
+ image = load_image (filename, run_mode, &error);
g_free (filename);
- if (image_id < 1)
+ if (! image)
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
error);
@@ -326,7 +326,7 @@ darktable_load (GimpProcedure *procedure,
GIMP_PDB_SUCCESS,
NULL);
- GIMP_VALUES_SET_IMAGE (return_vals, 1, image_id);
+ GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
return return_vals;
}
@@ -341,7 +341,7 @@ darktable_load_thumb (GimpProcedure *procedure,
GimpValueArray *return_vals;
gint width;
gint height;
- gint32 image_id;
+ GimpImage *image = NULL;
GError *error = NULL;
INIT_I18N ();
@@ -349,10 +349,10 @@ darktable_load_thumb (GimpProcedure *procedure,
width = size;
height = size;
- image_id = load_thumbnail_image (g_file_get_path (file),
- width, &width, &height, &error);
+ image = load_thumbnail_image (g_file_get_path (file),
+ width, &width, &height, &error);
- if (image_id < 1)
+ if (! image)
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
error);
@@ -361,7 +361,7 @@ darktable_load_thumb (GimpProcedure *procedure,
GIMP_PDB_SUCCESS,
NULL);
- GIMP_VALUES_SET_IMAGE (return_vals, 1, image_id);
+ GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
GIMP_VALUES_SET_INT (return_vals, 2, width);
GIMP_VALUES_SET_INT (return_vals, 3, height);
GIMP_VALUES_SET_ENUM (return_vals, 4, GIMP_RGB_IMAGE);
@@ -372,22 +372,22 @@ darktable_load_thumb (GimpProcedure *procedure,
return return_vals;
}
-static gint32
+static GimpImage *
load_image (const gchar *filename,
GimpRunMode run_mode,
GError **error)
{
- gint32 image_ID = -1;
- GFile *lua_file = gimp_data_directory_file ("file-raw",
- "file-darktable-export-on-exit.lua",
- NULL);
- gchar *lua_script = g_file_get_path (lua_file);
- gchar *lua_script_escaped = g_strescape (lua_script, "");
- gchar *lua_quoted = g_shell_quote (lua_script_escaped);
- gchar *lua_cmd = g_strdup_printf ("dofile(%s)", lua_quoted);
- gchar *filename_out = gimp_temp_name ("exr");
- gchar *export_filename = g_strdup_printf ("lua/export_on_exit/export_filename=%s",
- filename_out);
+ GimpImage *image = NULL;
+ GFile *lua_file = gimp_data_directory_file ("file-raw",
+ "file-darktable-export-on-exit.lua",
+ NULL);
+ gchar *lua_script = g_file_get_path (lua_file);
+ gchar *lua_script_escaped = g_strescape (lua_script, "");
+ gchar *lua_quoted = g_shell_quote (lua_script_escaped);
+ gchar *lua_cmd = g_strdup_printf ("dofile(%s)", lua_quoted);
+ gchar *filename_out = gimp_temp_name ("exr");
+ gchar *export_filename = g_strdup_printf ("lua/export_on_exit/export_filename=%s",
+ filename_out);
gchar *darktable_stdout = NULL;
gchar *darktable_stderr = NULL;
@@ -442,9 +442,9 @@ load_image (const gchar *filename,
NULL,
error))
{
- image_ID = gimp_file_load (run_mode, filename_out, filename_out);
- if (image_ID != -1)
- gimp_image_set_filename (image_ID, filename);
+ image = gimp_file_load (run_mode, filename_out, filename_out);
+ if (image)
+ gimp_image_set_filename (image, filename);
}
if (debug_prints)
@@ -467,17 +467,18 @@ load_image (const gchar *filename,
gimp_progress_update (1.0);
- return image_ID;
+ return image;
}
-static gint32
+static GimpImage *
load_thumbnail_image (const gchar *filename,
gint thumb_size,
gint *width,
gint *height,
GError **error)
{
- gint32 image_ID = -1;
+ GimpImage *image = NULL;
+
gchar *filename_out = gimp_temp_name ("jpg");
gchar *size = g_strdup_printf ("%d", thumb_size);
GFile *lua_file = gimp_data_directory_file ("file-raw",
@@ -532,10 +533,10 @@ load_thumbnail_image (const gchar *filename,
{
gimp_progress_update (0.5);
- image_ID = gimp_file_load (GIMP_RUN_NONINTERACTIVE,
- filename_out,
- filename_out);
- if (image_ID != -1)
+ image = gimp_file_load (GIMP_RUN_NONINTERACTIVE,
+ filename_out,
+ filename_out);
+ if (image)
{
/* the size reported by raw files isn't precise,
* but it should be close enough to get an idea.
@@ -547,7 +548,7 @@ load_thumbnail_image (const gchar *filename,
sscanf (start_of_size, "[dt4gimp] %d %d", width, height);
/* is this needed for thumbnails? */
- gimp_image_set_filename (image_ID, filename);
+ gimp_image_set_filename (image, filename);
}
}
@@ -560,5 +561,5 @@ load_thumbnail_image (const gchar *filename,
g_free (darktable_stdout);
g_free (exec_path);
- return image_ID;
+ return image;
}
diff --git a/plug-ins/file-raw/file-rawtherapee.c b/plug-ins/file-raw/file-rawtherapee.c
index 980db59268..decb2bdec8 100644
--- a/plug-ins/file-raw/file-rawtherapee.c
+++ b/plug-ins/file-raw/file-rawtherapee.c
@@ -70,10 +70,10 @@ static GimpValueArray * rawtherapee_load_thumb (GimpProcedure *proc
const GimpValueArray *args,
gpointer run_data);
-static gint32 load_image (const gchar *filename,
+static GimpImage * load_image (const gchar *filename,
GimpRunMode run_mode,
GError **error);
-static gint32 load_thumbnail_image (const gchar *filename,
+static GimpImage * load_thumbnail_image (const gchar *filename,
gint thumb_size,
GError **error);
@@ -257,18 +257,18 @@ rawtherapee_load (GimpProcedure *procedure,
{
GimpValueArray *return_vals;
gchar *filename;
- gint32 image_id;
+ GimpImage *image;
GError *error = NULL;
INIT_I18N ();
filename = g_file_get_path (file);
- image_id = load_image (filename, run_mode, &error);
+ image = load_image (filename, run_mode, &error);
g_free (filename);
- if (image_id < 1)
+ if (! image)
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
error);
@@ -277,7 +277,7 @@ rawtherapee_load (GimpProcedure *procedure,
GIMP_PDB_SUCCESS,
NULL);
- GIMP_VALUES_SET_IMAGE (return_vals, 1, image_id);
+ GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
return return_vals;
}
@@ -290,15 +290,15 @@ rawtherapee_load_thumb (GimpProcedure *procedure,
gpointer run_data)
{
GimpValueArray *return_vals;
- gint32 image_id;
+ GimpImage *image;
GError *error = NULL;
INIT_I18N ();
- image_id = load_thumbnail_image (g_file_get_path (file),
- size, &error);
+ image = load_thumbnail_image (g_file_get_path (file),
+ size, &error);
- if (image_id < 1)
+ if (! image)
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_EXECUTION_ERROR,
error);
@@ -307,7 +307,7 @@ rawtherapee_load_thumb (GimpProcedure *procedure,
GIMP_PDB_SUCCESS,
NULL);
- GIMP_VALUES_SET_IMAGE (return_vals, 1, image_id);
+ GIMP_VALUES_SET_IMAGE (return_vals, 1, image);
GIMP_VALUES_SET_INT (return_vals, 2, 0);
GIMP_VALUES_SET_INT (return_vals, 3, 0);
GIMP_VALUES_SET_ENUM (return_vals, 4, GIMP_RGB_IMAGE);
@@ -318,17 +318,17 @@ rawtherapee_load_thumb (GimpProcedure *procedure,
return return_vals;
}
-static gint32
+static GimpImage *
load_image (const gchar *filename,
GimpRunMode run_mode,
GError **error)
{
- gint32 image_ID = -1;
- gchar *filename_out = gimp_temp_name ("tif");
- gchar *rawtherapee_stdout = NULL;
+ GimpImage *image = NULL;
+ gchar *filename_out = gimp_temp_name ("tif");
+ gchar *rawtherapee_stdout = NULL;
- gboolean search_path = FALSE;
- gchar *exec_path = file_raw_get_executable_path ("rawtherapee", NULL,
+ gboolean search_path = FALSE;
+ gchar *exec_path = file_raw_get_executable_path ("rawtherapee", NULL,
"RAWTHERAPEE_EXECUTABLE",
"com.rawtherapee.rawtherapee",
REGISTRY_KEY_BASE,
@@ -360,9 +360,9 @@ load_image (const gchar *filename,
NULL,
error))
{
- image_ID = gimp_file_load (run_mode, filename_out, filename_out);
- if (image_ID != -1)
- gimp_image_set_filename (image_ID, filename);
+ image = gimp_file_load (run_mode, filename_out, filename_out);
+ if (image)
+ gimp_image_set_filename (image, filename);
}
/*if (rawtherapee_stdout) printf ("%s\n", rawtherapee_stdout);*/
@@ -374,19 +374,19 @@ load_image (const gchar *filename,
gimp_progress_update (1.0);
- return image_ID;
+ return image;
}
-static gint32
+static GimpImage *
load_thumbnail_image (const gchar *filename,
gint thumb_size,
GError **error)
{
- gint32 image_ID = -1;
- gchar *filename_out = gimp_temp_name ("jpg");
- gchar *thumb_pp3 = gimp_temp_name ("pp3");
- FILE *thumb_pp3_f = fopen (thumb_pp3, "w");
- gchar *rawtherapee_stdout = NULL;
+ GimpImage *image = NULL;
+ gchar *filename_out = gimp_temp_name ("jpg");
+ gchar *thumb_pp3 = gimp_temp_name ("pp3");
+ FILE *thumb_pp3_f = fopen (thumb_pp3, "w");
+ gchar *rawtherapee_stdout = NULL;
const char *pp3_content =
"[Version]\n"
"AppVersion=5.0\n"
@@ -479,13 +479,13 @@ load_thumbnail_image (const gchar *filename,
{
gimp_progress_update (0.5);
- image_ID = gimp_file_load (GIMP_RUN_NONINTERACTIVE,
- filename_out,
- filename_out);
- if (image_ID != -1)
+ image = gimp_file_load (GIMP_RUN_NONINTERACTIVE,
+ filename_out,
+ filename_out);
+ if (image)
{
/* is this needed for thumbnails? */
- gimp_image_set_filename (image_ID, filename);
+ gimp_image_set_filename (image, filename);
}
}
@@ -500,5 +500,5 @@ load_thumbnail_image (const gchar *filename,
g_free (rawtherapee_stdout);
g_free (exec_path);
- return image_ID;
+ return image;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]