mirror of https://github.com/GNOME/gimp.git
plug-ins: get rid of various gimp_image_set_file() calls.
- This is unneeded in all import procedures. See previous commit. Note though
that this is not because of a change in previous commit. This was already
useless previously. The file set with this PDB function was overridden by the
core anyway (i.e. even before the previous commits).
In app/file/file-import.c:file_import_image(), the imported file is correctly
set (so there is no need to set it from plug-in, which anyway libgimp's
gimp_image_set_file() was not doing) and the XCF file is reset to NULL
(rendering the call to gimp_image_set_file() in a GimpLoadProcedure useless).
- Similarly, this is a useless call in export procedures because
app/file/file-save.c:file_save() overrides such call too. I could only see one
such case for JPEG export, which was quite useless.
- Finally in other types of plug-ins, setting a non-XCF file extension was
interfering with the save feature (similarly to commit e6e73e14c7
). I only
fixed the screenshot implementations doing such a thing.
- I left a few usages which will have to be looked at more in details later.
This commit is contained in:
parent
fc2925def0
commit
4f1d0fb53b
|
@ -491,8 +491,6 @@ load_image (GFile *file,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
/* Create an indexed-alpha layer to hold the image... */
|
||||
if (bpp == 32)
|
||||
layer = gimp_layer_new (image, _("Background"), width, height,
|
||||
|
|
|
@ -741,7 +741,6 @@ load_image (GFile *file,
|
|||
image = gimp_image_new (dicominfo->width, dicominfo->height,
|
||||
(dicominfo->samples_per_pixel >= 3 ?
|
||||
GIMP_RGB : GIMP_GRAY));
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
layer = gimp_layer_new (image, _("Background"),
|
||||
dicominfo->width, dicominfo->height,
|
||||
|
|
|
@ -462,8 +462,6 @@ load_image (GFile *file,
|
|||
|
||||
image = gimp_image_new_with_precision (width, height,
|
||||
base_type, precision);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
layer = gimp_layer_new (image,
|
||||
_("Background"),
|
||||
width, height,
|
||||
|
|
|
@ -1021,7 +1021,6 @@ ReadImage (FILE *fd,
|
|||
screenheight = height;
|
||||
|
||||
*image = gimp_image_new (screenwidth, screenheight, GIMP_INDEXED);
|
||||
gimp_image_set_file (*image, file);
|
||||
|
||||
for (i = 0, j = 0; i < ncols; i++)
|
||||
{
|
||||
|
|
|
@ -1164,7 +1164,6 @@ load_image (GFile *file,
|
|||
}
|
||||
|
||||
image = gimp_image_new_with_precision (width, height, GIMP_RGB, precision);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
if (profile)
|
||||
{
|
||||
|
|
|
@ -1304,8 +1304,6 @@ load_image (GFile *file,
|
|||
gimp_image = gimp_image_new_with_precision (width, height,
|
||||
base_type, image_precision);
|
||||
|
||||
gimp_image_set_file (gimp_image, file);
|
||||
|
||||
if (profile)
|
||||
gimp_image_set_color_profile (gimp_image, profile);
|
||||
|
||||
|
|
|
@ -491,7 +491,6 @@ load_image (GFile *file,
|
|||
gimp_image_get_default_new_layer_mode (image));
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_set_resolution (image, resolution_x, resolution_y);
|
||||
|
||||
gimp_image_insert_layer (image, layer, NULL, 0);
|
||||
|
|
|
@ -844,30 +844,9 @@ load_image (PopplerDocument *doc,
|
|||
|
||||
if (! image)
|
||||
{
|
||||
GFile *new_file;
|
||||
gchar *uri;
|
||||
gchar *new_uri;
|
||||
|
||||
image = gimp_image_new (width, height, GIMP_RGB);
|
||||
gimp_image_undo_disable (image);
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
if (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES)
|
||||
new_uri = g_strdup_printf (_("%s-%s"), uri, page_label);
|
||||
else
|
||||
new_uri = g_strdup_printf (_("%s-pages"), uri);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
new_file = g_file_new_for_uri (new_uri);
|
||||
|
||||
g_free (new_uri);
|
||||
|
||||
gimp_image_set_file (image, new_file);
|
||||
|
||||
g_object_unref (new_file);
|
||||
|
||||
gimp_image_set_resolution (image, resolution, resolution);
|
||||
}
|
||||
|
||||
|
|
|
@ -419,8 +419,6 @@ load_image (GFile *file,
|
|||
}
|
||||
|
||||
image = gimp_image_new (width, height, imgtype);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
layer = gimp_layer_new (image, _("Background"),
|
||||
width, height,
|
||||
gdtype,
|
||||
|
|
|
@ -1031,8 +1031,6 @@ load_image (GFile *file,
|
|||
|
||||
}
|
||||
|
||||
gimp_image_set_file ((GimpImage *) image, file);
|
||||
|
||||
/*
|
||||
* Load the colormap as necessary...
|
||||
*/
|
||||
|
|
|
@ -837,8 +837,6 @@ load_image (GFile *file,
|
|||
(pnminfo->np >= 3) ? GIMP_RGB : GIMP_GRAY,
|
||||
precision);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
switch (pnminfo->np)
|
||||
{
|
||||
case 0:
|
||||
|
@ -2246,4 +2244,4 @@ pnmscanner_getheaderline (PNMScanner *s,
|
|||
}
|
||||
|
||||
pnmscanner_gettoken (s, buf, bufsize);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1239,8 +1239,6 @@ load_image (GFile *file,
|
|||
image = gimp_image_new (urx, ury, GIMP_RGB);
|
||||
|
||||
gimp_image_undo_disable (image);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_set_resolution (image,
|
||||
plvals.resolution,
|
||||
plvals.resolution);
|
||||
|
@ -2044,9 +2042,6 @@ create_new_image (GFile *file,
|
|||
{
|
||||
GimpImage *image;
|
||||
GimpImageType gdtype;
|
||||
GFile *new_file;
|
||||
gchar *uri;
|
||||
gchar *new_uri;
|
||||
gchar *tmp;
|
||||
|
||||
switch (type)
|
||||
|
@ -2066,17 +2061,6 @@ create_new_image (GFile *file,
|
|||
GIMP_PRECISION_U8_NON_LINEAR);
|
||||
gimp_image_undo_disable (image);
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
new_uri = g_strdup_printf ("%s-%d", uri, pagenum);
|
||||
g_free (uri);
|
||||
|
||||
new_file = g_file_new_for_uri (new_uri);
|
||||
g_free (new_uri);
|
||||
|
||||
gimp_image_set_file (image, new_file);
|
||||
g_object_unref (new_file);
|
||||
|
||||
tmp = g_strdup_printf (_("Page %d"), pagenum);
|
||||
*layer = gimp_layer_new (image, tmp, width, height,
|
||||
gdtype,
|
||||
|
|
|
@ -2461,8 +2461,6 @@ load_image (GFile *file,
|
|||
goto error;
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
gimp_image_set_resolution (image, ia.resolution, ia.resolution);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1833,7 +1833,6 @@ load_image (GFile *file,
|
|||
|
||||
data->image = gimp_image_new_with_precision (width, height, itype, precision);
|
||||
|
||||
gimp_image_set_file (data->image, file);
|
||||
layer = gimp_layer_new (data->image, _("Background"),
|
||||
width, height, ltype, 100,
|
||||
gimp_image_get_default_new_layer_mode (data->image));
|
||||
|
|
|
@ -1076,7 +1076,6 @@ create_new_image (GFile *file,
|
|||
}
|
||||
|
||||
image = gimp_image_new (width, height, type);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
*layer = gimp_layer_new (image, _("Background"), width, height,
|
||||
gdtype,
|
||||
|
|
|
@ -378,7 +378,6 @@ load_image (GFile *file,
|
|||
image = gimp_image_new (width, height, GIMP_RGB);
|
||||
gimp_image_undo_disable (image);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_set_resolution (image,
|
||||
load_vals.resolution, load_vals.resolution);
|
||||
|
||||
|
|
|
@ -1101,7 +1101,6 @@ ReadImage (FILE *fp,
|
|||
}
|
||||
|
||||
image = gimp_image_new (info->width, info->height, itype);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
if (gimp_cmap)
|
||||
gimp_image_set_colormap (image, gimp_cmap, info->colorMapLength);
|
||||
|
|
|
@ -271,7 +271,6 @@ read_image (FILE *fd,
|
|||
GIMP_INDEXED_IMAGE, 100,
|
||||
gimp_image_get_default_new_layer_mode (image));
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_set_colormap (image, mono, 2);
|
||||
|
||||
gimp_image_insert_layer (image, layer, NULL, 0);
|
||||
|
|
|
@ -1032,7 +1032,6 @@ load_image (GFile *file,
|
|||
return NULL;
|
||||
|
||||
image = gimp_image_new (width, height, GIMP_RGB);
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_set_resolution (image,
|
||||
load_vals.resolution, load_vals.resolution);
|
||||
|
||||
|
|
|
@ -871,7 +871,6 @@ load_image (GFile *file,
|
|||
}
|
||||
|
||||
image = gimp_image_new (width, height, GIMP_INDEXED);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
if (comment)
|
||||
{
|
||||
|
|
|
@ -699,8 +699,6 @@ load_image (GFile *file,
|
|||
|
||||
image = gimp_image_new (img_width, img_height, GIMP_RGB);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
if (! set_hotspot_to_parasite (image, hot_spot_x, hot_spot_y))
|
||||
{
|
||||
fclose (fp);
|
||||
|
|
|
@ -409,8 +409,6 @@ load_image (GFile *file,
|
|||
xpm_image.height,
|
||||
GIMP_RGB);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
/* fill it */
|
||||
parse_image (image, &xpm_image, cmap);
|
||||
|
||||
|
|
|
@ -1300,7 +1300,6 @@ create_new_image (GFile *file,
|
|||
GimpImage *image;
|
||||
|
||||
image = gimp_image_new (width, height, type);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
*layer = gimp_layer_new (image, "Background", width, height,
|
||||
gdtype,
|
||||
|
|
|
@ -738,9 +738,6 @@ ReadImage (FILE *fd,
|
|||
width, height,
|
||||
image_type, 100,
|
||||
gimp_image_get_default_new_layer_mode (image));
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
gimp_image_insert_layer (image, layer, NULL, 0);
|
||||
|
||||
/* use g_malloc0 to initialize the dest buffer so that unspecified
|
||||
|
|
|
@ -368,8 +368,6 @@ read_dds (GFile *file,
|
|||
return GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
if (hdr.pixelfmt.flags & DDPF_PALETTEINDEXED8)
|
||||
{
|
||||
d.palette = g_malloc (256 * 4);
|
||||
|
|
|
@ -257,8 +257,6 @@ load_image (GFile *file,
|
|||
goto out;
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
/* try to load an icc profile, it will be generated on the fly if
|
||||
* chromaticities are given
|
||||
*/
|
||||
|
|
|
@ -570,7 +570,6 @@ emitgimp (gint hcol,
|
|||
_("Could not create image."));
|
||||
return NULL;
|
||||
}
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
layer = gimp_layer_new (image, _("Background"),
|
||||
hcol,
|
||||
|
|
|
@ -535,23 +535,9 @@ create_new_image (GFile *file,
|
|||
GeglBuffer **buffer)
|
||||
{
|
||||
GimpImage *image;
|
||||
GFile *new_file;
|
||||
gchar *uri;
|
||||
gchar *new_uri;
|
||||
|
||||
image = gimp_image_new_with_precision (width, height, itype, iprecision);
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
new_uri = g_strdup_printf ("%s-img%d", uri, pagenum);
|
||||
g_free (uri);
|
||||
|
||||
new_file = g_file_new_for_uri (new_uri);
|
||||
g_free (new_uri);
|
||||
|
||||
gimp_image_set_file (image, new_file);
|
||||
g_object_unref (new_file);
|
||||
|
||||
gimp_image_undo_disable (image);
|
||||
*layer = gimp_layer_new (image, _("Background"), width, height,
|
||||
dtype, 100,
|
||||
|
|
|
@ -559,7 +559,6 @@ load_image (GFile *file,
|
|||
}
|
||||
|
||||
image = gimp_image_new (fli_header.width, fli_header.height, GIMP_INDEXED);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
fb = g_malloc (fli_header.width * fli_header.height);
|
||||
ofb = g_malloc (fli_header.width * fli_header.height);
|
||||
|
|
|
@ -170,7 +170,6 @@ icns_load (IcnsResource *icns,
|
|||
|
||||
/* Largest .icns icon is 1024 x 1024 */
|
||||
image = gimp_image_new (1024, 1024, GIMP_RGB);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
nResources = 0;
|
||||
while (resource_get_next (icns, &resources[nResources++])) {}
|
||||
|
|
|
@ -721,8 +721,6 @@ ico_load_image (GFile *file,
|
|||
D(("image size: %ix%i\n", max_width, max_height));
|
||||
|
||||
image = gimp_image_new (max_width, max_height, GIMP_RGB);
|
||||
if (! file_offset)
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
maxsize = max_width * max_height * 4;
|
||||
buf = g_new (guchar, max_width * max_height * 4);
|
||||
|
@ -923,7 +921,6 @@ ani_load_image (GFile *file,
|
|||
gimp_parasite_free (parasite);
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
return image;
|
||||
|
|
|
@ -230,7 +230,6 @@ load_image (GFile *file,
|
|||
GIMP_PRECISION_U8_NON_LINEAR);
|
||||
|
||||
gimp_image_undo_disable (image);
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
/* Step 5.0: save the original JPEG settings in a parasite */
|
||||
jpeg_detect_original_settings (&cinfo, image);
|
||||
|
|
|
@ -464,20 +464,8 @@ jpeg_save (GimpProcedure *procedure,
|
|||
switch (export)
|
||||
{
|
||||
case GIMP_EXPORT_EXPORT:
|
||||
{
|
||||
gchar *tmp = g_filename_from_utf8 (_("Export Preview"), -1,
|
||||
NULL, NULL, NULL);
|
||||
if (tmp)
|
||||
{
|
||||
GFile *file = g_file_new_for_path (tmp);
|
||||
gimp_image_set_file (image, file);
|
||||
g_object_unref (file);
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
display = NULL;
|
||||
separate_display = TRUE;
|
||||
}
|
||||
display = NULL;
|
||||
separate_display = TRUE;
|
||||
break;
|
||||
|
||||
case GIMP_EXPORT_IGNORE:
|
||||
|
|
|
@ -1339,7 +1339,6 @@ create_gimp_image (PSDimage *img_a,
|
|||
IFDBG(2) g_debug ("Create image");
|
||||
image = gimp_image_new_with_precision (img_a->columns, img_a->rows,
|
||||
img_a->base_type, precision);
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_undo_disable (image);
|
||||
|
||||
return image;
|
||||
|
|
|
@ -273,7 +273,6 @@ create_gimp_image (PSDimage *img_a,
|
|||
IFDBG(2) g_debug ("Create image");
|
||||
image = gimp_image_new (img_a->columns, img_a->rows, img_a->base_type);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
gimp_image_undo_disable (image);
|
||||
|
||||
return image;
|
||||
|
|
|
@ -443,8 +443,6 @@ load_image (GFile *file,
|
|||
error))
|
||||
{
|
||||
image = gimp_file_load (run_mode, file_out);
|
||||
if (image)
|
||||
gimp_image_set_file (image, file);
|
||||
}
|
||||
|
||||
if (debug_prints)
|
||||
|
@ -542,9 +540,6 @@ load_thumbnail_image (GFile *file,
|
|||
"[dt4gimp]");
|
||||
if (start_of_size)
|
||||
sscanf (start_of_size, "[dt4gimp] %d %d", width, height);
|
||||
|
||||
/* is this needed for thumbnails? */
|
||||
gimp_image_set_file (image, file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -355,8 +355,6 @@ load_image (GFile *file,
|
|||
error))
|
||||
{
|
||||
image = gimp_file_load (run_mode, file_out);
|
||||
if (image)
|
||||
gimp_image_set_file (image, file);
|
||||
}
|
||||
|
||||
/*if (rawtherapee_stdout) printf ("%s\n", rawtherapee_stdout);*/
|
||||
|
@ -473,11 +471,6 @@ load_thumbnail_image (GFile *file,
|
|||
gimp_progress_update (0.5);
|
||||
|
||||
image = gimp_file_load (GIMP_RUN_NONINTERACTIVE, file_out);
|
||||
if (image)
|
||||
{
|
||||
/* is this needed for thumbnails? */
|
||||
gimp_image_set_file (image, file);
|
||||
}
|
||||
}
|
||||
|
||||
gimp_progress_update (1.0);
|
||||
|
|
|
@ -465,8 +465,6 @@ load_image (GFile *file,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
/*
|
||||
* Create the "background" layer to hold the image...
|
||||
*/
|
||||
|
|
|
@ -1162,45 +1162,7 @@ load_image (GFile *file,
|
|||
gimp_image_undo_disable (*image);
|
||||
|
||||
if (pages.target == GIMP_PAGE_SELECTOR_TARGET_IMAGES)
|
||||
{
|
||||
gchar *uri;
|
||||
gchar *fname;
|
||||
GFile *new_file;
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
fname = g_strdup_printf ("%s-%d", uri, ilayer);
|
||||
new_file = g_file_new_for_uri (fname);
|
||||
|
||||
gimp_image_set_file (*image, new_file);
|
||||
|
||||
g_free (uri);
|
||||
g_free (fname);
|
||||
g_object_unref (new_file);
|
||||
|
||||
images_list = g_list_prepend (images_list, *image);
|
||||
}
|
||||
else if (pages.o_pages != pages.n_pages)
|
||||
{
|
||||
gchar *uri;
|
||||
gchar *fname;
|
||||
GFile *new_file;
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
fname = g_strdup_printf (_("%s-%d-of-%d-pages"),
|
||||
uri,
|
||||
pages.n_pages, pages.o_pages);
|
||||
new_file = g_file_new_for_uri (fname);
|
||||
|
||||
gimp_image_set_file (*image, new_file);
|
||||
|
||||
g_free (uri);
|
||||
g_free (fname);
|
||||
g_object_unref (new_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_image_set_file (*image, file);
|
||||
}
|
||||
images_list = g_list_prepend (images_list, *image);
|
||||
}
|
||||
|
||||
/* attach CMYK profile to GimpImage if applicable */
|
||||
|
|
|
@ -282,8 +282,6 @@ load_image (GFile *file,
|
|||
|
||||
WebPMuxDelete (mux);
|
||||
|
||||
gimp_image_set_file (image, file);
|
||||
|
||||
if (profile)
|
||||
g_object_unref (profile);
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ screenshot_freedesktop_dbus_signal (GDBusProxy *proxy,
|
|||
GFile *file = g_file_new_for_uri (uri);
|
||||
|
||||
*image = gimp_file_load (GIMP_RUN_NONINTERACTIVE, file);
|
||||
gimp_image_set_file (*image, g_file_new_for_path ("screenshot.png"));
|
||||
|
||||
/* Delete the actual file. */
|
||||
g_file_delete (file, NULL, NULL);
|
||||
|
|
|
@ -141,7 +141,6 @@ screenshot_osx_shoot (ScreenshotValues *shootvals,
|
|||
|
||||
*image = gimp_file_load (GIMP_RUN_NONINTERACTIVE,
|
||||
tmpfile);
|
||||
gimp_image_set_file (*image, g_file_new_for_uri ("screenshot.png"));
|
||||
|
||||
g_file_delete (tmpfile, NULL, NULL);
|
||||
g_free (command);
|
||||
|
|
Loading…
Reference in New Issue