aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/e-day-view.c63
-rw-r--r--calendar/gui/e-week-view.c71
3 files changed, 131 insertions, 9 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index cf5ff30325..2bc9110256 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+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
+
2001-06-14 Damon Chaplin <damon@ximian.com>
* gui/e-timezone-entry.[hc]: new widget to enter a timezone.
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);
}