Commit a98306ef authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

derive GIMP_TYPE_MEMSIZE from G_TYPE_ULONG. Should probably be even

2002-05-28  Sven Neumann  <sven@gimp.org>

	* app/config/gimpconfig-types.c: derive GIMP_TYPE_MEMSIZE from
	G_TYPE_ULONG. Should probably be even G_TYPE_UINT64 but we use
	strtol which can only handles unsigned long int.

	* app/config/gimpbaseconfig.[ch]
	* app/config/gimpguiconfig.[ch]: changed accordingly.

	* app/config/test-config.c: use gimp_config_serialize_value() to
	dump changed values to stdout.
parent b7e3c716
2002-05-28 Sven Neumann <sven@gimp.org>
* app/config/gimpconfig-types.c: derive GIMP_TYPE_MEMSIZE from
G_TYPE_ULONG. Should probably be even G_TYPE_UINT64 but we use
strtol which can only handles unsigned long int.
* app/config/gimpbaseconfig.[ch]
* app/config/gimpguiconfig.[ch]: changed accordingly.
* app/config/test-config.c: use gimp_config_serialize_value() to
dump changed values to stdout.
2002-05-28 Michael Natterer <mitch@gimp.org>
 
* app/core/gimpcontext.c: override GObjectClass->constructor() and
......
......@@ -112,7 +112,7 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
1, 30, 1);
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_TILE_CACHE_SIZE,
"tile-cache-size",
0, G_MAXUINT, 1 << 25);
0, G_MAXULONG, 1 << 25);
}
static void
......@@ -155,7 +155,7 @@ gimp_base_config_set_property (GObject *object,
base_config->num_processors = g_value_get_uint (value);
break;
case PROP_TILE_CACHE_SIZE:
base_config->tile_cache_size = g_value_get_uint (value);
base_config->tile_cache_size = g_value_get_ulong (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -188,7 +188,7 @@ gimp_base_config_get_property (GObject *object,
g_value_set_uint (value, base_config->num_processors);
break;
case PROP_TILE_CACHE_SIZE:
g_value_set_uint (value, base_config->tile_cache_size);
g_value_set_ulong (value, base_config->tile_cache_size);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......
......@@ -43,7 +43,7 @@ struct _GimpBaseConfig
gchar *swap_path;
gboolean stingy_memory_use;
guint num_processors;
guint tile_cache_size;
gulong tile_cache_size;
};
struct _GimpBaseConfigClass
......
......@@ -68,7 +68,7 @@ gimp_memsize_get_type (void)
{
static const GTypeInfo type_info = { 0, };
memsize_type = g_type_register_static (G_TYPE_UINT, "GimpMemsize",
memsize_type = g_type_register_static (G_TYPE_ULONG, "GimpMemsize",
&type_info, 0);
g_value_register_transform_func (memsize_type, G_TYPE_STRING,
......@@ -135,19 +135,19 @@ static void
memsize_to_string (const GValue *src_value,
GValue *dest_value)
{
guint size;
gchar *str;
gulong size;
gchar *str;
size = g_value_get_uint (src_value);
size = g_value_get_ulong (src_value);
if (size > (1 << 30) && size % (1 << 30) == 0)
str = g_strdup_printf ("%uG", size >> 30);
str = g_strdup_printf ("%luG", size >> 30);
else if (size > (1 << 20) && size % (1 << 20) == 0)
str = g_strdup_printf ("%uM", size >> 20);
str = g_strdup_printf ("%luM", size >> 20);
else if (size > (1 << 10) && size % (1 << 10) == 0)
str = g_strdup_printf ("%uk", size >> 10);
str = g_strdup_printf ("%luk", size >> 10);
else
str = g_strdup_printf ("%u", size);
str = g_strdup_printf ("%lu", size);
g_value_set_string_take_ownership (dest_value, str);
};
......@@ -158,7 +158,7 @@ string_to_memsize (const GValue *src_value,
{
const gchar *str;
gchar *end;
guint size;
gulong size;
str = g_value_get_string (src_value);
......@@ -194,7 +194,7 @@ string_to_memsize (const GValue *src_value,
size <<= shift;
}
g_value_set_uint (dest_value, size);
g_value_set_ulong (dest_value, size);
return;
......
......@@ -155,7 +155,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
TRUE);
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_MAX_NEW_IMAGE_SIZE,
"max-new-image-size",
0, G_MAXUINT, 1 << 25);
0, G_MAXULONG, 1 << 25);
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH,
"theme-path",
gimp_config_build_data_path ("themes"));
......@@ -239,7 +239,7 @@ gimp_gui_config_set_property (GObject *object,
gui_config->tearoff_menus = g_value_get_boolean (value);
break;
case PROP_MAX_NEW_IMAGE_SIZE:
gui_config->max_new_image_size = g_value_get_uint (value);
gui_config->max_new_image_size = g_value_get_ulong (value);
break;
case PROP_THEME_PATH:
g_free (gui_config->theme_path);
......@@ -317,7 +317,7 @@ gimp_gui_config_get_property (GObject *object,
g_value_set_boolean (value, gui_config->tearoff_menus);
break;
case PROP_MAX_NEW_IMAGE_SIZE:
g_value_set_uint (value, gui_config->max_new_image_size);
g_value_set_ulong (value, gui_config->max_new_image_size);
break;
case PROP_THEME_PATH:
g_value_set_string (value, gui_config->theme_path);
......
......@@ -55,7 +55,7 @@ struct _GimpGuiConfig
gboolean show_tips;
gboolean show_tool_tips;
gboolean tearoff_menus;
guint max_new_image_size;
gulong max_new_image_size;
gchar *theme_path;
gchar *theme;
gboolean use_help;
......
......@@ -33,6 +33,7 @@
#include "core/core-enums.h"
#include "gimpconfig.h"
#include "gimpconfig-serialize.h"
#include "gimprc.h"
......@@ -173,34 +174,33 @@ main (int argc,
return EXIT_SUCCESS;
}
void
static void
notify_callback (GObject *object,
GParamSpec *pspec)
{
GString *str;
GValue value = { 0, };
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
if (g_value_type_transformable (pspec->value_type, G_TYPE_STRING))
{
GValue src = { 0, };
GValue dest = { 0, };
g_value_init (&src, pspec->value_type);
g_object_get_property (object, pspec->name, &src);
g_value_init (&dest, G_TYPE_STRING);
g_value_transform (&src, &dest);
g_value_init (&value, pspec->value_type);
g_object_get_property (object, pspec->name, &value);
g_print (" %s -> %s\n", pspec->name, g_value_get_string (&dest));
str = g_string_new (NULL);
g_value_unset (&dest);
g_value_unset (&src);
if (gimp_config_serialize_value (&value, str, TRUE))
{
g_print (" %s -> %s\n", pspec->name, str->str);
}
else
{
g_print (" %s changed\n", pspec->name);
g_print (" %s changed but we failed to serialize its value!\n",
pspec->name);
}
g_string_free (str, TRUE);
g_value_unset (&value);
}
static void
......
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