Commit aaa9ae1a authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent 350c6ca1
......@@ -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,11 +307,58 @@ 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)
......
......@@ -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);
......
......@@ -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))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment