diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c index 0dea2885f6..8582a3dbca 100644 --- a/libgimp/gimpproceduredialog.c +++ b/libgimp/gimpproceduredialog.c @@ -57,6 +57,7 @@ struct _GimpProcedureDialogPrivate GimpProcedureConfig *config; GimpProcedureConfig *initial_config; + GtkWidget *ok_button; GtkWidget *reset_popover; GtkWidget *load_settings_button; @@ -319,6 +320,7 @@ gimp_procedure_dialog_constructed (GObject *object) gimp_procedure_dialog_check_mnemonic (GIMP_PROCEDURE_DIALOG (dialog), button, NULL, "cancel"); button = gimp_dialog_add_button (GIMP_DIALOG (dialog), ok_label, GTK_RESPONSE_OK); + dialog->priv->ok_button = button; gimp_procedure_dialog_check_mnemonic (GIMP_PROCEDURE_DIALOG (dialog), button, NULL, "ok"); /* OK button is the default action and has focus from start. * This allows to just accept quickly whatever default values. @@ -546,6 +548,34 @@ gimp_procedure_dialog_new (GimpProcedure *procedure, NULL); } +/** + * gimp_procedure_dialog_set_ok_label: + * @dialog: the associated #GimpProcedureDialog. + * @ok_label: a label to replace the OK button's text. + * + * Changes the "OK" button's label of @dialog to @ok_label. + */ +void +gimp_procedure_dialog_set_ok_label (GimpProcedureDialog *dialog, + const gchar *ok_label) +{ + if (ok_label == NULL) + { + GimpProcedure *procedure = dialog->priv->procedure; + + if (GIMP_IS_LOAD_PROCEDURE (procedure)) + ok_label = _("_Open"); + else if (GIMP_IS_SAVE_PROCEDURE (procedure)) + ok_label = _("_Export"); + else + ok_label = _("_OK"); + } + + gtk_button_set_label (GTK_BUTTON (dialog->priv->ok_button), ok_label); + gimp_procedure_dialog_check_mnemonic (GIMP_PROCEDURE_DIALOG (dialog), + dialog->priv->ok_button, NULL, "ok"); +} + /** * gimp_procedure_dialog_get_widget: * @dialog: the associated #GimpProcedureDialog. diff --git a/libgimp/gimpproceduredialog.h b/libgimp/gimpproceduredialog.h index a5f008bfd5..661e6a642d 100644 --- a/libgimp/gimpproceduredialog.h +++ b/libgimp/gimpproceduredialog.h @@ -74,6 +74,8 @@ GType gimp_procedure_dialog_get_type (void) G_GNUC_CONST; GtkWidget * gimp_procedure_dialog_new (GimpProcedure *procedure, GimpProcedureConfig *config, const gchar *title); +void gimp_procedure_dialog_set_ok_label (GimpProcedureDialog *dialog, + const gchar *ok_label); GtkWidget * gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog, const gchar *property, diff --git a/libgimp/gimpui.def b/libgimp/gimpui.def index 636685c9ea..dad8c713ec 100644 --- a/libgimp/gimpui.def +++ b/libgimp/gimpui.def @@ -50,6 +50,7 @@ EXPORTS gimp_procedure_dialog_get_widget gimp_procedure_dialog_new gimp_procedure_dialog_run + gimp_procedure_dialog_set_ok_label gimp_procedure_dialog_set_sensitive gimp_procedure_dialog_set_sensitive_if_in gimp_progress_bar_get_type