From 3cedfae4c21b3e2cdd53a74208f38c0e9885055f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 16 May 2002 20:56:36 +0000 Subject: Check for a label tag when doing a lookup on the COLOR column. 2002-05-16 Jeffrey Stedfast * message-list.c (ml_tree_value_at): Check for a label tag when doing a lookup on the COLOR column. * mail-config.c (mail_config_get_label_color_string): Return the colour in string format. * folder-browser.c (set_msg_label): Replaces colourise_msg and sets the "label" tag rather than the "colour" tag. * mail-preferences.c (mail_preferences_apply): Call mail_config_write() so that the settings get synced to disk. svn path=/trunk/; revision=16938 --- mail/mail-config.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'mail/mail-config.c') diff --git a/mail/mail-config.c b/mail/mail-config.c index ecd0b8487a..316f945d59 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -71,11 +71,11 @@ MailConfigLabel label_defaults[5] = { - { N_("Important"), 0x00ff0000 }, /* red */ - { N_("Work"), 0x00ff8c00 }, /* orange */ - { N_("Personal"), 0x00008b00 }, /* forest green */ - { N_("To Do"), 0x000000ff }, /* blue */ - { N_("Later"), 0x008b008b } /* magenta */ + { N_("Important"), 0x00ff0000, NULL }, /* red */ + { N_("Work"), 0x00ff8c00, NULL }, /* orange */ + { N_("Personal"), 0x00008b00, NULL }, /* forest green */ + { N_("To Do"), 0x000000ff, NULL }, /* blue */ + { N_("Later"), 0x008b008b, NULL } /* magenta */ }; typedef struct { @@ -375,6 +375,8 @@ mail_config_clear (void) for (i = 0; i < 5; i++) { g_free (config->labels[i].name); config->labels[i].name = NULL; + g_free (config->labels[i].string); + config->labels[i].string = NULL; } } @@ -2205,9 +2207,31 @@ mail_config_set_label_color (int label, guint32 color) { g_return_if_fail (label >= 0 && label < 5); + g_free (config->labels[label].string); + config->labels[label].string = NULL; + config->labels[label].color = color; } +const char * +mail_config_get_label_color_string (int label) +{ + g_return_val_if_fail (label >= 0 && label < 5, NULL); + + if (!config->labels[label].string) { + guint32 rgb = config->labels[label].color; + char *colour; + + colour = g_strdup_printf ("#%.2x%.2x%.2x", + (rgb & 0xff0000) >> 16, + (rgb & 0xff00) >> 8, + rgb & 0xff); + + config->labels[label].string = colour; + } + + return config->labels[label].string; +} gboolean mail_config_find_account (const MailConfigAccount *account) -- cgit v1.2.3