evolution r35619 - in branches/gnome-2-22/calendar: . gui



Author: mcrha
Date: Mon Jun  9 10:09:16 2008
New Revision: 35619
URL: http://svn.gnome.org/viewvc/evolution?rev=35619&view=rev

Log:
2008-06-09  Milan Crha  <mcrha redhat com>

	** Fix for bug #536813

	* gui/comp-util.h: (is_icalcomp_on_the_server):
	* gui/comp-util.c: (is_icalcomp_on_the_server): Similar helper function
	as cal_comp_is_on_server only the parameter is icalcomponent.
	* gui/e-week-view-event-item.c: (e_week_view_event_item_double_click):
	* gui/e-week-view.c: (e_week_view_on_text_item_event):
	Do not start to edit the event on the double click if the event is not
	on the server yet. Storing the event can cause the renumbering events
	so the result can be that the edited event would be different.



Modified:
   branches/gnome-2-22/calendar/ChangeLog
   branches/gnome-2-22/calendar/gui/comp-util.c
   branches/gnome-2-22/calendar/gui/comp-util.h
   branches/gnome-2-22/calendar/gui/e-week-view-event-item.c
   branches/gnome-2-22/calendar/gui/e-week-view.c

Modified: branches/gnome-2-22/calendar/gui/comp-util.c
==============================================================================
--- branches/gnome-2-22/calendar/gui/comp-util.c	(original)
+++ branches/gnome-2-22/calendar/gui/comp-util.c	Mon Jun  9 10:09:16 2008
@@ -248,6 +248,29 @@
 }
 
 /**
+ * is_icalcomp_on_the_server:
+ * same as @cal_comp_is_on_server, only the component parameter is icalcomponent, not the ECalComponent.
+ **/
+gboolean
+is_icalcomp_on_the_server (icalcomponent *icalcomp, ECal *client)
+{
+	gboolean on_server;
+	ECalComponent *comp;
+
+	if (!icalcomp || !client || !icalcomponent_get_uid (icalcomp))
+		return FALSE;
+
+	comp = e_cal_component_new ();
+	e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
+
+	on_server = cal_comp_is_on_server (comp, client);
+
+	g_object_unref (comp);
+
+	return on_server;
+}
+
+/**
  * cal_comp_event_new_with_defaults:
  *
  * Creates a new VEVENT component and adds any default alarms to it as set in

Modified: branches/gnome-2-22/calendar/gui/comp-util.h
==============================================================================
--- branches/gnome-2-22/calendar/gui/comp-util.h	(original)
+++ branches/gnome-2-22/calendar/gui/comp-util.h	Mon Jun  9 10:09:16 2008
@@ -43,6 +43,7 @@
 
 gboolean cal_comp_is_on_server (ECalComponent *comp,
 				ECal *client);
+gboolean is_icalcomp_on_the_server (icalcomponent *icalcomp, ECal *client);
 
 ECalComponent *cal_comp_event_new_with_defaults (ECal *client);
 ECalComponent *cal_comp_event_new_with_current_time (ECal *client, gboolean all_day);

Modified: branches/gnome-2-22/calendar/gui/e-week-view-event-item.c
==============================================================================
--- branches/gnome-2-22/calendar/gui/e-week-view-event-item.c	(original)
+++ branches/gnome-2-22/calendar/gui/e-week-view-event-item.c	Mon Jun  9 10:09:16 2008
@@ -1650,7 +1650,6 @@
 	return FALSE;
 }
 
-
 static gboolean
 e_week_view_event_item_double_click (EWeekViewEventItem *wveitem,
 				     GdkEvent		*bevent)
@@ -1670,8 +1669,8 @@
 	if (week_view->editing_event_num >= 0) {
 		EWeekViewEvent *editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
 
-		/* do not call edit of the component, if double clicked on the same component - the event is spread into more days */
-		if (editing && event && editing->comp_data == event->comp_data)
+		/* do not call edit of the component, if double clicked on the component, which is not on the server */
+		if (editing && event && editing->comp_data == event->comp_data && (!event->comp_data || !is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client)))
 			return TRUE;
 	}
 

Modified: branches/gnome-2-22/calendar/gui/e-week-view.c
==============================================================================
--- branches/gnome-2-22/calendar/gui/e-week-view.c	(original)
+++ branches/gnome-2-22/calendar/gui/e-week-view.c	Mon Jun  9 10:09:16 2008
@@ -3107,6 +3107,11 @@
 		event = &g_array_index (week_view->events, EWeekViewEvent,
 					event_num);
 
+		/* if we started to editing new item on the canvas, then do not open editing dialog until it's saved,
+		   because the save of the event recalculates event numbers and you can edit different one */
+		if (!is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client))
+			return TRUE;
+
 		e_calendar_view_edit_appointment (E_CALENDAR_VIEW (week_view),
 					     event->comp_data->client,
 					     event->comp_data->icalcomp, FALSE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]