libgimpbase/Makefile.am libgimpbase/gimpbase.h libgimpbase/gimpbase.def
2004-07-27 Sven Neumann <sven@gimp.org> * libgimpbase/Makefile.am * libgimpbase/gimpbase.h * libgimpbase/gimpbase.def * libgimpbase/gimpmemsize.[ch]: added new files with memsize related functions (moved here from gimputil.c) and GIMP_TYPE_MEMSIZE (moved here from app/config/gimpconfig-types.[ch]). * libgimpbase/gimputils.[ch]: removed gimp_memsize_to_string() here. * libgimpbase/gimpunit.[ch]: added GIMP_TYPE_UNIT (moved here from app/config/gimpconfig-types.[ch]). * libgimpbase/gimpbase-private.c * libgimp/gimptile.c * libgimp/gimpunitcache.c * plug-ins/help/domain.c * app/xcf/xcf-read.c: need to include glib-object.h. * plug-ins/common/uniteditor.c: use GIMP_TYPE_UNIT. * app/config/gimpconfig-types.[ch]: removed code that lives in libgimpbase now. * app/config/gimpconfig-deserialize.c: changed accordingly. * app/config/gimpbaseconfig.c * app/config/gimpdisplayconfig.c * app/core/gimpcontext.c * app/gui/grid-dialog.c * app/tools/gimpcolortool.c * app/widgets/gimpaction.c * app/widgets/gimpunitstore.c: no need to include gimpconfig-types.h any longer.
This commit is contained in:

committed by
Sven Neumann

parent
ed3f8fd1bc
commit
bd427b2e4d
38
ChangeLog
38
ChangeLog
@ -1,4 +1,40 @@
|
||||
2004-07-27 Michael Natterer <mitch@gimp.org>
|
||||
2004-07-27 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpbase/Makefile.am
|
||||
* libgimpbase/gimpbase.h
|
||||
* libgimpbase/gimpbase.def
|
||||
* libgimpbase/gimpmemsize.[ch]: added new files with memsize
|
||||
related functions (moved here from gimputil.c) and
|
||||
GIMP_TYPE_MEMSIZE (moved here from app/config/gimpconfig-types.[ch]).
|
||||
|
||||
* libgimpbase/gimputils.[ch]: removed gimp_memsize_to_string() here.
|
||||
|
||||
* libgimpbase/gimpunit.[ch]: added GIMP_TYPE_UNIT (moved here from
|
||||
app/config/gimpconfig-types.[ch]).
|
||||
|
||||
* libgimpbase/gimpbase-private.c
|
||||
* libgimp/gimptile.c
|
||||
* libgimp/gimpunitcache.c
|
||||
* plug-ins/help/domain.c
|
||||
* app/xcf/xcf-read.c: need to include glib-object.h.
|
||||
|
||||
* plug-ins/common/uniteditor.c: use GIMP_TYPE_UNIT.
|
||||
|
||||
* app/config/gimpconfig-types.[ch]: removed code that lives in
|
||||
libgimpbase now.
|
||||
|
||||
* app/config/gimpconfig-deserialize.c: changed accordingly.
|
||||
|
||||
* app/config/gimpbaseconfig.c
|
||||
* app/config/gimpdisplayconfig.c
|
||||
* app/core/gimpcontext.c
|
||||
* app/gui/grid-dialog.c
|
||||
* app/tools/gimpcolortool.c
|
||||
* app/widgets/gimpaction.c
|
||||
* app/widgets/gimpunitstore.c: no need to include gimpconfig-types.h
|
||||
any longer.
|
||||
|
||||
004-07-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimp/Makefile.am
|
||||
* libgimp/gimp.h
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "config-types.h"
|
||||
|
||||
#include "gimpconfig-params.h"
|
||||
#include "gimpconfig-types.h"
|
||||
|
||||
#include "gimprc-blurbs.h"
|
||||
#include "gimpbaseconfig.h"
|
||||
|
@ -560,8 +560,9 @@ gimp_config_deserialize_memsize (GValue *value,
|
||||
GParamSpec *prop_spec,
|
||||
GScanner *scanner)
|
||||
{
|
||||
gchar *orig_cset_first = scanner->config->cset_identifier_first;
|
||||
gchar *orig_cset_nth = scanner->config->cset_identifier_nth;
|
||||
gchar *orig_cset_first = scanner->config->cset_identifier_first;
|
||||
gchar *orig_cset_nth = scanner->config->cset_identifier_nth;
|
||||
guint64 memsize;
|
||||
|
||||
scanner->config->cset_identifier_first = G_CSET_DIGITS;
|
||||
scanner->config->cset_identifier_nth = G_CSET_DIGITS "gGmMkKbB";
|
||||
@ -574,10 +575,12 @@ gimp_config_deserialize_memsize (GValue *value,
|
||||
scanner->config->cset_identifier_first = orig_cset_first;
|
||||
scanner->config->cset_identifier_nth = orig_cset_nth;
|
||||
|
||||
if (gimp_memsize_set_from_string (value, scanner->value.v_identifier))
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
else
|
||||
if (! gimp_memsize_deserialize (scanner->value.v_identifier, &memsize))
|
||||
return G_TOKEN_NONE;
|
||||
|
||||
g_value_set_uint64 (value, memsize);
|
||||
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
}
|
||||
|
||||
static GTokenType
|
||||
|
@ -21,12 +21,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
#include "config-types.h"
|
||||
@ -34,35 +30,8 @@
|
||||
#include "gimpconfig-types.h"
|
||||
|
||||
|
||||
static GimpRGB * color_copy (const GimpRGB *color);
|
||||
static void color_free (GimpRGB *color);
|
||||
static GimpMatrix2 * matrix2_copy (const GimpMatrix2 *matrix);
|
||||
|
||||
static GimpMatrix2 * matrix2_copy (const GimpMatrix2 *matrix);
|
||||
static void matrix2_free (GimpMatrix2 *matrix);
|
||||
|
||||
static void memsize_to_string (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
static void string_to_memsize (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
|
||||
static void unit_to_string (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
static void string_to_unit (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
|
||||
|
||||
GType
|
||||
gimp_color_get_type (void)
|
||||
{
|
||||
static GType color_type = 0;
|
||||
|
||||
if (!color_type)
|
||||
color_type = g_boxed_type_register_static ("GimpColor",
|
||||
(GBoxedCopyFunc) color_copy,
|
||||
(GBoxedFreeFunc) color_free);
|
||||
|
||||
return color_type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_matrix2_get_type (void)
|
||||
@ -72,85 +41,17 @@ gimp_matrix2_get_type (void)
|
||||
if (!matrix_type)
|
||||
matrix_type = g_boxed_type_register_static ("GimpMatrix2",
|
||||
(GBoxedCopyFunc) matrix2_copy,
|
||||
(GBoxedFreeFunc) matrix2_free);
|
||||
(GBoxedFreeFunc) g_free);
|
||||
|
||||
return matrix_type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_memsize_get_type (void)
|
||||
static GimpMatrix2 *
|
||||
matrix2_copy (const GimpMatrix2 *matrix)
|
||||
{
|
||||
static GType memsize_type = 0;
|
||||
|
||||
if (!memsize_type)
|
||||
{
|
||||
static const GTypeInfo type_info = { 0, };
|
||||
|
||||
memsize_type = g_type_register_static (G_TYPE_UINT64, "GimpMemsize",
|
||||
&type_info, 0);
|
||||
|
||||
g_value_register_transform_func (memsize_type, G_TYPE_STRING,
|
||||
memsize_to_string);
|
||||
g_value_register_transform_func (G_TYPE_STRING, memsize_type,
|
||||
string_to_memsize);
|
||||
}
|
||||
|
||||
return memsize_type;
|
||||
return (GimpMatrix2 *) g_memdup (matrix, sizeof (GimpMatrix2));
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_memsize_set_from_string (GValue *value,
|
||||
const gchar *string)
|
||||
{
|
||||
gchar *end;
|
||||
guint64 size;
|
||||
|
||||
g_return_val_if_fail (GIMP_VALUE_HOLDS_MEMSIZE (value), FALSE);
|
||||
g_return_val_if_fail (string != NULL, FALSE);
|
||||
|
||||
size = g_ascii_strtoull (string, &end, 0);
|
||||
|
||||
if (size == G_MAXUINT64 && errno == ERANGE)
|
||||
return FALSE;
|
||||
|
||||
if (end && *end)
|
||||
{
|
||||
guint shift;
|
||||
|
||||
switch (g_ascii_tolower (*end))
|
||||
{
|
||||
case 'b':
|
||||
shift = 0;
|
||||
break;
|
||||
case 'k':
|
||||
shift = 10;
|
||||
break;
|
||||
case 'm':
|
||||
shift = 20;
|
||||
break;
|
||||
case 'g':
|
||||
shift = 30;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* protect against overflow */
|
||||
if (shift)
|
||||
{
|
||||
guint64 limit = G_MAXUINT64 >> shift;
|
||||
|
||||
if (size != (size & limit))
|
||||
return FALSE;
|
||||
|
||||
size <<= shift;
|
||||
}
|
||||
}
|
||||
|
||||
g_value_set_uint64 (value, size);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_path_get_type (void)
|
||||
@ -167,126 +68,3 @@ gimp_path_get_type (void)
|
||||
|
||||
return path_type;
|
||||
}
|
||||
|
||||
GType
|
||||
gimp_unit_get_type (void)
|
||||
{
|
||||
static GType unit_type = 0;
|
||||
|
||||
if (!unit_type)
|
||||
{
|
||||
static const GTypeInfo type_info = { 0, };
|
||||
|
||||
unit_type = g_type_register_static (G_TYPE_INT, "GimpUnit",
|
||||
&type_info, 0);
|
||||
|
||||
g_value_register_transform_func (unit_type, G_TYPE_STRING,
|
||||
unit_to_string);
|
||||
g_value_register_transform_func (G_TYPE_STRING, unit_type,
|
||||
string_to_unit);
|
||||
}
|
||||
|
||||
return unit_type;
|
||||
}
|
||||
|
||||
|
||||
static GimpRGB *
|
||||
color_copy (const GimpRGB *color)
|
||||
{
|
||||
return (GimpRGB *) g_memdup (color, sizeof (GimpRGB));
|
||||
}
|
||||
|
||||
static void
|
||||
color_free (GimpRGB *color)
|
||||
{
|
||||
g_free (color);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
memsize_to_string (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
guint64 size;
|
||||
gchar *str;
|
||||
|
||||
size = g_value_get_uint64 (src_value);
|
||||
|
||||
if (size > (1 << 30) && size % (1 << 30) == 0)
|
||||
str = g_strdup_printf ("%" G_GUINT64_FORMAT "G", size >> 30);
|
||||
else if (size > (1 << 20) && size % (1 << 20) == 0)
|
||||
str = g_strdup_printf ("%" G_GUINT64_FORMAT "M", size >> 20);
|
||||
else if (size > (1 << 10) && size % (1 << 10) == 0)
|
||||
str = g_strdup_printf ("%" G_GUINT64_FORMAT "k", size >> 10);
|
||||
else
|
||||
str = g_strdup_printf ("%" G_GUINT64_FORMAT, size);
|
||||
|
||||
g_value_take_string (dest_value, str);
|
||||
}
|
||||
|
||||
static void
|
||||
string_to_memsize (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
const gchar *str = g_value_get_string (src_value);
|
||||
|
||||
if (!str || !gimp_memsize_set_from_string (dest_value, str))
|
||||
g_warning ("Can't convert string to GimpMemsize.");
|
||||
}
|
||||
|
||||
|
||||
static GimpMatrix2 *
|
||||
matrix2_copy (const GimpMatrix2 *matrix)
|
||||
{
|
||||
return (GimpMatrix2 *) g_memdup (matrix, sizeof (GimpMatrix2));
|
||||
}
|
||||
|
||||
static void
|
||||
matrix2_free (GimpMatrix2 *matrix)
|
||||
{
|
||||
g_free (matrix);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
unit_to_string (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
GimpUnit unit = (GimpUnit) g_value_get_int (src_value);
|
||||
|
||||
g_value_set_string (dest_value, gimp_unit_get_identifier (unit));
|
||||
}
|
||||
|
||||
static void
|
||||
string_to_unit (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
const gchar *str;
|
||||
gint num_units;
|
||||
gint i;
|
||||
|
||||
str = g_value_get_string (src_value);
|
||||
|
||||
if (!str || !*str)
|
||||
goto error;
|
||||
|
||||
num_units = gimp_unit_get_number_of_units ();
|
||||
|
||||
for (i = GIMP_UNIT_PIXEL; i < num_units; i++)
|
||||
if (strcmp (str, gimp_unit_get_identifier (i)) == 0)
|
||||
break;
|
||||
|
||||
if (i == num_units)
|
||||
{
|
||||
if (strcmp (str, gimp_unit_get_identifier (GIMP_UNIT_PERCENT)) == 0)
|
||||
i = GIMP_UNIT_PERCENT;
|
||||
else
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_value_set_int (dest_value, i);
|
||||
return;
|
||||
|
||||
error:
|
||||
g_warning ("Can't convert string to GimpUnit.");
|
||||
}
|
||||
|
@ -29,24 +29,10 @@
|
||||
GType gimp_matrix2_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#define GIMP_TYPE_MEMSIZE (gimp_memsize_get_type ())
|
||||
#define GIMP_VALUE_HOLDS_MEMSIZE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MEMSIZE))
|
||||
|
||||
GType gimp_memsize_get_type (void) G_GNUC_CONST;
|
||||
gboolean gimp_memsize_set_from_string (GValue *value,
|
||||
const gchar *string);
|
||||
|
||||
|
||||
#define GIMP_TYPE_PATH (gimp_path_get_type ())
|
||||
#define GIMP_VALUE_HOLDS_PATH(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_PATH))
|
||||
|
||||
GType gimp_path_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#define GIMP_TYPE_UNIT (gimp_unit_get_type ())
|
||||
#define GIMP_VALUE_HOLDS_UNIT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_UNIT))
|
||||
|
||||
GType gimp_unit_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_CONFIG_TYPES_H__ */
|
||||
|
@ -33,7 +33,6 @@
|
||||
|
||||
#include "gimpconfig.h"
|
||||
#include "gimpconfig-params.h"
|
||||
#include "gimpconfig-types.h"
|
||||
#include "gimpconfig-utils.h"
|
||||
|
||||
#include "gimprc-blurbs.h"
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "config/gimpconfig.h"
|
||||
#include "config/gimpconfig-params.h"
|
||||
#include "config/gimpconfig-serialize.h"
|
||||
#include "config/gimpconfig-types.h"
|
||||
#include "config/gimpconfigwriter.h"
|
||||
#include "config/gimpcoreconfig.h"
|
||||
#include "config/gimpscanner.h"
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "config/gimpconfig.h"
|
||||
#include "config/gimpconfig-types.h"
|
||||
#include "config/gimpconfig-utils.h"
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "gui-types.h"
|
||||
|
||||
#include "config/gimpconfig.h"
|
||||
#include "config/gimpconfig-types.h"
|
||||
#include "config/gimpconfig-utils.h"
|
||||
#include "config/gimpcoreconfig.h"
|
||||
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "config/gimpconfig-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpimage-pick-color.h"
|
||||
#include "core/gimpitem.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "config/gimpconfig-params.h"
|
||||
#include "config/gimpconfig-types.h"
|
||||
|
||||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimpviewable.h"
|
||||
|
@ -28,8 +28,6 @@
|
||||
|
||||
#include "widgets-types.h"
|
||||
|
||||
#include "config/gimpconfig-types.h"
|
||||
|
||||
#include "gimpunitstore.h"
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
2004-07-27 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpbase/libgimpbase-docs.sgml
|
||||
* libgimpbase/libgimpbase-sections.txt
|
||||
* libgimpbase/tmpl/gimpmemsize.sgml
|
||||
* libgimpbase/tmpl/gimpunit.sgml
|
||||
* libgimpbase/tmpl/gimputils.sgml: added docs for new unit and
|
||||
memsize functions.
|
||||
|
||||
2004-07-27 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimp/tmpl/gimppalettemenu.sgml
|
||||
|
@ -9,13 +9,11 @@ gimppalettemenu
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_palette_select_widget_new ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -9,13 +9,11 @@ gimppaletteselect
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GimpRunPaletteCallback ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
<xi:include href="xml/gimplimits.xml" />
|
||||
<xi:include href="xml/gimpdatafiles.xml" />
|
||||
<xi:include href="xml/gimpenv.xml" />
|
||||
<xi:include href="xml/gimpmemsize.xml" />
|
||||
<xi:include href="xml/gimpparasite.xml" />
|
||||
<xi:include href="xml/gimpparasiteio.xml" />
|
||||
<xi:include href="xml/gimpsignal.xml" />
|
||||
|
@ -36,6 +36,17 @@ GIMP_CHECK_DARK
|
||||
GIMP_CHECK_LIGHT
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gimpmemsize</FILE>
|
||||
gimp_memsize_serialize
|
||||
gimp_memsize_deserialize
|
||||
gimp_memsize_to_string
|
||||
GIMP_VALUE_HOLDS_MEMSIZE
|
||||
<SUBSECTION Standard>
|
||||
GIMP_TYPE_MEMSIZE
|
||||
gimp_memsize_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gimpparasite</FILE>
|
||||
GimpParasite
|
||||
@ -119,6 +130,10 @@ gimp_unit_get_symbol
|
||||
gimp_unit_get_abbreviation
|
||||
gimp_unit_get_singular
|
||||
gimp_unit_get_plural
|
||||
GIMP_VALUE_HOLDS_UNIT
|
||||
<SUBSECTION Standard>
|
||||
GIMP_TYPE_UNIT
|
||||
gimp_unit_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@ -126,7 +141,6 @@ gimp_unit_get_plural
|
||||
gimp_any_to_utf8
|
||||
gimp_filename_to_utf8
|
||||
gimp_utf8_strtrim
|
||||
gimp_memsize_to_string
|
||||
gimp_escape_uline
|
||||
gimp_strip_uline
|
||||
</SECTION>
|
||||
|
52
devel-docs/libgimpbase/tmpl/gimpmemsize.sgml
Normal file
52
devel-docs/libgimpbase/tmpl/gimpmemsize.sgml
Normal file
@ -0,0 +1,52 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
gimpmemsize
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gimp_memsize_serialize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@memsize:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_memsize_deserialize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@string:
|
||||
@memsize:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_memsize_to_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@memsize:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO GIMP_VALUE_HOLDS_MEMSIZE ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
@ -145,3 +145,11 @@ user-defined units.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO GIMP_VALUE_HOLDS_UNIT ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
|
@ -45,15 +45,6 @@ Utilities of general interest
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_memsize_to_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@memsize:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gimp_escape_uline ##### -->
|
||||
<para>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpbase/gimpprotocol.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbasetypes.h"
|
||||
|
||||
|
@ -77,6 +77,8 @@ libgimpbase_2_0_la_SOURCES = \
|
||||
gimpdatafiles.h \
|
||||
gimpenv.c \
|
||||
gimpenv.h \
|
||||
gimpmemsize.c \
|
||||
gimpmemsize.h \
|
||||
gimpparasite.c \
|
||||
gimpparasite.h \
|
||||
gimpparasiteio.c \
|
||||
@ -101,6 +103,7 @@ libgimpbaseinclude_HEADERS = \
|
||||
\
|
||||
gimpdatafiles.h \
|
||||
gimpenv.h \
|
||||
gimpmemsize.h \
|
||||
gimpparasite.h \
|
||||
gimpparasiteio.h \
|
||||
gimpsignal.h \
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
@ -10,6 +10,9 @@ EXPORTS
|
||||
gimp_filename_to_utf8
|
||||
gimp_gtkrc
|
||||
gimp_locale_directory
|
||||
gimp_memsize_deserialize
|
||||
gimp_memsize_get_type
|
||||
gimp_memsize_serialize
|
||||
gimp_memsize_to_string
|
||||
gimp_parasite_compare
|
||||
gimp_parasite_copy
|
||||
@ -45,6 +48,7 @@ EXPORTS
|
||||
gimp_unit_get_plural
|
||||
gimp_unit_get_singular
|
||||
gimp_unit_get_symbol
|
||||
gimp_unit_get_type
|
||||
gimp_unit_new
|
||||
gimp_unit_set_deletion_flag
|
||||
gimp_utf8_strtrim
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <libgimpbase/gimpdatafiles.h>
|
||||
#include <libgimpbase/gimpenv.h>
|
||||
#include <libgimpbase/gimplimits.h>
|
||||
#include <libgimpbase/gimpmemsize.h>
|
||||
#include <libgimpbase/gimpparasite.h>
|
||||
#include <libgimpbase/gimpunit.h>
|
||||
#include <libgimpbase/gimputils.h>
|
||||
|
247
libgimpbase/gimpmemsize.c
Normal file
247
libgimpbase/gimpmemsize.c
Normal file
@ -0,0 +1,247 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "gimpmemsize.h"
|
||||
|
||||
#include "libgimp/libgimp-intl.h"
|
||||
|
||||
|
||||
static void memsize_to_string (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
static void string_to_memsize (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
|
||||
|
||||
GType
|
||||
gimp_memsize_get_type (void)
|
||||
{
|
||||
static GType memsize_type = 0;
|
||||
|
||||
if (!memsize_type)
|
||||
{
|
||||
static const GTypeInfo type_info = { 0, };
|
||||
|
||||
memsize_type = g_type_register_static (G_TYPE_UINT64, "GimpMemsize",
|
||||
&type_info, 0);
|
||||
|
||||
g_value_register_transform_func (memsize_type, G_TYPE_STRING,
|
||||
memsize_to_string);
|
||||
g_value_register_transform_func (G_TYPE_STRING, memsize_type,
|
||||
string_to_memsize);
|
||||
}
|
||||
|
||||
return memsize_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_memsize_serialize:
|
||||
* @memsize: memory size in bytes
|
||||
*
|
||||
* Creates a string representation of a given memory size. This string
|
||||
* can be parsed by gimp_memsize_deserialize() and can thus be used in
|
||||
* config files. It should not be displayed to the user. If you need a
|
||||
* nice human-readable string please use gimp_memsize_to_string().
|
||||
*
|
||||
* Return value: A newly allocated string representation of @memsize.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
**/
|
||||
gchar *
|
||||
gimp_memsize_serialize (guint64 memsize)
|
||||
{
|
||||
if (memsize > (1 << 30) && memsize % (1 << 30) == 0)
|
||||
return g_strdup_printf ("%" G_GUINT64_FORMAT "G", memsize >> 30);
|
||||
else if (memsize > (1 << 20) && memsize % (1 << 20) == 0)
|
||||
return g_strdup_printf ("%" G_GUINT64_FORMAT "M", memsize >> 20);
|
||||
else if (memsize > (1 << 10) && memsize % (1 << 10) == 0)
|
||||
return g_strdup_printf ("%" G_GUINT64_FORMAT "k", memsize >> 10);
|
||||
else
|
||||
return g_strdup_printf ("%" G_GUINT64_FORMAT, memsize);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_memsize_deserialize:
|
||||
* @string: a string as returned by gimp_memsize_serialize()
|
||||
* @memsize: return location for memory size in bytes
|
||||
*
|
||||
* Parses a string representation of a memory size as returned by
|
||||
* gimp_memsize_serialize().
|
||||
*
|
||||
* Return value: %TRUE if the @string was successfully parsed and
|
||||
* @memsize has been set, %FALSE otherwise.
|
||||
*
|
||||
* Since: GIMP 2.2
|
||||
**/
|
||||
gboolean
|
||||
gimp_memsize_deserialize (const gchar *string,
|
||||
guint64 *memsize)
|
||||
{
|
||||
gchar *end;
|
||||
guint64 size;
|
||||
|
||||
g_return_val_if_fail (string != NULL, FALSE);
|
||||
g_return_val_if_fail (memsize != NULL, FALSE);
|
||||
|
||||
size = g_ascii_strtoull (string, &end, 0);
|
||||
|
||||
if (size == G_MAXUINT64 && errno == ERANGE)
|
||||
return FALSE;
|
||||
|
||||
if (end && *end)
|
||||
{
|
||||
guint shift;
|
||||
|
||||
switch (g_ascii_tolower (*end))
|
||||
{
|
||||
case 'b':
|
||||
shift = 0;
|
||||
break;
|
||||
case 'k':
|
||||
shift = 10;
|
||||
break;
|
||||
case 'm':
|
||||
shift = 20;
|
||||
break;
|
||||
case 'g':
|
||||
shift = 30;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* protect against overflow */
|
||||
if (shift)
|
||||
{
|
||||
guint64 limit = G_MAXUINT64 >> shift;
|
||||
|
||||
if (size != (size & limit))
|
||||
return FALSE;
|
||||
|
||||
size <<= shift;
|
||||
}
|
||||
}
|
||||
|
||||
*memsize = size;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_memsize_to_string:
|
||||
* @memsize: A memory size in bytes.
|
||||
*
|
||||
* This function returns a human readable, translated representation
|
||||
* of the passed @memsize. Large values are displayed using a
|
||||
* reasonable memsize unit, e.g.: "345" becomes "345 Bytes", "4500"
|
||||
* becomes "4.4 KB" and so on.
|
||||
*
|
||||
* Return value: A newly allocated human-readable, translated string.
|
||||
**/
|
||||
gchar *
|
||||
gimp_memsize_to_string (guint64 memsize)
|
||||
{
|
||||
#if defined _MSC_VER && (_MSC_VER < 1300)
|
||||
/* sorry, error C2520: conversion from unsigned __int64 to double not
|
||||
* implemented, use signed __int64
|
||||
*/
|
||||
# define CAST_DOUBLE (gdouble)(gint64)
|
||||
#else
|
||||
# define CAST_DOUBLE (gdouble)
|
||||
#endif
|
||||
|
||||
if (memsize < 1024)
|
||||
{
|
||||
return g_strdup_printf (_("%d Bytes"), (gint) memsize);
|
||||
}
|
||||
|
||||
if (memsize < 1024 * 10)
|
||||
{
|
||||
return g_strdup_printf (_("%.2f KB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 100)
|
||||
{
|
||||
return g_strdup_printf (_("%.1f KB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 1024)
|
||||
{
|
||||
return g_strdup_printf (_("%d KB"), (gint) memsize / 1024);
|
||||
}
|
||||
|
||||
memsize /= 1024;
|
||||
|
||||
if (memsize < 1024 * 10)
|
||||
{
|
||||
return g_strdup_printf (_("%.2f MB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 100)
|
||||
{
|
||||
return g_strdup_printf (_("%.1f MB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 1024)
|
||||
{
|
||||
return g_strdup_printf (_("%d MB"), (gint) memsize / 1024);
|
||||
}
|
||||
|
||||
memsize /= 1024;
|
||||
|
||||
if (memsize < 1024 * 10)
|
||||
{
|
||||
return g_strdup_printf (_("%.2f GB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 100)
|
||||
{
|
||||
return g_strdup_printf (_("%.1f GB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_strdup_printf (_("%d GB"), (gint) memsize / 1024);
|
||||
}
|
||||
#undef CAST_DOUBLE
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
memsize_to_string (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
g_value_take_string (dest_value,
|
||||
gimp_memsize_serialize (g_value_get_uint64 (src_value)));
|
||||
}
|
||||
|
||||
static void
|
||||
string_to_memsize (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
const gchar *str;
|
||||
guint64 memsize;
|
||||
|
||||
str = g_value_get_string (src_value);
|
||||
|
||||
if (! str || ! gimp_memsize_deserialize (str, &memsize))
|
||||
g_warning ("Can't convert string to GimpMemsize.");
|
||||
|
||||
g_value_set_uint64 (dest_value, memsize);
|
||||
}
|
36
libgimpbase/gimpmemsize.h
Normal file
36
libgimpbase/gimpmemsize.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_MEMSIZE_H__
|
||||
#define __GIMP_MEMSIZE_H__
|
||||
|
||||
|
||||
#define GIMP_TYPE_MEMSIZE (gimp_memsize_get_type ())
|
||||
#define GIMP_VALUE_HOLDS_MEMSIZE(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_MEMSIZE))
|
||||
|
||||
GType gimp_memsize_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gchar * gimp_memsize_serialize (guint64 memsize);
|
||||
gboolean gimp_memsize_deserialize (const gchar *string,
|
||||
guint64 *memsize);
|
||||
|
||||
gchar * gimp_memsize_to_string (guint64 memsize);
|
||||
|
||||
|
||||
#endif /* __GIMP_MEMSIZE_H__ */
|
@ -22,7 +22,9 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "gimpbasetypes.h"
|
||||
|
||||
@ -30,6 +32,76 @@
|
||||
#include "gimpunit.h"
|
||||
|
||||
|
||||
static void unit_to_string (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
static void string_to_unit (const GValue *src_value,
|
||||
GValue *dest_value);
|
||||
|
||||
GType
|
||||
gimp_unit_get_type (void)
|
||||
{
|
||||
static GType unit_type = 0;
|
||||
|
||||
if (!unit_type)
|
||||
{
|
||||
static const GTypeInfo type_info = { 0, };
|
||||
|
||||
unit_type = g_type_register_static (G_TYPE_INT, "GimpUnit",
|
||||
&type_info, 0);
|
||||
|
||||
g_value_register_transform_func (unit_type, G_TYPE_STRING,
|
||||
unit_to_string);
|
||||
g_value_register_transform_func (G_TYPE_STRING, unit_type,
|
||||
string_to_unit);
|
||||
}
|
||||
|
||||
return unit_type;
|
||||
}
|
||||
|
||||
static void
|
||||
unit_to_string (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
GimpUnit unit = (GimpUnit) g_value_get_int (src_value);
|
||||
|
||||
g_value_set_string (dest_value, gimp_unit_get_identifier (unit));
|
||||
}
|
||||
|
||||
static void
|
||||
string_to_unit (const GValue *src_value,
|
||||
GValue *dest_value)
|
||||
{
|
||||
const gchar *str;
|
||||
gint num_units;
|
||||
gint i;
|
||||
|
||||
str = g_value_get_string (src_value);
|
||||
|
||||
if (!str || !*str)
|
||||
goto error;
|
||||
|
||||
num_units = gimp_unit_get_number_of_units ();
|
||||
|
||||
for (i = GIMP_UNIT_PIXEL; i < num_units; i++)
|
||||
if (strcmp (str, gimp_unit_get_identifier (i)) == 0)
|
||||
break;
|
||||
|
||||
if (i == num_units)
|
||||
{
|
||||
if (strcmp (str, gimp_unit_get_identifier (GIMP_UNIT_PERCENT)) == 0)
|
||||
i = GIMP_UNIT_PERCENT;
|
||||
else
|
||||
goto error;
|
||||
}
|
||||
|
||||
g_value_set_int (dest_value, i);
|
||||
return;
|
||||
|
||||
error:
|
||||
g_warning ("Can't convert string to GimpUnit.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_unit_get_number_of_units:
|
||||
*
|
||||
|
@ -27,6 +27,11 @@ G_BEGIN_DECLS
|
||||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
#define GIMP_TYPE_UNIT (gimp_unit_get_type ())
|
||||
#define GIMP_VALUE_HOLDS_UNIT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_UNIT))
|
||||
|
||||
GType gimp_unit_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
gint gimp_unit_get_number_of_units (void);
|
||||
gint gimp_unit_get_number_of_built_in_units (void) G_GNUC_CONST;
|
||||
|
@ -216,78 +216,6 @@ gimp_filename_to_utf8 (const gchar *filename)
|
||||
return filename_utf8;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_memsize_to_string:
|
||||
* @memsize: A memory size in bytes.
|
||||
*
|
||||
* This function returns a human readable, translated representation
|
||||
* of the passed @memsize. Large values are displayed using a
|
||||
* reasonable memsize unit, e.g.: "345" becomes "345 Bytes", "4500"
|
||||
* becomes "4.4 KB" and so on.
|
||||
*
|
||||
* Return value: A newly allocated human-readable, translated string.
|
||||
**/
|
||||
gchar *
|
||||
gimp_memsize_to_string (guint64 memsize)
|
||||
{
|
||||
#if defined _MSC_VER && (_MSC_VER < 1300)
|
||||
/* sorry, error C2520: conversion from unsigned __int64 to double not
|
||||
* implemented, use signed __int64
|
||||
*/
|
||||
# define CAST_DOUBLE (gdouble)(gint64)
|
||||
#else
|
||||
# define CAST_DOUBLE (gdouble)
|
||||
#endif
|
||||
|
||||
if (memsize < 1024)
|
||||
{
|
||||
return g_strdup_printf (_("%d Bytes"), (gint) memsize);
|
||||
}
|
||||
|
||||
if (memsize < 1024 * 10)
|
||||
{
|
||||
return g_strdup_printf (_("%.2f KB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 100)
|
||||
{
|
||||
return g_strdup_printf (_("%.1f KB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 1024)
|
||||
{
|
||||
return g_strdup_printf (_("%d KB"), (gint) memsize / 1024);
|
||||
}
|
||||
|
||||
memsize /= 1024;
|
||||
|
||||
if (memsize < 1024 * 10)
|
||||
{
|
||||
return g_strdup_printf (_("%.2f MB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 100)
|
||||
{
|
||||
return g_strdup_printf (_("%.1f MB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 1024)
|
||||
{
|
||||
return g_strdup_printf (_("%d MB"), (gint) memsize / 1024);
|
||||
}
|
||||
|
||||
memsize /= 1024;
|
||||
|
||||
if (memsize < 1024 * 10)
|
||||
{
|
||||
return g_strdup_printf (_("%.2f GB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else if (memsize < 1024 * 100)
|
||||
{
|
||||
return g_strdup_printf (_("%.1f GB"), CAST_DOUBLE memsize / 1024.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
return g_strdup_printf (_("%d GB"), (gint) memsize / 1024);
|
||||
}
|
||||
#undef CAST_DOUBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_strip_uline:
|
||||
|
@ -29,8 +29,6 @@ gchar * gimp_any_to_utf8 (const gchar *str,
|
||||
...) G_GNUC_PRINTF (3, 4);
|
||||
const gchar * gimp_filename_to_utf8 (const gchar *filename);
|
||||
|
||||
gchar * gimp_memsize_to_string (guint64 memsize);
|
||||
|
||||
gchar * gimp_strip_uline (const gchar *str);
|
||||
gchar * gimp_escape_uline (const gchar *str);
|
||||
|
||||
|
@ -560,8 +560,9 @@ gimp_config_deserialize_memsize (GValue *value,
|
||||
GParamSpec *prop_spec,
|
||||
GScanner *scanner)
|
||||
{
|
||||
gchar *orig_cset_first = scanner->config->cset_identifier_first;
|
||||
gchar *orig_cset_nth = scanner->config->cset_identifier_nth;
|
||||
gchar *orig_cset_first = scanner->config->cset_identifier_first;
|
||||
gchar *orig_cset_nth = scanner->config->cset_identifier_nth;
|
||||
guint64 memsize;
|
||||
|
||||
scanner->config->cset_identifier_first = G_CSET_DIGITS;
|
||||
scanner->config->cset_identifier_nth = G_CSET_DIGITS "gGmMkKbB";
|
||||
@ -574,10 +575,12 @@ gimp_config_deserialize_memsize (GValue *value,
|
||||
scanner->config->cset_identifier_first = orig_cset_first;
|
||||
scanner->config->cset_identifier_nth = orig_cset_nth;
|
||||
|
||||
if (gimp_memsize_set_from_string (value, scanner->value.v_identifier))
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
else
|
||||
if (! gimp_memsize_deserialize (scanner->value.v_identifier, &memsize))
|
||||
return G_TOKEN_NONE;
|
||||
|
||||
g_value_set_uint64 (value, memsize);
|
||||
|
||||
return G_TOKEN_RIGHT_PAREN;
|
||||
}
|
||||
|
||||
static GTokenType
|
||||
|
@ -519,18 +519,18 @@ unit_editor_dialog (void)
|
||||
gimp_ui_init ("uniteditor", FALSE);
|
||||
|
||||
list_store = gtk_list_store_new (NUM_COLUMNS,
|
||||
G_TYPE_BOOLEAN,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_INT,
|
||||
G_TYPE_BOOLEAN,
|
||||
GDK_TYPE_COLOR,
|
||||
GDK_TYPE_COLOR);
|
||||
G_TYPE_BOOLEAN, /* SAVE */
|
||||
G_TYPE_STRING, /* IDENTIFIER */
|
||||
G_TYPE_DOUBLE, /* FACTOR */
|
||||
G_TYPE_INT, /* DIGITS */
|
||||
G_TYPE_STRING, /* SYMBOL */
|
||||
G_TYPE_STRING, /* ABBREVIATION */
|
||||
G_TYPE_STRING, /* SINGULAR */
|
||||
G_TYPE_STRING, /* PLURAL */
|
||||
GIMP_TYPE_UNIT, /* UNIT */
|
||||
G_TYPE_BOOLEAN, /* USER_UNIT */
|
||||
GDK_TYPE_COLOR); /* BG_COLOR */
|
||||
|
||||
tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
|
||||
g_object_unref (list_store);
|
||||
|
||||
@ -607,11 +607,12 @@ unit_editor_dialog (void)
|
||||
if (i == SAVE)
|
||||
continue;
|
||||
|
||||
col = gtk_tree_view_column_new_with_attributes (gettext (columns[i].title),
|
||||
gtk_cell_renderer_text_new (),
|
||||
"text", i,
|
||||
"cell-background-gdk", BG_COLOR,
|
||||
NULL);
|
||||
col =
|
||||
gtk_tree_view_column_new_with_attributes (gettext (columns[i].title),
|
||||
gtk_cell_renderer_text_new (),
|
||||
"text", i,
|
||||
"cell-background-gdk", BG_COLOR,
|
||||
NULL);
|
||||
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
||||
|
Reference in New Issue
Block a user