plug-ins/jpeg/jpeg.[ch] Make the "Save XMP data" checkbox insensitive if

2007-07-27  Raphael Quinet  <raphael@gimp.org>

	* plug-ins/jpeg/jpeg.[ch]
	* plug-ins/jpeg/jpeg-save.c (save_dialog): Make the "Save XMP
	data" checkbox insensitive if there is no XMP packet to save.

svn path=/trunk/; revision=23019
This commit is contained in:
Raphael Quinet
2007-07-26 23:44:51 +00:00
committed by Raphaël Quinet
parent 554b12fbe7
commit b361037a52
4 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2007-07-27 Raphaël Quinet <raphael@gimp.org>
* plug-ins/jpeg/jpeg.[ch]
* plug-ins/jpeg/jpeg-save.c (save_dialog): Make the "Save XMP
data" checkbox insensitive if there is no XMP packet to save.
2007-07-26 Raphaël Quinet <raphael@gimp.org> 2007-07-26 Raphaël Quinet <raphael@gimp.org>
* plug-ins/jpeg/Makefile.am * plug-ins/jpeg/Makefile.am

View File

@ -575,6 +575,7 @@ save_image (const gchar *filename,
jpeg_write_marker (&cinfo, JPEG_APP0 + 1, app_block, jpeg_write_marker (&cinfo, JPEG_APP0 + 1, app_block,
sizeof (JPEG_APP_HEADER_XMP) + xmp_data_size); sizeof (JPEG_APP_HEADER_XMP) + xmp_data_size);
g_free (app_block); g_free (app_block);
gimp_parasite_free (parasite);
} }
} }
@ -1016,9 +1017,10 @@ save_dialog (void)
G_CALLBACK (gimp_toggle_button_update), G_CALLBACK (gimp_toggle_button_update),
&jsvals.save_xmp); &jsvals.save_xmp);
/* FIXME: check if XMP packet exists, disable toggle if not */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
jsvals.save_xmp); jsvals.save_xmp && has_metadata);
gtk_widget_set_sensitive (toggle, has_metadata);
/* Subsampling */ /* Subsampling */
label = gtk_label_new (_("Subsampling:")); label = gtk_label_new (_("Subsampling:"));

View File

@ -58,6 +58,7 @@ gint32 display_ID;
JpegSaveVals jsvals; JpegSaveVals jsvals;
gint32 orig_image_ID_global; gint32 orig_image_ID_global;
gint32 drawable_ID_global; gint32 drawable_ID_global;
gboolean has_metadata;
#ifdef HAVE_EXIF #ifdef HAVE_EXIF
ExifData *exif_data = NULL; ExifData *exif_data = NULL;
@ -205,6 +206,7 @@ run (const gchar *name,
image_ID_global = -1; image_ID_global = -1;
layer_ID_global = -1; layer_ID_global = -1;
has_metadata = FALSE;
if (strcmp (name, LOAD_PROC) == 0) if (strcmp (name, LOAD_PROC) == 0)
{ {
@ -322,6 +324,13 @@ run (const gchar *name,
gimp_parasite_free (parasite); gimp_parasite_free (parasite);
} }
parasite = gimp_image_parasite_find (orig_image_ID, "gimp-metadata");
if (parasite)
{
has_metadata = TRUE;
gimp_parasite_free (parasite);
}
#ifdef HAVE_EXIF #ifdef HAVE_EXIF
exif_data = gimp_metadata_generate_exif (orig_image_ID); exif_data = gimp_metadata_generate_exif (orig_image_ID);

View File

@ -48,6 +48,7 @@ extern gboolean undo_touched;
extern gboolean load_interactive; extern gboolean load_interactive;
extern gint32 display_ID; extern gint32 display_ID;
extern gchar *image_comment; extern gchar *image_comment;
extern gboolean has_metadata;
gint32 load_image (const gchar *filename, gint32 load_image (const gchar *filename,
GimpRunMode runmode, GimpRunMode runmode,