Removed check for len % 3 == 0, so that the entry accepts hex colors

2004-09-18  Simon Budig  <simon@gimp.org>

	* libgimpwidgets/gimpcolorhexentry.c: Removed check for len % 3 == 0,
	so that the entry accepts hex colors starting with "#" again.
	Untabbified.
This commit is contained in:
Simon Budig 2004-09-18 19:37:01 +00:00 committed by Simon Budig
parent adf71de005
commit eaf1b6801d
2 changed files with 23 additions and 17 deletions

View File

@ -1,3 +1,9 @@
2004-09-18 Simon Budig <simon@gimp.org>
* libgimpwidgets/gimpcolorhexentry.c: Removed check for len % 3 == 0,
so that the entry accepts hex colors starting with "#" again.
Untabbified.
2004-09-18 Manish Singh <yosh@gimp.org>
* app/Makefile.am: remove LDFLAGS references to now private

View File

@ -73,14 +73,14 @@ gimp_color_hex_entry_get_type (void)
static const GTypeInfo entry_info =
{
sizeof (GimpColorHexEntryClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_hex_entry_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorHexEntry),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_hex_entry_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_color_hex_entry_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpColorHexEntry),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_color_hex_entry_init,
};
entry_type = g_type_register_static (GTK_TYPE_ENTRY,
@ -156,11 +156,11 @@ gimp_color_hex_entry_init (GimpColorHexEntry *entry)
gtk_entry_set_text (GTK_ENTRY (entry), "000000");
g_signal_connect (entry, "focus_out_event",
G_CALLBACK (gimp_color_hex_entry_events),
NULL);
G_CALLBACK (gimp_color_hex_entry_events),
NULL);
g_signal_connect (entry, "key_press_event",
G_CALLBACK (gimp_color_hex_entry_events),
NULL);
G_CALLBACK (gimp_color_hex_entry_events),
NULL);
g_signal_connect (completion, "match_selected",
G_CALLBACK (gimp_color_hex_entry_matched),
@ -264,12 +264,12 @@ gimp_color_hex_entry_events (GtkWidget *widget,
GimpRGB color;
gsize len = strlen (text);
if (len > 0&&
((len % 3 == 0 && gimp_rgb_parse_hex (&color, text, len)) ||
(gimp_rgb_parse_name (&color, text, -1))))
{
if (len > 0 &&
(gimp_rgb_parse_hex (&color, text, len) ||
gimp_rgb_parse_name (&color, text, -1)))
{
gimp_color_hex_entry_set_color (entry, &color);
}
}
else
{
gtk_entry_set_text (GTK_ENTRY (entry), buffer);