gcal-view: add some API implementation
Added GcalView:get_left_header and GcalView:get_right_header implementations to GcalMonthView and GcalYearView
This commit is contained in:
@@ -133,6 +133,10 @@ static void gcal_month_view_clear_selection (GcalView *vie
|
|||||||
|
|
||||||
static void gcal_month_view_create_event_on_current_unit (GcalView *view);
|
static void gcal_month_view_create_event_on_current_unit (GcalView *view);
|
||||||
|
|
||||||
|
static gchar* gcal_month_view_get_left_header (GcalView *view);
|
||||||
|
|
||||||
|
static gchar* gcal_month_view_get_right_header (GcalView *view);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GcalMonthView,
|
G_DEFINE_TYPE_WITH_CODE (GcalMonthView,
|
||||||
gcal_month_view,
|
gcal_month_view,
|
||||||
GTK_TYPE_CONTAINER,
|
GTK_TYPE_CONTAINER,
|
||||||
@@ -217,6 +221,10 @@ gcal_view_interface_init (GcalViewIface *iface)
|
|||||||
iface->clear_selection = gcal_month_view_clear_selection;
|
iface->clear_selection = gcal_month_view_clear_selection;
|
||||||
|
|
||||||
iface->create_event_on_current_unit = gcal_month_view_create_event_on_current_unit;
|
iface->create_event_on_current_unit = gcal_month_view_create_event_on_current_unit;
|
||||||
|
|
||||||
|
/* New API */
|
||||||
|
iface->get_left_header = gcal_month_view_get_left_header;
|
||||||
|
iface->get_right_header = gcal_month_view_get_right_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1400,6 +1408,33 @@ gcal_month_view_create_event_on_current_unit (GcalView *view)
|
|||||||
g_free (start_span);
|
g_free (start_span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar*
|
||||||
|
gcal_month_view_get_left_header (GcalView *view)
|
||||||
|
{
|
||||||
|
GcalMonthViewPrivate *priv;
|
||||||
|
|
||||||
|
gchar str_date[64];
|
||||||
|
|
||||||
|
struct tm tm_date;
|
||||||
|
|
||||||
|
priv = GCAL_MONTH_VIEW (view)->priv;
|
||||||
|
|
||||||
|
tm_date = icaltimetype_to_tm (priv->date);
|
||||||
|
e_utf8_strftime_fix_am_pm (str_date, 64, "%B", &tm_date);
|
||||||
|
|
||||||
|
return g_strdup_printf ("%s", str_date);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gchar*
|
||||||
|
gcal_month_view_get_right_header (GcalView *view)
|
||||||
|
{
|
||||||
|
GcalMonthViewPrivate *priv;
|
||||||
|
|
||||||
|
priv = GCAL_MONTH_VIEW (view)->priv;
|
||||||
|
|
||||||
|
return g_strdup_printf ("%d", priv->date->year);
|
||||||
|
}
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
/**
|
/**
|
||||||
* gcal_month_view_new:
|
* gcal_month_view_new:
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ static void gcal_year_view_clear_selection (GcalView
|
|||||||
|
|
||||||
static void gcal_year_view_create_event_on_current_unit (GcalView *view);
|
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,
|
G_DEFINE_TYPE_WITH_CODE (GcalYearView,
|
||||||
gcal_year_view,
|
gcal_year_view,
|
||||||
GTK_TYPE_CONTAINER,
|
GTK_TYPE_CONTAINER,
|
||||||
@@ -215,6 +219,10 @@ gcal_view_interface_init (GcalViewIface *iface)
|
|||||||
iface->clear_selection = gcal_year_view_clear_selection;
|
iface->clear_selection = gcal_year_view_clear_selection;
|
||||||
|
|
||||||
iface->create_event_on_current_unit = gcal_year_view_create_event_on_current_unit;
|
iface->create_event_on_current_unit = gcal_year_view_create_event_on_current_unit;
|
||||||
|
|
||||||
|
/* New API */
|
||||||
|
iface->get_left_header = gcal_year_view_get_left_header;
|
||||||
|
iface->get_right_header = gcal_year_view_get_right_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1203,6 +1211,22 @@ gcal_year_view_create_event_on_current_unit (GcalView *view)
|
|||||||
g_free (end_span);
|
g_free (end_span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar*
|
||||||
|
gcal_year_view_get_left_header (GcalView *view)
|
||||||
|
{
|
||||||
|
GcalYearViewPrivate *priv;
|
||||||
|
|
||||||
|
priv = GCAL_YEAR_VIEW (view)->priv;
|
||||||
|
|
||||||
|
return g_strdup_printf ("%d", priv->date->year);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gchar*
|
||||||
|
gcal_year_view_get_right_header (GcalView *view)
|
||||||
|
{
|
||||||
|
return g_strdup ("");
|
||||||
|
}
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
/**
|
/**
|
||||||
* gcal_year_view_new:
|
* gcal_year_view_new:
|
||||||
|
|||||||
Reference in New Issue
Block a user