From ba74e70ec12a97148fd2b86df6f3f89f2e19051a Mon Sep 17 00:00:00 2001 From: TingPing Date: Tue, 1 Oct 2013 07:42:17 -0400 Subject: libsexy: load colors more efficiently --- src/fe-gtk/sexy-spell-entry.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'src/fe-gtk') diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c index 2f87dd91..ab509077 100644 --- a/src/fe-gtk/sexy-spell-entry.c +++ b/src/fe-gtk/sexy-spell-entry.c @@ -42,6 +42,7 @@ #include "../common/cfgfiles.h" #include "../common/hexchatc.h" +#include "palette.h" #include "xtext.h" /* @@ -297,41 +298,10 @@ insert_hiddenchar (SexySpellEntry *entry, guint start, guint end) static void insert_underline_error (SexySpellEntry *entry, guint start, guint end) { - int fh, l; - int red, green, blue; - struct stat st; - char *cfg; PangoAttribute *ucolor; PangoAttribute *unline; - fh = hexchat_open_file ("colors.conf", O_RDONLY, 0, 0); - - if (fh != -1) - { - fstat (fh, &st); - cfg = malloc (st.st_size + 1); - - if (cfg) - { - cfg[0] = '\0'; - l = read (fh, cfg, st.st_size); - if (l >= 0) - { - cfg[l] = '\0'; - } - - cfg_get_color (cfg, "color_265", &red, &green, &blue); - free (cfg); - } - - close (fh); - } else - { - red = 65535; - green = blue = 0; - } - - ucolor = pango_attr_underline_color_new (red, green, blue); + ucolor = pango_attr_underline_color_new (colors[COL_SPELL].red, colors[COL_SPELL].green, colors[COL_SPELL].blue); unline = pango_attr_underline_new (PANGO_UNDERLINE_ERROR); ucolor->start_index = start; -- cgit 1.4.1