mirror of https://github.com/GNOME/gimp.git
libgimp: rename "Save|Load Defaults" buttons in GimpProcedureDialog.
The term "Defaults" is not clear enough and looks like it may be redundant with the "Factory Defaults" button. Let's try an alternative "Save Settings" and "Load Saved Settings". Also adding some tooltips. And finally making the "Load Saved Settings" only sensitive if the "Save Settings" button had been used at least once.
This commit is contained in:
parent
3e25ea532e
commit
c9b0cafc1d
|
@ -23,6 +23,8 @@
|
|||
#define __GIMP_PROCEDURE_CONFIG_PRIVATE_H__
|
||||
|
||||
|
||||
gboolean gimp_procedure_config_has_default (GimpProcedureConfig *config);
|
||||
|
||||
gboolean gimp_procedure_config_load_default (GimpProcedureConfig *config,
|
||||
GError **error);
|
||||
gboolean gimp_procedure_config_save_default (GimpProcedureConfig *config,
|
||||
|
|
|
@ -908,6 +908,22 @@ gimp_procedure_config_get_file (GimpProcedureConfig *config,
|
|||
return file;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_procedure_config_has_default (GimpProcedureConfig *config)
|
||||
{
|
||||
GFile *file;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
|
||||
|
||||
file = gimp_procedure_config_get_file (config, ".default");
|
||||
|
||||
success = g_file_query_exists (file, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_procedure_config_load_default (GimpProcedureConfig *config,
|
||||
GError **error)
|
||||
|
|
|
@ -52,6 +52,7 @@ struct _GimpProcedureDialogPrivate
|
|||
GimpProcedureConfig *initial_config;
|
||||
|
||||
GtkWidget *reset_popover;
|
||||
GtkWidget *load_settings_button;
|
||||
|
||||
GHashTable *widgets;
|
||||
GHashTable *mnemonics;
|
||||
|
@ -234,7 +235,8 @@ gimp_procedure_dialog_constructed (GObject *object)
|
|||
"padding", 3, NULL);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gtk_button_new_with_mnemonic (_("_Load Defaults"));
|
||||
button = gtk_button_new_with_mnemonic (_("_Load Saved Settings"));
|
||||
gtk_widget_set_tooltip_text (button, _("Load settings saved with \"Save Settings\" button"));
|
||||
gimp_procedure_dialog_check_mnemonic (GIMP_PROCEDURE_DIALOG (dialog), button, NULL, "load-defaults");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -242,8 +244,12 @@ gimp_procedure_dialog_constructed (GObject *object)
|
|||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gimp_procedure_dialog_load_defaults),
|
||||
dialog);
|
||||
gtk_widget_set_sensitive (button,
|
||||
gimp_procedure_config_has_default (dialog->priv->config));
|
||||
dialog->priv->load_settings_button = button;
|
||||
|
||||
button = gtk_button_new_with_mnemonic (_("_Save Defaults"));
|
||||
button = gtk_button_new_with_mnemonic (_("_Save Settings"));
|
||||
gtk_widget_set_tooltip_text (button, _("Store current settings for later reuse"));
|
||||
gimp_procedure_dialog_check_mnemonic (GIMP_PROCEDURE_DIALOG (dialog), button, NULL, "save-defaults");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
@ -1271,6 +1277,8 @@ gimp_procedure_dialog_save_defaults (GtkWidget *button,
|
|||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
gtk_widget_set_sensitive (dialog->priv->load_settings_button,
|
||||
gimp_procedure_config_has_default (dialog->priv->config));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in New Issue