From b4f3f0c1028773d2f06a1a9311037a8cdccb84cf Mon Sep 17 00:00:00 2001 From: Jason Leach Date: Mon, 23 Jul 2001 19:14:53 +0000 Subject: [Bug #5225: No UI way to mark as unimportant] 2001-07-23 Jason Leach [Bug #5225: No UI way to mark as unimportant] * folder-browser.c (on_right_click): Do the necessary stuff to show or hide the correct "Mark Important" or "Mark as Unimportant" menu items depending on the status of messages that are selected. * folder-browser-ui.c: Add the MarkAsUnimportant verb here. * mail-callbacks.c (mark_as_unimportant): Simple function that's the callback for these new menu items. svn path=/trunk/; revision=11316 --- mail/ChangeLog | 13 +++++++++++++ mail/folder-browser-ui.c | 3 ++- mail/folder-browser.c | 24 +++++++++++++++++++++++- mail/mail-callbacks.c | 14 ++++++++++---- mail/mail-callbacks.h | 1 + 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 4bcf917cc4..20ccbcdbc5 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,16 @@ +2001-07-23 Jason Leach + + [Bug #5225: No UI way to mark as unimportant] + + * folder-browser.c (on_right_click): Do the necessary stuff to + show or hide the correct "Mark Important" or "Mark as Unimportant" + menu items depending on the status of messages that are selected. + + * folder-browser-ui.c: Add the MarkAsUnimportant verb here. + + * mail-callbacks.c (mark_as_unimportant): Simple function that's + the callback for these new menu items. + 2001-07-22 Ettore Perazzoli * component-factory.c (remove_folder): Updated to get a @type diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c index 29a9af5cfc..255e553a03 100644 --- a/mail/folder-browser-ui.c +++ b/mail/folder-browser-ui.c @@ -49,9 +49,10 @@ static BonoboUIVerb message_verbs [] = { BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached), BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline), BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted), - BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important), BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen), BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen), + BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important), + BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", mark_as_unimportant), BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg), BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message), BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all), diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 0d3d0545a9..7cc1071112 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1223,6 +1223,8 @@ enum { CAN_UNDELETE = 32, IS_MAILING_LIST = 64, CAN_RESEND = 128, + CAN_MARK_IMPORTANT = 256, + CAN_MARK_UNIMPORTANT = 512 }; #define MLIST_VFOLDER (3) @@ -1287,7 +1289,9 @@ static EPopupMenu context_menu[] = { { N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD }, { N_("Mark as _Important"), NULL, - GTK_SIGNAL_FUNC (mark_as_important), NULL, 0 }, + GTK_SIGNAL_FUNC (mark_as_important), NULL, CAN_MARK_IMPORTANT }, + { N_("Mark as Unim_portant"), NULL, + GTK_SIGNAL_FUNC (mark_as_unimportant), NULL, CAN_MARK_UNIMPORTANT }, E_POPUP_SEPARATOR, @@ -1391,6 +1395,8 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event gboolean have_undeleted = FALSE; gboolean have_seen = FALSE; gboolean have_unseen = FALSE; + gboolean have_important = FALSE; + gboolean have_unimportant = FALSE; for (i = 0; i < uids->len; i++) { info = camel_folder_get_message_info (fb->folder, uids->pdata[i]); @@ -1406,6 +1412,11 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event have_deleted = TRUE; else have_undeleted = TRUE; + + if (info->flags & CAMEL_MESSAGE_FLAGGED) + have_important = TRUE; + else + have_unimportant = TRUE; camel_folder_free_message_info(fb->folder, info); @@ -1423,6 +1434,11 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event if (!have_deleted) enable_mask |= CAN_UNDELETE; + if (!have_unimportant) + enable_mask |= CAN_MARK_IMPORTANT; + if (!have_important) + enable_mask |= CAN_MARK_UNIMPORTANT; + /* * Hide items that wont get used. */ @@ -1438,6 +1454,12 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event else hide_mask |= CAN_UNDELETE; } + if (!(have_important && have_unimportant)){ + if (have_important) + hide_mask |= CAN_MARK_IMPORTANT; + else + hide_mask |= CAN_MARK_UNIMPORTANT; + } } /* free uids */ diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 067866fed5..5a4e782671 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -1277,6 +1277,12 @@ mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path) flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED); } +void +mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path) +{ + flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED, 0); +} + void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path) { @@ -1777,13 +1783,13 @@ do_mail_print (MailDisplay *md, gboolean preview) int copies = 1; int collate = FALSE; - if (!preview){ + if (!preview) { - gpd = GNOME_PRINT_DIALOG ( - gnome_print_dialog_new (_("Print Message"), GNOME_PRINT_DIALOG_COPIES)); + gpd = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"), + GNOME_PRINT_DIALOG_COPIES)); gnome_dialog_set_default (GNOME_DIALOG (gpd), GNOME_PRINT_PRINT); - switch (gnome_dialog_run (GNOME_DIALOG (gpd))){ + switch (gnome_dialog_run (GNOME_DIALOG (gpd))) { case GNOME_PRINT_PRINT: break; diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h index 6d37bb4819..e37813b03e 100644 --- a/mail/mail-callbacks.h +++ b/mail/mail-callbacks.h @@ -88,6 +88,7 @@ void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path); void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path); void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path); +void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path); void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path); void edit_message (BonoboUIComponent *uih, void *user_data, const char *path); -- cgit v1.2.3