aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-day-view.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2003-04-23 02:06:38 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2003-04-23 02:06:38 +0800
commit95d8e5b20bdc58eb2a72a6f8f75ca99cbd6b169b (patch)
treebb270c7030c3dad20de98b0f9d68455e65fda34b /calendar/gui/e-day-view.c
parent4167920c363eb3ff08268ffe250c4786fe72b0ac (diff)
downloadgsoc2013-evolution-95d8e5b20bdc58eb2a72a6f8f75ca99cbd6b169b.tar.gz
gsoc2013-evolution-95d8e5b20bdc58eb2a72a6f8f75ca99cbd6b169b.tar.zst
gsoc2013-evolution-95d8e5b20bdc58eb2a72a6f8f75ca99cbd6b169b.zip
Fixes #22444
2003-04-21 Rodrigo Moya <rodrigo@ximian.com> Fixes #22444 * gui/calendar-commands.c: added new verbs for occurrence-related menu items. (delete_occurrence_cmd): added callback for "Delete this occurrence" menu item. "Delete all occurrences" is just the same as "Delete". (sensitize_calendar_commands): sensitive ocurrence-related menu items. * gui/gnome-cal.[ch] (gnome_calendar_delete_selected_occurrence): new function. (gnome_calendar_get_current_view_widget): made this public. * gui/e-week-view.[ch] (e_week_view_get_selected_event): (e_week_view_delete_occurrence): new functions. (e_week_view_delete_occurrence_internal): real implementation of the 'Delete Occurrence' logic. (e_week_view_on_delete_occurrence): call delete_instance_internal. * gui/e-day-view.[ch] (e_day_view_get_selected_event): (e_day_view_delete_occurrence): new functions. (e_week_view_delete_occurrence_internal): real implementation of the 'Delete Occurrence' logic. (e_week_view_on_delete_occurrence): call delete_occurrence_internal. svn path=/trunk/; revision=20917
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r--calendar/gui/e-day-view.c118
1 files changed, 84 insertions, 34 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 90e8f28069..27b512a63a 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -4077,40 +4077,6 @@ e_day_view_on_settings (GtkWidget *widget, gpointer data)
}
static void
-e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
- CalComponent *comp;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- if (cal_component_is_instance (event->comp)) {
- const char *uid;
-
- cal_component_get_uid (event->comp, &uid);
- if (cal_client_remove_object_with_mod (day_view->client, uid, CALOBJ_MOD_THIS) != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
-
- return;
- }
-
- /* We must duplicate the CalComponent, or we won't know it has changed
- when we get the "update_event" callback. */
- comp = cal_component_clone (event->comp);
- cal_comp_util_add_exdate (comp, event->start, day_view->zone);
-
- if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
-
- g_object_unref (comp);
-}
-
-static void
e_day_view_delete_event_internal (EDayView *day_view, EDayViewEvent *event)
{
CalComponentVType vtype;
@@ -4182,6 +4148,69 @@ e_day_view_delete_event (EDayView *day_view)
e_day_view_delete_event_internal (day_view, event);
}
+static void
+e_day_view_delete_occurrence_internal (EDayView *day_view, EDayViewEvent *event)
+{
+ CalComponent *comp;
+
+ if (cal_component_is_instance (event->comp)) {
+ const char *uid;
+
+ cal_component_get_uid (event->comp, &uid);
+ if (cal_client_remove_object_with_mod (day_view->client, uid, CALOBJ_MOD_THIS) != CAL_CLIENT_RESULT_SUCCESS)
+ g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
+
+ return;
+ }
+
+ /* We must duplicate the CalComponent, or we won't know it has changed
+ when we get the "update_event" callback. */
+ comp = cal_component_clone (event->comp);
+ cal_comp_util_add_exdate (comp, event->start, day_view->zone);
+
+ if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
+ g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
+
+ g_object_unref (comp);
+}
+
+static void
+e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ EDayViewEvent *event;
+ CalComponent *comp;
+
+ day_view = E_DAY_VIEW (data);
+
+ event = e_day_view_get_popup_menu_event (day_view);
+ if (event == NULL)
+ return;
+
+ e_day_view_delete_occurrence_internal (day_view, event);
+}
+
+void
+e_day_view_delete_occurrence (EDayView *day_view)
+{
+ EDayViewEvent *event;
+
+ g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
+ if (day_view->editing_event_day == -1)
+ return;
+
+ if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT)
+ event = &g_array_index (day_view->long_events,
+ EDayViewEvent,
+ day_view->editing_event_num);
+ else
+ event = &g_array_index (day_view->events[day_view->editing_event_day],
+ EDayViewEvent,
+ day_view->editing_event_num);
+
+ e_day_view_delete_occurrence_internal (day_view, event);
+}
static void
e_day_view_on_cut (GtkWidget *widget, gpointer data)
@@ -7756,6 +7785,27 @@ e_day_view_get_num_events_selected (EDayView *day_view)
return (day_view->editing_event_day != -1) ? 1 : 0;
}
+/* Returns the currently-selected event, or NULL if none */
+CalComponent *
+e_day_view_get_selected_event (EDayView *day_view)
+{
+ EDayViewEvent *event;
+
+ g_return_val_if_fail (E_IS_DAY_VIEW (day_view), NULL);
+ g_return_val_if_fail (day_view->editing_event_day != -1, NULL);
+
+ if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT)
+ event = &g_array_index (day_view->long_events,
+ EDayViewEvent,
+ day_view->editing_event_num);
+ else
+ event = &g_array_index (day_view->events[day_view->editing_event_day],
+ EDayViewEvent,
+ day_view->editing_event_num);
+
+ return event ? event->comp : NULL;
+}
+
/* Displays messages on the status bar. */
void
e_day_view_set_status_message (EDayView *day_view, const char *message)