diff options
author | Milan Crha <mcrha@redhat.com> | 2011-02-23 22:11:43 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-02-23 22:11:43 +0800 |
commit | 56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1 (patch) | |
tree | 5c5f0a8305c9ce05770b16808ca9d11f654c867f /calendar | |
parent | c8a46943439f1544cb32650078e8598a308c34db (diff) | |
download | gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.tar gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.tar.gz gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.tar.bz2 gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.tar.lz gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.tar.xz gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.tar.zst gsoc2013-evolution-56fa4795bbb46d17c90ca9f02ca8b4d64a8289f1.zip |
Bug #550867 - Showing location in meetings
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/e-day-view.c | 8 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 66 |
2 files changed, 54 insertions, 20 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 3c792e6330..b0a2683ce2 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2122,7 +2122,13 @@ e_day_view_update_event_label (EDayView *day_view, if (!editing_event) { if (!short_event) { - text = g_strdup_printf (" \n%s", text); + const gchar *location = icalcomponent_get_location (event->comp_data->icalcomp); + + if (location && *location) + text = g_strdup_printf (" \n%s%c(%s)", text, day_view->days_shown == 1 ? ' ' : '\n', location); + else + text = g_strdup_printf (" \n%s", text); + free_text = TRUE; } } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 10f95d3463..07b94ca200 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2975,7 +2975,7 @@ tooltip_event_cb (GnomeCanvasItem *item, switch (event->type) { case GDK_ENTER_NOTIFY: - { + if (view->editing_event_num == -1) { ECalendarViewEventData *data; data = g_malloc (sizeof (ECalendarViewEventData)); @@ -2994,7 +2994,9 @@ tooltip_event_cb (GnomeCanvasItem *item, data, (GDestroyNotify) g_free); g_object_set_data ((GObject *)view, "tooltip-timeout", GUINT_TO_POINTER (pevent->timeout)); - return TRUE; + return TRUE; + } else { + return FALSE; } case GDK_MOTION_NOTIFY: pevent->x = ((GdkEventMotion *)event)->x_root; @@ -3015,6 +3017,32 @@ tooltip_event_cb (GnomeCanvasItem *item, } } +static const gchar * +get_comp_summary (ECal *ecal, icalcomponent *icalcomp, gboolean *free_text) +{ + const gchar *my_summary, *location; + const gchar *summary; + gboolean my_free_text = FALSE; + + g_return_val_if_fail (icalcomp != NULL && free_text != NULL, NULL); + + my_summary = e_calendar_view_get_icalcomponent_summary (ecal, icalcomp, &my_free_text); + + location = icalcomponent_get_location (icalcomp); + if (location && *location) { + *free_text = TRUE; + summary = g_strdup_printf ("%s (%s)", my_summary, location); + + if (my_free_text) + g_free ((gchar *) my_summary); + } else { + *free_text = my_free_text; + summary = my_summary; + } + + return summary; +} + static void e_week_view_reshape_event_span (EWeekView *week_view, gint event_num, @@ -3127,7 +3155,7 @@ e_week_view_reshape_event_span (EWeekView *week_view, widget = (GtkWidget *)week_view; color = e_week_view_get_text_color (week_view, event, widget); - summary = e_calendar_view_get_icalcomponent_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text); + summary = get_comp_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text); span->text_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root), @@ -3348,11 +3376,9 @@ e_week_view_start_editing_event (EWeekView *week_view, return FALSE; } - if (initial_text) { - gnome_canvas_item_set (span->text_item, - "text", initial_text, - NULL); - } + gnome_canvas_item_set (span->text_item, + "text", initial_text ? initial_text : icalcomponent_get_summary (event->comp_data->icalcomp), + NULL); /* Save the comp_data value because we use that as our invariant */ comp_data = event->comp_data; @@ -3419,7 +3445,6 @@ cancel_editing (EWeekView *week_view) EWeekViewEvent *event; EWeekViewEventSpan *span; const gchar *summary; - gboolean free_text = FALSE; event_num = week_view->editing_event_num; span_num = week_view->editing_span_num; @@ -3441,12 +3466,9 @@ cancel_editing (EWeekView *week_view) /* Reset the text to what was in the component */ - summary = e_calendar_view_get_icalcomponent_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text); + summary = icalcomponent_get_summary (event->comp_data->icalcomp); g_object_set (G_OBJECT (span->text_item), "text", summary ? summary : "", NULL); - if (free_text) - g_free ((gchar *)summary); - /* Stop editing */ e_week_view_stop_editing_event (week_view); } @@ -3598,10 +3620,8 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item, ECalendarViewEventData *data; gint nspan; - if (!e_week_view_find_event_from_item (week_view, - item, - &nevent, - &nspan)) + if (week_view->editing_event_num != -1 + || !e_week_view_find_event_from_item (week_view, item, &nevent, &nspan)) return FALSE; g_object_set_data ((GObject *)item, "event-num", GINT_TO_POINTER (nevent)); @@ -3963,9 +3983,17 @@ e_week_view_on_editing_stopped (EWeekView *week_view, /* Only update the summary if necessary. */ e_cal_component_get_summary (comp, &summary); if (summary.value && !strcmp (text, summary.value)) { + gboolean free_text = FALSE; + const gchar *summary; + + summary = get_comp_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text); + g_object_set (G_OBJECT (span->text_item), "text", summary ? summary : "", NULL); + + if (free_text) + g_free ((gchar *) summary); + if (!e_week_view_is_one_day_event (week_view, event_num)) - e_week_view_reshape_event_span (week_view, event_num, - span_num); + e_week_view_reshape_event_span (week_view, event_num, span_num); } else if (summary.value || !string_is_empty (text)) { icalcomponent *icalcomp = e_cal_component_get_icalcomponent (comp); |