aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-02-12 07:00:13 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-02-12 07:00:13 +0800
commit2d4d49a088d9666ea76cdaafc2cd7a6d57623020 (patch)
tree89ecde9b01a65c6d7ce670e9e0e37f201f08f78b /mail
parentb5fe626e9d8c633ab9b2810df7081eb947dac292 (diff)
downloadgsoc2013-evolution-2d4d49a088d9666ea76cdaafc2cd7a6d57623020.tar.gz
gsoc2013-evolution-2d4d49a088d9666ea76cdaafc2cd7a6d57623020.tar.zst
gsoc2013-evolution-2d4d49a088d9666ea76cdaafc2cd7a6d57623020.zip
Get followup-up message-list values. Also highlight the message in red if
2002-02-11 Jeffrey Stedfast <fejj@ximian.com> * message-list.c (ml_tree_value_at): Get followup-up message-list values. Also highlight the message in red if the due-by date is past due (this is what Outlook does). (ml_duplicate_value): Handle follow-up columns. (ml_free_value): Same. (ml_initialize_value): Here too. (ml_value_is_empty): And here. (ml_value_to_string): And finally here. * message-tag-followup.c (message_tag_followup_i18n_name): New convenience function. svn path=/trunk/; revision=15680
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/message-list.c219
-rw-r--r--mail/message-list.etspec17
-rw-r--r--mail/message-list.h7
-rw-r--r--mail/message-tag-followup.c45
-rw-r--r--mail/message-tag-followup.h24
6 files changed, 219 insertions, 107 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 96ea089f8d..4fde40e165 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2002-02-11 Jeffrey Stedfast <fejj@ximian.com>
+
+ * message-list.c (ml_tree_value_at): Get followup-up message-list
+ values. Also highlight the message in red if the due-by date is
+ past due (this is what Outlook does).
+ (ml_duplicate_value): Handle follow-up columns.
+ (ml_free_value): Same.
+ (ml_initialize_value): Here too.
+ (ml_value_is_empty): And here.
+ (ml_value_to_string): And finally here.
+
+ * message-tag-followup.c (message_tag_followup_i18n_name): New
+ convenience function.
+
2002-02-11 Radek Doulik <rodo@ximian.com>
* mail-callbacks.c (create_msg_composer): unset changed, drop
diff --git a/mail/message-list.c b/mail/message-list.c
index 152d144067..e3c6f3f726 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -44,6 +44,8 @@
#include "mail-ops.h"
#include "Mail.h"
+#include "message-tag-followup.h"
+
#include "art/mail-new.xpm"
#include "art/mail-read.xpm"
#include "art/mail-replied.xpm"
@@ -150,6 +152,7 @@ static struct {
{ score_high_xpm, NULL },
{ score_higher_xpm, NULL },
{ score_highest_xpm, NULL },
+ { priority_high_xpm, NULL }, /* FIXME: replace with a flag icon */
{ NULL, NULL }
};
@@ -530,13 +533,16 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
+ case COL_FOLLOWUP_FLAG_STATUS:
+ case COL_FOLLOWUP_DUE_BY:
return (void *) value;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
+ case COL_FOLLOWUP_FLAG:
return g_strdup (value);
-
+
default:
g_assert_not_reached ();
}
@@ -556,11 +562,14 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
+ case COL_FOLLOWUP_FLAG_STATUS:
+ case COL_FOLLOWUP_DUE_BY:
break;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
+ case COL_FOLLOWUP_FLAG:
g_free (value);
break;
default:
@@ -581,12 +590,15 @@ ml_initialize_value (ETreeModel *etm, int col, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
+ case COL_FOLLOWUP_FLAG_STATUS:
+ case COL_FOLLOWUP_DUE_BY:
return NULL;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- return g_strdup("");
+ case COL_FOLLOWUP_FLAG:
+ return g_strdup ("");
default:
g_assert_not_reached ();
}
@@ -607,11 +619,14 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
+ case COL_FOLLOWUP_FLAG_STATUS:
+ case COL_FOLLOWUP_DUE_BY:
return value == NULL;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
+ case COL_FOLLOWUP_FLAG:
return !(value && *(char *)value);
default:
g_assert_not_reached ();
@@ -637,40 +652,44 @@ static const char *score_map[] = {
N_("Highest"),
};
+
static char *
ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data)
{
unsigned int i;
-
+
switch (col){
case COL_MESSAGE_STATUS:
i = (unsigned int)value;
if (i > 4)
- return g_strdup("");
- return g_strdup(_(status_map[i]));
-
+ return g_strdup ("");
+ return g_strdup (_(status_map[i]));
+
case COL_SCORE:
- i = (unsigned int)value + 3;
+ i = (unsigned int) value + 3;
if (i > 6)
i = 3;
- return g_strdup(_(score_map[i]));
+ return g_strdup (_(score_map[i]));
case COL_ATTACHMENT:
case COL_FLAGGED:
case COL_DELETED:
case COL_UNREAD:
- return g_strdup_printf("%d", (int) value);
+ case COL_FOLLOWUP_FLAG_STATUS:
+ return g_strdup_printf ("%d", (int) value);
case COL_SENT:
case COL_RECEIVED:
- return filter_date (GPOINTER_TO_INT(value));
+ case COL_FOLLOWUP_DUE_BY:
+ return filter_date (GPOINTER_TO_INT (value));
case COL_SIZE:
- return filter_size (GPOINTER_TO_INT(value));
-
+ return filter_size (GPOINTER_TO_INT (value));
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
+ case COL_FOLLOWUP_FLAG:
return g_strdup (value);
default:
g_assert_not_reached ();
@@ -691,14 +710,14 @@ subtree_unread(MessageList *ml, ETreePath node)
{
CamelMessageInfo *info;
ETreePath child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
if (!(info->flags & CAMEL_MESSAGE_SEEN))
return TRUE;
-
+
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
if (subtree_unread(ml, child))
return TRUE;
@@ -713,15 +732,15 @@ subtree_size(MessageList *ml, ETreePath node)
CamelMessageInfo *info;
int size = 0;
ETreePath child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
size += info->size;
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
size += subtree_size(ml, child);
-
+
node = e_tree_model_node_get_next (ml->model, node);
}
return size;
@@ -733,28 +752,28 @@ subtree_earliest(MessageList *ml, ETreePath node, int sent)
CamelMessageInfo *info;
time_t earliest = 0, date;
ETreePath *child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
if (sent)
date = info->date_sent;
else
date = info->date_received;
-
+
if (earliest == 0 || date < earliest)
earliest = date;
-
+
if ((child = e_tree_model_node_get_first_child (ml->model, node))) {
date = subtree_earliest(ml, child, sent);
if (earliest == 0 || (date != 0 && date < earliest))
earliest = date;
}
-
+
node = e_tree_model_node_get_next (ml->model, node);
}
-
+
return earliest;
}
@@ -763,15 +782,15 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
{
MessageList *message_list = model_data;
CamelMessageInfo *msg_info;
-
+
/* retrieve the message information array */
msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path);
g_assert(msg_info);
-
+
switch (col){
case COL_MESSAGE_STATUS: {
ETreePath child;
-
+
/* if a tree is collapsed, then scan its insides for details */
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)) {
@@ -780,7 +799,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
else
return (void *)4;
}
-
+
if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
return GINT_TO_POINTER (2);
else if (msg_info->flags & CAMEL_MESSAGE_SEEN)
@@ -801,6 +820,46 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER (score);
}
+ case COL_FOLLOWUP_FLAG_STATUS: {
+ const char *tag;
+
+ tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
+ if (tag)
+ return GINT_TO_POINTER (TRUE);
+ else
+ return GINT_TO_POINTER (FALSE);
+ }
+ case COL_FOLLOWUP_DUE_BY: {
+ struct _FollowUpTag *tag;
+ const char *tag_value;
+ time_t due_by;
+
+ tag_value = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
+ if (tag_value) {
+ tag = message_tag_followup_decode (tag_value);
+ due_by = tag->target_date;
+ g_free (tag);
+ return GINT_TO_POINTER (due_by);
+ } else {
+ return GINT_TO_POINTER (0);
+ }
+ }
+ case COL_FOLLOWUP_FLAG: {
+ struct _FollowUpTag *tag;
+ const char *tag_value;
+ int flag_type;
+
+ tag_value = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
+ if (tag_value) {
+ tag = message_tag_followup_decode (tag_value);
+ flag_type = tag ? tag->type : FOLLOWUP_FLAG_NONE;
+ g_free (tag);
+
+ return (void *) message_tag_followup_i18n_name (flag_type);
+ } else {
+ return NULL;
+ }
+ }
case COL_ATTACHMENT:
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
case COL_FROM:
@@ -819,29 +878,40 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0);
case COL_UNREAD: {
ETreePath child;
-
+
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)
&& (msg_info->flags & CAMEL_MESSAGE_SEEN)) {
return GINT_TO_POINTER (subtree_unread (message_list, child));
}
-
+
return GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN));
}
case COL_COLOUR: {
- const char *colour;
-
+ const char *colour, *followup;
+
colour = camel_tag_get ((CamelTag **) &msg_info->user_tags, "colour");
- if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED)
+ followup = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
+ if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED) {
/* FIXME: extract from the xpm somehow. */
colour = "#A7453E";
+ } else if (followup != NULL) {
+ struct _FollowUpTag *tag;
+ time_t now = time (NULL);
+
+ tag = message_tag_followup_decode (followup);
+ if (tag && now >= tag->target_date) {
+ /* FIXME: extract from the xpm somehow. */
+ colour = "#A7453E";
+ }
+ g_free (tag);
+ }
return (void *)colour;
}
+ default:
+ g_assert_not_reached ();
+ return NULL;
}
-
- g_assert_not_reached ();
-
- return NULL;
}
static void
@@ -882,10 +952,10 @@ filter_date (time_t date)
struct tm then, now, yesterday;
char buf[26];
gboolean done = FALSE;
-
+
if (date == 0)
return g_strdup (_("?"));
-
+
localtime_r (&date, &then);
localtime_r (&nowdate, &now);
if (then.tm_mday == now.tm_mday &&
@@ -943,42 +1013,45 @@ message_list_create_extras (void)
GdkPixbuf *images [7];
ETableExtras *extras;
ECell *cell;
-
- extras = e_table_extras_new();
- e_table_extras_add_pixbuf(extras, "status", states_pixmaps [0].pixbuf);
- e_table_extras_add_pixbuf(extras, "score", states_pixmaps [13].pixbuf);
- e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [6].pixbuf);
- e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [7].pixbuf);
- e_table_extras_add_compare(extras, "address_compare", address_compare);
- e_table_extras_add_compare(extras, "subject_compare", subject_compare);
+ extras = e_table_extras_new ();
+ e_table_extras_add_pixbuf (extras, "status", states_pixmaps [0].pixbuf);
+ e_table_extras_add_pixbuf (extras, "score", states_pixmaps [13].pixbuf);
+ e_table_extras_add_pixbuf (extras, "attachment", states_pixmaps [6].pixbuf);
+ e_table_extras_add_pixbuf (extras, "flagged", states_pixmaps [7].pixbuf);
+ e_table_extras_add_pixbuf (extras, "followup", states_pixmaps [15].pixbuf);
+
+ e_table_extras_add_compare (extras, "address_compare", address_compare);
+ e_table_extras_add_compare (extras, "subject_compare", subject_compare);
for (i = 0; i < 5; i++)
images [i] = states_pixmaps [i].pixbuf;
-
- e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 5, images));
-
+
+ e_table_extras_add_cell (extras, "render_message_status", e_cell_toggle_new (0, 5, images));
+
for (i = 0; i < 2; i++)
images [i] = states_pixmaps [i + 5].pixbuf;
- e_table_extras_add_cell(extras, "render_attachment", e_cell_toggle_new (0, 2, images));
+ e_table_extras_add_cell (extras, "render_attachment", e_cell_toggle_new (0, 2, images));
images [1] = states_pixmaps [7].pixbuf;
- e_table_extras_add_cell(extras, "render_flagged", e_cell_toggle_new (0, 2, images));
-
+ e_table_extras_add_cell (extras, "render_flagged", e_cell_toggle_new (0, 2, images));
+
+ images[1] = states_pixmaps [15].pixbuf;
+ e_table_extras_add_cell (extras, "render_flag_status", e_cell_toggle_new (0, 2, images));
+
for (i = 0; i < 7; i++)
images[i] = states_pixmaps [i + 7].pixbuf;
- e_table_extras_add_cell(extras, "render_score", e_cell_toggle_new (0, 7, images));
-
-
+ e_table_extras_add_cell (extras, "render_score", e_cell_toggle_new (0, 7, images));
+
/* date cell */
cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT);
gtk_object_set (GTK_OBJECT (cell),
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell(extras, "render_date", cell);
+ e_table_extras_add_cell (extras, "render_date", cell);
/* text cell */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
@@ -986,20 +1059,20 @@ message_list_create_extras (void)
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell(extras, "render_text", cell);
+ e_table_extras_add_cell (extras, "render_text", cell);
+
+ e_table_extras_add_cell (extras, "render_tree",
+ e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */
+ TRUE, cell));
- e_table_extras_add_cell(extras, "render_tree",
- e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */
- TRUE, cell));
-
/* size cell */
cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT);
gtk_object_set (GTK_OBJECT (cell),
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell(extras, "render_size", cell);
-
+ e_table_extras_add_cell (extras, "render_size", cell);
+
return extras;
}
@@ -1970,9 +2043,9 @@ on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_dat
static gint
on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list)
{
- int flag;
CamelMessageInfo *info;
-
+ int flag;
+
if (col == COL_MESSAGE_STATUS)
flag = CAMEL_MESSAGE_SEEN;
else if (col == COL_FLAGGED)
@@ -1988,14 +2061,12 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess
/* If a message was marked as deleted and the user flags it as
important, marks it as needing a reply, marks it as unread,
then undelete the message. */
- if (info->flags & CAMEL_MESSAGE_DELETED) {
-
+ if (info->flags & CAMEL_MESSAGE_DELETED) {
if (col == COL_FLAGGED && !(info->flags & CAMEL_MESSAGE_FLAGGED))
flag |= CAMEL_MESSAGE_DELETED;
-
+
if (col == COL_MESSAGE_STATUS && (info->flags & CAMEL_MESSAGE_SEEN))
flag |= CAMEL_MESSAGE_DELETED;
-
}
camel_folder_set_message_flags (list->folder, camel_message_info_uid (info), flag, ~info->flags);
diff --git a/mail/message-list.etspec b/mail/message-list.etspec
index d75a261173..4f91cbb98d 100644
--- a/mail/message-list.etspec
+++ b/mail/message-list.etspec
@@ -2,17 +2,32 @@
<ETableColumn model_col= "0" _title="Status" pixbuf="status" expansion="0.0" minimum_width="18" resizable="false" cell="render_message_status" compare="integer" sortable="false"/>
<ETableColumn model_col= "1" _title="Flagged" pixbuf="flagged" expansion="0.0" minimum_width="18" resizable="false" cell="render_flagged" compare="integer"/>
+
<ETableColumn model_col= "2" _title="Score" pixbuf="score" expansion="0.0" minimum_width="18" disabled="true" resizable="false" cell="render_score" compare="integer"/>
+
<ETableColumn model_col= "3" _title="Attachment" pixbuf="attachment" expansion="0.0" minimum_width="18" resizable="false" cell="render_attachment" compare="integer" sortable="false"/>
+
<ETableColumn model_col= "4" _title="From" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare"/>
+
<ETableColumn model_col= "5" _title="Subject" expansion="1.6" minimum_width="32" resizable="true" cell="render_tree" compare="subject_compare"/>
+
<ETableColumn model_col= "6" _title="Sent" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
+
<ETableColumn model_col= "7" _title="Received" expansion="0.4" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
+
<ETableColumn model_col= "8" _title="To" expansion="1.0" minimum_width="32" resizable="true" cell="render_text" compare="address_compare"/>
+
<ETableColumn model_col= "9" _title="Size" expansion="0.2" minimum_width="32" resizable="true" cell="render_size" compare="integer"/>
+
+ <ETableColumn model_col= "10" _title="Flag Status" pixbuf="flagged" expansion="0.0" minimum_width="18" resizable="false" cell="render_flag_status" compare="integer"/>
+
+ <ETableColumn model_col= "11" _title="Follow Up Flag" expansion="0.2" minimum_width="32" resizable="true" cell="render_text" compare="string"/>
+
+ <ETableColumn model_col= "12" _title="Due By" expansion="0.2" minimum_width="32" resizable="true" cell="render_date" compare="integer"/>
+
<ETableState>
<column source="0"/> <column source="3"/> <column source="1"/>
<column source="4"/> <column source="5" expansion="1.60"/> <column source="6" expansion="0.40"/>
- <grouping> </grouping>
+ <grouping> </grouping>
</ETableState>
</ETableSpecification>
diff --git a/mail/message-list.h b/mail/message-list.h
index ed2652024f..42de65cbd8 100644
--- a/mail/message-list.h
+++ b/mail/message-list.h
@@ -26,7 +26,9 @@ enum {
COL_RECEIVED,
COL_TO,
COL_SIZE,
- COL_NEED_REPLY,
+ COL_FOLLOWUP_FLAG_STATUS,
+ COL_FOLLOWUP_FLAG,
+ COL_FOLLOWUP_DUE_BY,
COL_LAST,
@@ -37,8 +39,7 @@ enum {
};
#define MESSAGE_LIST_COLUMN_IS_ACTIVE(col) (col == COL_MESSAGE_STATUS || \
- col == COL_FLAGGED || \
- col == COL_NEED_REPLY)
+ col == COL_FLAGGED)
#define ML_HIDE_NONE_START (0)
#define ML_HIDE_NONE_END (2147483647)
diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c
index 86a7abd95b..067dd941ee 100644
--- a/mail/message-tag-followup.c
+++ b/mail/message-tag-followup.c
@@ -47,17 +47,17 @@ static struct {
const char *name;
int value;
} available_flags[] = {
- { N_("Call"), "call", FLAG_CALL },
- { N_("Do Not Forward"), "do-not-forward", FLAG_DO_NOT_FORWARD },
- { N_("Follow-Up"), "follow-up", FLAG_FOLLOWUP },
- { N_("For Your Information"), "fyi", FLAG_FYI },
- { N_("Forward"), "forward", FLAG_FORWARD },
- { N_("No Response Necessary"), "no-response", FLAG_NO_RESPONSE_NECESSARY },
- { N_("Read"), "read", FLAG_READ },
- { N_("Reply"), "reply", FLAG_REPLY },
- { N_("Reply to All"), "reply-all", FLAG_REPLY_ALL },
- { N_("Review"), "review", FLAG_REVIEW },
- { N_("None"), NULL, FLAG_NONE }
+ { N_("Call"), "call", FOLLOWUP_FLAG_CALL },
+ { N_("Do Not Forward"), "do-not-forward", FOLLOWUP_FLAG_DO_NOT_FORWARD },
+ { N_("Follow-Up"), "follow-up", FOLLOWUP_FLAG_FOLLOWUP },
+ { N_("For Your Information"), "fyi", FOLLOWUP_FLAG_FYI },
+ { N_("Forward"), "forward", FOLLOWUP_FLAG_FORWARD },
+ { N_("No Response Necessary"), "no-response", FOLLOWUP_FLAG_NO_RESPONSE_NECESSARY },
+ { N_("Read"), "read", FOLLOWUP_FLAG_READ },
+ { N_("Reply"), "reply", FOLLOWUP_FLAG_REPLY },
+ { N_("Reply to All"), "reply-all", FOLLOWUP_FLAG_REPLY_ALL },
+ { N_("Review"), "review", FOLLOWUP_FLAG_REVIEW },
+ { N_("None"), NULL, FOLLOWUP_FLAG_NONE }
};
static MessageTagEditorClass *parent_class;
@@ -105,7 +105,7 @@ static void
message_tag_followup_init (MessageTagFollowUp *editor)
{
editor->tag = g_new (struct _FollowUpTag, 1);
- editor->tag->type = FLAG_NONE;
+ editor->tag->type = FOLLOWUP_FLAG_NONE;
editor->tag->target_date = time (NULL);
editor->tag->completed = 0;
@@ -190,7 +190,7 @@ message_tag_followup_decode (const char *value)
tag = g_new (struct _FollowUpTag, 1);
- for (i = 0; i < FLAG_NONE; i++) {
+ for (i = 0; i < FOLLOWUP_FLAG_NONE; i++) {
if (!strncmp (value, available_flags[i].name, strlen (available_flags[i].name)))
break;
}
@@ -221,7 +221,7 @@ message_tag_followup_encode (struct _FollowUpTag *tag)
{
g_return_val_if_fail (tag != NULL, NULL);
- if (tag->type == FLAG_NONE)
+ if (tag->type == FOLLOWUP_FLAG_NONE)
return NULL;
return g_strdup_printf ("%s:%lx:%lx", available_flags[tag->type].name,
@@ -229,13 +229,24 @@ message_tag_followup_encode (struct _FollowUpTag *tag)
(unsigned long) tag->completed);
}
+const char *
+message_tag_followup_i18n_name (int type)
+{
+ g_return_val_if_fail (type >= 0 && type <= FOLLOWUP_FLAG_NONE, NULL);
+
+ if (type != FOLLOWUP_FLAG_NONE)
+ return _(available_flags[type].i18n_name);
+ else
+ return NULL;
+}
+
static void
clear_clicked (GtkButton *button, gpointer user_data)
{
MessageTagFollowUp *followup = user_data;
gtk_widget_show (followup->none);
- gtk_option_menu_set_history (followup->type, FLAG_NONE);
+ gtk_option_menu_set_history (followup->type, FOLLOWUP_FLAG_NONE);
gtk_signal_emit_by_name (GTK_OBJECT (followup->none), "activate", followup);
e_date_edit_set_time (followup->target_date, time (NULL));
@@ -309,7 +320,7 @@ construct (MessageTagEditor *editor)
followup->type = GTK_OPTION_MENU (glade_xml_get_widget (gui, "followup_type"));
gtk_option_menu_remove_menu (followup->type);
menu = gtk_menu_new ();
- for (i = 0; i <= FLAG_NONE; i++) {
+ for (i = 0; i <= FOLLOWUP_FLAG_NONE; i++) {
item = gtk_menu_item_new_with_label (_(available_flags[i].i18n_name));
gtk_object_set_data (GTK_OBJECT (item), "value",
GINT_TO_POINTER (available_flags[i].value));
@@ -321,7 +332,7 @@ construct (MessageTagEditor *editor)
followup->none = item;
gtk_option_menu_set_menu (followup->type, menu);
gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", followup);
- gtk_option_menu_set_history (followup->type, FLAG_NONE);
+ gtk_option_menu_set_history (followup->type, FOLLOWUP_FLAG_NONE);
followup->target_date = E_DATE_EDIT (glade_xml_get_widget (gui, "target_date"));
e_date_edit_set_time (followup->target_date, time (NULL));
diff --git a/mail/message-tag-followup.h b/mail/message-tag-followup.h
index 2f61679664..75161a4e76 100644
--- a/mail/message-tag-followup.h
+++ b/mail/message-tag-followup.h
@@ -41,17 +41,17 @@ extern "C" {
#define IS_MESSAGE_TAG_FOLLOWUP(obj) GTK_CHECK_TYPE (obj, message_tag_followup_get_type ())
enum {
- FLAG_CALL,
- FLAG_DO_NOT_FORWARD,
- FLAG_FOLLOWUP,
- FLAG_FYI,
- FLAG_FORWARD,
- FLAG_NO_RESPONSE_NECESSARY,
- FLAG_READ,
- FLAG_REPLY,
- FLAG_REPLY_ALL,
- FLAG_REVIEW,
- FLAG_NONE
+ FOLLOWUP_FLAG_CALL,
+ FOLLOWUP_FLAG_DO_NOT_FORWARD,
+ FOLLOWUP_FLAG_FOLLOWUP,
+ FOLLOWUP_FLAG_FYI,
+ FOLLOWUP_FLAG_FORWARD,
+ FOLLOWUP_FLAG_NO_RESPONSE_NECESSARY,
+ FOLLOWUP_FLAG_READ,
+ FOLLOWUP_FLAG_REPLY,
+ FOLLOWUP_FLAG_REPLY_ALL,
+ FOLLOWUP_FLAG_REVIEW,
+ FOLLOWUP_FLAG_NONE
};
struct _FollowUpTag {
@@ -90,7 +90,7 @@ GtkType message_tag_followup_get_type (void);
/* utility functions */
struct _FollowUpTag *message_tag_followup_decode (const char *tag_value);
char *message_tag_followup_encode (struct _FollowUpTag *followup);
-
+const char *message_tag_followup_i18n_name (int type);
MessageTagEditor *message_tag_followup_new (void);