aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinivasa Ragavan <sragavan@novell.com>2005-11-23 16:19:00 +0800
committerSrinivasa Ragavan <sragavan@src.gnome.org>2005-11-23 16:19:00 +0800
commita722e3281e5404a902eefe0f20005f59b5b2d813 (patch)
treec589fa71f218ee0c0e17f86bf066f2866ca1ee41
parent80f4fd336fed8066ba8db8dd398c5023b0ff4ff7 (diff)
downloadgsoc2013-evolution-a722e3281e5404a902eefe0f20005f59b5b2d813.tar.gz
gsoc2013-evolution-a722e3281e5404a902eefe0f20005f59b5b2d813.tar.zst
gsoc2013-evolution-a722e3281e5404a902eefe0f20005f59b5b2d813.zip
Added a function to get tooltip tooltip widget
2005-11-23 Srinivasa Ragavan <sragavan@novell.com> * gui/e-calendar-view.c (tooltip_grab), (get_label), (e_calendar_view_get_tooltips): Added a function to get tooltip tooltip widget * gui/e-calendar-view.h: * gui/e-day-view.c (e_day_view_add_event), (e_day_view_reshape_long_event), (e_day_view_reshape_day_event), (e_day_view_on_text_item_event): Added tooltip for day/work week view. * gui/e-week-view.c (e_week_view_add_event), (tooltip_event_cb), (e_week_view_reshape_event_span), (e_week_view_on_text_item_event): Added tooltip for week/month view. * gui/e-week-view.h: * gui/misc.c (get_position_in_array), (calculate_time): Added a function for converting time to string. * gui/misc.h: svn path=/trunk/; revision=30648
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/gui/e-calendar-view.c168
-rw-r--r--calendar/gui/e-calendar-view.h8
-rw-r--r--calendar/gui/e-day-view.c48
-rw-r--r--calendar/gui/e-week-view.c90
-rw-r--r--calendar/gui/e-week-view.h1
-rw-r--r--calendar/gui/misc.c52
-rw-r--r--calendar/gui/misc.h3
8 files changed, 379 insertions, 9 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 13b683a4de..8d6a674924 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,21 @@
+2005-11-23 Srinivasa Ragavan <sragavan@novell.com>
+
+ * gui/e-calendar-view.c (tooltip_grab), (get_label),
+ (e_calendar_view_get_tooltips): Added a function to get tooltip
+ tooltip widget
+ * gui/e-calendar-view.h:
+ * gui/e-day-view.c (e_day_view_add_event),
+ (e_day_view_reshape_long_event), (e_day_view_reshape_day_event),
+ (e_day_view_on_text_item_event): Added tooltip for day/work week
+ view.
+ * gui/e-week-view.c (e_week_view_add_event), (tooltip_event_cb),
+ (e_week_view_reshape_event_span), (e_week_view_on_text_item_event):
+ Added tooltip for week/month view.
+ * gui/e-week-view.h:
+ * gui/misc.c (get_position_in_array), (calculate_time): Added a
+ function for converting time to string.
+ * gui/misc.h:
+
2005-11-22 Boby Wang <boby.wang@sun.com>
Fixes #321237
* gui/dialogs/event-page.glade: Add the categories' name
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index f2324da1f7..d9b624f5f9 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -31,9 +31,14 @@
#include <gtk/gtkstock.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkbindings.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkcontainer.h>
+#include <gtk/gtkwindow.h>
#include <libgnome/gnome-i18n.h>
#include <e-util/e-dialog-utils.h>
#include <e-util/e-icon-factory.h>
+#include <e-util/e-time-utils.h>
#include "e-calendar-marshal.h"
#include <libecal/e-cal-time-util.h>
#include <libecal/e-cal-component.h>
@@ -59,6 +64,7 @@
#include "goto.h"
#include "ea-calendar.h"
#include "e-cal-popup.h"
+#include "misc.h"
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "stock_calendar"
@@ -1851,3 +1857,165 @@ e_calendar_view_modify_and_send (ECalComponent *comp,
g_message (G_STRLOC ": Could not update the object!");
}
}
+
+static gboolean
+tooltip_grab (GtkWidget *tooltip, GdkEventKey *event, ECalendarViewEvent *pevent)
+{
+ gdk_keyboard_ungrab(GDK_CURRENT_TIME);
+
+ gtk_widget_destroy (pevent->tooltip);
+ pevent->tooltip = NULL;
+ pevent->timeout = -1;
+
+ return FALSE;
+}
+
+static char *
+get_label (struct icaltimetype *tt)
+{
+ char buffer[1000];
+ struct tm tmp_tm;
+
+ tmp_tm = icaltimetype_to_tm (tt);
+ e_time_format_date_and_time (&tmp_tm,
+ calendar_config_get_24_hour_format (),
+ FALSE, FALSE,
+ buffer, 1000);
+
+ return g_strdup (buffer);
+}
+
+
+gboolean
+e_calendar_view_get_tooltips (ECalendarViewEvent *pevent)
+{
+ GtkWidget *label, *box, *hbox, *ebox, *frame;
+ const char *str;
+ char *tmp, *tmp1, *tmp2;
+ ECalComponentOrganizer organiser;
+ ECalComponentDateTime dtstart, dtend;
+ icalcomponent *clone_comp;
+ time_t t_start, t_end;
+
+ ECalComponent *newcomp = e_cal_component_new ();
+ icaltimezone *zone;
+ GdkColor color, outer_color;
+
+ gdk_color_parse ("PeachPuff2", &color);
+ gdk_color_parse ("antique white", &outer_color);
+
+ clone_comp = icalcomponent_new_clone (pevent->comp_data->icalcomp);
+ if (!e_cal_component_set_icalcomponent (newcomp, clone_comp))
+ g_warning ("couldn't update calendar component with modified data from backend\n");
+
+ box = gtk_vbox_new (FALSE, 0);
+
+ str = icalcomponent_get_summary (pevent->comp_data->icalcomp);
+ tmp = g_strdup_printf ("<b>%s</b>", str);
+ label = gtk_label_new (NULL);
+ gtk_label_set_line_wrap ((GtkLabel *)label, TRUE);
+ gtk_label_set_markup ((GtkLabel *)label, tmp);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 0);
+ ebox = gtk_event_box_new ();
+ gtk_container_add ((GtkContainer *)ebox, hbox);
+ gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL, &color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_ACTIVE, &color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_SELECTED, &color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_PRELIGHT, &color);
+
+ gtk_box_pack_start ((GtkBox *)box, ebox, FALSE, FALSE, 0);
+ g_free (tmp);
+
+ e_cal_component_get_organizer (newcomp, &organiser);
+ if (organiser.cn) {
+ char *ptr ;
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
+ ptr = strchr(organiser.value, ':');
+ ptr++;
+ tmp = g_strdup_printf ("Organiser: %s <%s>", organiser.cn, ptr);
+ label = gtk_label_new (tmp);
+ gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 0);
+ ebox = gtk_event_box_new ();
+ gtk_container_add ((GtkContainer *)ebox, hbox);
+ gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_ACTIVE, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_SELECTED, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_PRELIGHT, &outer_color);
+ gtk_box_pack_start ((GtkBox *)box, ebox, FALSE, FALSE, 0);
+
+ g_free (tmp);
+ }
+
+ e_cal_component_get_location (newcomp, &str);
+
+ if (str) {
+ tmp = g_strdup_printf ("Location: %s", str);
+ label = gtk_label_new (NULL);
+ gtk_label_set_markup ((GtkLabel *)label, tmp);
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 0);
+ ebox = gtk_event_box_new ();
+ gtk_container_add ((GtkContainer *)ebox, hbox);
+ gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_ACTIVE, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_SELECTED, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_PRELIGHT, &outer_color);
+ gtk_box_pack_start ((GtkBox *)box, ebox, FALSE, FALSE, 0);
+ g_free (tmp);
+ }
+ e_cal_component_get_dtstart (newcomp, &dtstart);
+ e_cal_component_get_dtend (newcomp, &dtend);
+
+ if (dtstart.tzid) {
+ zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (newcomp), dtstart.tzid);
+ } else {
+ zone = NULL;
+ }
+ t_start = icaltime_as_timet_with_zone (*dtstart.value, zone);
+
+ if (dtend.tzid) {
+ zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (newcomp), dtend.tzid);
+ } else {
+ zone = NULL;
+ }
+ t_end = icaltime_as_timet_with_zone (*dtend.value, zone);
+
+ tmp1 = get_label(dtstart.value);
+ tmp = calculate_time (t_start, t_end);
+
+ tmp2 = g_strdup_printf("Time: %s %s", tmp1, tmp);
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start ((GtkBox *)hbox, gtk_label_new_with_mnemonic (tmp2), FALSE, FALSE, 0);
+ ebox = gtk_event_box_new ();
+ gtk_container_add ((GtkContainer *)ebox, hbox);
+ gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_ACTIVE, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_SELECTED, &outer_color);
+ gtk_widget_modify_bg (ebox, GTK_STATE_PRELIGHT, &outer_color);
+ gtk_box_pack_start ((GtkBox *)box, ebox, FALSE, FALSE, 0);
+
+ g_free (tmp);
+ g_free (tmp2);
+ g_free (tmp1);
+
+ pevent->tooltip = gtk_window_new (GTK_WINDOW_POPUP);
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type ((GtkFrame *)frame, GTK_SHADOW_IN);
+
+ gtk_window_move ((GtkWindow *)pevent->tooltip, pevent->x +16, pevent->y+16);
+ gtk_container_add ((GtkContainer *)frame, box);
+ gtk_container_add ((GtkContainer *)pevent->tooltip, frame);
+
+ gtk_widget_show_all (pevent->tooltip);
+ gdk_keyboard_grab (pevent->tooltip->window, FALSE, GDK_CURRENT_TIME);
+ g_signal_connect (pevent->tooltip, "key-press-event", G_CALLBACK (tooltip_grab), pevent);
+ pevent->timeout = -1;
+
+ g_object_unref (newcomp);
+
+ return FALSE;
+}
+
+
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 17778e3a2b..8e2d67c477 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -66,7 +66,11 @@ typedef enum {
time_t end; \
guint16 start_minute; \
guint16 end_minute; \
- guint different_timezone : 1;
+ guint different_timezone : 1; \
+ GtkWidget *tooltip; \
+ gint timeout; \
+ GdkColor *color; \
+ gint x,y;
typedef struct {
E_CALENDAR_VIEW_EVENT_FIELDS
@@ -154,7 +158,7 @@ void e_calendar_view_modify_and_send (ECalComponent *comp,
GtkWindow *toplevel,
gboolean new);
-
+gboolean e_calendar_view_get_tooltips (ECalendarViewEvent *pevent);
G_END_DECLS
#endif
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index a7092f8f91..1c655ad7f2 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -4224,6 +4224,9 @@ e_day_view_add_event (ECalComponent *comp,
}
event.start = start;
+ event.tooltip = NULL;
+ event.color = NULL;
+ event.timeout = -1;
event.end = end;
event.canvas_item = NULL;
event.comp_data->instance_start = start;
@@ -4465,6 +4468,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
NULL);
g_signal_connect (event->canvas_item, "event",
G_CALLBACK (e_day_view_on_text_item_event), day_view);
+ g_object_set_data ((GObject *)event->canvas_item, "event", (gpointer)event);
g_signal_emit_by_name (G_OBJECT(day_view),
"event_added", event);
@@ -4646,6 +4650,7 @@ e_day_view_reshape_day_event (EDayView *day_view,
NULL);
g_signal_connect (event->canvas_item, "event",
G_CALLBACK (e_day_view_on_text_item_event), day_view);
+ g_object_set_data ((GObject *)event->canvas_item, "event", (gpointer)event);
g_signal_emit_by_name (G_OBJECT(day_view),
"event_added", event);
@@ -5765,7 +5770,6 @@ cancel_editing (EDayView *day_view)
e_day_view_stop_editing_event (day_view);
}
-
static gboolean
e_day_view_on_text_item_event (GnomeCanvasItem *item,
GdkEvent *event,
@@ -5825,10 +5829,50 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
e_day_view_on_editing_stopped (day_view, item);
return FALSE;
+ case GDK_ENTER_NOTIFY:
+ {
+ EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event");
+
+ pevent->x = ((GdkEventCrossing *)event)->x_root;
+ pevent->y = ((GdkEventCrossing *)event)->y_root;
+ pevent->tooltip = NULL;
+ pevent->timeout = g_timeout_add (500, (GSourceFunc)e_calendar_view_get_tooltips, pevent);
+
+ return TRUE;
+ }
+ case GDK_LEAVE_NOTIFY:
+ {
+ EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event");
+
+ if (pevent && pevent->tooltip) {
+ gtk_widget_destroy (pevent->tooltip);
+ pevent->tooltip = NULL;
+ }
+
+ if (pevent && pevent->timeout != -1) {
+ g_source_remove (pevent->timeout);
+ pevent->timeout = -1;
+ }
+
+ return TRUE;
+ }
+ case GDK_MOTION_NOTIFY:
+ {
+ EDayViewEvent *pevent = (EDayViewEvent *)g_object_get_data ((GObject *)item, "event");
+
+ pevent->x = ((GdkEventMotion *)event)->x_root;
+ pevent->y = ((GdkEventMotion *)event)->y_root;
+
+ if (pevent->tooltip) {
+ gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16);
+ }
+
+ return TRUE;
+ }
default:
break;
}
-
+
return FALSE;
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index a3cd52bba3..d6a0aba123 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2391,6 +2391,9 @@ e_week_view_add_event (ECalComponent *comp,
}
event.start = start;
event.end = end;
+ event.tooltip = NULL;
+ event.timeout = -1;
+ event.color = NULL;
event.spans_index = 0;
event.num_spans = 0;
event.comp_data->instance_start = start;
@@ -2547,6 +2550,50 @@ e_week_view_reshape_events (EWeekView *week_view)
}
+static gboolean
+tooltip_event_cb (GnomeCanvasItem *item,
+ GdkEvent *event,
+ EWeekView *view)
+{
+ EWeekViewEvent *pevent = g_object_get_data ((GObject *)item, "event");
+
+ switch (event->type) {
+ case GDK_ENTER_NOTIFY:
+
+ pevent->x = ((GdkEventCrossing *)event)->x_root;
+ pevent->y = ((GdkEventCrossing *)event)->y_root;
+ pevent->tooltip = NULL;
+ pevent->timeout = g_timeout_add (500, (GSourceFunc)e_calendar_view_get_tooltips, pevent);
+
+ return TRUE;
+
+ case GDK_LEAVE_NOTIFY:
+ if (pevent && pevent->tooltip) {
+ gtk_widget_destroy (pevent->tooltip);
+ pevent->tooltip = NULL;
+ }
+
+ if (pevent && pevent->timeout != -1) {
+ g_source_remove (pevent->timeout);
+ pevent->timeout = -1;
+ }
+ return TRUE;
+ case GDK_MOTION_NOTIFY:
+ pevent->x = ((GdkEventMotion *)event)->x_root;
+ pevent->y = ((GdkEventMotion *)event)->y_root;
+
+ if (pevent->tooltip) {
+ gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16);
+ }
+
+ return TRUE;
+ default:
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
static void
e_week_view_reshape_event_span (EWeekView *week_view,
gint event_num,
@@ -2640,7 +2687,12 @@ e_week_view_reshape_event_span (EWeekView *week_view,
e_week_view_event_item_get_type (),
NULL);
}
-
+
+ g_object_set_data ((GObject *)span->background_item, "event", event);
+ g_signal_connect (span->background_item, "event",
+ G_CALLBACK (tooltip_event_cb),
+ week_view);
+
gnome_canvas_item_set (span->background_item,
"event_num", event_num,
"span_num", span_num,
@@ -2671,7 +2723,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
&& e_cal_util_component_has_attendee (event->comp_data->icalcomp)) {
set_text_as_bold (event, span);
} */
-
+ g_object_set_data ((GObject *)span->text_item, "event", event);
g_signal_connect (span->text_item, "event",
G_CALLBACK (e_week_view_on_text_item_event),
week_view);
@@ -2940,11 +2992,12 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
{
EWeekViewEvent *event;
gint event_num, span_num;
-
+ EWeekViewEvent *pevent = g_object_get_data ((GObject *)item, "event");
+
#if 0
g_print ("In e_week_view_on_text_item_event\n");
#endif
-
+
switch (gdkevent->type) {
case GDK_KEY_PRESS:
if (gdkevent && gdkevent->key.keyval == GDK_Return) {
@@ -3055,6 +3108,35 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
}
week_view->pressed_event_num = -1;
break;
+ case GDK_ENTER_NOTIFY:
+
+ pevent->x = ((GdkEventCrossing *)gdkevent)->x_root;
+ pevent->y = ((GdkEventCrossing *)gdkevent)->y_root;
+ pevent->tooltip = NULL;
+ pevent->timeout = g_timeout_add (500, (GSourceFunc)e_calendar_view_get_tooltips, pevent);
+
+ return TRUE;
+
+ case GDK_LEAVE_NOTIFY:
+ if (pevent && pevent->tooltip) {
+ gtk_widget_destroy (pevent->tooltip);
+ pevent->tooltip = NULL;
+ }
+
+ if (pevent && pevent->timeout != -1) {
+ g_source_remove (pevent->timeout);
+ pevent->timeout = -1;
+ }
+ return TRUE;
+ case GDK_MOTION_NOTIFY:
+ pevent->x = ((GdkEventMotion *)gdkevent)->x_root;
+ pevent->y = ((GdkEventMotion *)gdkevent)->y_root;
+
+ if (pevent->tooltip) {
+ gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)gdkevent)->x_root)+16, ((int)((GdkEventMotion *)gdkevent)->y_root) +16);
+ }
+
+ return TRUE;
case GDK_FOCUS_CHANGE:
if (gdkevent->focus_change.in) {
e_week_view_on_editing_started (week_view, item);
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 58ff08aa22..888d88bccb 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -143,6 +143,7 @@ struct _EWeekViewEventSpan {
typedef struct _EWeekViewEvent EWeekViewEvent;
struct _EWeekViewEvent {
E_CALENDAR_VIEW_EVENT_FIELDS
+
gint spans_index;
guint8 num_spans;
};
diff --git a/calendar/gui/misc.c b/calendar/gui/misc.c
index 026cd8417e..5ab2739525 100644
--- a/calendar/gui/misc.c
+++ b/calendar/gui/misc.c
@@ -24,7 +24,10 @@
#endif
#include <ctype.h>
+#include <time.h>
#include <libedataserver/e-url.h>
+#include "e-util/e-i18n.h"
+
#include "misc.h"
@@ -91,3 +94,52 @@ get_position_in_array (GPtrArray *objects, gpointer item)
return -1;
}
+
+char *
+calculate_time (time_t start, time_t end)
+{
+ time_t difference = end - start;
+ char *str;
+
+ if (difference < 60) {/* Can't be zero */
+ str = g_strdup_printf (_("(%d seconds)"), difference);
+ } else if (difference > 60 && difference < 3600) { /* It will be x minutes y seconds*/
+ int minutes, seconds;
+ minutes = difference / 60;
+ seconds = difference % 60;
+ if (seconds)
+ str = g_strdup_printf (_("(%d %s %d %s)"), minutes, ngettext(_("minute"), _("minutes"), minutes), seconds, ngettext(_("second"), _("seconds"), seconds));
+ else
+ str = g_strdup_printf (_("(%d %s)"), minutes, ngettext(_("minute"), _("minutes"), minutes));
+ } else {
+ guint hours, minutes, seconds;
+ char *s_hours = NULL, *s_minutes = NULL, *s_seconds = NULL;
+
+ hours = difference / 3600;
+ minutes = (difference % 3600)/60;
+ seconds = difference % 60;
+
+
+ if (seconds)
+ s_seconds = g_strdup_printf (ngettext(_(" %u second"), _(" %u seconds"), seconds), seconds);
+ if (minutes)
+ s_minutes = g_strdup_printf (ngettext(_(" %u minute"), _(" %u minutes"), minutes), minutes);
+ if (hours)
+ s_hours = g_strdup_printf (ngettext(_("%u hour"),_("%u hours"), hours), hours);
+
+ if (s_minutes && s_seconds)
+ str = g_strconcat ("(", s_hours, s_minutes, s_seconds, ")", NULL);
+ else if (s_minutes)
+ str = g_strconcat ("(", s_hours, s_minutes, ")", NULL);
+ else if (s_seconds)
+ str = g_strconcat ("(", s_hours, s_seconds, ")", NULL);
+ else
+ str = g_strconcat ("(", s_hours, ")", NULL);
+
+ g_free (s_hours);
+ g_free (s_minutes);
+ g_free (s_seconds);
+ }
+
+ return g_strchug(str);
+}
diff --git a/calendar/gui/misc.h b/calendar/gui/misc.h
index 7f89788f2c..c48dbaffa1 100644
--- a/calendar/gui/misc.h
+++ b/calendar/gui/misc.h
@@ -23,9 +23,10 @@
#define MISC_H
#include <glib.h>
+#include <time.h>
gboolean string_is_empty (const char *value);
char *get_uri_without_password (const char *uri);
gint get_position_in_array (GPtrArray *objects, gpointer item);
-
+char * calculate_time (time_t start, time_t end);
#endif