+void summary_set_label_color(GtkCTree *ctree, GtkCTreeNode *node,
+ guint labelcolor)
+{
+ GdkColor color;
+ GtkStyle *style, *prev_style, *ctree_style;
+ MsgInfo *msginfo;
+
+ ctree_style = gtk_widget_get_style(GTK_WIDGET(ctree));
+
+ prev_style = gtk_ctree_node_get_row_style(ctree, node);
+
+ if (!prev_style)
+ prev_style = ctree_style;
+
+ style = gtk_style_copy(prev_style);
+
+ switch (labelcolor) {
+ case MSG_LABEL_ORANGE:
+ color.red = 0xffff;
+ color.green = (0x99<<8);
+ color.blue = 0x0;
+ break;
+ case MSG_LABEL_RED:
+ color.red = 0xffff;
+ color.green = color.blue = 0x0;
+ break;
+ case MSG_LABEL_PINK:
+ color.red = 0xffff;
+ color.green = (0x66<<8);
+ color.blue = 0xffff;
+ break;
+ case MSG_LABEL_SKYBLUE:
+ color.red = 0x0;
+ color.green = (0xcc<<8);
+ color.blue = 0xffff;
+ break;
+ case MSG_LABEL_BLUE:
+ color.red = 0x0;
+ color.green = 0x0;
+ color.blue = 0xffff;
+ break;
+ case MSG_LABEL_GREEN:
+ color.red = 0x0;
+ color.green = (0x99<<8);
+ color.blue = 0x0;
+ break;
+ case MSG_LABEL_BROWN:
+ color.red = (0x66<<8);
+ color.green = (0x33<<8);
+ color.blue = (0x33<<8);
+ break;
+ case MSG_LABEL_NONE:
+ default:
+ labelcolor = MSG_LABEL_NONE;
+ color.red = ctree_style->fg[GTK_STATE_NORMAL].red;
+ color.green = ctree_style->fg[GTK_STATE_NORMAL].green;
+ color.blue = ctree_style->fg[GTK_STATE_NORMAL].blue;
+ style->fg[GTK_STATE_NORMAL] = color;
+
+ color.red = ctree_style->fg[GTK_STATE_SELECTED].red;
+ color.green = ctree_style->fg[GTK_STATE_SELECTED].green;
+ color.blue = ctree_style->fg[GTK_STATE_SELECTED].blue;
+ style->fg[GTK_STATE_SELECTED] = color;
+ gtk_ctree_node_set_row_style(ctree, node, style);
+ break;
+ }
+
+ msginfo = gtk_ctree_node_get_row_data(ctree, node);
+
+ MSG_UNSET_FLAGS(msginfo->flags, MSG_LABEL);
+ MSG_SET_FLAGS(msginfo->flags, labelcolor);
+
+ if ( style ) {
+ style->fg[GTK_STATE_NORMAL] = color;
+ style->fg[GTK_STATE_SELECTED] = color;
+ gtk_ctree_node_set_row_style(ctree, node, style);
+ }
+}
+
+void summary_set_label(SummaryView *summaryview, guint labelcolor, GtkWidget *widget)
+{
+ GtkCTree *ctree = GTK_CTREE(summaryview->ctree);
+ GtkCList *clist = GTK_CLIST(summaryview->ctree);
+ GList *cur;
+
+ for (cur = clist->selection; cur != NULL; cur = cur->next)
+ summary_set_label_color(ctree, GTK_CTREE_NODE(cur->data), labelcolor);
+}
+