aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-07-28 04:50:11 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-07-28 04:50:11 +0800
commitdc3aaa74eddd6cacf27716fb1c1f478fa4b59dab (patch)
tree0fe0fdb51c7cf3ceaaa4cc1f212b75544652b13d /calendar
parent478eaf85395a4cfe2402cac8125ab49da1f3ceb4 (diff)
downloadgsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.tar
gsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.tar.gz
gsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.tar.bz2
gsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.tar.lz
gsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.tar.xz
gsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.tar.zst
gsoc2013-evolution-dc3aaa74eddd6cacf27716fb1c1f478fa4b59dab.zip
initialize to NULL some pointers
2001-07-27 Rodrigo Moya <rodrigo@ximian.com> * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): initialize to NULL some pointers * e-calendar-table.c (selection_received): deal correctly with VCALENDAR objects (e_calendar_table_copy_clipboard): g_strdup the value returned by icalcomponent_get_as_ical_string svn path=/trunk/; revision=11459
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/e-calendar-table.c74
-rw-r--r--calendar/gui/e-day-view-main-item.c4
-rw-r--r--calendar/gui/e-day-view-top-item.c4
-rw-r--r--calendar/gui/e-week-view-event-item.c4
5 files changed, 78 insertions, 20 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7592665f36..59cd002e21 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,15 @@
+2001-07-27 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event):
+ * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event):
+ * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons):
+ initialize to NULL some pointers
+
+ * e-calendar-table.c (selection_received): deal correctly with
+ VCALENDAR objects
+ (e_calendar_table_copy_clipboard): g_strdup the value returned by
+ icalcomponent_get_as_ical_string
+
2001-07-27 Federico Mena Quintero <federico@ximian.com>
* gui/gnome-cal.c (gnome_calendar_set_query): Constify and set the
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index fc86f5e4f9..a513dbf6f5 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -528,8 +528,10 @@ e_calendar_table_destroy (GtkObject *object)
if (cal_table->invisible)
gtk_widget_destroy (cal_table->invisible);
- if (cal_table->clipboard_selection)
+ if (cal_table->clipboard_selection) {
g_free (cal_table->clipboard_selection);
+ cal_table->clipboard_selection = NULL;
+ }
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
@@ -712,10 +714,10 @@ copy_row_cb (int model_row, gpointer data)
/* add the new component to the VCALENDAR component */
comp_str = cal_component_get_as_string (comp);
- child = icalcomponent_new_from_string (comp_str);
- icalcomponent_add_component (cal_table->tmp_vcal, child);
+ child = icalparser_parse_string (comp_str);
+ if (child)
+ icalcomponent_add_component (cal_table->tmp_vcal, child);
- //icalcomponent_free (child);
g_free (comp_str);
}
@@ -729,6 +731,7 @@ void
e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
{
ETable *etable;
+ char *comp_str;
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
@@ -743,7 +746,8 @@ e_calendar_table_copy_clipboard (ECalendarTable *cal_table)
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);
+ comp_str = icalcomponent_as_ical_string (cal_table->tmp_vcal);
+ cal_table->clipboard_selection = g_strdup (comp_str);
icalcomponent_free (cal_table->tmp_vcal);
cal_table->tmp_vcal = NULL;
@@ -1027,16 +1031,58 @@ selection_received (GtkWidget *invisible,
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);
+ if (kind == ICAL_VCALENDAR_COMPONENT) {
+ int num_found = 0;
+ icalcomponent_kind child_kind;
+ icalcomponent *subcomp;
+
+ subcomp = icalcomponent_get_first_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp) {
+ child_kind = icalcomponent_isa (subcomp);
+ if (child_kind == ICAL_VEVENT_COMPONENT ||
+ child_kind == ICAL_VTODO_COMPONENT ||
+ child_kind == ICAL_VJOURNAL_COMPONENT) {
+ CalComponent *tmp_comp;
+
+ uid = cal_component_gen_uid ();
+ tmp_comp = cal_component_new ();
+ cal_component_set_icalcomponent (
+ tmp_comp, icalcomponent_new_clone (subcomp));
+ cal_component_set_uid (tmp_comp, uid);
+
+ free (uid);
+ gtk_object_unref (GTK_OBJECT (tmp_comp));
+
+ num_found++;
+ }
+ subcomp = icalcomponent_get_next_component (
+ icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ if (num_found) {
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (comp, icalcomp);
+
+ cal_client_update_object (
+ calendar_model_get_cal_client (cal_table->model),
+ comp);
- cal_client_update_object (
- calendar_model_get_cal_client (cal_table->model),
- comp);
- gtk_object_unref (GTK_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
+ }
+ }
+ else {
+ 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-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 79ee0b0826..f17eff457e 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -663,8 +663,8 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
/* draw categories icons */
for (elem = categories_list; elem; elem = elem->next) {
char *category;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
+ GdkPixmap *pixmap = NULL;
+ GdkBitmap *mask = NULL;
category = (char *) elem->data;
e_categories_config_get_icon_for (category, &pixmap, &mask);
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 10b1cd0b13..e7a3aad90b 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -584,8 +584,8 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
cal_component_get_categories_list (comp, &categories_list);
for (elem = categories_list; elem; elem = elem->next) {
char *category;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
+ GdkPixmap *pixmap = NULL;
+ GdkBitmap *mask = NULL;
category = (char *) elem->data;
e_categories_config_get_icon_for (category, &pixmap, &mask);
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index e6e8a0e2b4..e5970445ce 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -631,8 +631,8 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
/* draw categories icons */
for (elem = categories_list; elem; elem = elem->next) {
char *category;
- GdkPixmap *pixmap;
- GdkBitmap *mask;
+ GdkPixmap *pixmap = NULL;
+ GdkBitmap *mask = NULL;
category = (char *) elem->data;
e_categories_config_get_icon_for (category, &pixmap, &mask);