aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-06-15 07:26:30 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-06-15 07:26:30 +0800
commitefd9bd119ca61ca8f2d7d2d9e724a5c51911fc51 (patch)
tree4af0d85a26a2ea0a1299f6690d77c00f7028024a /calendar
parent9a52bdf0d14b19c40d65fa4ad1c1103fee36e165 (diff)
downloadgsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.tar
gsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.tar.gz
gsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.tar.bz2
gsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.tar.lz
gsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.tar.xz
gsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.tar.zst
gsoc2013-evolution-efd9bd119ca61ca8f2d7d2d9e724a5c51911fc51.zip
finished implementation of Paste stuff
2001-06-15 Rodrigo Moya <rodrigo@ximian.com> * gui/e-day-view.c (selection_received): finished implementation of Paste stuff * gui/e-week-view.c (selection_received): ditto svn path=/trunk/; revision=10243
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/e-day-view.c43
-rw-r--r--calendar/gui/e-week-view.c40
3 files changed, 81 insertions, 9 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 2bc9110256..4c130bc3a5 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2001-06-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/e-day-view.c (selection_received): finished implementation
+ of Paste stuff
+
+ * gui/e-week-view.c (selection_received): ditto
+
2001-06-14 Rodrigo Moya <rodrigo@ximian.com>
* gui/e-day-view.[ch]: added popup menu items for cut/copy/paste
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 71db1c05b2..8dfeaa8079 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -36,6 +36,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <gtk/gtkdnd.h>
+#include <gtk/gtkinvisible.h>
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkvscrollbar.h>
@@ -3178,6 +3179,11 @@ enum {
};
static EPopupMenu main_items [] = {
+ { N_("Paste"), NULL,
+ e_day_view_on_paste, NULL, 0 },
+
+ { "", NULL, NULL, NULL, 0 },
+
{ N_("New Appointment"), NULL,
e_day_view_on_new_appointment, NULL, 0 },
{ N_("New All Day Event"), NULL,
@@ -3203,7 +3209,7 @@ static EPopupMenu child_items [] = {
{ N_("Copy"), NULL,
e_day_view_on_copy, NULL, 0 },
{ N_("Paste"), NULL,
- e_day_view_on_paste, NULL, MASK_EDITABLE | MASK_EDITING },
+ e_day_view_on_paste, NULL, 0 },
{ N_("Schedule Meeting"), NULL,
e_day_view_on_schedule_meet, NULL, MASK_EDITING },
@@ -6512,13 +6518,40 @@ selection_clear_event (GtkWidget *invisible,
}
}
-static void selection_received (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EDayView *day_view)
+static void
+selection_received (GtkWidget *invisible,
+ GtkSelectionData *selection_data,
+ guint time,
+ EDayView *day_view)
{
+ char *comp_str;
+ icalcomponent *icalcomp;
+ time_t dtstart, dtend;
+ struct icaltimetype itime;
+ CalComponent *comp;
+
+ g_return_if_fail (E_IS_DAY_VIEW (day_view));
+
if (selection_data->length < 0 ||
selection_data->type != GDK_SELECTION_TYPE_STRING) {
return;
}
+
+ comp_str = (char *) selection_data->data;
+ icalcomp = icalparser_parse_string ((const char *) comp_str);
+ if (icalcomp) {
+ e_day_view_get_selected_time_range (day_view, &dtstart, &dtend);
+
+ itime = icaltime_from_timet (dtstart, TRUE);
+ icalcomponent_set_dtstart (icalcomp, itime);
+
+ itime = icaltime_from_timet (dtend, TRUE);
+ icalcomponent_set_dtend (icalcomp, itime);
+
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (comp, icalcomp);
+ cal_client_update_object (day_view->client, comp);
+
+ gtk_object_unref (GTK_OBJECT (comp));
+ }
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index fa4ea144d0..65ec0bfa21 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3017,6 +3017,11 @@ enum {
};
static EPopupMenu main_items [] = {
+ { N_("Paste"), NULL,
+ e_week_view_on_paste, NULL, 0 },
+
+ { "", NULL, NULL, NULL, 0 },
+
{ N_("New Appointment..."), NULL,
e_week_view_on_new_appointment, NULL, 0 },
{ N_("New All Day Event"), NULL,
@@ -3464,13 +3469,40 @@ selection_clear_event (GtkWidget *invisible,
}
}
-static void selection_received (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EWeekView *week_view)
+static void
+selection_received (GtkWidget *invisible,
+ GtkSelectionData *selection_data,
+ guint time,
+ EWeekView *week_view)
{
+ char *comp_str;
+ icalcomponent *icalcomp;
+ time_t dtstart, dtend;
+ struct icaltimetype itime;
+ CalComponent *comp;
+
+ g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+
if (selection_data->length < 0 ||
selection_data->type != GDK_SELECTION_TYPE_STRING) {
return;
}
+
+ comp_str = (char *) selection_data->data;
+ icalcomp = icalparser_parse_string ((const char *) comp_str);
+ if (icalcomp) {
+ dtstart = week_view->day_starts[week_view->selection_start_day];
+ itime = icaltime_from_timet (dtstart, TRUE);
+ icalcomponent_set_dtstart (icalcomp, itime);
+
+ dtend = week_view->day_starts[week_view->selection_end_day + 1];
+ itime = icaltime_from_timet (dtend, TRUE);
+ icalcomponent_set_dtend (icalcomp, itime);
+
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (comp, icalcomp);
+ cal_client_update_object (week_view->client, comp);
+
+ gtk_object_unref (GTK_OBJECT (comp));
+ }
}