[evolution/wip/gsettings] Bug #627536 - Open meeting as meeting, not as appointment, in week view



commit c9049740c8a45a9f05b9ba3507de3e0c7d3c9606
Author: Milan Crha <mcrha redhat com>
Date:   Mon Dec 6 17:17:44 2010 +0100

    Bug #627536 - Open meeting as meeting, not as appointment, in week view

 calendar/gui/e-cal-list-view.c              |   13 +------------
 calendar/gui/e-calendar-view.c              |   13 +++++--------
 calendar/gui/e-calendar-view.h              |    8 +++++++-
 calendar/gui/e-day-view.c                   |    7 +------
 calendar/gui/e-week-view-event-item.c       |    2 +-
 calendar/gui/e-week-view.c                  |    2 +-
 modules/calendar/e-cal-shell-view-actions.c |    3 +--
 7 files changed, 17 insertions(+), 31 deletions(-)
---
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index d2baa35..fc2996f 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -372,16 +372,6 @@ e_cal_list_view_popup_menu (GtkWidget *widget)
 }
 
 static gboolean
-find_meeting (icalcomponent *icalcomp)
-{
-	icalproperty *prop = NULL;
-
-	prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
-
-	return prop ? TRUE: FALSE;
-}
-
-static gboolean
 e_cal_list_view_on_table_double_click (GtkWidget *table, gint row, gint col, GdkEvent *event,
 				      gpointer data)
 {
@@ -389,8 +379,7 @@ e_cal_list_view_on_table_double_click (GtkWidget *table, gint row, gint col, Gdk
 	ECalModelComponent *comp_data;
 
 	comp_data = e_cal_model_get_component_at (e_calendar_view_get_model (E_CALENDAR_VIEW (cal_list_view)), row);
-	e_calendar_view_edit_appointment (E_CALENDAR_VIEW (cal_list_view), comp_data->client,
-					  comp_data->icalcomp, find_meeting (comp_data->icalcomp));
+	e_calendar_view_edit_appointment (E_CALENDAR_VIEW (cal_list_view), comp_data->client, comp_data->icalcomp, EDIT_EVENT_AUTODETECT);
 
 	return TRUE;
 }
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index a9e6d68..13ea437 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1391,8 +1391,7 @@ e_calendar_view_open_event (ECalendarView *cal_view)
 	if (selected) {
 		ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
 		if (event && is_comp_data_valid (event))
-			e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
-					event->comp_data->icalcomp, icalcomponent_get_first_property (event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY) != NULL);
+			e_calendar_view_edit_appointment (cal_view, event->comp_data->client, event->comp_data->icalcomp, EDIT_EVENT_AUTODETECT);
 
 		g_list_free (selected);
 	}
@@ -1631,16 +1630,13 @@ e_calendar_view_open_event_with_flags (ECalendarView *cal_view, ECal *client, ic
  * @cal_view: A calendar view.
  * @client: Calendar client.
  * @icalcomp: The object to be edited.
- * @meeting: Whether the appointment is a meeting or not.
+ * @mode: one of #EEditEventMode
  *
  * Opens an editor window to allow the user to edit the selected
  * object.
  */
 void
-e_calendar_view_edit_appointment (ECalendarView *cal_view,
-			     ECal *client,
-			     icalcomponent *icalcomp,
-			     gboolean meeting)
+e_calendar_view_edit_appointment (ECalendarView *cal_view, ECal *client, icalcomponent *icalcomp, EEditEventMode mode)
 {
 	guint32 flags = 0;
 
@@ -1648,7 +1644,8 @@ e_calendar_view_edit_appointment (ECalendarView *cal_view,
 	g_return_if_fail (E_IS_CAL (client));
 	g_return_if_fail (icalcomp != NULL);
 
-	if (meeting) {
+	if ((mode == EDIT_EVENT_AUTODETECT && icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY) != NULL)
+	    || mode == EDIT_EVENT_FORCE_MEETING) {
 		ECalComponent *comp = e_cal_component_new ();
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
 		flags |= COMP_EDITOR_MEETING;
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 7804eed..e0087da 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -114,6 +114,12 @@ typedef struct {
 	gint event_num;
 } ECalendarViewEventData;
 
+typedef enum {
+	EDIT_EVENT_AUTODETECT,
+	EDIT_EVENT_FORCE_MEETING,
+	EDIT_EVENT_FORCE_APPOINTMENT
+} EEditEventMode;
+
 struct _ECalendarViewClass {
 	GtkTableClass parent_class;
 
@@ -225,7 +231,7 @@ void		e_calendar_view_new_appointment	(ECalendarView *cal_view);
 void		e_calendar_view_edit_appointment (ECalendarView *cal_view,
 						 ECal *client,
 						 icalcomponent *icalcomp,
-						 gboolean meeting);
+						 EEditEventMode mode);
 void		e_calendar_view_open_event	(ECalendarView *cal_view);
 void		e_calendar_view_modify_and_send	(ECalComponent *comp,
 						 ECal *client,
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index ea2b13c..e50e1c2 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -3538,7 +3538,6 @@ e_day_view_on_event_double_click (EDayView *day_view,
 				  gint event_num)
 {
 	EDayViewEvent *event;
-	icalproperty *attendee_prop = NULL;
 
 	if (day == -1) {
 		if (!is_array_index_in_bounds (day_view->long_events, event_num))
@@ -3557,11 +3556,7 @@ e_day_view_on_event_double_click (EDayView *day_view,
 	if (!is_comp_data_valid (event))
 		return;
 
-	attendee_prop = icalcomponent_get_first_property (event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
-
-	e_calendar_view_edit_appointment ((ECalendarView *)day_view,
-			event->comp_data->client,
-			event->comp_data->icalcomp, attendee_prop ? TRUE:FALSE);
+	e_calendar_view_edit_appointment ((ECalendarView *)day_view, event->comp_data->client, event->comp_data->icalcomp, EDIT_EVENT_AUTODETECT);
 }
 
 static void
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 8a525eb..902840a 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -171,7 +171,7 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item,
 	e_calendar_view_edit_appointment (
 		E_CALENDAR_VIEW (week_view),
 		event->comp_data->client,
-		event->comp_data->icalcomp, FALSE);
+		event->comp_data->icalcomp, EDIT_EVENT_AUTODETECT);
 
 	return TRUE;
 }
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index c964d1e..c57cca9 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -3515,7 +3515,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
 
 		e_calendar_view_edit_appointment (E_CALENDAR_VIEW (week_view),
 					     event->comp_data->client,
-					     event->comp_data->icalcomp, FALSE);
+					     event->comp_data->icalcomp, EDIT_EVENT_AUTODETECT);
 
 		g_signal_stop_emission_by_name (G_OBJECT (item), "event");
 		return TRUE;
diff --git a/modules/calendar/e-cal-shell-view-actions.c b/modules/calendar/e-cal-shell-view-actions.c
index 7b9d88f..3417875 100644
--- a/modules/calendar/e-cal-shell-view-actions.c
+++ b/modules/calendar/e-cal-shell-view-actions.c
@@ -1216,8 +1216,7 @@ edit_event_as (ECalShellView *cal_shell_view, gboolean as_meeting)
 		}
 	}
 
-	e_calendar_view_edit_appointment (
-		calendar_view, client, icalcomp, as_meeting);
+	e_calendar_view_edit_appointment (calendar_view, client, icalcomp, as_meeting ? EDIT_EVENT_FORCE_MEETING : EDIT_EVENT_FORCE_APPOINTMENT);
 
 	if (!as_meeting && icalcomp) {
 		icalcomponent_free (icalcomp);



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