Commit a4304638 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

added the new function gimp_rc_set_unknown_token() to get autosave working

2004-02-04  Sven Neumann  <sven@gimp.org>

	* app/config/gimprc.[ch]: added the new function
	gimp_rc_set_unknown_token() to get autosave working for unknown
	gimprc tokens.

	* app/config/gimpconfig.c: indentation.

	* tools/pdbgen/pdb/gimprc.pdb: gimp->edit_config was used for a
	good reason, it's the one that's saved. Reverted a change I did
	about a month ago. Use gimp_rc_set_unknown_token() so unknown
	tokens get saved. This really fixes gimp_gimprc_set().

	* app/pdb/gimprc_cmds.c: regenerated.
parent d885d717
2004-02-04 Sven Neumann <sven@gimp.org>
* app/config/gimprc.[ch]: added the new function
gimp_rc_set_unknown_token() to get autosave working for unknown
gimprc tokens.
* app/config/gimpconfig.c: indentation.
* tools/pdbgen/pdb/gimprc.pdb: gimp->edit_config was used for a
good reason, it's the one that's saved. Reverted a change I did
about a month ago. Use gimp_rc_set_unknown_token() so unknown
tokens get saved. This really fixes gimp_gimprc_set().
* app/pdb/gimprc_cmds.c: regenerated.
2004-02-03 Manish Singh <yosh@gimp.org>
* configure.in: Allow generated files with versions.
......@@ -535,7 +535,7 @@ static void gimp_config_destroy_unknown_tokens (GSList *unknown_tokens);
* function with a %NULL @value.
**/
void
gimp_config_add_unknown_token (GimpConfig *config,
gimp_config_add_unknown_token (GimpConfig *config,
const gchar *key,
const gchar *value)
{
......@@ -613,7 +613,7 @@ gimp_config_add_unknown_token (GimpConfig *config,
* Returns: a pointer to a constant string.
**/
const gchar *
gimp_config_lookup_unknown_token (GimpConfig *config,
gimp_config_lookup_unknown_token (GimpConfig *config,
const gchar *key)
{
GimpConfigToken *token;
......@@ -647,7 +647,7 @@ gimp_config_lookup_unknown_token (GimpConfig *config,
* gimp_config_add_unknown_token().
**/
void
gimp_config_foreach_unknown_token (GimpConfig *config,
gimp_config_foreach_unknown_token (GimpConfig *config,
GimpConfigForeachFunc func,
gpointer user_data)
{
......
......@@ -540,6 +540,28 @@ gimp_rc_query (GimpRc *rc,
return retval;
}
/**
* gimp_rc_set_unkown_token:
* @gimprc: a #GimpRc object.
* @token:
* @value:
*
* Calls gimp_config_add_unknown_token() and triggers an idle-save if
* autosave is enabled on @gimprc.
**/
void
gimp_rc_set_unknown_token (GimpRc *rc,
const gchar *token,
const gchar *value)
{
g_return_if_fail (GIMP_IS_RC (rc));
gimp_config_add_unknown_token (GIMP_CONFIG (rc), token, value);
if (rc->autosave)
gimp_rc_notify (rc, NULL, NULL);
}
/**
* gimp_rc_save:
* @gimprc: a #GimpRc object.
......
......@@ -51,15 +51,18 @@ struct _GimpRcClass
};
GType gimp_rc_get_type (void) G_GNUC_CONST;
GimpRc * gimp_rc_new (const gchar *system_gimprc,
const gchar *user_gimprc,
gboolean verbose);
void gimp_rc_set_autosave (GimpRc *gimprc,
gboolean autosave);
void gimp_rc_save (GimpRc *gimprc);
gchar * gimp_rc_query (GimpRc *rc,
const gchar *key);
GType gimp_rc_get_type (void) G_GNUC_CONST;
GimpRc * gimp_rc_new (const gchar *system_gimprc,
const gchar *user_gimprc,
gboolean verbose);
void gimp_rc_set_autosave (GimpRc *gimprc,
gboolean autosave);
void gimp_rc_save (GimpRc *gimprc);
gchar * gimp_rc_query (GimpRc *rc,
const gchar *key);
void gimp_rc_set_unknown_token (GimpRc *rc,
const gchar *token,
const gchar *value);
#endif /* GIMP_RC_H__ */
......@@ -70,7 +70,8 @@ gimprc_query_invoker (Gimp *gimp,
if (success)
{
value = gimp_rc_query (GIMP_RC (gimp->config), token);
/* use edit_config because unknown tokens are set there */
value = gimp_rc_query (GIMP_RC (gimp->edit_config), token);
if (! value)
success = FALSE;
......@@ -136,7 +137,8 @@ gimprc_set_invoker (Gimp *gimp,
if (success)
{
gimp_config_add_unknown_token (GIMP_CONFIG (gimp->config), token, value);
/* use edit_config because that's the one that gets saved */
gimp_rc_set_unknown_token (GIMP_RC (gimp->edit_config), token, value);
}
return procedural_db_return_args (&gimprc_set_proc, success);
......
......@@ -535,7 +535,7 @@ static void gimp_config_destroy_unknown_tokens (GSList *unknown_tokens);
* function with a %NULL @value.
**/
void
gimp_config_add_unknown_token (GimpConfig *config,
gimp_config_add_unknown_token (GimpConfig *config,
const gchar *key,
const gchar *value)
{
......@@ -613,7 +613,7 @@ gimp_config_add_unknown_token (GimpConfig *config,
* Returns: a pointer to a constant string.
**/
const gchar *
gimp_config_lookup_unknown_token (GimpConfig *config,
gimp_config_lookup_unknown_token (GimpConfig *config,
const gchar *key)
{
GimpConfigToken *token;
......@@ -647,7 +647,7 @@ gimp_config_lookup_unknown_token (GimpConfig *config,
* gimp_config_add_unknown_token().
**/
void
gimp_config_foreach_unknown_token (GimpConfig *config,
gimp_config_foreach_unknown_token (GimpConfig *config,
GimpConfigForeachFunc func,
gpointer user_data)
{
......
......@@ -56,7 +56,8 @@ HELP
vars => [ 'gchar *value = NULL' ],
code => <<'CODE'
{
value = gimp_rc_query (GIMP_RC (gimp->config), token);
/* use edit_config because unknown tokens are set there */
value = gimp_rc_query (GIMP_RC (gimp->edit_config), token);
if (! value)
success = FALSE;
......@@ -90,7 +91,8 @@ HELP
headers => [ qw("config/gimpconfig.h") ],
code => <<'CODE'
{
gimp_config_add_unknown_token (GIMP_CONFIG (gimp->config), token, value);
/* use edit_config because that's the one that gets saved */
gimp_rc_set_unknown_token (GIMP_RC (gimp->edit_config), token, value);
}
CODE
);
......
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