aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-07-13 00:26:05 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-07-13 00:26:05 +0800
commit91ab110ec61eaaa0cabc0dd8ec3b45a143cac122 (patch)
tree7580edd30cccb7410300d98a8881760f91d48d6e
parent060173826a32e739ca88d6d4c3caa42687fc8049 (diff)
downloadgsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.tar
gsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.tar.gz
gsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.tar.bz2
gsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.tar.lz
gsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.tar.xz
gsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.tar.zst
gsoc2013-evolution-91ab110ec61eaaa0cabc0dd8ec3b45a143cac122.zip
added support for multiple selections in cut/copy/paste. Also, it's now
2001-07-12 Rodrigo Moya <rodrigo@ximian.com> * gui/e-calendar-table.c: added support for multiple selections in cut/copy/paste. Also, it's now ready for the s/update_object/update_objects change (I think) svn path=/trunk/; revision=11043
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/e-calendar-table.c59
-rw-r--r--calendar/gui/e-calendar-table.h1
3 files changed, 45 insertions, 21 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 8ac823d09f..5f69455242 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-12 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/e-calendar-table.c: added support for multiple selections in
+ cut/copy/paste. Also, it's now ready for the
+ s/update_object/update_objects change (I think)
+
2001-07-11 Damon Chaplin <damon@ximian.com>
* idl/evolution-calendar.idl: renamed updateObject to updateObjects
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 33742b933d..dee26ae88b 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -750,22 +750,22 @@ copy_row_cb (int model_row, gpointer data)
ECalendarTable *cal_table;
CalComponent *comp;
gchar *comp_str;
+ icalcomponent *child;
cal_table = E_CALENDAR_TABLE (data);
+ g_return_if_fail (cal_table->tmp_vcal != NULL);
+
comp = calendar_model_get_component (cal_table->model, model_row);
if (!comp)
return;
-
- if (cal_table->clipboard_selection) {
- g_free (cal_table->clipboard_selection);
- cal_table->clipboard_selection = NULL;
- }
-
+ /* add the new component to the VCALENDAR component */
comp_str = cal_component_get_as_string (comp);
- cal_table->clipboard_selection = g_strdup (comp_str);
+ child = icalcomponent_new_from_string (comp_str);
+ icalcomponent_add_component (cal_table->tmp_vcal, child);
+ //icalcomponent_free (child);
g_free (comp_str);
}
@@ -787,9 +787,16 @@ e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
cal_table->clipboard_selection = NULL;
}
+ /* create temporary VCALENDAR object */
+ cal_table->tmp_vcal = icalcomponent_new (ICAL_VCALENDAR_COMPONENT);
+
etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
e_table_selected_row_foreach (etable, copy_row_cb, cal_table);
+ cal_table->clipboard_selection = icalcomponent_as_ical_string (cal_table->tmp_vcal);
+ icalcomponent_free (cal_table->tmp_vcal);
+ cal_table->tmp_val = NULL;
+
gtk_selection_owner_set (cal_table->invisible, clipboard_atom, GDK_CURRENT_TIME);
}
@@ -1180,6 +1187,9 @@ selection_received (GtkWidget *invisible,
{
char *comp_str;
icalcomponent *icalcomp;
+ char *uid;
+ CalComponent *comp;
+ icalcomponent_kind kind;
if (selection_data->length < 0 ||
selection_data->type != GDK_SELECTION_TYPE_STRING) {
@@ -1188,21 +1198,28 @@ selection_received (GtkWidget *invisible,
comp_str = (char *) selection_data->data;
icalcomp = icalparser_parse_string ((const char *) comp_str);
- if (icalcomp) {
- char *uid;
- CalComponent *comp;
-
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomp);
- uid = cal_component_gen_uid ();
- cal_component_set_uid (comp, (const char *) uid);
- free (uid);
-
- cal_client_update_object (
- calendar_model_get_cal_client (cal_table->model),
- comp);
- gtk_object_unref (GTK_OBJECT (comp));
+ if (!icalcomp)
+ return;
+
+ /* check the type of the component */
+ kind = icalcomponent_isa (icalcomp);
+ if (kind != ICAL_VCALENDAR_COMPONENT &&
+ kind != ICAL_VEVENT_COMPONENT &&
+ kind != ICAL_VTODO_COMPONENT &&
+ kind != ICAL_VJOURNAL_COMPONENT) {
+ return;
}
+
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (comp, icalcomp);
+ uid = cal_component_gen_uid ();
+ cal_component_set_uid (comp, (const char *) uid);
+ free (uid);
+
+ cal_client_update_object (
+ calendar_model_get_cal_client (cal_table->model),
+ comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 86f2aa20a3..5ab32f3c18 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -87,6 +87,7 @@ struct _ECalendarTable
/* The invisible widget used for cut/copy/paste */
GtkWidget *invisible;
gchar *clipboard_selection;
+ icalcomponent *tmp_vcal;
};
struct _ECalendarTableClass