diff options
Diffstat (limited to 'calendar/gui/e-calendar-view.c')
-rw-r--r-- | calendar/gui/e-calendar-view.c | 186 |
1 files changed, 36 insertions, 150 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 4ceb8910c3..cc51599440 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -37,15 +37,14 @@ #include <e-util/e-icon-factory.h> #include <libecal/e-cal-time-util.h> #include <libecal/e-cal-component.h> +#include <shell/e-shell.h> #include "common/authentication.h" #include "calendar-commands.h" -#include "calendar-component.h" #include "calendar-config.h" #include "comp-util.h" #include "e-cal-model-calendar.h" #include "e-calendar-view.h" -#include "e-comp-editor-registry.h" #include "itip-utils.h" #include "dialogs/delete-comp.h" #include "dialogs/delete-error.h" @@ -56,7 +55,7 @@ #include "dialogs/select-source-dialog.h" #include "print.h" #include "goto.h" -#include "ea-calendar.h" +#include "a11y/ea-calendar.h" #include "e-cal-popup.h" #include "misc.h" @@ -67,10 +66,6 @@ struct _ECalendarViewPrivate { /* The calendar model we are monitoring */ ECalModel *model; - /* Current activity (for the EActivityHandler, i.e. the status bar). */ - EActivityHandler *activity_handler; - guint activity_id; - /* The default category */ char *default_category; }; @@ -79,7 +74,6 @@ static void e_calendar_view_get_property (GObject *object, guint property_id, GV static void e_calendar_view_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); static void e_calendar_view_destroy (GtkObject *object); -extern ECompEditorRegistry *comp_editor_registry; /* Property IDs */ enum props { @@ -254,8 +248,10 @@ e_calendar_view_class_init (ECalendarViewClass *klass) GDK_CONTROL_MASK, "open_event", 0); +#if 0 /* KILL-BONOBO */ /* init the accessibility support for e_day_view */ e_cal_view_a11y_init (); +#endif } @@ -263,6 +259,7 @@ void e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart, icaltimezone *default_zone, icalcomponent *icalcomp, gboolean in_top_canvas) { +#if 0 /* KILL-BONOBO */ ECalComponent *comp; struct icaltimetype itime, old_dtstart, old_dtend; time_t tt_start, tt_end, new_dtstart = 0; @@ -380,6 +377,7 @@ e_calendar_view_add_event (ECalendarView *cal_view, ECal *client, time_t dtstart } g_object_unref (comp); +#endif } static void @@ -536,55 +534,6 @@ e_calendar_view_set_use_24_hour_format (ECalendarView *cal_view, gboolean use_24 e_cal_model_set_use_24_hour_format (cal_view->priv->model, use_24_hour); } -void -e_calendar_view_set_activity_handler (ECalendarView *cal_view, EActivityHandler *activity_handler) -{ - ECalendarViewPrivate *priv; - - g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); - - priv = cal_view->priv; - - priv->activity_handler = activity_handler; -} - -void -e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *message, int percent) -{ - ECalendarViewPrivate *priv; - - g_return_if_fail (E_IS_CALENDAR_VIEW (cal_view)); - - priv = cal_view->priv; - - if (!priv->activity_handler) - return; - - if (!message || !*message) { - if (priv->activity_id != 0) { - e_activity_handler_operation_finished (priv->activity_handler, priv->activity_id); - priv->activity_id = 0; - } - } else if (priv->activity_id == 0) { - char *client_id = g_strdup_printf ("%p", (gpointer) cal_view); - - priv->activity_id = e_activity_handler_operation_started ( - priv->activity_handler, client_id, message, TRUE); - - g_free (client_id); - } else { - double progress; - - if (percent < 0) - progress = -1.0; - else { - progress = ((double) percent / 100); - } - - e_activity_handler_operation_progressing (priv->activity_handler, priv->activity_id, message, progress); - } -} - GList * e_calendar_view_get_selected_events (ECalendarView *cal_view) { @@ -655,7 +604,9 @@ e_calendar_view_cut_clipboard (ECalendarView *cal_view) if (!selected) return; +#if 0 /* KILL-BONOBO */ e_calendar_view_set_status_message (cal_view, _("Deleting selected objects"), -1); +#endif e_calendar_view_copy_clipboard (cal_view); for (l = selected; l != NULL; l = l->next) { @@ -700,7 +651,9 @@ e_calendar_view_cut_clipboard (ECalendarView *cal_view) g_object_unref (comp); } +#if 0 /* KILL-BONOBO */ e_calendar_view_set_status_message (cal_view, NULL, -1); +#endif g_list_free (selected); } @@ -869,7 +822,9 @@ clipboard_get_calendar_data (ECalendarView *cal_view, const gchar *text) if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT) return; +#if 0 /* KILL-BONOBO */ e_calendar_view_set_status_message (cal_view, _("Updating objects"), -1); +#endif e_calendar_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end); if ((selected_time_end - selected_time_start) == 60 * 60 * 24) @@ -917,7 +872,9 @@ clipboard_get_calendar_data (ECalendarView *cal_view, const gchar *text) e_calendar_view_add_event (cal_view, client, selected_time_start, default_zone, icalcomp, in_top_canvas); } +#if 0 /* KILL-BONOBO */ e_calendar_view_set_status_message (cal_view, NULL, -1); +#endif } static void @@ -1268,11 +1225,13 @@ on_new_meeting (EPopup *ep, EPopupItem *pitem, void *data) static void on_new_task (EPopup *ep, EPopupItem *pitem, void *data) { +#if 0 /* KILL-BONOBO */ ECalendarView *cal_view = data; time_t dtstart, dtend; e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend); gnome_calendar_new_task (cal_view->priv->calendar, &dtstart, &dtend); +#endif } static void @@ -1286,9 +1245,11 @@ on_goto_date (EPopup *ep, EPopupItem *pitem, void *data) static void on_goto_today (EPopup *ep, EPopupItem *pitem, void *data) { +#if 0 /* KILL-BONOBO */ ECalendarView *cal_view = data; - calendar_goto_today (cal_view->priv->calendar); + gnome_calendar_goto_today (cal_view->priv->calendar); +#endif } static void @@ -1313,9 +1274,11 @@ on_edit_appointment (EPopup *ep, EPopupItem *pitem, void *data) static void on_print (EPopup *ep, EPopupItem *pitem, void *data) { +#if 0 /* KILL-BONOBO */ ECalendarView *cal_view = data; calendar_command_print (cal_view->priv->calendar, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); +#endif } static void @@ -1475,16 +1438,20 @@ transfer_selected_items (ECalendarView *cal_view, gboolean remove_item) return; } +#if 0 /* KILL-BONOBO */ /* process all selected events */ if (remove_item) e_calendar_view_set_status_message (cal_view, _("Moving items"), -1); else e_calendar_view_set_status_message (cal_view, _("Copying items"), -1); +#endif for (l = selected; l != NULL; l = l->next) transfer_item_to ((ECalendarViewEvent *) l->data, dest_client, remove_item); +#if 0 /* KILL-BONOBO */ e_calendar_view_set_status_message (cal_view, NULL, -1); +#endif /* free memory */ g_object_unref (destination_source); @@ -1836,69 +1803,6 @@ static EPopupItem ecv_child_items [] = { { E_POPUP_ITEM, "54.delete", N_("Delete _All Occurrences"), on_delete_appointment, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_RECURRING, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_EDITABLE }, }; -static void -ecv_popup_free (EPopup *ep, GSList *list, void *data) -{ - g_slist_free(list); -} - -GtkMenu * -e_calendar_view_create_popup_menu (ECalendarView *cal_view) -{ - ECalPopup *ep; - GSList *menus = NULL; - GList *selected, *l; - int i; - ECalPopupTargetSelect *t; - ECalModel *model; - GPtrArray *events; - - g_return_val_if_fail (E_IS_CALENDAR_VIEW (cal_view), NULL); - - /* We could do this using a factory on the ECalPopup class, - * that way we would get called implicitly whenever a popup - * menu was created rather than everyone having to call us. - * We could also have a different menu id for each view */ - - /** @HookPoint-ECalPopup: Calendar Main View Context Menu - * @Id: org.gnome.evolution.calendar.view.popup - * @Class: org.gnome.evolution.calendar.popup:1.0 - * @Target: ECalPopupTargetSelect - * - * The context menu on the main calendar view. This menu - * applies to all view types. - */ - ep = e_cal_popup_new("org.gnome.evolution.calendar.view.popup"); - - model = e_calendar_view_get_model(cal_view); - events = g_ptr_array_new(); - selected = e_calendar_view_get_selected_events(cal_view); - for (l=selected;l;l=g_list_next(l)) { - ECalendarViewEvent *event = l->data; - - if (event) - g_ptr_array_add(events, e_cal_model_copy_component_data(event->comp_data)); - } - g_list_free(selected); - - t = e_cal_popup_target_new_select(ep, model, events); - t->target.widget = (GtkWidget *)cal_view; - - if (t->events->len == 0) { - for (i=0;i<sizeof(ecv_main_items)/sizeof(ecv_main_items[0]);i++) - menus = g_slist_prepend(menus, &ecv_main_items[i]); - - gnome_calendar_view_popup_factory(cal_view->priv->calendar, (EPopup *)ep, "60.view"); - } else { - for (i=0;i<sizeof(ecv_child_items)/sizeof(ecv_child_items[0]);i++) - menus = g_slist_prepend(menus, &ecv_child_items[i]); - } - - e_popup_add_items((EPopup *)ep, menus, NULL, ecv_popup_free, cal_view); - - return e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0); -} - void e_calendar_view_open_event (ECalendarView *cal_view) { @@ -2097,7 +2001,9 @@ e_calendar_view_new_appointment (ECalendarView *cal_view) static void object_created_cb (CompEditor *ce, ECalendarView *cal_view) { +#if 0 /* KILL-BONOBO */ gnome_calendar_emit_user_created_signal (cal_view, e_calendar_view_get_calendar (cal_view), comp_editor_get_client (ce)); +#endif } CompEditor * @@ -2106,13 +2012,16 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view, ECal *client, ic CompEditor *ce; const char *uid; ECalComponent *comp; + EShell *shell; + /* FIXME ECalendarView should own an EShell pointer. */ + shell = e_shell_get_default (); uid = icalcomponent_get_uid (icalcomp); - ce = e_comp_editor_registry_find (comp_editor_registry, uid); + ce = comp_editor_find_instance (uid); if (!ce) { - ce = event_editor_new (client, flags); + ce = event_editor_new (client, shell, flags); g_signal_connect (ce, "object_created", G_CALLBACK (object_created_cb), cal_view); @@ -2122,8 +2031,6 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view, ECal *client, ic if (flags & COMP_EDITOR_MEETING) event_editor_show_meeting (EVENT_EDITOR (ce)); - e_comp_editor_registry_add (comp_editor_registry, ce, FALSE); - g_object_unref (comp); } @@ -2660,29 +2567,8 @@ draw_curved_rectangle (cairo_t *cr, double x0, double y0, static void error_response(GtkWidget *widget, gint response, void *data) { - gtk_widget_destroy (widget); -} - -void -e_calendar_utils_show_error_silent (GtkWidget *widget) -{ - EActivityHandler *handler = calendar_component_peek_activity_handler (calendar_component_peek ()); - - if(!g_object_get_data ((GObject *) widget, "response-handled")) { - g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL); - } - - e_activity_handler_make_error (handler, "calendar", E_LOG_ERROR, widget); -} - -void -e_calendar_utils_show_info_silent (GtkWidget *widget) -{ - EActivityHandler *handler = calendar_component_peek_activity_handler (calendar_component_peek ()); - - if(!g_object_get_data ((GObject *) widget, "response-handled")) { - g_signal_connect(widget, "response", G_CALLBACK(error_response), NULL); - } - - e_activity_handler_make_error (handler, "calendar", E_LOG_WARNINGS, widget); + if (response == GTK_RESPONSE_DELETE_EVENT) + gtk_widget_destroy(widget); + else if (response == GTK_RESPONSE_OK) + gtk_widget_destroy(widget); } |