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:
@ -1200,6 +1200,7 @@ out:
|
|||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
save_dialog (TiffSaveVals *tsvals,
|
save_dialog (TiffSaveVals *tsvals,
|
||||||
|
gint32 image,
|
||||||
const gchar *help_id,
|
const gchar *help_id,
|
||||||
gboolean has_alpha,
|
gboolean has_alpha,
|
||||||
gboolean is_monochrome,
|
gboolean is_monochrome,
|
||||||
@ -1217,7 +1218,22 @@ save_dialog (TiffSaveVals *tsvals,
|
|||||||
GtkWidget *cmp_jpeg;
|
GtkWidget *cmp_jpeg;
|
||||||
GtkBuilder *builder;
|
GtkBuilder *builder;
|
||||||
gchar *ui_file;
|
gchar *ui_file;
|
||||||
|
gchar **parasites;
|
||||||
gboolean run;
|
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);
|
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"));
|
toggle = GTK_WIDGET (gtk_builder_get_object (builder, "save-geotiff"));
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
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_signal_connect (toggle, "toggled",
|
||||||
G_CALLBACK (gimp_toggle_button_update),
|
G_CALLBACK (gimp_toggle_button_update),
|
||||||
&tsvals->save_geotiff);
|
&tsvals->save_geotiff);
|
||||||
|
@ -50,6 +50,7 @@ gboolean save_image (GFile *file,
|
|||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean save_dialog (TiffSaveVals *tsvals,
|
gboolean save_dialog (TiffSaveVals *tsvals,
|
||||||
|
gint32 image,
|
||||||
const gchar *help_id,
|
const gchar *help_id,
|
||||||
gboolean has_alpha,
|
gboolean has_alpha,
|
||||||
gboolean is_monochrome,
|
gboolean is_monochrome,
|
||||||
|
@ -318,7 +318,7 @@ run (const gchar *name,
|
|||||||
gimp_parasite_free (parasite);
|
gimp_parasite_free (parasite);
|
||||||
|
|
||||||
/* First acquire information with a dialog */
|
/* First acquire information with a dialog */
|
||||||
if (! save_dialog (&tsvals,
|
if (! save_dialog (&tsvals, image,
|
||||||
SAVE_PROC,
|
SAVE_PROC,
|
||||||
gimp_drawable_has_alpha (drawable),
|
gimp_drawable_has_alpha (drawable),
|
||||||
image_is_monochrome (image),
|
image_is_monochrome (image),
|
||||||
|
@ -248,6 +248,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkCheckButton" id="save-geotiff">
|
<object class="GtkCheckButton" id="save-geotiff">
|
||||||
<property name="label" translatable="yes">Save _GeoTIFF data</property>
|
<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="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
Reference in New Issue
Block a user