aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-calendar-view.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-11-24 13:14:44 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-11-24 13:14:44 +0800
commit4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 (patch)
tree828acaa7b76aa12a490a3238b0ec4a7086b8be16 /calendar/gui/e-calendar-view.c
parent076b7c45131482b87d18963d34d035435491ee8d (diff)
downloadgsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.gz
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.bz2
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.lz
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.xz
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.zst
gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.zip
Merge revisions 36737:36810 from trunk.
svn path=/branches/kill-bonobo/; revision=36811
Diffstat (limited to 'calendar/gui/e-calendar-view.c')
-rw-r--r--calendar/gui/e-calendar-view.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 63740563f9..594527aee8 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -2034,6 +2034,83 @@ e_calendar_view_move_tip (GtkWidget *widget, int x, int y)
gtk_widget_show (widget);
}
+/**
+ * Returns information about attendees in the component. If no attendees, then returns NULL.
+ * The information is like "Status: Accepted: X Declined: Y ...".
+ * Free returned pointer with g_free.
+ **/
+char *
+e_calendar_view_get_attendees_status_info (ECalComponent *comp)
+{
+ struct _values {
+ icalparameter_partstat status;
+ const char *caption;
+ int count;
+ } values[] = {
+ { ICAL_PARTSTAT_ACCEPTED, N_("Accepted"), 0 },
+ { ICAL_PARTSTAT_DECLINED, N_("Declined"), 0 },
+ { ICAL_PARTSTAT_TENTATIVE, N_("Tentative"), 0 },
+ { ICAL_PARTSTAT_DELEGATED, N_("Delegated"), 0 },
+ { ICAL_PARTSTAT_NEEDSACTION, N_("Needs action"), 0 },
+ { ICAL_PARTSTAT_NONE, N_("Other"), 0 },
+ { ICAL_PARTSTAT_X, NULL, -1 }
+ };
+
+ GSList *attendees = NULL, *a;
+ gboolean have = FALSE;
+ char *res = NULL;
+ int i;
+
+ if (!comp || !e_cal_component_has_attendees (comp))
+ return NULL;
+
+ e_cal_component_get_attendee_list (comp, &attendees);
+
+ for (a = attendees; a; a = a->next) {
+ ECalComponentAttendee *att = a->data;
+
+ if (att && att->cutype == ICAL_CUTYPE_INDIVIDUAL &&
+ (att->role == ICAL_ROLE_CHAIR ||
+ att->role == ICAL_ROLE_REQPARTICIPANT ||
+ att->role == ICAL_ROLE_OPTPARTICIPANT)) {
+ have = TRUE;
+
+ for (i = 0; values[i].count != -1; i++) {
+ if (att->status == values[i].status || values[i].status == ICAL_PARTSTAT_NONE) {
+ values[i].count++;
+ break;
+ }
+ }
+ }
+ }
+
+ if (have) {
+ GString *str = g_string_new ("");
+
+ for (i = 0; values[i].count != -1; i++) {
+ if (values[i].count > 0) {
+ if (str->str && *str->str)
+ g_string_append (str, " ");
+
+ g_string_append_printf (str, "%s: %d", _(values[i].caption), values[i].count);
+ }
+ }
+
+ g_string_prepend (str, ": ");
+
+ /* To Translators: 'Status' here means the state of the attendees, the resulting string will be in a form:
+ Status: Accepted: X Declined: Y ... */
+ g_string_prepend (str, _("Status"));
+
+ res = g_string_free (str, FALSE);
+ }
+
+ if (attendees)
+ e_cal_component_free_attendee_list (attendees);
+
+ return res;
+}
+
/*
* It is expected to show the tooltips in this below format
*
@@ -2041,6 +2118,7 @@ e_calendar_view_move_tip (GtkWidget *widget, int x, int y)
* Organiser: NameOfTheUser<email@ofuser.com>
* Location: PlaceOfTheMeeting
* Time : DateAndTime (xx Minutes)
+ * Status: Accepted: X Declined: Y ...
*/
gboolean
@@ -2179,6 +2257,17 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data)
g_free (tmp2);
g_free (tmp1);
+ tmp = e_calendar_view_get_attendees_status_info (newcomp);
+ if (tmp) {
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)hbox, gtk_label_new (tmp), FALSE, FALSE, 0);
+ ebox = gtk_event_box_new ();
+ gtk_container_add ((GtkContainer *)ebox, hbox);
+ gtk_box_pack_start ((GtkBox *)box, ebox, FALSE, FALSE, 0);
+
+ g_free (tmp);
+ }
+
pevent->tooltip = gtk_window_new (GTK_WINDOW_POPUP);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type ((GtkFrame *)frame, GTK_SHADOW_IN);