evolution/bnc-435455-attendees-meeting-resize.patch

497 lines
15 KiB
Diff

Index: calendar/gui/e-day-view-main-item.c
===================================================================
--- calendar/gui/e-day-view-main-item.c (revision 36947)
+++ calendar/gui/e-day-view-main-item.c (working copy)
@@ -940,146 +940,18 @@
if (day_view->resize_drag_pos != E_CALENDAR_VIEW_POS_NONE
&& day_view->resize_event_day == day
&& day_view->resize_event_num == event_num) {
- resize_flag = TRUE;
+ /* If the item is being resized, don't resized it.
+ I have removed code which are resized the meeting.
+ It will block the resize or move the meeting in
+ calendar UI from attendee side.*/
if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_TOP_EDGE)
bar_y1 = item_y + 1;
- else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE) {
+ else if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_BOTTOM_EDGE)
bar_y2 = item_y + item_h - 1;
-
- end_minute = event->end_minute;
-
- end_hour = end_minute / 60;
- end_minute = end_minute % 60;
-
- e_day_view_convert_time_to_display (day_view, end_hour,
- &end_display_hour,
- &end_resize_suffix,
- &end_suffix_width);
-
- cairo_save (cr);
- cairo_rectangle (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 2.75,
- item_w - E_DAY_VIEW_BAR_WIDTH - 4.5,
- item_h - 5.5);
- cairo_clip (cr);
- cairo_new_path (cr);
-
- if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
- cairo_translate (cr, item_x + item_w - E_DAY_VIEW_BAR_WIDTH - 32, item_y + item_h - 8);
- end_resize_time = g_strdup_printf ("%2i:%02i",
- end_display_hour, end_minute);
-
- } else {
- cairo_translate (cr, item_x + item_w - E_DAY_VIEW_BAR_WIDTH - 48, item_y + item_h - 8);
- end_resize_time = g_strdup_printf ("%2i:%02i%s",
- end_display_hour, end_minute,
- end_resize_suffix);
- }
- cairo_set_font_size (cr, 14);
- if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 ))
- cairo_set_source_rgb (cr, 0, 0, 0);
- else
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_set_font_options (cr, font_options);
- cairo_show_text (cr, end_resize_time);
- cairo_close_path (cr);
- cairo_restore (cr);
- }
}
- if (bar_y2 > scroll_flag)
- event->end_minute += day_view->mins_per_row;
- else if (bar_y2 < scroll_flag)
- event->end_minute -= day_view->mins_per_row;
-
- if (!short_event)
- {
- if (event->start_minute % day_view->mins_per_row != 0
- || (day_view->show_event_end_times
- && event->end_minute % day_view->mins_per_row != 0)) {
- offset = day_view->first_hour_shown * 60
- + day_view->first_minute_shown;
- show_span = TRUE;
- } else {
- offset = 0;
- }
- start_minute = offset + event->start_minute;
- end_minute = offset + event->end_minute;
-
- format_time = (((end_minute - start_minute)/day_view->mins_per_row) >= 2) ? TRUE : FALSE;
-
- start_hour = start_minute / 60;
- start_minute = start_minute % 60;
-
- end_hour = end_minute / 60;
- end_minute = end_minute % 60;
-
- e_day_view_convert_time_to_display (day_view, start_hour,
- &start_display_hour,
- &start_suffix,
- &start_suffix_width);
- e_day_view_convert_time_to_display (day_view, end_hour,
- &end_display_hour,
- &end_suffix,
- &end_suffix_width);
-
- if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) {
- if (day_view->show_event_end_times && show_span) {
- /* 24 hour format with end time. */
- text = g_strdup_printf
- ("%2i:%02i-%2i:%02i",
- start_display_hour, start_minute,
- end_display_hour, end_minute);
- } else {
- if (format_time) {
- /* 24 hour format without end time. */
- text = g_strdup_printf
- ("%2i:%02i",
- start_display_hour, start_minute);
- }
- }
- } else {
- if (day_view->show_event_end_times && show_span) {
- /* 12 hour format with end time. */
- text = g_strdup_printf
- ("%2i:%02i%s-%2i:%02i%s",
- start_display_hour, start_minute,
- start_suffix,
- end_display_hour, end_minute, end_suffix);
- } else {
- /* 12 hour format without end time. */
- text = g_strdup_printf
- ("%2i:%02i%s",
- start_display_hour, start_minute,
- start_suffix);
- }
- }
-
- cairo_save (cr);
- cairo_rectangle (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 2.75,
- item_w - E_DAY_VIEW_BAR_WIDTH - 4.5,
- 14);
- cairo_clip (cr);
- cairo_new_path (cr);
- if (resize_flag)
- cairo_move_to (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 10, item_y + 13);
- else
- cairo_move_to (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 14, item_y + 13);
- if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 ))
- cairo_set_source_rgb (cr, 0, 0, 0);
- else
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_set_font_size (cr, 14.0);
- cairo_set_font_options (cr, font_options);
- cairo_show_text (cr, text);
- cairo_close_path (cr);
- cairo_restore (cr);
- }
-
- if (font_options)
- cairo_font_options_destroy (font_options);
-
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -1115,188 +987,181 @@
&day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]);
/* Draw the reminder & recurrence icons, if needed. */
- if (!resize_flag) {
- num_icons = 0;
- draw_reminder_icon = FALSE;
- draw_recurrence_icon = FALSE;
- draw_timezone_icon = FALSE;
- draw_meeting_icon = FALSE;
- draw_attach_icon = FALSE;
- icon_x = item_x + E_DAY_VIEW_BAR_WIDTH + E_DAY_VIEW_ICON_X_PAD;
- icon_y = item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT
- + E_DAY_VIEW_ICON_Y_PAD;
+ num_icons = 0;
+ draw_reminder_icon = FALSE;
+ draw_recurrence_icon = FALSE;
+ draw_timezone_icon = FALSE;
+ draw_meeting_icon = FALSE;
+ draw_attach_icon = FALSE;
+ icon_x = item_x + E_DAY_VIEW_BAR_WIDTH + E_DAY_VIEW_ICON_X_PAD;
+ icon_y = item_y + E_DAY_VIEW_EVENT_BORDER_HEIGHT
+ + E_DAY_VIEW_ICON_Y_PAD;
- if (e_cal_component_has_alarms (comp)) {
- draw_reminder_icon = TRUE;
- num_icons++;
- }
+ if (e_cal_component_has_alarms (comp)) {
+ draw_reminder_icon = TRUE;
+ num_icons++;
+ }
- if (e_cal_component_has_recurrences (comp) || e_cal_component_is_instance (comp)) {
- draw_recurrence_icon = TRUE;
- num_icons++;
- }
- if (e_cal_component_has_attachments (comp)) {
- draw_attach_icon = TRUE;
- num_icons++;
- }
- /* If the DTSTART or DTEND are in a different timezone to our current
- timezone, we display the timezone icon. */
- if (event->different_timezone) {
- draw_timezone_icon = TRUE;
- num_icons++;
- }
+ if (e_cal_component_has_recurrences (comp) || e_cal_component_is_instance (comp)) {
+ draw_recurrence_icon = TRUE;
+ num_icons++;
+ }
+ if (e_cal_component_has_attachments (comp)) {
+ draw_attach_icon = TRUE;
+ num_icons++;
+ }
+ /* If the DTSTART or DTEND are in a different timezone to our current
+ timezone, we display the timezone icon. */
+ if (event->different_timezone) {
+ draw_timezone_icon = TRUE;
+ num_icons++;
+ }
- if (e_cal_component_has_organizer (comp)) {
- draw_meeting_icon = TRUE;
- num_icons++;
- }
+ if (e_cal_component_has_organizer (comp)) {
+ draw_meeting_icon = TRUE;
+ num_icons++;
+ }
- num_icons += cal_comp_util_get_n_icons (comp);
- e_cal_component_get_categories_list (comp, &categories_list);
+ num_icons += cal_comp_util_get_n_icons (comp);
+ e_cal_component_get_categories_list (comp, &categories_list);
- if (num_icons != 0) {
- if (item_h >= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD)
- * num_icons) {
- icon_x_inc = 0;
- icon_y_inc = E_DAY_VIEW_ICON_HEIGHT
- + E_DAY_VIEW_ICON_Y_PAD;
- } else {
- icon_x_inc = E_DAY_VIEW_ICON_WIDTH
- + E_DAY_VIEW_ICON_X_PAD;
- icon_y_inc = 0;
- }
+ if (num_icons != 0) {
+ if (item_h >= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD)
+ * num_icons) {
+ icon_x_inc = 0;
+ icon_y_inc = E_DAY_VIEW_ICON_HEIGHT
+ + E_DAY_VIEW_ICON_Y_PAD;
+ } else {
+ icon_x_inc = E_DAY_VIEW_ICON_WIDTH
+ + E_DAY_VIEW_ICON_X_PAD;
+ icon_y_inc = 0;
+ }
- if (draw_reminder_icon) {
- max_icon_w = item_x + item_w - icon_x
- - E_DAY_VIEW_EVENT_BORDER_WIDTH;
- max_icon_h = item_y + item_h - icon_y
- - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+ if (draw_reminder_icon) {
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
- cairo_save (cr);
- cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
- cairo_clip (cr);
- cairo_new_path (cr);
- gdk_cairo_set_source_pixbuf (cr, day_view->reminder_icon, icon_x, icon_y);
- cairo_paint (cr);
- cairo_close_path (cr);
- cairo_restore (cr);
+ cairo_save (cr);
+ cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+ gdk_cairo_set_source_pixbuf (cr, day_view->reminder_icon, icon_x, icon_y);
+ cairo_paint (cr);
+ cairo_close_path (cr);
+ cairo_restore (cr);
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
- icon_x += icon_x_inc;
- icon_y += icon_y_inc;
- }
+ if (draw_recurrence_icon) {
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
- if (draw_recurrence_icon) {
- max_icon_w = item_x + item_w - icon_x
- - E_DAY_VIEW_EVENT_BORDER_WIDTH;
- max_icon_h = item_y + item_h - icon_y
- - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+ cairo_save (cr);
+ cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+ gdk_cairo_set_source_pixbuf (cr, day_view->recurrence_icon, icon_x, icon_y);
+ cairo_paint (cr);
+ cairo_close_path (cr);
+ cairo_restore (cr);
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
+ if (draw_attach_icon) {
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
- cairo_save (cr);
- cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
- cairo_clip (cr);
- cairo_new_path (cr);
- gdk_cairo_set_source_pixbuf (cr, day_view->recurrence_icon, icon_x, icon_y);
- cairo_paint (cr);
- cairo_close_path (cr);
- cairo_restore (cr);
+ cairo_save (cr);
+ cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+ gdk_cairo_set_source_pixbuf (cr, day_view->attach_icon, icon_x, icon_y);
+ cairo_paint (cr);
+ cairo_close_path (cr);
+ cairo_restore (cr);
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
+ if (draw_timezone_icon) {
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
- icon_x += icon_x_inc;
- icon_y += icon_y_inc;
- }
- if (draw_attach_icon) {
- max_icon_w = item_x + item_w - icon_x
- - E_DAY_VIEW_EVENT_BORDER_WIDTH;
- max_icon_h = item_y + item_h - icon_y
- - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+ cairo_save (cr);
+ cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+ gdk_cairo_set_source_pixbuf (cr, day_view->timezone_icon, icon_x, icon_y);
+ cairo_paint (cr);
+ cairo_close_path (cr);
+ cairo_restore (cr);
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
- cairo_save (cr);
- cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
- cairo_clip (cr);
- cairo_new_path (cr);
- gdk_cairo_set_source_pixbuf (cr, day_view->attach_icon, icon_x, icon_y);
- cairo_paint (cr);
- cairo_close_path (cr);
- cairo_restore (cr);
- icon_x += icon_x_inc;
- icon_y += icon_y_inc;
- }
- if (draw_timezone_icon) {
- max_icon_w = item_x + item_w - icon_x
- - E_DAY_VIEW_EVENT_BORDER_WIDTH;
- max_icon_h = item_y + item_h - icon_y
- - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+ if (draw_meeting_icon) {
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
- cairo_save (cr);
- cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h);
- cairo_clip (cr);
- cairo_new_path (cr);
- gdk_cairo_set_source_pixbuf (cr, day_view->timezone_icon, icon_x, icon_y);
- cairo_paint (cr);
- cairo_close_path (cr);
- cairo_restore (cr);
+ cairo_save (cr);
+ gdk_cairo_set_source_pixbuf (cr, day_view->meeting_icon, icon_x, icon_y);
+ cairo_paint (cr);
+ cairo_restore (cr);
- icon_x += icon_x_inc;
- icon_y += icon_y_inc;
- }
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
+ /* draw categories icons */
+ for (elem = categories_list; elem; elem = elem->next) {
+ char *category;
+ GdkPixmap *pixmap = NULL;
+ GdkBitmap *mask = NULL;
- if (draw_meeting_icon) {
- max_icon_w = item_x + item_w - icon_x
- - E_DAY_VIEW_EVENT_BORDER_WIDTH;
- max_icon_h = item_y + item_h - icon_y
- - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+ category = (char *) elem->data;
+ if (!e_categories_config_get_icon_for (category, &pixmap, &mask))
+ continue;
- cairo_save (cr);
- gdk_cairo_set_source_pixbuf (cr, day_view->meeting_icon, icon_x, icon_y);
- cairo_paint (cr);
- cairo_restore (cr);
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
- icon_x += icon_x_inc;
- icon_y += icon_y_inc;
- }
+ gdk_gc_set_clip_origin (gc, icon_x, icon_y);
+ if (mask != NULL)
+ gdk_gc_set_clip_mask (gc, mask);
+ gdk_draw_drawable (drawable, gc,
+ pixmap,
+ 0, 0, icon_x, icon_y,
+ MIN (E_DAY_VIEW_ICON_WIDTH,
+ max_icon_w),
+ MIN (E_DAY_VIEW_ICON_HEIGHT,
+ max_icon_h));
- /* draw categories icons */
- for (elem = categories_list; elem; elem = elem->next) {
- char *category;
- GdkPixmap *pixmap = NULL;
- GdkBitmap *mask = NULL;
+ g_object_unref (pixmap);
+ if (mask != NULL)
+ g_object_unref (mask);
- category = (char *) elem->data;
- if (!e_categories_config_get_icon_for (category, &pixmap, &mask))
- continue;
-
- max_icon_w = item_x + item_w - icon_x
- - E_DAY_VIEW_EVENT_BORDER_WIDTH;
- max_icon_h = item_y + item_h - icon_y
- - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
-
- gdk_gc_set_clip_origin (gc, icon_x, icon_y);
- if (mask != NULL)
- gdk_gc_set_clip_mask (gc, mask);
- gdk_draw_drawable (drawable, gc,
- pixmap,
- 0, 0, icon_x, icon_y,
- MIN (E_DAY_VIEW_ICON_WIDTH,
- max_icon_w),
- MIN (E_DAY_VIEW_ICON_HEIGHT,
- max_icon_h));
-
- g_object_unref (pixmap);
- if (mask != NULL)
- g_object_unref (mask);
-
- icon_x += icon_x_inc;
- icon_y += icon_y_inc;
- }
-
- gdk_gc_set_clip_mask (gc, NULL);
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
}
- /* free memory */
- e_cal_component_free_categories_list (categories_list);
+ gdk_gc_set_clip_mask (gc, NULL);
}
- g_free (text);
+ /* free memory */
+ e_cal_component_free_categories_list (categories_list);
+
g_object_unref (comp);
cairo_destroy (cr);
}