[gimp] libgimp: rename "Save|Load Defaults" buttons in GimpProcedureDialog.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: rename "Save|Load Defaults" buttons in GimpProcedureDialog.
- Date: Thu, 7 Jan 2021 21:03:29 +0000 (UTC)
commit c9b0cafc1d5c6fbf004baffbc7aee9b82c375235
Author: Jehan <jehan girinstud io>
Date: Thu Jan 7 21:59:59 2021 +0100
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.
libgimp/gimpprocedureconfig-private.h | 2 ++
libgimp/gimpprocedureconfig.c | 16 ++++++++++++++++
libgimp/gimpproceduredialog.c | 12 ++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/libgimp/gimpprocedureconfig-private.h b/libgimp/gimpprocedureconfig-private.h
index 3d5a8ff11f..d3c2085254 100644
--- a/libgimp/gimpprocedureconfig-private.h
+++ b/libgimp/gimpprocedureconfig-private.h
@@ -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,
diff --git a/libgimp/gimpprocedureconfig.c b/libgimp/gimpprocedureconfig.c
index 6c0082d846..5a80bddaf9 100644
--- a/libgimp/gimpprocedureconfig.c
+++ b/libgimp/gimpprocedureconfig.c
@@ -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)
diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c
index f8be166e66..d99191043e 100644
--- a/libgimp/gimpproceduredialog.c
+++ b/libgimp/gimpproceduredialog.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]