void gtk_calex_add_calendar (GtkCalEx *calex, GtkCalExCalendar *calendar);
void gtk_calex_remove_calendar (GtkCalEx *calex, GtkCalExCalendar *calendar);
+GList *gtk_calex_get_calendars (GtkCalEx *calex);
+
void gtk_calex_add_category (GtkCalEx *calex, GtkCalExCategory *category);
void gtk_calex_remove_category (GtkCalEx *calex, GtkCalExCategory *category);
+GList *gtk_calex_get_categories (GtkCalEx *calex);
+
void gtk_calex_add_event (GtkCalEx *calex, GtkCalExEvent *event);
void gtk_calex_remove_event (GtkCalEx *calex, GtkCalExEvent *event);
GooCanvasItem *goo_canvas_root;
GDate *date;
gboolean working_week;
+
+ guint division;
};
G_DEFINE_TYPE (GtkCalExViewDay, gtk_calex_view_day, G_TYPE_OBJECT)
gtk_calex_view_day_init (GtkCalExViewDay *gtk_calex_view_day)
{
GtkCalExViewDayPrivate *priv = GTK_CALEX_VIEW_DAY_GET_PRIVATE (gtk_calex_view_day);
+
+ priv->division = 30;
}
static void
return gtk_calex_view_day;
}
+void
+gtk_calex_view_day_set_division (GtkCalExViewDay *view_day, guint division)
+{
+ g_return_if_fail (IS_GTK_CALEX_VIEW_DAY (view_day));
+
+ GtkCalExViewDayPrivate *priv = GTK_CALEX_VIEW_DAY_GET_PRIVATE (view_day);
+
+ priv->division = division;
+
+ gtk_calex_view_day_draw (view_day);
+}
+
+guint
+gtk_calex_view_day_get_division (GtkCalExViewDay *view_day)
+{
+ g_return_if_fail (IS_GTK_CALEX_VIEW_DAY (view_day));
+
+ GtkCalExViewDayPrivate *priv = GTK_CALEX_VIEW_DAY_GET_PRIVATE (view_day);
+
+ return priv->division;
+}
+
static void
gtk_calex_view_day_draw (GtkCalExViewDay *gtk_calex_view_day)
{
guint hour;
+ guint division;
+ guint divisions;
+
+ gdouble y;
+
g_return_if_fail (IS_GTK_CALEX_VIEW_DAY (gtk_calex_view_day));
GtkCalExViewDayPrivate *priv = GTK_CALEX_VIEW_DAY_GET_PRIVATE (gtk_calex_view_day);
+ divisions = 60 / priv->division;
+ y = -20;
for (hour = 0; hour < 24; hour++)
{
- goo_canvas_text_new (priv->goo_canvas_root, g_strdup_printf ("%d", hour),
- 0, hour * 40, 50,
- GTK_ANCHOR_NORTH_WEST,
- "font", "Sans 24",
- NULL);
- goo_canvas_text_new (priv->goo_canvas_root, "00",
- 25, hour * 40, 25,
- GTK_ANCHOR_NORTH_WEST,
- "font", "Sans 12",
- NULL);
- goo_canvas_polyline_new_line (priv->goo_canvas_root, 0, hour * 40, 50, hour * 40,
+ y += 20;
+ goo_canvas_polyline_new_line (priv->goo_canvas_root,
+ 0, y, 50, y,
"stroke-color", "black",
NULL);
- goo_canvas_rect_new (priv->goo_canvas_root, 55, hour * 40, 400, 20,
+ goo_canvas_rect_new (priv->goo_canvas_root,
+ 55, y, 400, 20,
"line-width", 1.0,
"stroke-color", "black",
"fill-color", "yellow",
NULL);
- goo_canvas_polyline_new_line (priv->goo_canvas_root, 25, hour * 40 + 20, 50, hour * 40 + 20,
- "stroke-color", "black",
+ goo_canvas_text_new (priv->goo_canvas_root, g_strdup_printf ("%d", hour),
+ 0, y, 50,
+ GTK_ANCHOR_NORTH_WEST,
+ "font", "Sans 24",
NULL);
- goo_canvas_rect_new (priv->goo_canvas_root, 55, hour * 40 + 20, 400, 20,
- "line-width", 1.0,
- "stroke-color", "black",
- "fill-color", "yellow",
+ goo_canvas_text_new (priv->goo_canvas_root, "00",
+ 25, y, 25,
+ GTK_ANCHOR_NORTH_WEST,
+ "font", "Sans 12",
NULL);
+
+ for (division = 1; division < divisions; division++)
+ {
+ y += 20;
+ goo_canvas_polyline_new_line (priv->goo_canvas_root,
+ 25, y, 50, y,
+ "stroke-color", "black",
+ NULL);
+ goo_canvas_text_new (priv->goo_canvas_root, g_strdup_printf ("%02d", 60 / divisions * division),
+ 25, y, 25,
+ GTK_ANCHOR_NORTH_WEST,
+ "font", "Sans 12",
+ NULL);
+ goo_canvas_rect_new (priv->goo_canvas_root,
+ 55, y, 400, 20,
+ "line-width", 1.0,
+ "stroke-color", "black",
+ "fill-color", "yellow",
+ NULL);
+ }
}
}