gcal-view: modified API

Implemented in views.
Reworked GcalDayView implementation to allow bigger
than days events.
This commit is contained in:
Erick Pérez Castellanos
2014-12-04 17:10:26 -05:00
parent 318cd4dd33
commit 9f530a5b8a
7 changed files with 105 additions and 87 deletions
+15 -13
View File
@@ -115,8 +115,13 @@ static icaltimetype* gcal_year_view_get_initial_date (GcalView
static icaltimetype* gcal_year_view_get_final_date (GcalView *view);
static gboolean gcal_year_view_contains_date (GcalView *view,
icaltimetype *date);
static gchar* gcal_year_view_get_left_header (GcalView *view);
static gchar* gcal_year_view_get_right_header (GcalView *view);
static gboolean gcal_year_view_draw_event (GcalView *view,
icaltimetype *start_date,
icaltimetype *end_date);
static GtkWidget* gcal_year_view_get_by_uuid (GcalView *view,
const gchar *uuid);
@@ -129,10 +134,6 @@ static void gcal_year_view_clear_selection (GcalView
static void gcal_year_view_create_event_on_current_unit (GcalView *view);
static gchar* gcal_year_view_get_left_header (GcalView *view);
static gchar* gcal_year_view_get_right_header (GcalView *view);
G_DEFINE_TYPE_WITH_CODE (GcalYearView,
gcal_year_view,
GTK_TYPE_CONTAINER,
@@ -213,11 +214,11 @@ gcal_view_interface_init (GcalViewIface *iface)
/* New API */
iface->get_initial_date = gcal_year_view_get_initial_date;
iface->get_final_date = gcal_year_view_get_final_date;
iface->contains_date = gcal_year_view_contains_date;
iface->get_left_header = gcal_year_view_get_left_header;
iface->get_right_header = gcal_year_view_get_right_header;
iface->draw_event = gcal_year_view_draw_event;
iface->get_by_uuid = gcal_year_view_get_by_uuid;
}
@@ -758,7 +759,7 @@ gcal_year_view_set_date (GcalYearView *view,
will_resize = FALSE;
/* if span_updated: queue_resize */
will_resize = ! gcal_year_view_contains_date (GCAL_VIEW (view), date);
will_resize = ! gcal_year_view_draw_event (GCAL_VIEW (view), date, NULL);
if (priv->date != NULL)
g_free (priv->date);
@@ -779,7 +780,7 @@ gcal_year_view_set_date (GcalYearView *view,
child = (GcalViewChild*) l->data;
child_date =
gcal_event_widget_get_date (GCAL_EVENT_WIDGET (child->widget));
if (! gcal_year_view_contains_date (GCAL_VIEW (view), child_date))
if (! gcal_year_view_draw_event (GCAL_VIEW (view), child_date, NULL))
to_remove = g_list_append (to_remove, child->widget);
}
}
@@ -1023,8 +1024,9 @@ gcal_year_view_get_final_date (GcalView *view)
}
static gboolean
gcal_year_view_contains_date (GcalView *view,
icaltimetype *date)
gcal_year_view_draw_event (GcalView *view,
icaltimetype *start_date,
icaltimetype *end_date)
{
GcalYearViewPrivate *priv;
@@ -1034,7 +1036,7 @@ gcal_year_view_contains_date (GcalView *view,
if (priv->date == NULL)
return FALSE;
return priv->date->year == date->year;
return priv->date->year == start_date->year;
}
static GtkWidget*
@@ -1091,7 +1093,7 @@ gcal_year_view_reposition_child (GcalView *view,
date =
gcal_event_widget_get_date (GCAL_EVENT_WIDGET (child->widget));
if (gcal_year_view_contains_date (view, date))
if (gcal_year_view_draw_event (view, date, NULL))
{
if (date->month - 1 == i)
{