aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/view-utils.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-21 02:00:54 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-21 02:00:54 +0800
commit26e5915000652f4807e337a2b370ce0051972f04 (patch)
treee439a67248bf8c320c79774d6247fb5a3c37a05b /calendar/gui/view-utils.c
parentefc1cef1db090cbce9b25260d7f236a21fc7e129 (diff)
downloadgsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.tar
gsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.tar.gz
gsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.tar.bz2
gsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.tar.lz
gsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.tar.xz
gsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.tar.zst
gsoc2013-evolution-26e5915000652f4807e337a2b370ce0051972f04.zip
A lot of usability changes to GnomeCal -miguel
svn path=/trunk/; revision=168
Diffstat (limited to 'calendar/gui/view-utils.c')
-rw-r--r--calendar/gui/view-utils.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/calendar/gui/view-utils.c b/calendar/gui/view-utils.c
index ccbe125291..0c074bd944 100644
--- a/calendar/gui/view-utils.c
+++ b/calendar/gui/view-utils.c
@@ -2,19 +2,41 @@
*
* Copyright (C) 1998 The Free Software Foundation
*
- * Author: Federico Mena <quartic@gimp.org>
+ * Authors: Federico Mena <quartic@gimp.org>
+ * Miguel de Icaza <miguel@kernel.org>
*/
#include <string.h>
#include "view-utils.h"
+int am_pm_flag = 0;
+
+char *
+nicetime (struct tm *tm)
+{
+ static char buf [20];
+
+ if (am_pm_flag){
+ if (tm->tm_min)
+ strftime (buf, sizeof (buf), "%I:%M%p", tm);
+ else
+ strftime (buf, sizeof (buf), "%I%p", tm);
+ } else {
+ if (tm->tm_min)
+ strftime (buf, sizeof (buf), "%H:%M", tm);
+ else
+ strftime (buf, sizeof (buf), "%H", tm);
+ }
+ return buf;
+}
+
void
view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRectangle *area,
int flags, GList *events, time_t start, time_t end)
{
int font_height;
int x, y, max_y;
- char buf[512];
+ char buf [40];
int len;
struct tm tm_start, tm_end;
char *str;
@@ -35,13 +57,12 @@ view_utils_draw_events (GtkWidget *widget, GdkWindow *window, GdkGC *gc, GdkRect
tm_end = *localtime (&co->ev_end);
str = ico->summary;
- if (flags & VIEW_UTILS_DRAW_END) {
- strftime (buf, 512, "%X-", &tm_start);
- len = strlen (buf);
- strftime (buf + len, 512 - len, "%X ", &tm_end);
- } else
- strftime (buf, 512, "%X ", &tm_start);
-
+ strcpy (buf, nicetime (&tm_start));
+
+ if (flags & VIEW_UTILS_DRAW_END){
+ strcat (buf, "-");
+ strcat (buf, nicetime (&tm_end));
+ }
gdk_draw_string (window,
widget->style->font,
gc,