mirror of https://github.com/GNOME/gimp.git
fixed typo.
2002-05-06 Sven Neumann <sven@gimp.org> * autogen.sh: fixed typo. * app/config/gimpconfig-serialize.[ch] (gimp_config_serialize_value): allow to specify whether strings should be escaped. * app/config/gimprc.c (gimp_rc_query): don't escape string values. * app/config/test-config.c: changed accordingly.
This commit is contained in:
parent
8eef831956
commit
6747ea3f1f
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2002-05-06 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* autogen.sh: fixed typo.
|
||||||
|
|
||||||
|
* app/config/gimpconfig-serialize.[ch] (gimp_config_serialize_value):
|
||||||
|
allow to specify whether strings should be escaped.
|
||||||
|
|
||||||
|
* app/config/gimprc.c (gimp_rc_query): don't escape string values.
|
||||||
|
|
||||||
|
* app/config/test-config.c: changed accordingly.
|
||||||
|
|
||||||
2002-05-06 Nathan Summers <rock@gimp.org>
|
2002-05-06 Nathan Summers <rock@gimp.org>
|
||||||
|
|
||||||
* tools/gimp-mkproxy: added proxy-subst command, which substitutes its
|
* tools/gimp-mkproxy: added proxy-subst command, which substitutes its
|
||||||
|
|
|
@ -89,7 +89,7 @@ gimp_config_serialize_properties (GObject *object,
|
||||||
g_string_append (str, prop_spec->name);
|
g_string_append (str, prop_spec->name);
|
||||||
g_string_append_c (str, ' ');
|
g_string_append_c (str, ' ');
|
||||||
|
|
||||||
if (gimp_config_serialize_value (&value, str))
|
if (gimp_config_serialize_value (&value, str, TRUE))
|
||||||
{
|
{
|
||||||
g_string_append (str, ")\n");
|
g_string_append (str, ")\n");
|
||||||
write (fd, str->str, str->len);
|
write (fd, str->str, str->len);
|
||||||
|
@ -165,7 +165,7 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||||
g_string_append (str, prop_spec->name);
|
g_string_append (str, prop_spec->name);
|
||||||
g_string_append_c (str, ' ');
|
g_string_append_c (str, ' ');
|
||||||
|
|
||||||
if (gimp_config_serialize_value (&new_value, str))
|
if (gimp_config_serialize_value (&new_value, str, TRUE))
|
||||||
{
|
{
|
||||||
g_string_append (str, ")\n");
|
g_string_append (str, ")\n");
|
||||||
write (fd, str->str, str->len);
|
write (fd, str->str, str->len);
|
||||||
|
@ -191,6 +191,7 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||||
* gimp_config_serialize_value:
|
* gimp_config_serialize_value:
|
||||||
* @value: a #GValue.
|
* @value: a #GValue.
|
||||||
* @str: a #Gstring.
|
* @str: a #Gstring.
|
||||||
|
* @escaped: whether to escape string values.
|
||||||
*
|
*
|
||||||
* This utility function appends a string representation of #GValue to @str.
|
* This utility function appends a string representation of #GValue to @str.
|
||||||
*
|
*
|
||||||
|
@ -198,7 +199,8 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_config_serialize_value (const GValue *value,
|
gimp_config_serialize_value (const GValue *value,
|
||||||
GString *str)
|
GString *str,
|
||||||
|
gboolean escaped)
|
||||||
{
|
{
|
||||||
if (G_VALUE_HOLDS_BOOLEAN (value))
|
if (G_VALUE_HOLDS_BOOLEAN (value))
|
||||||
{
|
{
|
||||||
|
@ -233,15 +235,22 @@ gimp_config_serialize_value (const GValue *value,
|
||||||
|
|
||||||
if (G_VALUE_HOLDS_STRING (value))
|
if (G_VALUE_HOLDS_STRING (value))
|
||||||
{
|
{
|
||||||
gchar *escaped;
|
gchar *esc;
|
||||||
const gchar *cstr = g_value_get_string (value);
|
const gchar *cstr = g_value_get_string (value);
|
||||||
|
|
||||||
if (!cstr)
|
if (!cstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
escaped = g_strescape (cstr, NULL);
|
if (escaped)
|
||||||
g_string_append_printf (str, "\"%s\"", escaped);
|
{
|
||||||
g_free (escaped);
|
esc = g_strescape (cstr, NULL);
|
||||||
|
g_string_append_printf (str, "\"%s\"", esc);
|
||||||
|
g_free (esc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_string_append (str, cstr);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ void gimp_config_serialize_changed_properties (GObject *new,
|
||||||
void gimp_config_serialize_unknown_tokens (GObject *object,
|
void gimp_config_serialize_unknown_tokens (GObject *object,
|
||||||
gint fd);
|
gint fd);
|
||||||
gboolean gimp_config_serialize_value (const GValue *value,
|
gboolean gimp_config_serialize_value (const GValue *value,
|
||||||
GString *str);
|
GString *str,
|
||||||
|
gboolean escaped);
|
||||||
|
|
||||||
#endif /* __GIMP_CONFIG_SERIALIZE_H__ */
|
#endif /* __GIMP_CONFIG_SERIALIZE_H__ */
|
||||||
|
|
|
@ -208,7 +208,7 @@ gimp_rc_query (GimpRc *rc,
|
||||||
g_value_init (&value, prop_spec->value_type);
|
g_value_init (&value, prop_spec->value_type);
|
||||||
g_object_get_property (G_OBJECT (rc), prop_spec->name, &value);
|
g_object_get_property (G_OBJECT (rc), prop_spec->name, &value);
|
||||||
|
|
||||||
if (gimp_config_serialize_value (&value, str))
|
if (gimp_config_serialize_value (&value, str, FALSE))
|
||||||
retval = g_string_free (str, FALSE);
|
retval = g_string_free (str, FALSE);
|
||||||
else
|
else
|
||||||
g_string_free (str, TRUE);
|
g_string_free (str, TRUE);
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
|
||||||
#include "libgimpbase/gimplimits.h"
|
#include "libgimpbase/gimplimits.h"
|
||||||
|
@ -82,7 +85,7 @@ main (int argc,
|
||||||
if (! gimp_config_serialize (G_OBJECT (gimprc), filename, &error))
|
if (! gimp_config_serialize (G_OBJECT (gimprc), filename, &error))
|
||||||
{
|
{
|
||||||
g_print ("%s\n", error->message);
|
g_print ("%s\n", error->message);
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
g_print (" done.\n\n");
|
g_print (" done.\n\n");
|
||||||
|
|
||||||
|
@ -94,7 +97,7 @@ main (int argc,
|
||||||
if (! gimp_config_deserialize (G_OBJECT (gimprc), filename, &error))
|
if (! gimp_config_deserialize (G_OBJECT (gimprc), filename, &error))
|
||||||
{
|
{
|
||||||
g_print ("%s\n", error->message);
|
g_print ("%s\n", error->message);
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
header = "\n Unknown string tokens:\n";
|
header = "\n Unknown string tokens:\n";
|
||||||
gimp_config_foreach_unknown_token (G_OBJECT (gimprc),
|
gimp_config_foreach_unknown_token (G_OBJECT (gimprc),
|
||||||
|
@ -118,7 +121,7 @@ main (int argc,
|
||||||
g_print ("\n Testing gimp_rc_write_changes() ... \n\n");
|
g_print ("\n Testing gimp_rc_write_changes() ... \n\n");
|
||||||
|
|
||||||
if (! gimp_rc_write_changes (gimprc2, gimprc, NULL))
|
if (! gimp_rc_write_changes (gimprc2, gimprc, NULL))
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
g_print ("\n done.\n");
|
g_print ("\n done.\n");
|
||||||
|
|
||||||
|
@ -133,26 +136,35 @@ main (int argc,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_print ("This test should have failed :-(\n");
|
g_print ("This test should have failed :-(\n");
|
||||||
return -1;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_print ("\n Querying for default-comment ... ");
|
g_print ("\n Querying for \"default-comment\" ... ");
|
||||||
|
|
||||||
result = gimp_rc_query (gimprc, "default-comment");
|
result = gimp_rc_query (gimprc, "default-comment");
|
||||||
if (result)
|
if (result)
|
||||||
g_print ("OK, found %s.\n", result);
|
{
|
||||||
|
g_print ("OK, found \"%s\".\n", result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_print ("failed!\n");
|
{
|
||||||
|
g_print ("failed!\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
g_free (result);
|
g_free (result);
|
||||||
|
|
||||||
g_print (" Querying for foobar ... ");
|
g_print (" Querying for \"foobar\" ... ");
|
||||||
|
|
||||||
result = gimp_rc_query (gimprc, "foobar");
|
result = gimp_rc_query (gimprc, "foobar");
|
||||||
if (result && strcmp (result, "hadjaha") == 0)
|
if (result && strcmp (result, "hadjaha") == 0)
|
||||||
g_print ("OK, found %s.\n", result);
|
{
|
||||||
|
g_print ("OK, found \"%s\".\n", result);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
g_print ("failed!\n");
|
{
|
||||||
|
g_print ("failed!\n");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
g_free (result);
|
g_free (result);
|
||||||
|
|
||||||
|
@ -160,7 +172,7 @@ main (int argc,
|
||||||
|
|
||||||
g_print ("\nFinished test of GimpConfig.\n\n");
|
g_print ("\nFinished test of GimpConfig.\n\n");
|
||||||
|
|
||||||
return 0;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ DIE=0
|
||||||
echo
|
echo
|
||||||
echo "You must have glib-gettextize installed to compile $PROJECT."
|
echo "You must have glib-gettextize installed to compile $PROJECT."
|
||||||
echo "glib-gettextize is part of glib-2.0, so you should already"
|
echo "glib-gettextize is part of glib-2.0, so you should already"
|
||||||
echo "have it. Make sure it is in your PATH".
|
echo "have it. Make sure it is in your PATH."
|
||||||
DIE=1
|
DIE=1
|
||||||
}
|
}
|
||||||
(intltoolize --version) < /dev/null > /dev/null 2>&1 || {
|
(intltoolize --version) < /dev/null > /dev/null 2>&1 || {
|
||||||
|
@ -101,6 +101,7 @@ else
|
||||||
echo "too old! (Need 0.17, have $VER)"
|
echo "too old! (Need 0.17, have $VER)"
|
||||||
DIE=1
|
DIE=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if test "$DIE" -eq 1; then
|
if test "$DIE" -eq 1; then
|
||||||
|
|
|
@ -89,7 +89,7 @@ gimp_config_serialize_properties (GObject *object,
|
||||||
g_string_append (str, prop_spec->name);
|
g_string_append (str, prop_spec->name);
|
||||||
g_string_append_c (str, ' ');
|
g_string_append_c (str, ' ');
|
||||||
|
|
||||||
if (gimp_config_serialize_value (&value, str))
|
if (gimp_config_serialize_value (&value, str, TRUE))
|
||||||
{
|
{
|
||||||
g_string_append (str, ")\n");
|
g_string_append (str, ")\n");
|
||||||
write (fd, str->str, str->len);
|
write (fd, str->str, str->len);
|
||||||
|
@ -165,7 +165,7 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||||
g_string_append (str, prop_spec->name);
|
g_string_append (str, prop_spec->name);
|
||||||
g_string_append_c (str, ' ');
|
g_string_append_c (str, ' ');
|
||||||
|
|
||||||
if (gimp_config_serialize_value (&new_value, str))
|
if (gimp_config_serialize_value (&new_value, str, TRUE))
|
||||||
{
|
{
|
||||||
g_string_append (str, ")\n");
|
g_string_append (str, ")\n");
|
||||||
write (fd, str->str, str->len);
|
write (fd, str->str, str->len);
|
||||||
|
@ -191,6 +191,7 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||||
* gimp_config_serialize_value:
|
* gimp_config_serialize_value:
|
||||||
* @value: a #GValue.
|
* @value: a #GValue.
|
||||||
* @str: a #Gstring.
|
* @str: a #Gstring.
|
||||||
|
* @escaped: whether to escape string values.
|
||||||
*
|
*
|
||||||
* This utility function appends a string representation of #GValue to @str.
|
* This utility function appends a string representation of #GValue to @str.
|
||||||
*
|
*
|
||||||
|
@ -198,7 +199,8 @@ gimp_config_serialize_changed_properties (GObject *new,
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_config_serialize_value (const GValue *value,
|
gimp_config_serialize_value (const GValue *value,
|
||||||
GString *str)
|
GString *str,
|
||||||
|
gboolean escaped)
|
||||||
{
|
{
|
||||||
if (G_VALUE_HOLDS_BOOLEAN (value))
|
if (G_VALUE_HOLDS_BOOLEAN (value))
|
||||||
{
|
{
|
||||||
|
@ -233,15 +235,22 @@ gimp_config_serialize_value (const GValue *value,
|
||||||
|
|
||||||
if (G_VALUE_HOLDS_STRING (value))
|
if (G_VALUE_HOLDS_STRING (value))
|
||||||
{
|
{
|
||||||
gchar *escaped;
|
gchar *esc;
|
||||||
const gchar *cstr = g_value_get_string (value);
|
const gchar *cstr = g_value_get_string (value);
|
||||||
|
|
||||||
if (!cstr)
|
if (!cstr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
escaped = g_strescape (cstr, NULL);
|
if (escaped)
|
||||||
g_string_append_printf (str, "\"%s\"", escaped);
|
{
|
||||||
g_free (escaped);
|
esc = g_strescape (cstr, NULL);
|
||||||
|
g_string_append_printf (str, "\"%s\"", esc);
|
||||||
|
g_free (esc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_string_append (str, cstr);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ void gimp_config_serialize_changed_properties (GObject *new,
|
||||||
void gimp_config_serialize_unknown_tokens (GObject *object,
|
void gimp_config_serialize_unknown_tokens (GObject *object,
|
||||||
gint fd);
|
gint fd);
|
||||||
gboolean gimp_config_serialize_value (const GValue *value,
|
gboolean gimp_config_serialize_value (const GValue *value,
|
||||||
GString *str);
|
GString *str,
|
||||||
|
gboolean escaped);
|
||||||
|
|
||||||
#endif /* __GIMP_CONFIG_SERIALIZE_H__ */
|
#endif /* __GIMP_CONFIG_SERIALIZE_H__ */
|
||||||
|
|
Loading…
Reference in New Issue