diff options
Diffstat (limited to 'calendar/gui/e-calendar-table.c')
-rw-r--r-- | calendar/gui/e-calendar-table.c | 447 |
1 files changed, 248 insertions, 199 deletions
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index a3d50bb475..7eec950039 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -27,10 +27,7 @@ * Used for calendar events and tasks. */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif - #include <sys/stat.h> #include <unistd.h> #include <gnome.h> @@ -39,6 +36,7 @@ #include <gal/e-table/e-cell-toggle.h> #include <gal/e-table/e-cell-text.h> #include <gal/e-table/e-cell-combo.h> +#include <gal/widgets/e-popup-menu.h> #include <e-util/e-dialog-utils.h> #include <widgets/misc/e-cell-date-edit.h> #include <widgets/misc/e-cell-percent.h> @@ -54,7 +52,6 @@ #include "e-comp-editor-registry.h" #include "print.h" #include <e-util/e-icon-factory.h> -#include "e-cal-popup.h" extern ECompEditorRegistry *comp_editor_registry; @@ -79,6 +76,22 @@ static gint e_calendar_table_on_right_click (ETable *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, + gpointer data); +static void e_calendar_table_on_print_task (GtkWidget *menuitem, + gpointer data); +static void e_calendar_table_on_cut (GtkWidget *menuitem, + gpointer data); +static void e_calendar_table_on_copy (GtkWidget *menuitem, + gpointer data); +static void e_calendar_table_on_paste (GtkWidget *menuitem, + gpointer data); +static void e_calendar_table_on_assign (GtkWidget *menuitem, + gpointer data); +static void e_calendar_table_on_forward (GtkWidget *menuitem, + gpointer data); static gint e_calendar_table_on_key_press (ETable *table, gint row, gint col, @@ -106,9 +119,11 @@ static const char* icon_names[E_CALENDAR_MODEL_NUM_ICONS] = { }; static GdkPixbuf* icon_pixbufs[E_CALENDAR_MODEL_NUM_ICONS] = { 0 }; +static GtkTableClass *parent_class; static GdkAtom clipboard_atom = GDK_NONE; -G_DEFINE_TYPE (ECalendarTable, e_calendar_table, GTK_TYPE_TABLE); +E_MAKE_TYPE (e_calendar_table, "ECalendarTable", ECalendarTable, e_calendar_table_class_init, + e_calendar_table_init, GTK_TYPE_TABLE); static void e_calendar_table_class_init (ECalendarTableClass *class) @@ -116,6 +131,7 @@ e_calendar_table_class_init (ECalendarTableClass *class) GtkObjectClass *object_class; GtkWidgetClass *widget_class; + parent_class = g_type_class_peek_parent (class); object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; @@ -294,7 +310,6 @@ e_calendar_table_init (ECalendarTable *cal_table) gint i; GdkPixbuf *pixbuf; GList *strings; - AtkObject *a11y; /* Create the model */ @@ -510,10 +525,6 @@ e_calendar_table_init (ECalendarTable *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); - - a11y = gtk_widget_get_accessible (e_table); - if (a11y) - atk_object_set_name (a11y, _("Task Table")); } @@ -564,7 +575,7 @@ e_calendar_table_destroy (GtkObject *object) cal_table->model = NULL; } - GTK_OBJECT_CLASS (e_calendar_table_parent_class)->destroy (object); + GTK_OBJECT_CLASS (parent_class)->destroy (object); } /** @@ -589,12 +600,10 @@ void e_calendar_table_open_selected (ECalendarTable *cal_table) { ECalModelComponent *comp_data; - icalproperty *prop; comp_data = get_selected_comp (cal_table); - prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); if (comp_data != NULL) - open_task (cal_table, comp_data, prop ? TRUE : FALSE); + open_task (cal_table, comp_data, FALSE); } /** @@ -753,21 +762,6 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table) } /** - * e_calendar_table_get_selected: - * @cal_table: - * - * Get the currently selected ECalModelComponent's on the table. - * - * Return value: A GSList of the components, which should be - * g_slist_free'd when finished with. - **/ -GSList * -e_calendar_table_get_selected (ECalendarTable *cal_table) -{ - return get_selected_objects(cal_table); -} - -/** * e_calendar_table_cut_clipboard: * @cal_table: A calendar table. * @@ -947,7 +941,7 @@ open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean as if (tedit == NULL) { ECalComponent *comp; - tedit = COMP_EDITOR (task_editor_new (comp_data->client, assign)); + tedit = COMP_EDITOR (task_editor_new (comp_data->client)); comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); @@ -966,11 +960,9 @@ static void open_task_by_row (ECalendarTable *cal_table, int row) { ECalModelComponent *comp_data; - icalproperty *prop; comp_data = e_cal_model_get_component_at (cal_table->model, row); - prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); - open_task (cal_table, comp_data, prop ? TRUE : FALSE); + open_task (cal_table, comp_data, FALSE); } static void @@ -983,30 +975,223 @@ e_calendar_table_on_double_click (ETable *table, open_task_by_row (cal_table, row); } -/* popup menu callbacks */ +/* Used from e_table_selected_row_foreach() */ +static void +mark_row_complete_cb (int model_row, gpointer data) +{ + ECalendarTable *cal_table; + + cal_table = E_CALENDAR_TABLE (data); + e_cal_model_tasks_mark_task_complete (E_CAL_MODEL_TASKS (cal_table->model), model_row); +} +/* Callback used for the "mark tasks as complete" menu item */ static void -e_calendar_table_on_open_task (EPopup *ep, EPopupItem *pitem, void *data) +mark_as_complete_cb (GtkWidget *menuitem, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; + ETable *etable; + + cal_table = E_CALENDAR_TABLE (data); + + etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); + e_table_selected_row_foreach (etable, mark_row_complete_cb, cal_table); +} + +/* Opens the URL of the task */ +static void +open_url_cb (GtkWidget *menuitem, gpointer data) +{ + ECalendarTable *cal_table; ECalModelComponent *comp_data; icalproperty *prop; + cal_table = E_CALENDAR_TABLE (data); + + comp_data = get_selected_comp (cal_table); + if (!comp_data) + return; + + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY); + if (!prop) + return; + + gnome_url_show (icalproperty_get_url (prop), NULL); +} + +/* Callback for the "delete tasks" menu item */ +static void +delete_cb (GtkWidget *menuitem, gpointer data) +{ + ECalendarTable *cal_table; + + cal_table = E_CALENDAR_TABLE (data); + e_calendar_table_delete_selected (cal_table); +} + + +enum { + MASK_SINGLE = 1 << 0, /* For commands that work on 1 task. */ + MASK_MULTIPLE = 1 << 1, /* For commands for multiple tasks. */ + MASK_EDITABLE = 1 << 2, /* For commands disabled in read-only folders */ + MASK_ASSIGNABLE = 1 << 3, /* For non-task assignable backends */ + MASK_LACKS_URL = 1 << 4 /* For tasks that don't have the URL property set */ +}; + + +static EPopupMenu tasks_popup_menu [] = { + E_POPUP_ITEM (N_("_Open"), GTK_SIGNAL_FUNC (e_calendar_table_on_open_task), MASK_SINGLE), + E_POPUP_ITEM (N_("Open _Web Page"), GTK_SIGNAL_FUNC (open_url_cb), MASK_SINGLE | MASK_LACKS_URL), + E_POPUP_ITEM (N_("_Save As..."), GTK_SIGNAL_FUNC (e_calendar_table_on_save_as), MASK_SINGLE), + E_POPUP_ITEM (N_("_Print..."), GTK_SIGNAL_FUNC (e_calendar_table_on_print_task), MASK_SINGLE), + + E_POPUP_SEPARATOR, + + E_POPUP_ITEM (N_("C_ut"), GTK_SIGNAL_FUNC (e_calendar_table_on_cut), MASK_EDITABLE), + E_POPUP_ITEM (N_("_Copy"), GTK_SIGNAL_FUNC (e_calendar_table_on_copy), 0), + E_POPUP_ITEM (N_("_Paste"), GTK_SIGNAL_FUNC (e_calendar_table_on_paste), MASK_EDITABLE), + + E_POPUP_SEPARATOR, + + E_POPUP_ITEM (N_("_Assign Task"), GTK_SIGNAL_FUNC (e_calendar_table_on_assign), MASK_SINGLE | MASK_EDITABLE | MASK_ASSIGNABLE), + E_POPUP_ITEM (N_("_Forward as iCalendar"), GTK_SIGNAL_FUNC (e_calendar_table_on_forward), MASK_SINGLE), + E_POPUP_ITEM (N_("_Mark as Complete"), GTK_SIGNAL_FUNC (mark_as_complete_cb), MASK_SINGLE | MASK_EDITABLE), + E_POPUP_ITEM (N_("_Mark Selected Tasks as Complete"), GTK_SIGNAL_FUNC (mark_as_complete_cb), MASK_MULTIPLE | MASK_EDITABLE), + + E_POPUP_SEPARATOR, + + E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (delete_cb), MASK_SINGLE | MASK_EDITABLE), + E_POPUP_ITEM (N_("_Delete Selected Tasks"), GTK_SIGNAL_FUNC (delete_cb), MASK_MULTIPLE | MASK_EDITABLE), + + E_POPUP_TERMINATOR +}; + +static void +setup_popup_icons (EPopupMenu *context_menu) +{ + gint i; + + for (i = 0; context_menu[i].name; i++) { + GtkWidget *pixmap_widget = NULL; + + if (!strcmp (context_menu[i].name, _("_Copy"))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); + else if (!strcmp (context_menu[i].name, _("C_ut"))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU); + else if (!strcmp (context_menu[i].name, _("_Delete")) || + !strcmp (context_menu[i].name, _("_Delete Selected Tasks"))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU); + else if (!strcmp (context_menu[i].name, _("_Open"))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); + else if (!strcmp (context_menu[i].name, _("_Paste"))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU); + else if (!strcmp (context_menu[i].name, _("_Print..."))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU); + else if (!strcmp (context_menu[i].name, _("_Save As..."))) + pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU); + + if (pixmap_widget) + gtk_widget_show (pixmap_widget); + context_menu[i].pixmap_widget = pixmap_widget; + } +} + +static gint +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; + icalproperty *prop; + GSList *selection; + ECalModelComponent *comp_data; + gboolean read_only = TRUE; + + selection = get_selected_objects (cal_table); + if (!selection) + return TRUE; + + comp_data = selection->data; + n_selected = g_slist_length (selection); + if (n_selected == 1) { + hide_mask = MASK_MULTIPLE; + + /* See if the task has the URL property set */ + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY); + if (!prop) + disable_mask |= MASK_LACKS_URL; + } else + hide_mask = MASK_SINGLE; + + e_cal_is_read_only (comp_data->client, &read_only, NULL); + if (read_only) + disable_mask |= MASK_EDITABLE; + + if (e_cal_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) + disable_mask |= MASK_ASSIGNABLE; + + if (e_cal_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK)) + disable_mask |= MASK_ASSIGNABLE; + + setup_popup_icons (tasks_popup_menu); + gtk_menu = e_popup_menu_create (tasks_popup_menu, disable_mask, + hide_mask, cal_table); + + e_popup_menu (gtk_menu, gdk_event); + + g_slist_free (selection); + + 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_val_if_fail(table, FALSE); + + return e_calendar_table_show_popup_menu (table, NULL, + E_CALENDAR_TABLE(data)); +} + +static void +e_calendar_table_on_open_task (GtkWidget *menuitem, + gpointer data) +{ + ECalendarTable *cal_table; + ECalModelComponent *comp_data; + + cal_table = E_CALENDAR_TABLE (data); + comp_data = get_selected_comp (cal_table); - prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY); if (comp_data) - open_task (cal_table, comp_data, prop ? TRUE : FALSE); + open_task (cal_table, comp_data, FALSE); } static void -e_calendar_table_on_save_as (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_save_as (GtkWidget *widget, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; ECalModelComponent *comp_data; char *filename; char *ical_string; FILE *file; + cal_table = E_CALENDAR_TABLE (data); + comp_data = get_selected_comp (cal_table); if (comp_data == NULL) return; @@ -1033,12 +1218,14 @@ e_calendar_table_on_save_as (EPopup *ep, EPopupItem *pitem, void *data) } static void -e_calendar_table_on_print_task (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_print_task (GtkWidget *widget, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; ECalModelComponent *comp_data; ECalComponent *comp; + cal_table = E_CALENDAR_TABLE (data); + comp_data = get_selected_comp (cal_table); if (comp_data == NULL) return; @@ -1051,203 +1238,65 @@ e_calendar_table_on_print_task (EPopup *ep, EPopupItem *pitem, void *data) } static void -e_calendar_table_on_cut (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_cut (GtkWidget *menuitem, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; + cal_table = E_CALENDAR_TABLE (data); e_calendar_table_cut_clipboard (cal_table); } static void -e_calendar_table_on_copy (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_copy (GtkWidget *menuitem, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; + cal_table = E_CALENDAR_TABLE (data); e_calendar_table_copy_clipboard (cal_table); } static void -e_calendar_table_on_paste (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_paste (GtkWidget *menuitem, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; + cal_table = E_CALENDAR_TABLE (data); e_calendar_table_paste_clipboard (cal_table); } static void -e_calendar_table_on_assign (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_assign (GtkWidget *widget, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; ECalModelComponent *comp_data; + cal_table = E_CALENDAR_TABLE (data); + comp_data = get_selected_comp (cal_table); if (comp_data) open_task (cal_table, comp_data, TRUE); } static void -e_calendar_table_on_forward (EPopup *ep, EPopupItem *pitem, void *data) +e_calendar_table_on_forward (GtkWidget *widget, gpointer data) { - ECalendarTable *cal_table = data; + ECalendarTable *cal_table; ECalModelComponent *comp_data; + cal_table = E_CALENDAR_TABLE (data); + comp_data = get_selected_comp (cal_table); if (comp_data) { ECalComponent *comp; comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); - itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL, NULL); + itip_send_comp (E_CAL_COMPONENT_METHOD_PUBLISH, comp, comp_data->client, NULL); g_object_unref (comp); } } -/* Used from e_table_selected_row_foreach() */ -static void -mark_row_complete_cb (int model_row, gpointer data) -{ - ECalendarTable *cal_table; - - cal_table = E_CALENDAR_TABLE (data); - e_cal_model_tasks_mark_task_complete (E_CAL_MODEL_TASKS (cal_table->model), model_row); -} - -/* Callback used for the "mark tasks as complete" menu item */ -static void -mark_as_complete_cb (EPopup *ep, EPopupItem *pitem, void *data) -{ - ECalendarTable *cal_table = data; - ETable *etable; - - etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable)); - e_table_selected_row_foreach (etable, mark_row_complete_cb, cal_table); -} - -/* Opens the URL of the task */ -static void -open_url_cb (EPopup *ep, EPopupItem *pitem, void *data) -{ - ECalendarTable *cal_table = data; - ECalModelComponent *comp_data; - icalproperty *prop; - - comp_data = get_selected_comp (cal_table); - if (!comp_data) - return; - - prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_URL_PROPERTY); - if (!prop) - return; - - gnome_url_show (icalproperty_get_url (prop), NULL); -} - -/* Callback for the "delete tasks" menu item */ -static void -delete_cb (EPopup *ep, EPopupItem *pitem, void *data) -{ - ECalendarTable *cal_table = data; - - e_calendar_table_delete_selected (cal_table); -} - -static EPopupItem tasks_popup_items [] = { - { E_POPUP_ITEM, "00.open", N_("_Open"), e_calendar_table_on_open_task, NULL, GTK_STOCK_OPEN, E_CAL_POPUP_SELECT_ONE }, - { E_POPUP_ITEM, "05.openweb", N_("Open _Web Page"), open_url_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_HASURL }, - { E_POPUP_ITEM, "10.saveas", N_("_Save As..."), e_calendar_table_on_save_as, NULL, GTK_STOCK_SAVE_AS, E_CAL_POPUP_SELECT_ONE }, - { E_POPUP_ITEM, "20.print", N_("_Print..."), e_calendar_table_on_print_task, NULL, GTK_STOCK_PRINT, E_CAL_POPUP_SELECT_ONE }, - - { E_POPUP_BAR, "30.bar" }, - - { E_POPUP_ITEM, "40.cut", N_("C_ut"), e_calendar_table_on_cut, NULL, GTK_STOCK_CUT, 0, E_CAL_POPUP_SELECT_EDITABLE }, - { E_POPUP_ITEM, "50.copy", N_("_Copy"), e_calendar_table_on_copy, NULL, GTK_STOCK_COPY, 0, 0 }, - { E_POPUP_ITEM, "60.paste", N_("_Paste"), e_calendar_table_on_paste, NULL, GTK_STOCK_PASTE, 0, E_CAL_POPUP_SELECT_EDITABLE }, - - { E_POPUP_BAR, "70.bar" }, - - { E_POPUP_ITEM, "80.assign", N_("_Assign Task"), e_calendar_table_on_assign, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE|E_CAL_POPUP_SELECT_ASSIGNABLE }, - { E_POPUP_ITEM, "90.forward", N_("_Forward as iCalendar"), e_calendar_table_on_forward, NULL, "stock_mail-forward", E_CAL_POPUP_SELECT_ONE }, - { E_POPUP_ITEM, "a0.markonecomplete", N_("_Mark as Complete"), mark_as_complete_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE }, - { E_POPUP_ITEM, "b0.markmanycomplete", N_("_Mark Selected Tasks as Complete"), mark_as_complete_cb, NULL, NULL, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE }, - - { E_POPUP_BAR, "c0.bar" }, - - { E_POPUP_ITEM, "d0.delete", N_("_Delete"), delete_cb, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE }, - { E_POPUP_ITEM, "e0.deletemany", N_("_Delete Selected Tasks"), delete_cb, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE }, -}; - -static void -ect_popup_free(EPopup *ep, GSList *items, void *data) -{ - g_slist_free(items); -} - -static gint -e_calendar_table_show_popup_menu (ETable *table, - GdkEvent *gdk_event, - ECalendarTable *cal_table) -{ - GtkMenu *menu; - GSList *selection, *l, *menus = NULL; - GPtrArray *events; - ECalPopup *ep; - ECalPopupTargetSelect *t; - int i; - - selection = get_selected_objects (cal_table); - if (!selection) - return TRUE; - - /** @HookPoint-ECalPopup: Tasks Table Context Menu - * @Id: org.gnome.evolution.tasks.table.popup - * @Class: org.gnome.evolution.calendar.popup:1.0 - * @Target: ECalPopupTargetSelect - * - * The context menu on the tasks table. - */ - ep = e_cal_popup_new("org.gnome.evolution.tasks.table.popup"); - - events = g_ptr_array_new(); - for (l=selection;l;l=g_slist_next(l)) - g_ptr_array_add(events, e_cal_model_copy_component_data((ECalModelComponent *)l->data)); - g_slist_free(selection); - - t = e_cal_popup_target_new_select(ep, cal_table->model, events); - t->target.widget = (GtkWidget *)cal_table; - - for (i=0;i<sizeof(tasks_popup_items)/sizeof(tasks_popup_items[0]);i++) - menus = g_slist_prepend(menus, &tasks_popup_items[i]); - e_popup_add_items((EPopup *)ep, menus, NULL, ect_popup_free, cal_table); - - menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0); - - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, gdk_event?gdk_event->button.button:0, - gdk_event?gdk_event->button.time:gtk_get_current_event_time()); - - 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_val_if_fail(table, FALSE); - - return e_calendar_table_show_popup_menu (table, NULL, - E_CALENDAR_TABLE(data)); -} - static gint e_calendar_table_on_key_press (ETable *table, gint row, @@ -1256,7 +1305,7 @@ e_calendar_table_on_key_press (ETable *table, ECalendarTable *cal_table) { if (event->keyval == GDK_Delete) { - delete_cb (NULL, NULL, cal_table); + delete_cb (NULL, cal_table); return TRUE; } else if ((event->keyval == GDK_o) &&(event->state & GDK_CONTROL_MASK)) { |