[gimp] Bug 698278 - Preferences|Reset ignores /etc/gimp/2.0/gimprc
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 698278 - Preferences|Reset ignores /etc/gimp/2.0/gimprc
- Date: Sun, 11 Dec 2016 19:21:07 +0000 (UTC)
commit aaa9ae1ada5b51adf5bff690fb275ab9dac7a70f
Author: Michael Natterer <mitch gimp org>
Date: Sun Dec 11 20:19:42 2016 +0100
Bug 698278 - Preferences|Reset ignores /etc/gimp/2.0/gimprc
Make gimp_rc_load() public as gimp_rc_load_system() and
gimp_rc_load_user() and call gimp_rc_load_system() from the
preferences dialog's reset code.
app/config/gimprc.c | 88 ++++++++++++++++++++-----------------
app/config/gimprc.h | 10 +++-
app/dialogs/preferences-dialog.c | 1 +
3 files changed, 57 insertions(+), 42 deletions(-)
---
diff --git a/app/config/gimprc.c b/app/config/gimprc.c
index e68816b..998f784 100644
--- a/app/config/gimprc.c
+++ b/app/config/gimprc.c
@@ -62,7 +62,6 @@ static void gimp_rc_get_property (GObject *object,
GParamSpec *pspec);
static GimpConfig * gimp_rc_duplicate (GimpConfig *object);
-static void gimp_rc_load (GimpRc *rc);
static gboolean gimp_rc_idle_save (GimpRc *rc);
static void gimp_rc_notify (GimpRc *rc,
GParamSpec *param,
@@ -251,44 +250,6 @@ gimp_rc_duplicate (GimpConfig *config)
return dup;
}
-static void
-gimp_rc_load (GimpRc *rc)
-{
- GError *error = NULL;
-
- g_return_if_fail (GIMP_IS_RC (rc));
-
- if (rc->verbose)
- g_print ("Parsing '%s'\n",
- gimp_file_get_utf8_name (rc->system_gimprc));
-
- if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
- rc->system_gimprc, NULL, &error))
- {
- if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
- g_message ("%s", error->message);
-
- g_clear_error (&error);
- }
-
- if (rc->verbose)
- g_print ("Parsing '%s'\n",
- gimp_file_get_utf8_name (rc->user_gimprc));
-
- if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
- rc->user_gimprc, NULL, &error))
- {
- if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
- {
- g_message ("%s", error->message);
-
- gimp_config_file_backup_on_error (rc->user_gimprc, "gimprc", NULL);
- }
-
- g_clear_error (&error);
- }
-}
-
static gboolean
gimp_rc_idle_save (GimpRc *rc)
{
@@ -346,12 +307,59 @@ gimp_rc_new (GObject *gimp,
"user-gimprc", user_gimprc,
NULL);
- gimp_rc_load (rc);
+ gimp_rc_load_system (rc);
+ gimp_rc_load_user (rc);
return rc;
}
void
+gimp_rc_load_system (GimpRc *rc)
+{
+ GError *error = NULL;
+
+ g_return_if_fail (GIMP_IS_RC (rc));
+
+ if (rc->verbose)
+ g_print ("Parsing '%s'\n",
+ gimp_file_get_utf8_name (rc->system_gimprc));
+
+ if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
+ rc->system_gimprc, NULL, &error))
+ {
+ if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
+ g_message ("%s", error->message);
+
+ g_clear_error (&error);
+ }
+}
+
+void
+gimp_rc_load_user (GimpRc *rc)
+{
+ GError *error = NULL;
+
+ g_return_if_fail (GIMP_IS_RC (rc));
+
+ if (rc->verbose)
+ g_print ("Parsing '%s'\n",
+ gimp_file_get_utf8_name (rc->user_gimprc));
+
+ if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
+ rc->user_gimprc, NULL, &error))
+ {
+ if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
+ {
+ g_message ("%s", error->message);
+
+ gimp_config_file_backup_on_error (rc->user_gimprc, "gimprc", NULL);
+ }
+
+ g_clear_error (&error);
+ }
+}
+
+void
gimp_rc_set_autosave (GimpRc *rc,
gboolean autosave)
{
diff --git a/app/config/gimprc.h b/app/config/gimprc.h
index 5cbb557..53391f5 100644
--- a/app/config/gimprc.h
+++ b/app/config/gimprc.h
@@ -51,16 +51,22 @@ struct _GimpRcClass
GType gimp_rc_get_type (void) G_GNUC_CONST;
+
GimpRc * gimp_rc_new (GObject *gimp,
GFile *system_gimprc,
GFile *user_gimprc,
gboolean verbose);
-void gimp_rc_set_autosave (GimpRc *gimprc,
+void gimp_rc_load_system (GimpRc *rc);
+void gimp_rc_load_user (GimpRc *rc);
+
+void gimp_rc_set_autosave (GimpRc *rc,
gboolean autosave);
-void gimp_rc_save (GimpRc *gimprc);
+void gimp_rc_save (GimpRc *rc);
+
gchar * gimp_rc_query (GimpRc *rc,
const gchar *key);
+
void gimp_rc_set_unknown_token (GimpRc *rc,
const gchar *token,
const gchar *value);
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 04ad6bc..36fe715 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -294,6 +294,7 @@ prefs_response (GtkWidget *widget,
config_copy = g_object_get_data (G_OBJECT (dialog), "config-copy");
gimp_config_reset (config_copy);
+ gimp_rc_load_system (GIMP_RC (config_copy));
/* don't use the default value if there is no help browser */
if (! gimp_help_browser_is_installed (gimp))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]