plug-ins: set the "Save GeoTIFF data" checkbox insensitive when…

… there are no such data available.
No need to have people test and wonder what it changes when it makes no
difference. Also adding a tooltip to make the "present on import"
condition a bit more obvious (hopefully).

This is only on `gimp-2-10` for now, for the 2.10.24 release. I will
port this to `master` branch later.
This commit is contained in:
Jehan
2021-03-28 19:13:03 +02:00
parent c864b65525
commit 6a2910bd3b
4 changed files with 21 additions and 2 deletions

View File

@ -1200,6 +1200,7 @@ out:
gboolean
save_dialog (TiffSaveVals *tsvals,
gint32 image,
const gchar *help_id,
gboolean has_alpha,
gboolean is_monochrome,
@ -1217,7 +1218,22 @@ save_dialog (TiffSaveVals *tsvals,
GtkWidget *cmp_jpeg;
GtkBuilder *builder;
gchar *ui_file;
gchar **parasites;
gboolean run;
gboolean has_geotiff = FALSE;
gint n_parasites;
gint i;
parasites = gimp_image_get_parasite_list (image, &n_parasites);
for (i = 0; i < n_parasites; i++)
{
if (g_str_has_prefix (parasites[i], "Gimp_GeoTIFF_"))
{
has_geotiff = TRUE;
break;
}
}
g_strfreev (parasites);
dialog = gimp_export_dialog_new (_("TIFF"), PLUG_IN_ROLE, help_id);
@ -1320,7 +1336,8 @@ save_dialog (TiffSaveVals *tsvals,
toggle = GTK_WIDGET (gtk_builder_get_object (builder, "save-geotiff"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
tsvals->save_geotiff);
has_geotiff && tsvals->save_geotiff);
gtk_widget_set_sensitive (toggle, has_geotiff);;
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&tsvals->save_geotiff);

View File

@ -50,6 +50,7 @@ gboolean save_image (GFile *file,
GError **error);
gboolean save_dialog (TiffSaveVals *tsvals,
gint32 image,
const gchar *help_id,
gboolean has_alpha,
gboolean is_monochrome,

View File

@ -318,7 +318,7 @@ run (const gchar *name,
gimp_parasite_free (parasite);
/* First acquire information with a dialog */
if (! save_dialog (&tsvals,
if (! save_dialog (&tsvals, image,
SAVE_PROC,
gimp_drawable_has_alpha (drawable),
image_is_monochrome (image),

View File

@ -248,6 +248,7 @@
<child>
<object class="GtkCheckButton" id="save-geotiff">
<property name="label" translatable="yes">Save _GeoTIFF data</property>
<property name="tooltip_text" translatable="yes">Keep the GeoTIFF metadata if it was present on import</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>