From c3ece20f02b7c1452af1380946e6c62a3d48cf11 Mon Sep 17 00:00:00 2001 From: Bolian Yin Date: Wed, 25 Jun 2003 16:08:57 +0000 Subject: Fixes #45275 2003-06-25 Bolian Yin Fixes #45275 * gui/e-calendar-table.c (e_calendar_table_show_popup_menu): new function. (e_calendar_table_on_right_click_menu): call e_calendar_table_show_popup_menu. (e_calendar_table_on_popup_menu): callback for "popup_menu" signal. (e_calendar_table_init): connect to ETable's "popup_menu" signal. svn path=/trunk/; revision=21537 --- calendar/gui/e-calendar-table.c | 45 +++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index c55875d943..faaee9d9f4 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -70,11 +71,18 @@ static void e_calendar_table_on_double_click (ETable *table, gint col, GdkEvent *event, ECalendarTable *cal_table); +static gint e_calendar_table_show_popup_menu (ETable *table, + GdkEvent *gdk_event, + ECalendarTable *cal_table); + static gint e_calendar_table_on_right_click (ETable *table, gint row, gint col, - GdkEventButton *event, + GdkEvent *event, ECalendarTable *cal_table); +static gboolean e_calendar_table_on_popup_menu (GtkWidget *widget, + gpointer data); + static void e_calendar_table_on_open_task (GtkWidget *menuitem, gpointer data); static void e_calendar_table_on_save_as (GtkWidget *menuitem, @@ -519,6 +527,7 @@ e_calendar_table_init (ECalendarTable *cal_table) g_signal_connect (e_table, "double_click", G_CALLBACK (e_calendar_table_on_double_click), cal_table); g_signal_connect (e_table, "right_click", G_CALLBACK (e_calendar_table_on_right_click), cal_table); g_signal_connect (e_table, "key_press", G_CALLBACK (e_calendar_table_on_key_press), cal_table); + g_signal_connect (e_table, "popup_menu", G_CALLBACK (e_calendar_table_on_popup_menu), cal_table); /* Set up the invisible widget for the clipboard selections */ cal_table->invisible = gtk_invisible_new (); @@ -972,15 +981,14 @@ static EPopupMenu tasks_popup_menu [] = { }; static gint -e_calendar_table_on_right_click (ETable *table, - gint row, - gint col, - GdkEventButton *event, - ECalendarTable *cal_table) +e_calendar_table_show_popup_menu (ETable *table, + GdkEvent *gdk_event, + ECalendarTable *cal_table) { int n_selected; int hide_mask = 0; int disable_mask = 0; + GtkMenu *gtk_menu; n_selected = e_table_selected_count (table); if (n_selected <= 0) @@ -998,12 +1006,33 @@ e_calendar_table_on_right_click (ETable *table, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) disable_mask |= MASK_ASSIGNABLE; - e_popup_menu_run (tasks_popup_menu, (GdkEvent *) event, - disable_mask, hide_mask, cal_table); + gtk_menu = e_popup_menu_create (tasks_popup_menu, disable_mask, + hide_mask, cal_table); + + e_popup_menu (gtk_menu, gdk_event); return TRUE; } +static gint +e_calendar_table_on_right_click (ETable *table, + gint row, + gint col, + GdkEvent *event, + ECalendarTable *cal_table) +{ + return e_calendar_table_show_popup_menu (table, event, cal_table); +} + +static gboolean +e_calendar_table_on_popup_menu (GtkWidget *widget, gpointer data) +{ + ETable *table = E_TABLE(widget); + g_return_if_fail(table); + + return e_calendar_table_show_popup_menu (table, NULL, + E_CALENDAR_TABLE(data)); +} static void e_calendar_table_on_open_task (GtkWidget *menuitem, -- cgit