in interactive mode, return an extra boolean indicating the choide for the

2006-11-01  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/lcms.c: in interactive mode, return an extra
	boolean indicating the choide for the "Don't ask me again"
toggle.

	* app/plug-in/plug-in-icc-profile.c: look for the extra return
	value and update the "color-profile-policy" in gimprc.
This commit is contained in:
Sven Neumann 2006-11-01 00:30:46 +00:00 committed by Sven Neumann
parent b443b138e8
commit 40425620f2
3 changed files with 49 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2006-11-01 Sven Neumann <sven@gimp.org>
* plug-ins/common/lcms.c: in interactive mode, return an extra
boolean indicating the choide for the "Don't ask me again" toggle.
* app/plug-in/plug-in-icc-profile.c: look for the extra return
value and update the "color-profile-policy" in gimprc.
2006-11-01 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimppluginprocframe.c

View File

@ -63,8 +63,10 @@ plug_in_icc_profile_apply_rgb (GimpImage *image,
GIMP_IS_PARAM_SPEC_INT32 (procedure->args[0]) &&
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]))
{
GValueArray *return_vals;
GimpPDBStatusType status;
GValueArray *return_vals;
GimpPDBStatusType status;
GimpColorProfilePolicy policy = GIMP_COLOR_PROFILE_POLICY_ASK;
gboolean success;
return_vals =
gimp_pdb_execute_procedure_by_name (gimp->pdb, context, progress,
@ -75,18 +77,47 @@ plug_in_icc_profile_apply_rgb (GimpImage *image,
G_TYPE_NONE);
status = g_value_get_enum (return_vals->values);
g_value_array_free (return_vals);
switch (status)
{
case GIMP_PDB_SUCCESS:
return TRUE;
policy = GIMP_COLOR_PROFILE_POLICY_CONVERT;
success = TRUE;
break;
case GIMP_PDB_CANCEL:
policy = GIMP_COLOR_PROFILE_POLICY_KEEP;
success = TRUE;
break;
default:
g_set_error (error, 0, 0,
_("Error running '%s'"), ICC_PROFILE_APPLY_RGB_PROC);
return FALSE;
success = FALSE;
break;
}
g_printerr ("%d\n", return_vals->n_values);
if (success && return_vals->n_values > 1)
{
GValue *value = g_value_array_get_nth (return_vals, 1);
g_printerr ("%s\n", G_VALUE_TYPE_NAME (value));
if (GIMP_VALUE_HOLDS_INT32 (value) && g_value_get_int (value))
{
g_printerr ("setting policy to %d\n", policy);
g_object_set (G_OBJECT (gimp->config),
"color-profile-policy", policy,
NULL);
}
}
g_value_array_free (return_vals);
return success;
}
g_set_error (error, 0, 0,

View File

@ -301,6 +301,8 @@ run (const gchar *name,
values[1].type = GIMP_PDB_INT32;
values[1].data.d_int32 = dont_ask;
g_printerr ("dont-ask: %d\n", dont_ask);
}
break;
@ -812,6 +814,7 @@ lcms_icc_apply_dialog (cmsHPROFILE src_profile,
GtkWidget *dialog;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *toggle = NULL;
gboolean run;
gimp_ui_init (PLUG_IN_BINARY, FALSE);
@ -847,21 +850,16 @@ lcms_icc_apply_dialog (cmsHPROFILE src_profile,
if (dont_ask)
{
GtkWidget *toggle;
toggle = gtk_check_button_new_with_mnemonic (_("_Don't ask me again"));
gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), FALSE);
gtk_widget_show (toggle);
g_signal_connect (toggle, "toggled",
G_CALLBACK (gimp_toggle_button_update),
&dont_ask);
}
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
*dont_ask = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle));
gtk_widget_destroy (dialog);
return run;