diff options
author | Miguel de Icaza <miguel@ximian.com> | 2001-03-07 05:08:56 +0800 |
---|---|---|
committer | Miguel de Icaza <miguel@src.gnome.org> | 2001-03-07 05:08:56 +0800 |
commit | 789ed9286edc7f4455ce5fe87dfe7e33a841c5e7 (patch) | |
tree | 3cfa6b6fcb9de473d7a0bc1420f4df56022f4af5 /mail/folder-browser.c | |
parent | b3dabe72df7ad9899cfe36383c7dfdb6794c58a0 (diff) | |
download | gsoc2013-evolution-789ed9286edc7f4455ce5fe87dfe7e33a841c5e7.tar.gz gsoc2013-evolution-789ed9286edc7f4455ce5fe87dfe7e33a841c5e7.tar.zst gsoc2013-evolution-789ed9286edc7f4455ce5fe87dfe7e33a841c5e7.zip |
Reorganize the menus to have entries always in a consistent fashion, as
2001-02-27 Miguel de Icaza <miguel@ximian.com>
* gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize
the menus to have entries always in a consistent fashion, as
reported to the genepool mailing list.
(e_day_view_on_event_right_click): Added a FIXME comment to the
FIXME comment without a FIXME.
Now we use e_popup_menu. This allows us to hide/show items on
demand, and to sensitize/de-sensitize items depending on their
state.
This will also let us add icon support (when we get nice icons for
this)
* gui/e-week-view.c (e_week_view_show_popup_menu): Ditto.
The files popup-menu.c and popup-menu.h can now be removed.
2001-03-01 Miguel de Icaza <miguel@ximian.com>
* folder-browser.c (on_right_click): Move the context menus to
the toplevel code; Use enumerations for the various bitfield
constants.
Add support for hiding items that are not required (read/unread
and delete/undelete).
This requires my previous patch, as it assumes "Open" does the
right thing instead of having two operations: Open and Edit.
2001-02-28 Miguel de Icaza <miguel@ximian.com>
* folder-browser.c (on_right_click): Removed draft folders op
here, since open_msg now does the right thing (edit or view).
* folder-browser-factory.c (update_pixmaps): Removed MessageEdit
from here.
* mail-callbacks.c (open_msg): New function, does the "right
thing" to a message (either, edit or open).
* folder-browser-factory.c: Register new command here.
(update_pixmaps): Rename keys that have been shuffled around.
(update_pixmaps): Rename to match new updates on xml file.
Rename MessageOpenNewWindow to MessageOpen. Change action from
"view_message" to "open_message".
* mail-callbacks.c (mark_all_as_seen): New command. Marks all
messages as seen.
2001-03-06 Miguel de Icaza <miguel@ximian.com>
* evolution-tasks.xml: Added "File/New/Task" as well.
* evolution-mail.xml: Added "File/New/Mail Message" at the top
with binding C-n.
* evolution-calendar.xml: Set the binding for New Appointment to C-n
* evolution-contact-editor.xml: Set the toolbar to hlook=text
vlook=icon; Set all icons priority-text to 1.
* evolution-addressbook.xml: Added "Contact" to the New menu.
* evolution.xml: Provide an entry point to put "New" items on the
first level.
We are going to need some Bonobo support to "hide" objects when
other objects appear (like, having Mail Message bound to C-S-X in
the global space, and when we switch to Mail, we only show the
entry that has C-n as the binding).
2001-02-28 Miguel de Icaza <miguel@ximian.com>
* evolution.xml: Moved Importer after the Folder operations per
Dan's proposal.
* evolution-addressbook.xml: Renamed Settings/AddressBook
Configuration to Tools/Settings.
Make all the items have "Print" items that use the same icon
instead of a collection of icons.
* evolution-calendar.xml: Moved "Calendar Preferences" from
"Settings" to "Tools/Settings".
* evolution-mail.xml: Settings menu is fully gone. All things
that run a dialog now end up in "Tools" while actions end up in
"Actions". Hence I am right.
Renamed "Mail Configuration..." to "Identieies and Servers"
Move MessageMarkAsRead, MessageMarkAsUnRead
to Edit menu. Add MessageMarkAllAsRead.
Remove "Print Message" from Message menu. Remove "Print Preview
Message" from Message menu. Leave them on the "File" menu.
Renamed "Reply to Sender" to "Reply" (awaiting Ettore's
permission).
Renamed "Messages" to "Actions".
Open Message renamed to "Open Selected Items" (as this is what it
actually does).
Moved "Save Message As" to "File" menu.
Added "Properties" to the File/Folder submenu.
Edit menu now looks like this: Message Move, Message Copy, Select
All, Invert Selection, Delete, Undelete, Mark as Read, Mark as
Unread. Some of them were moved from the "Messages" menu.
"Forward message" shortcut changed to C-f
Tools menu created.
Create Rule From message moved to "Tools".
* evolution.xml: Added Tools menu. Moved Edit/Customize to
Tools/Customize Toolbar.
Added File/Folder submenu. Duplicate "New Folder" in here.
2001-02-28 Miguel de Icaza <miguel@ximian.com>
* menus/gal-view-menus.c (build_menus): Add translation string
here.
svn path=/trunk/; revision=8572
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 184 |
1 files changed, 129 insertions, 55 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 726b79705d..42fa8d35fa 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -489,6 +489,107 @@ hide_sender(GtkWidget *w, FolderBrowser *fb) } } +enum { + SELECTION_SET = 2, + CAN_MARK_READ = 4, + CAN_MARK_UNREAD = 8, + CAN_DELETE = 16, + CAN_UNDELETE = 32, + IS_MAILING_LIST = 64, +}; + +#define SEPARATOR { "", NULL, (NULL), NULL, 0 } +#define TERMINATOR { NULL, NULL, (NULL), NULL, 0 } + +#define MLIST_VFOLDER (3) +#define MLIST_FILTER (8) + +static EPopupMenu filter_menu[] = { + { N_("VFolder on Subject"), NULL, + GTK_SIGNAL_FUNC (vfolder_subject), NULL, + SELECTION_SET }, + { N_("VFolder on Sender"), NULL, + GTK_SIGNAL_FUNC (vfolder_sender), NULL, + SELECTION_SET }, + { N_("VFolder on Recipients"), NULL, + GTK_SIGNAL_FUNC (vfolder_recipient), NULL, + SELECTION_SET }, + { N_("VFolder on Mailing List"), NULL, + GTK_SIGNAL_FUNC (vfolder_mlist), NULL, + SELECTION_SET | IS_MAILING_LIST }, + + SEPARATOR, + + { N_("Filter on Subject"), NULL, + GTK_SIGNAL_FUNC (filter_subject), NULL, + SELECTION_SET }, + { N_("Filter on Sender"), NULL, + GTK_SIGNAL_FUNC (filter_sender), NULL, + SELECTION_SET }, + { N_("Filter on Recipients"), NULL, + GTK_SIGNAL_FUNC (filter_recipient), NULL, + SELECTION_SET }, + { N_("Filter on Mailing List"), NULL, + GTK_SIGNAL_FUNC (filter_mlist), NULL, + SELECTION_SET | IS_MAILING_LIST }, + + TERMINATOR +}; + + +static EPopupMenu menu[] = { + { N_("Open"), NULL, + GTK_SIGNAL_FUNC (open_msg), NULL, 0 }, + { N_("Save As..."), NULL, + GTK_SIGNAL_FUNC (save_msg), NULL, 0 }, + { N_("Print"), NULL, + GTK_SIGNAL_FUNC (print_msg), NULL, 0 }, + + SEPARATOR, + + { N_("Reply to Sender"), NULL, + GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 }, + { N_("Reply to All"), NULL, + GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 }, + { N_("Forward"), NULL, + GTK_SIGNAL_FUNC (forward_attached), NULL, 0 }, + { N_("Forward inline"), NULL, + GTK_SIGNAL_FUNC (forward_inlined), NULL, 0 }, + { "", NULL, (NULL), NULL, 0 }, + { N_("Mark as Read"), NULL, + GTK_SIGNAL_FUNC (mark_as_seen), NULL, CAN_MARK_READ }, + { N_("Mark as Unread"), NULL, + GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD }, + + SEPARATOR, + + { N_("Move to Folder..."), NULL, + GTK_SIGNAL_FUNC (move_msg), NULL, 0 }, + { N_("Copy to Folder..."), NULL, + GTK_SIGNAL_FUNC (copy_msg), NULL, 0 }, + { N_("Delete"), NULL, + GTK_SIGNAL_FUNC (delete_msg), NULL, CAN_DELETE }, + { N_("Undelete"), NULL, + GTK_SIGNAL_FUNC (undelete_msg), NULL, CAN_UNDELETE }, + + SEPARATOR, + + /*{ _("Add Sender to Address Book"), NULL, + GTK_SIGNAL_FUNC (addrbook_sender), NULL, 0 }, + { "", NULL, + GTK_SIGNAL_FUNC (NULL), NULL, 0 },*/ + + { N_("Apply Filters"), NULL, + GTK_SIGNAL_FUNC (apply_filters), NULL, 0 }, + { "", NULL, + GTK_SIGNAL_FUNC (NULL), NULL, 0 }, + { N_("Create Rule From Message"), NULL, + GTK_SIGNAL_FUNC (NULL), filter_menu, SELECTION_SET }, + + TERMINATOR +}; + + /* handle context menu over message-list */ static gint on_right_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowser *fb) @@ -497,69 +598,25 @@ on_right_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowse CamelMessageInfo *info; GPtrArray *uids; int enable_mask = 0; + int hide_mask = 0; int i; char *mailing_list_name = NULL; char *subject_match = NULL, *from_match = NULL; -#define MLIST_VFOLDER (3) -#define MLIST_FILTER (8) - EPopupMenu filter_menu[] = { - { _("VFolder on Subject"), NULL, GTK_SIGNAL_FUNC (vfolder_subject), NULL, 2 }, - { _("VFolder on Sender"), NULL, GTK_SIGNAL_FUNC (vfolder_sender), NULL, 2 }, - { _("VFolder on Recipients"), NULL, GTK_SIGNAL_FUNC (vfolder_recipient), NULL, 2 }, - { _("VFolder on Mailing List"), NULL, GTK_SIGNAL_FUNC (vfolder_mlist), NULL, 66 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { _("Filter on Subject"), NULL, GTK_SIGNAL_FUNC (filter_subject), NULL, 2 }, - { _("Filter on Sender"), NULL, GTK_SIGNAL_FUNC (filter_sender), NULL, 2 }, - { _("Filter on Recipients"), NULL, GTK_SIGNAL_FUNC (filter_recipient), NULL, 2 }, - { _("Filter on Mailing List"), NULL, GTK_SIGNAL_FUNC (filter_mlist), NULL, 66 }, - { NULL, NULL, NULL, NULL, 0 } - }; - - - EPopupMenu menu[] = { - { _("Open"), NULL, GTK_SIGNAL_FUNC (view_msg), NULL, 0 }, - { _("Edit"), NULL, GTK_SIGNAL_FUNC (edit_msg), NULL, 1 }, - { _("Save As..."), NULL, GTK_SIGNAL_FUNC (save_msg), NULL, 0 }, - { _("Print"), NULL, GTK_SIGNAL_FUNC (print_msg), NULL, 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { _("Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 }, - { _("Reply to All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 }, - { _("Forward"), NULL, GTK_SIGNAL_FUNC (forward_attached), NULL, 0 }, - { _("Forward inline"), NULL, GTK_SIGNAL_FUNC (forward_inlined), NULL, 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { _("Mark as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), NULL, 4 }, - { _("Mark as Unread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, 8 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { _("Move to Folder..."), NULL, GTK_SIGNAL_FUNC (move_msg), NULL, 0 }, - { _("Copy to Folder..."), NULL, GTK_SIGNAL_FUNC (copy_msg), NULL, 0 }, - { _("Delete"), NULL, GTK_SIGNAL_FUNC (delete_msg), NULL, 16 }, - { _("Undelete"), NULL, GTK_SIGNAL_FUNC (undelete_msg), NULL, 32 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - /*{ _("Add Sender to Address Book"), NULL, GTK_SIGNAL_FUNC (addrbook_sender), NULL, 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 },*/ - { _("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), NULL, 0 }, - { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { _("Create Rule From Message"), NULL, GTK_SIGNAL_FUNC (NULL), filter_menu, 2 }, - { NULL, NULL, NULL, NULL, 0 } - }; - if (fb->reconfigure) { enable_mask = 0; goto display_menu; } - if (fb->folder != drafts_folder) - enable_mask |= 1; - if (fb->mail_display->current_message == NULL) { - enable_mask |= 2; + enable_mask |= SELECTION_SET; mailing_list_name = NULL; } else { const char *subject, *real, *addr; const CamelInternetAddress *from; - mailing_list_name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers); + mailing_list_name = header_raw_check_mailing_list( + &((CamelMimePart *)fb->mail_display->current_message)->headers); if ((subject = camel_mime_message_get_subject(fb->mail_display->current_message)) && (subject = strip_re(subject)) @@ -604,14 +661,30 @@ on_right_click (ETable *table, gint row, gint col, GdkEvent *event, FolderBrowse } if (!have_unseen) - enable_mask |= 4; + enable_mask |= CAN_MARK_READ; if (!have_seen) - enable_mask |= 8; + enable_mask |= CAN_MARK_UNREAD; if (!have_undeleted) - enable_mask |= 16; + enable_mask |= CAN_DELETE; if (!have_deleted) - enable_mask |= 32; + enable_mask |= CAN_UNDELETE; + + /* + * Hide items that wont get used. + */ + if (!(have_unseen && have_seen)){ + if (have_seen) + hide_mask |= CAN_MARK_READ; + else + hide_mask |= CAN_MARK_UNREAD; + } + if (!(have_undeleted && have_deleted)){ + if (have_deleted) + hide_mask |= CAN_DELETE; + else + hide_mask |= CAN_UNDELETE; + } } /* free uids */ @@ -623,7 +696,7 @@ display_menu: /* generate the "Filter on Mailing List menu item name */ if (mailing_list_name == NULL) { - enable_mask |= 64; + enable_mask |= IS_MAILING_LIST; filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on Mailing List")); filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on Mailing List")); } else { @@ -632,7 +705,7 @@ display_menu: g_free(mailing_list_name); } - e_popup_menu_run (menu, event, enable_mask, 0, fb); + e_popup_menu_run (menu, event, enable_mask, hide_mask, fb); g_free(filter_menu[MLIST_FILTER].name); g_free(filter_menu[MLIST_VFOLDER].name); @@ -724,7 +797,8 @@ folder_browser_gui_init (FolderBrowser *fb) fb->vpaned = e_vpaned_new (); gtk_widget_show (fb->vpaned); - gtk_table_attach (GTK_TABLE (fb), fb->vpaned, + gtk_table_attach ( + GTK_TABLE (fb), fb->vpaned, 0, 1, 1, 3, GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, |