diff options
author | Dan Winship <danw@src.gnome.org> | 2001-04-25 00:23:51 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-04-25 00:23:51 +0800 |
commit | 946ca213c46263ed2cb214193c67d367ebb15a03 (patch) | |
tree | 0d9d18bd98975aec02bea1883b9f787024d0e2e3 | |
parent | 2ab420a8580625decbc551ce4a0808ee0facb78b (diff) | |
download | gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.tar gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.tar.gz gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.tar.bz2 gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.tar.lz gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.tar.xz gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.tar.zst gsoc2013-evolution-946ca213c46263ed2cb214193c67d367ebb15a03.zip |
Add accelerators to the context menu. (on_right_click): Use
* folder-browser.c: Add accelerators to the context menu.
(on_right_click): Use e_tree_get_cell_geometry and a
GtkMenuPositionFunc when responding to a Menu-key press so we can
line the menu up with the selected row rather than the cursor.
* message-browser.c: include <gal/util/e-util.h> for E_MAKE_TYPE.
svn path=/trunk/; revision=9547
-rw-r--r-- | mail/ChangeLog | 9 | ||||
-rw-r--r-- | mail/folder-browser.c | 90 | ||||
-rw-r--r-- | mail/message-browser.c | 2 |
3 files changed, 73 insertions, 28 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 1088a86345..0a24a5aed6 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2001-04-24 Dan Winship <danw@ximian.com> + + * folder-browser.c: Add accelerators to the context menu. + (on_right_click): Use e_tree_get_cell_geometry and a + GtkMenuPositionFunc when responding to a Menu-key press so we can + line the menu up with the selected row rather than the cursor. + + * message-browser.c: include <gal/util/e-util.h> for E_MAKE_TYPE. + 2001-04-23 Jon Trowbridge <trow@ximian.com> * mail-display.c (html_button_press_event): Check for mailto: diff --git a/mail/folder-browser.c b/mail/folder-browser.c index e7416e50b5..1bbd3dce0c 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -19,6 +19,7 @@ #include <gal/widgets/e-unicode.h> #include <gal/e-paned/e-vpaned.h> #include <gal/widgets/e-popup-menu.h> +#include <gal/widgets/e-gui-utils.h> #include "filter/vfolder-rule.h" #include "filter/vfolder-context.h" @@ -41,7 +42,6 @@ #include "mail-local.h" #include "mail-config.h" -#include <gal/widgets/e-popup-menu.h> #include <camel/camel-vtrash-folder.h> #define d(x) x @@ -549,31 +549,31 @@ enum { #define MLIST_FILTER (8) static EPopupMenu filter_menu[] = { - { N_("VFolder on Subject"), NULL, + { N_("VFolder on _Subject"), NULL, GTK_SIGNAL_FUNC (vfolder_subject), NULL, SELECTION_SET }, - { N_("VFolder on Sender"), NULL, + { N_("VFolder on Se_nder"), NULL, GTK_SIGNAL_FUNC (vfolder_sender), NULL, SELECTION_SET }, - { N_("VFolder on Recipients"), NULL, + { N_("VFolder on _Recipients"), NULL, GTK_SIGNAL_FUNC (vfolder_recipient), NULL, SELECTION_SET }, - { N_("VFolder on Mailing List"), NULL, + { N_("VFolder on Mailing _List"), NULL, GTK_SIGNAL_FUNC (vfolder_mlist), NULL, SELECTION_SET | IS_MAILING_LIST }, SEPARATOR, - { N_("Filter on Subject"), NULL, + { N_("Filter on Sub_ject"), NULL, GTK_SIGNAL_FUNC (filter_subject), NULL, SELECTION_SET }, - { N_("Filter on Sender"), NULL, + { N_("Filter on Sen_der"), NULL, GTK_SIGNAL_FUNC (filter_sender), NULL, SELECTION_SET }, - { N_("Filter on Recipients"), NULL, + { N_("Filter on Re_cipients"), NULL, GTK_SIGNAL_FUNC (filter_recipient), NULL, SELECTION_SET }, - { N_("Filter on Mailing List"), NULL, + { N_("Filter on _Mailing List"), NULL, GTK_SIGNAL_FUNC (filter_mlist), NULL, SELECTION_SET | IS_MAILING_LIST }, @@ -581,41 +581,41 @@ static EPopupMenu filter_menu[] = { }; -static EPopupMenu menu[] = { - { N_("Open"), NULL, +static EPopupMenu context_menu[] = { + { N_("_Open"), NULL, GTK_SIGNAL_FUNC (open_msg), NULL, 0 }, { N_("Resend"), NULL, GTK_SIGNAL_FUNC (resend_msg), NULL, CAN_RESEND }, - { N_("Save As..."), NULL, + { N_("_Save As..."), NULL, GTK_SIGNAL_FUNC (save_msg), NULL, 0 }, - { N_("Print"), NULL, + { N_("_Print"), NULL, GTK_SIGNAL_FUNC (print_msg), NULL, 0 }, SEPARATOR, - { N_("Reply to Sender"), NULL, + { N_("_Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 }, - { N_("Reply to All"), NULL, + { N_("Reply to _All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 }, - { N_("Forward"), NULL, + { N_("_Forward"), NULL, GTK_SIGNAL_FUNC (forward_attached), NULL, 0 }, - { N_("Forward inline"), NULL, + { N_("Forward _inline"), NULL, GTK_SIGNAL_FUNC (forward_inlined), NULL, 0 }, { "", NULL, (NULL), NULL, 0 }, - { N_("Mark as Read"), NULL, + { N_("Mar_k as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), NULL, CAN_MARK_READ }, - { N_("Mark as Unread"), NULL, + { N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD }, SEPARATOR, - { N_("Move to Folder..."), NULL, + { N_("_Move to Folder..."), NULL, GTK_SIGNAL_FUNC (move_msg), NULL, 0 }, - { N_("Copy to Folder..."), NULL, + { N_("_Copy to Folder..."), NULL, GTK_SIGNAL_FUNC (copy_msg), NULL, 0 }, - { N_("Delete"), NULL, + { N_("_Delete"), NULL, GTK_SIGNAL_FUNC (delete_msg), NULL, CAN_DELETE }, - { N_("Undelete"), NULL, + { N_("_Undelete"), NULL, GTK_SIGNAL_FUNC (undelete_msg), NULL, CAN_UNDELETE }, SEPARATOR, @@ -625,17 +625,36 @@ static EPopupMenu menu[] = { { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 },*/ - { N_("Apply Filters"), NULL, + { N_("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), NULL, 0 }, { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 }, - { N_("Create Rule From Message"), NULL, + { N_("Create Ru_le From Message"), NULL, GTK_SIGNAL_FUNC (NULL), filter_menu, SELECTION_SET }, TERMINATOR }; +struct cmpf_data { + ETree *tree; + int row, col; +}; + +static void +context_menu_position_func (GtkMenu *menu, gint *x, gint *y, + gpointer user_data) +{ + int tx, ty, tw, th; + struct cmpf_data *closure = user_data; + + gdk_window_get_origin (GTK_WIDGET (closure->tree)->window, x, y); + e_tree_get_cell_geometry (closure->tree, closure->row, closure->col, + &tx, &ty, &tw, &th); + *x += tx + tw / 2; + *y += ty + th / 2; +} + /* handle context menu over message-list */ static gint on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb) @@ -648,7 +667,8 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event int i; char *mailing_list_name = NULL; char *subject_match = NULL, *from_match = NULL; - + GtkMenu *menu; + if (fb->reconfigure) { enable_mask = 0; goto display_menu; @@ -756,8 +776,22 @@ display_menu: g_free(mailing_list_name); } - e_popup_menu_run (menu, event, enable_mask, hide_mask, fb); - + menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb); + e_auto_kill_popup_menu_on_hide (menu); + + if (event->type == GDK_KEY_PRESS) { + struct cmpf_data closure; + + closure.tree = tree; + closure.row = row; + closure.col = col; + gtk_menu_popup (menu, NULL, NULL, context_menu_position_func, + &closure, 0, event->key.time); + } else { + gtk_menu_popup (menu, NULL, NULL, NULL, NULL, + event->button.button, event->button.time); + } + g_free(filter_menu[MLIST_FILTER].name); g_free(filter_menu[MLIST_VFOLDER].name); diff --git a/mail/message-browser.c b/mail/message-browser.c index 2286772f50..3a471b24e9 100644 --- a/mail/message-browser.c +++ b/mail/message-browser.c @@ -24,6 +24,8 @@ #include <config.h> #endif +#include <gal/util/e-util.h> + #include "message-browser.h" #include "mail.h" |