Revised patch for HEAD. Please review it. Harry Harry Lu wrote: Hi, |
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v retrieving revision 1.325 diff -u -r1.325 ChangeLog --- ChangeLog 13 Sep 2004 16:24:32 -0000 1.325 +++ ChangeLog 20 Sep 2004 06:59:14 -0000 @@ -1,3 +1,9 @@ +2004-09-20 Harry Lu <harry lu sun com> + + * e-source-selector.c: (e_source_selector_popup_menu), + (class_init): implement popup_menu so that popup menu can + be shown with Shift+F10. + 2004-09-13 Rodney Dawes <dobey novell com> * e-multi-config-dialog.c (impl_response): Index: e-source-selector.c =================================================================== RCS file: /cvs/gnome/evolution/widgets/misc/e-source-selector.c,v retrieving revision 1.22 diff -u -r1.22 e-source-selector.c --- e-source-selector.c 20 Jul 2004 16:36:43 -0000 1.22 +++ e-source-selector.c 20 Sep 2004 06:59:15 -0000 @@ -575,11 +575,28 @@ return FALSE; } +static void +selector_real_popup_menu (ESourceSelector *selector, GdkEvent *event) +{ + GtkWidget *menu; + + /* create the menu */ + menu = gtk_menu_new (); + g_signal_emit (G_OBJECT (selector), signals[FILL_POPUP_MENU], 0, GTK_MENU (menu)); + + /* popup the menu */ + if (event == NULL || event->type == GDK_KEY_PRESS) { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, GDK_CURRENT_TIME); + } else { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button.button, event->button.time); + } + +} + static gboolean selector_button_press_event (GtkWidget *widget, GdkEventButton *event, ESourceSelector *selector) { ESourceSelectorPrivate *priv = selector->priv; - GtkWidget *menu; GtkTreePath *path; ESource *source = NULL; @@ -611,14 +628,9 @@ e_source_selector_set_primary_selection (selector, source); g_object_unref (source); } - - /* create the menu */ - menu = gtk_menu_new (); - g_signal_emit (G_OBJECT (selector), signals[FILL_POPUP_MENU], 0, GTK_MENU (menu)); - - /* popup the menu */ - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, event->button, event->time); + selector_real_popup_menu (selector, (GdkEvent *)event); + return TRUE; } @@ -664,6 +676,18 @@ (* G_OBJECT_CLASS (parent_class)->finalize) (object); } +static gboolean +e_source_selector_popup_menu (GtkWidget *widget) +{ + ESourceSelector *selector = E_SOURCE_SELECTOR (widget); + + if (e_source_selector_peek_primary_selection (selector)) { + selector_real_popup_menu (selector, NULL); + return TRUE; + } + + return FALSE; +} /* Initialization. */ @@ -671,9 +695,12 @@ class_init (ESourceSelectorClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; + + widget_class->popup_menu = e_source_selector_popup_menu; parent_class = g_type_class_peek_parent (class);