diff options
author | Not Zed <NotZed@Ximian.com> | 2004-10-07 09:42:50 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-10-07 09:42:50 +0800 |
commit | eb114d32c827f54d0c752ee022f78fb35d5ee4ef (patch) | |
tree | e237e128549b5ad2cce8be3c481ab32ba886ddf4 /calendar/gui/e-cal-popup.c | |
parent | bfaace723bb0199325f79ac52c32260df9e524fb (diff) | |
download | gsoc2013-evolution-eb114d32c827f54d0c752ee022f78fb35d5ee4ef.tar.gz gsoc2013-evolution-eb114d32c827f54d0c752ee022f78fb35d5ee4ef.tar.zst gsoc2013-evolution-eb114d32c827f54d0c752ee022f78fb35d5ee4ef.zip |
rename to view_popup_factory. Make it build an epopup item list directly.
2004-10-06 Not Zed <NotZed@Ximian.com>
* gui/gnome-cal.c (gnome_calendar_setup_view_popup): rename to
view_popup_factory. Make it build an epopup item list directly.
Can't re-use the galview cruft :-/
(gnome_calendar_discard_view_popup): no longer needed.
(gc_set_view, gc_save_custom_view, gc_define_views_response)
(gc_define_views): implement the gal-view popup menu items.
* gui/gnome-cal.h:
* gui/e-week-view.h:
* gui/e-day-view.h:
* gui/e-cal-list-view.h: removed old e-popup-menu header.
* gui/e-calendar-view.c (setup_popup_icons): removed.
(e_calendar_view_create_popup_menu): converted to use e-popup.
(on_paste, on_copy, on_cut, on_delete_occurrence)
(on_unrecur_appointment, on_delete_appointment, on_publish)
(on_forward, on_meeting, on_move_to, on_copy_to, on_print_event)
(on_save_as, on_print, on_edit_appointment, on_goto_today)
(on_goto_date, on_new_task, on_new_meeting, on_new_event)
(on_new_appointment): convert to use e-popup stuff.
* gui/tasks-component.c (popup_event_cb): e-popup api changes.
* gui/e-cal-popup.c (e_cal_popup_target_new_select): implement the
selection target.
(ecalp_target_free): and free it.
* gui/e-cal-model.h: Make the ECalModel struct non-anonymous so it
can be forward-declared.
* gui/calendar-component.c (popup_event_cb): e-popup api changes.
svn path=/trunk/; revision=27489
Diffstat (limited to 'calendar/gui/e-cal-popup.c')
-rw-r--r-- | calendar/gui/e-cal-popup.c | 80 |
1 files changed, 76 insertions, 4 deletions
diff --git a/calendar/gui/e-cal-popup.c b/calendar/gui/e-cal-popup.c index d0a751fce1..55bd7bccbf 100644 --- a/calendar/gui/e-cal-popup.c +++ b/calendar/gui/e-cal-popup.c @@ -31,6 +31,10 @@ #include "e-cal-popup.h" #include "widgets/misc/e-source-selector.h" +#include "gui/e-calendar-view.h" +#include "gui/e-cal-model.h" +#include "itip-utils.h" + static GObjectClass *ecalp_parent; static void @@ -51,9 +55,12 @@ ecalp_target_free(EPopup *ep, EPopupTarget *t) switch (t->type) { case E_CAL_POPUP_TARGET_SELECT: { ECalPopupTargetSelect *s = (ECalPopupTargetSelect *)t; + int i; - /* FIXME: implement */ - s = s; + for (i=0;i<s->events->len;i++) + e_cal_model_free_component_data(s->events->pdata[i]); + g_ptr_array_free(s->events, TRUE); + g_object_unref(s->model); break; } case E_CAL_POPUP_TARGET_SOURCE: { ECalPopupTargetSource *s = (ECalPopupTargetSource *)t; @@ -110,12 +117,69 @@ ECalPopup *e_cal_popup_new(const char *menuid) * Return value: **/ ECalPopupTargetSelect * -e_cal_popup_target_new_select(ECalPopup *eabp) +e_cal_popup_target_new_select(ECalPopup *eabp, ECalendarView *view) { ECalPopupTargetSelect *t = e_popup_target_new(&eabp->popup, E_CAL_POPUP_TARGET_SELECT, sizeof(*t)); guint32 mask = ~0; + GList *events, *l; + ECal *client; + gboolean read_only; + + t->model = e_calendar_view_get_model(view); + g_object_ref(t->model); + t->events = g_ptr_array_new(); + l = events = e_calendar_view_get_selected_events(view); + for (l=events;l;l=g_list_next(l)) { + ECalendarViewEvent *event = l->data; + + if (event) + g_ptr_array_add(t->events, e_cal_model_copy_component_data(event->comp_data)); + } + + /* In reality this is only ever called with a single event or none */ + + if (t->events->len == 0) { + client = e_cal_model_get_default_client(t->model); + } else { + ECalendarViewEvent *event = (ECalendarViewEvent *)events->data; + + mask &= ~E_CAL_POPUP_SELECT_MANY; + if (events->next == NULL) + mask &= ~E_CAL_POPUP_SELECT_ONE; + + if (e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) + mask &= ~E_CAL_POPUP_SELECT_RECURRING; + else + mask &= ~E_CAL_POPUP_SELECT_NONRECURRING; + + if (e_cal_util_component_is_instance (event->comp_data->icalcomp)) + mask &= ~E_CAL_POPUP_SELECT_INSTANCE; + + if (e_cal_util_component_has_organizer (event->comp_data->icalcomp)) { + ECalComponent *comp; + + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); + if (!itip_organizer_is_user (comp, event->comp_data->client)) + mask &= ~E_CAL_POPUP_SELECT_ORGANIZER; + + g_object_unref (comp); + } else { + /* organiser is synonym for owner in this case */ + mask &= ~(E_CAL_POPUP_SELECT_ORGANIZER|E_CAL_POPUP_SELECT_NOTMEETING); + } + + client = event->comp_data->client; + } + + g_list_free(events); + + e_cal_is_read_only(client, &read_only, NULL); + if (!read_only) + mask &= ~E_CAL_POPUP_SELECT_EDITABLE; - /* FIXME: impelement */ + /* This bit isn't implemented ... */ + mask &= ~E_CAL_POPUP_SELECT_NOTEDITING; t->target.mask = mask; @@ -185,12 +249,20 @@ static void *ecalph_parent_class; static const EPopupHookTargetMask ecalph_select_masks[] = { { "one", E_CAL_POPUP_SELECT_ONE }, { "many", E_CAL_POPUP_SELECT_MANY }, + { "editable", E_CAL_POPUP_SELECT_EDITABLE }, + { "recurring", E_CAL_POPUP_SELECT_RECURRING }, + { "non-recurring", E_CAL_POPUP_SELECT_NONRECURRING }, + { "instance", E_CAL_POPUP_SELECT_INSTANCE }, + { "organizer", E_CAL_POPUP_SELECT_ORGANIZER }, + { "not-editing", E_CAL_POPUP_SELECT_NOTEDITING }, + { "not-meeting", E_CAL_POPUP_SELECT_NOTMEETING }, { 0 } }; static const EPopupHookTargetMask ecalph_source_masks[] = { { "primary", E_CAL_POPUP_SOURCE_PRIMARY }, { "system", E_CAL_POPUP_SOURCE_SYSTEM }, + { "user", E_CAL_POPUP_SOURCE_USER }, { 0 } }; |