diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-06-14 19:51:11 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-06-14 19:51:11 +0800 |
commit | a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e (patch) | |
tree | 43b8085fe0da3c6345571ad914c8669c7f37f590 /calendar/gui | |
parent | 5938953eeaf3ccb311b6d24dc0cd70c88de815c9 (diff) | |
download | gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.tar gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.tar.gz gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.tar.bz2 gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.tar.lz gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.tar.xz gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.tar.zst gsoc2013-evolution-a241f9afe91b2b45db6aa242ffb98fc2a3d91c4e.zip |
added popup menu items for cut/copy/paste
2001-06-14 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-day-view.[ch]: added popup menu items for cut/copy/paste
* gui/e-week-view.[ch]: ditto
svn path=/trunk/; revision=10229
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-day-view.c | 63 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 71 |
2 files changed, 125 insertions, 9 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index cd3f08aa77..71db1c05b2 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -321,6 +321,9 @@ static void e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data); static void e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data); +static void e_day_view_on_cut (GtkWidget *widget, gpointer data); +static void e_day_view_on_copy (GtkWidget *widget, gpointer data); +static void e_day_view_on_paste (GtkWidget *widget, gpointer data); static void e_day_view_on_schedule_meet (GtkWidget *widget, gpointer data); static void e_day_view_on_unrecur_appointment (GtkWidget *widget, @@ -3195,6 +3198,12 @@ static EPopupMenu child_items [] = { e_day_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING }, { N_("Delete this Appointment"), NULL, e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING }, + { N_("Cut"), NULL, + e_day_view_on_cut, NULL, MASK_EDITABLE | MASK_EDITING }, + { N_("Copy"), NULL, + e_day_view_on_copy, NULL, 0 }, + { N_("Paste"), NULL, + e_day_view_on_paste, NULL, MASK_EDITABLE | MASK_EDITING }, { N_("Schedule Meeting"), NULL, e_day_view_on_schedule_meet, NULL, MASK_EDITING }, @@ -3378,6 +3387,56 @@ e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data) } } +static void +e_day_view_on_cut (GtkWidget *widget, gpointer data) +{ + EDayView *day_view; + EDayViewEvent *event; + const char *uid; + + day_view = E_DAY_VIEW (data); + + e_day_view_on_copy (widget, data); + + event = e_day_view_get_popup_menu_event (day_view); + if (event == NULL) + return; + + cal_component_get_uid (event->comp, &uid); + cal_client_remove_object (day_view->client, uid); +} + +static void +e_day_view_on_copy (GtkWidget *widget, gpointer data) +{ + EDayView *day_view; + EDayViewEvent *event; + char *comp_str; + + day_view = E_DAY_VIEW (data); + + event = e_day_view_get_popup_menu_event (day_view); + if (event == NULL) + return; + + comp_str = cal_component_get_as_string (event->comp); + if (day_view->clipboard_selection) + g_free (day_view->clipboard_selection); + day_view->clipboard_selection = comp_str; + + gtk_selection_owner_set (day_view->invisible, clipboard_atom, GDK_CURRENT_TIME); +} + +static void +e_day_view_on_paste (GtkWidget *widget, gpointer data) +{ + EDayView *day_view = E_DAY_VIEW (data); + + gtk_selection_convert (day_view->invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + GDK_CURRENT_TIME); +} static void e_day_view_on_schedule_meet (GtkWidget *widget, gpointer data) @@ -6462,8 +6521,4 @@ static void selection_received (GtkWidget *invisible, selection_data->type != GDK_SELECTION_TYPE_STRING) { return; } - - if (day_view->clipboard_selection != NULL) - g_free (day_view->clipboard_selection); - day_view->clipboard_selection = g_strdup ((gchar *) selection_data->data); } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index ca1f05faec..fa4ea144d0 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -1,8 +1,9 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Author : + * Authors : * Damon Chaplin <damon@ximian.com> + * Rodrigo Moya <rodrigo@ximian.com> * * Copyright 1999, Helix Code, Inc. * Copyright 2001, Ximian, Inc. @@ -162,6 +163,9 @@ static void e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data); static void e_week_view_on_delete_appointment (GtkWidget *widget, gpointer data); +static void e_week_view_on_cut (GtkWidget *widget, gpointer data); +static void e_week_view_on_copy (GtkWidget *widget, gpointer data); +static void e_week_view_on_paste (GtkWidget *widget, gpointer data); static void e_week_view_on_schedule_meet (GtkWidget *widget, gpointer data); static void e_week_view_on_unrecur_appointment (GtkWidget *widget, @@ -3032,6 +3036,12 @@ static EPopupMenu child_items [] = { e_week_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING }, { N_("Delete this Appointment"), NULL, e_week_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING }, + { N_("Cut"), NULL, + e_week_view_on_cut, NULL, MASK_EDITING | MASK_EDITABLE }, + { N_("Copy"), NULL, + e_week_view_on_copy, NULL, MASK_EDITING | MASK_EDITABLE }, + { N_("Paste"), NULL, + e_week_view_on_paste, NULL, 0 }, { N_("Schedule Meeting"), NULL, e_week_view_on_schedule_meet, NULL, MASK_EDITING }, { "", NULL, NULL, NULL, 0}, @@ -3214,6 +3224,61 @@ e_week_view_on_delete_appointment (GtkWidget *widget, gpointer data) } static void +e_week_view_on_cut (GtkWidget *widget, gpointer data) +{ + EWeekView *week_view; + EWeekViewEvent *event; + const char *uid; + + week_view = E_WEEK_VIEW (data); + + e_week_view_on_copy (widget, data); + + if (week_view->popup_event_num == -1) + return; + + event = &g_array_index (week_view->events, EWeekViewEvent, + week_view->popup_event_num); + + cal_component_get_uid (event->comp, &uid); + cal_client_remove_object (week_view->client, uid); +} + +static void +e_week_view_on_copy (GtkWidget *widget, gpointer data) +{ + EWeekView *week_view; + EWeekViewEvent *event; + char *comp_str; + + week_view = E_WEEK_VIEW (data); + + if (week_view->popup_event_num == -1) + return; + + event = &g_array_index (week_view->events, EWeekViewEvent, + week_view->popup_event_num); + + comp_str = cal_component_get_as_string (event->comp); + if (week_view->clipboard_selection) + g_free (week_view->clipboard_selection); + week_view->clipboard_selection = comp_str; + + gtk_selection_owner_set (week_view->invisible, clipboard_atom, GDK_CURRENT_TIME); +} + +static void +e_week_view_on_paste (GtkWidget *widget, gpointer data) +{ + EWeekView *week_view = E_WEEK_VIEW (data); + + gtk_selection_convert (week_view->invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + GDK_CURRENT_TIME); +} + +static void e_week_view_on_schedule_meet (GtkWidget *widget, gpointer data) { EWeekView *week_view; @@ -3408,8 +3473,4 @@ static void selection_received (GtkWidget *invisible, selection_data->type != GDK_SELECTION_TYPE_STRING) { return; } - - if (week_view->clipboard_selection != NULL) - g_free (week_view->clipboard_selection); - week_view->clipboard_selection = g_strdup ((gchar *) selection_data->data); } |