From e6a929f3fdb867466dc571a152e2d9d179d10c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Thu, 25 Dec 2014 20:24:36 -0500 Subject: [PATCH] view: remove ::mark_current_unit New event action will open edit-dialog directly so this method is not needed --- src/gcal-month-view.c | 49 ------------------------------------------- src/gcal-view.c | 20 ------------------ src/gcal-view.h | 5 ----- src/gcal-week-view.c | 1 - src/gcal-year-view.c | 35 ------------------------------- 5 files changed, 110 deletions(-) diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index a29abdf7..0b24ee3b 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -201,10 +201,6 @@ static icaltimetype* gcal_month_view_get_initial_date (GcalView *vie static icaltimetype* gcal_month_view_get_final_date (GcalView *view); -static void gcal_month_view_mark_current_unit (GcalView *view, - gint *x, - gint *y); - static void gcal_month_view_clear_marks (GcalView *view); static gchar* gcal_month_view_get_left_header (GcalView *view); @@ -656,7 +652,6 @@ gcal_view_interface_init (GcalViewIface *iface) iface->get_initial_date = gcal_month_view_get_initial_date; iface->get_final_date = gcal_month_view_get_final_date; - iface->mark_current_unit = gcal_month_view_mark_current_unit; iface->clear_marks = gcal_month_view_clear_marks; iface->get_left_header = gcal_month_view_get_left_header; @@ -1818,50 +1813,6 @@ gcal_month_view_get_final_date (GcalView *view) return new_date; } -static void -gcal_month_view_mark_current_unit (GcalView *view, - gint *x, - gint *y) -{ - GcalMonthViewPrivate *priv; - - gdouble horizontal_block; - gdouble vertical_block; - - gint days; - gint shown_rows; - gint february_gap; - gdouble lines_gap; - gdouble lines_gap_for_5; - - gint x_pos, y_pos; - gdouble start_grid_y; - - priv = gcal_month_view_get_instance_private (GCAL_MONTH_VIEW (view)); - start_grid_y = get_start_grid_y (GTK_WIDGET (view)); - horizontal_block = gtk_widget_get_allocated_width (GTK_WIDGET (view)) / 7.0; - vertical_block = (gtk_widget_get_allocated_height (GTK_WIDGET (view)) - start_grid_y) / 6.0; - - days = priv->days_delay + icaltime_days_in_month (priv->date->month, priv->date->year); - shown_rows = ceil (days / 7.0); - february_gap = shown_rows == 4 ? 1 : 0; - lines_gap = ((shown_rows + 1) / 2.0) + 0.5 - ceil (shown_rows / 2.0); - lines_gap_for_5 = shown_rows == 5 ? lines_gap : 0; - - priv->start_mark_cell = priv->date->day + 7 * february_gap + priv->days_delay - 1; - priv->end_mark_cell = priv->start_mark_cell; - - x_pos = horizontal_block * ((priv->end_mark_cell % 7) + 0.5); - y_pos = start_grid_y + vertical_block * (lines_gap_for_5 + (priv->end_mark_cell / 7.0) + 0.5); - - gtk_widget_queue_draw (GTK_WIDGET (view)); - - if (x != NULL) - *x = x_pos; - if (y != NULL) - *y = y_pos; -} - static void gcal_month_view_clear_marks (GcalView *view) { diff --git a/src/gcal-view.c b/src/gcal-view.c index 74c157b5..4be2930c 100644 --- a/src/gcal-view.c +++ b/src/gcal-view.c @@ -161,26 +161,6 @@ gcal_view_get_final_date (GcalView *view) return GCAL_VIEW_GET_INTERFACE (view)->get_final_date (view); } -/** - * gcal_view_mark_current_unit: - * @view: a #GcalView implementation - * @x: the x position of the current unit. Returned by the view - * @y: the y position of the current unit. Returned by the view - * - * Mark the current unit in the view as marked for event creation. - * The (x, y) pair returned is the center of the cell - **/ -void -gcal_view_mark_current_unit (GcalView *view, - gint *x, - gint *y) -{ - g_return_if_fail (GCAL_IS_VIEW (view)); - g_return_if_fail (GCAL_VIEW_GET_INTERFACE (view)->mark_current_unit); - - GCAL_VIEW_GET_INTERFACE (view)->mark_current_unit (view, x, y); -} - /** * gcal_view_clear_marks: * @view: a #GcalView diff --git a/src/gcal-view.h b/src/gcal-view.h index c42dc8d0..b13e9087 100644 --- a/src/gcal-view.h +++ b/src/gcal-view.h @@ -54,7 +54,6 @@ struct _GcalViewIface icaltimetype* (*get_final_date) (GcalView *view); /* Marks related API */ - void (*mark_current_unit) (GcalView *view, gint *x, gint *y); void (*clear_marks) (GcalView *view); /* Update NavBar headings */ @@ -77,10 +76,6 @@ icaltimetype* gcal_view_get_initial_date (GcalView *view); icaltimetype* gcal_view_get_final_date (GcalView *view); -void gcal_view_mark_current_unit (GcalView *view, - gint *x, - gint *y); - void gcal_view_clear_marks (GcalView *view); gchar* gcal_view_get_left_header (GcalView *view); diff --git a/src/gcal-week-view.c b/src/gcal-week-view.c index e0416a59..22e38f79 100644 --- a/src/gcal-week-view.c +++ b/src/gcal-week-view.c @@ -564,7 +564,6 @@ gcal_view_interface_init (GcalViewIface *iface) iface->get_initial_date = gcal_week_view_get_initial_date; iface->get_final_date = gcal_week_view_get_final_date; - /* iface->mark_current_unit = gcal_week_view_mark_current_unit; */ /* iface->clear_marks = gcal_week_view_clear_marks; */ iface->get_left_header = gcal_week_view_get_left_header; diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c index 2ec3a720..beba0316 100644 --- a/src/gcal-year-view.c +++ b/src/gcal-year-view.c @@ -115,10 +115,6 @@ static icaltimetype* gcal_year_view_get_initial_date (GcalView static icaltimetype* gcal_year_view_get_final_date (GcalView *view); -static void gcal_year_view_mark_current_unit (GcalView *view, - gint *x, - gint *y); - static void gcal_year_view_clear_marks (GcalView *view); static gchar* gcal_year_view_get_left_header (GcalView *view); @@ -202,7 +198,6 @@ gcal_view_interface_init (GcalViewIface *iface) iface->get_initial_date = gcal_year_view_get_initial_date; iface->get_final_date = gcal_year_view_get_final_date; - iface->mark_current_unit = gcal_year_view_mark_current_unit; iface->clear_marks = gcal_year_view_clear_marks; iface->get_left_header = gcal_year_view_get_left_header; @@ -948,36 +943,6 @@ gcal_year_view_get_final_date (GcalView *view) return new_date; } -static void -gcal_year_view_mark_current_unit (GcalView *view, - gint *x, - gint *y) -{ - GcalYearViewPrivate *priv; - - gint x_pos, y_pos; - gint width, height; - - /* FIXME: This need to include marking the current unit */ - priv = gcal_year_view_get_instance_private (GCAL_YEAR_VIEW (view)); - - width = gtk_widget_get_allocated_width (GTK_WIDGET (view)); - height = gtk_widget_get_allocated_height (GTK_WIDGET (view)); - - priv->start_mark_cell = priv->date->month - 1; - priv->end_mark_cell = priv->start_mark_cell; - - x_pos = (width / 6) * (( priv->start_mark_cell % 6) + 0.5); - y_pos = (height / 2) * (( priv->start_mark_cell / 6) + 0.5); - - gtk_widget_queue_draw (GTK_WIDGET (view)); - - if (x != NULL) - *x = x_pos; - if (y != NULL) - *y = y_pos; -} - static void gcal_year_view_clear_marks (GcalView *view) {