From 1aacb36b7bcfe32859a07c9aeacac22c7958533b Mon Sep 17 00:00:00 2001 From: Parthasarathi Susarla Date: Wed, 7 Dec 2005 08:29:51 +0000 Subject: Add support for setting priority of a message. 2005-12-07 Parthasarathi Susarla * e-msg-composer.[ch]: (build_message): (menu_insert_priority_cb): (setup_ui): (e_msg_composer_get_priority): (e_msg_composer_set_priority): Add support for setting priority of a message. svn path=/trunk/; revision=30734 --- composer/ChangeLog | 10 ++++++++ composer/e-msg-composer.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++ composer/e-msg-composer.h | 4 +++ 3 files changed, 79 insertions(+) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index 890e1029ec..b6b51b88f2 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,13 @@ +2005-12-07 Parthasarathi Susarla + + * e-msg-composer.[ch]: + (build_message): + (menu_insert_priority_cb): + (setup_ui): + (e_msg_composer_get_priority): + (e_msg_composer_set_priority): + Add support for setting priority of a message. + 2005-12-05 Parthasarathi Susarla ** See bug #322863 diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index ae263cc9ba..2bb44eda3d 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -204,6 +204,7 @@ struct _EMsgComposerPrivate { guint32 view_cc : 1; guint32 view_subject : 1; guint32 request_receipt : 1; + guint32 set_priority : 1; guint32 has_changed : 1; guint32 autosaved : 1; @@ -565,6 +566,10 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_medium_add_header (CAMEL_MEDIUM (new), "Disposition-Notification-To", mdn_address); } + + /* Message Priority */ + if (p->set_priority) + camel_medium_add_header (CAMEL_MEDIUM (new), "X-Priority", "1"); if (p->mime_body) { plain_encoding = CAMEL_TRANSFER_ENCODING_7BIT; @@ -2047,6 +2052,19 @@ menu_insert_receipt_cb (BonoboUIComponent *component, e_msg_composer_set_request_receipt (E_MSG_COMPOSER (user_data), atoi (state)); } +static void +menu_insert_priority_cb (BonoboUIComponent *component, + const char *path, + Bonobo_UIComponent_EventType type, + const char *state, + gpointer user_data) +{ + if (type != Bonobo_UIComponent_STATE_CHANGED) + return; + + e_msg_composer_set_priority (E_MSG_COMPOSER (user_data), atoi (state)); +} + static void menu_changed_charset_cb (BonoboUIComponent *component, const char *path, @@ -2366,6 +2384,14 @@ setup_ui (EMsgComposer *composer) p->uic, "RequestReceipt", menu_insert_receipt_cb, composer); + /* Insert/Set Priority*/ + bonobo_ui_component_set_prop ( + p->uic, "/commands/SetPriority", + "state", p->set_priority? "1" : "0", NULL); + bonobo_ui_component_add_listener ( + p->uic, "SetPriority", + menu_insert_priority_cb, composer); + /* Security -> PGP Sign */ bonobo_ui_component_set_prop ( p->uic, "/commands/SecurityPGPSign", @@ -5807,6 +5833,45 @@ e_msg_composer_set_request_receipt (EMsgComposer *composer, gboolean request_rec } +/** + * e_msg_composer_get_priority + * @composer: A message composer widget + * + * Get the status of the "Priority" flag. + * + * Return value: The status of the "Priority" flag. + **/ +gboolean +e_msg_composer_get_priority (EMsgComposer *composer) +{ + EMsgComposerPrivate *p = composer->priv; + g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE); + + return p->set_priority; +} + + +/** + * e_msg_composer_set_priority: + * @composer: A message composer widget + * @state: whether to set priority or not + * + * If set, a message is sent with a high priority + */ +void +e_msg_composer_set_priority (EMsgComposer *composer, gboolean set_priority) +{ + EMsgComposerPrivate *p = composer->priv; + g_return_if_fail (E_IS_MSG_COMPOSER (composer)); + + if ((p->set_priority && set_priority) || + (!p->set_priority && !set_priority)) + return; + + p->set_priority= set_priority; + bonobo_ui_component_set_prop (p->uic, "/commands/SetPriority", + "state", p->set_priority ? "1" : "0", NULL); +} EDestination ** e_msg_composer_get_recipients (EMsgComposer *composer) diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 113d30be4e..dde9f9fb71 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -125,6 +125,10 @@ gboolean e_msg_composer_get_request_receipt (EMsgCo void e_msg_composer_set_request_receipt (EMsgComposer *composer, gboolean request_receipt); +gboolean e_msg_composer_get_priority (EMsgComposer *composer); +void e_msg_composer_set_priority (EMsgComposer *composer, + gboolean set_priority); + EDestination **e_msg_composer_get_recipients (EMsgComposer *composer); EDestination **e_msg_composer_get_to (EMsgComposer *composer); EDestination **e_msg_composer_get_cc (EMsgComposer *composer); -- cgit v1.2.3