[gnome-calendar/wip/pandusonu/week-view: 36/60] week-header: remove unnecessary code and correct access of public functions
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/pandusonu/week-view: 36/60] week-header: remove unnecessary code and correct access of public functions
- Date: Fri, 2 Dec 2016 01:51:32 +0000 (UTC)
commit 4fde7e369dc12061d44251904222f47543680a94
Author: pandusonu2 <pandu sonu yahoo com>
Date: Thu Jul 28 14:56:04 2016 +0530
week-header: remove unnecessary code and correct access of public functions
Remove code of functions which are no longer being used. Also corrected a few public functions and made
them private as they won't be used.
src/views/gcal-week-header.c | 16 +----
src/views/gcal-week-view.c | 154 +++++++++++++-----------------------------
src/views/gcal-week-view.h | 2 -
3 files changed, 48 insertions(+), 124 deletions(-)
---
diff --git a/src/views/gcal-week-header.c b/src/views/gcal-week-header.c
index be52b4f..4038c0e 100644
--- a/src/views/gcal-week-header.c
+++ b/src/views/gcal-week-header.c
@@ -612,15 +612,10 @@ gcal_week_header_draw (GcalWeekHeader *self,
PangoLayout *layout;
PangoFontDescription *bold_font;
- gint i, pos_i, start_grid_y;
- gint font_height;
+ gint i, font_height, current_cell;
gdouble sidebar_width, cell_width;
- icaltimetype *start_of_week, *end_of_week;
-
- cairo_pattern_t *pattern;
cairo_save(cr);
- start_grid_y = gcal_week_view_get_start_grid_y (widget);
/* Fonts and colour selection */
context = gtk_widget_get_style_context (widget);
@@ -629,15 +624,6 @@ gcal_week_header_draw (GcalWeekHeader *self,
gtk_style_context_get_padding (context, state, &padding);
gtk_widget_get_allocation (widget, &alloc);
- pattern = cairo_pattern_create_linear (0, start_grid_y - 18,
- 0, start_grid_y + 6);
-
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0, 0, 0, 0.6);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0, 0, 0, 0.0);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
-
gtk_style_context_get_color (context, state, &color);
gdk_cairo_set_source_rgba (cr, &color);
diff --git a/src/views/gcal-week-view.c b/src/views/gcal-week-view.c
index 02201a4..c6b1e95 100644
--- a/src/views/gcal-week-view.c
+++ b/src/views/gcal-week-view.c
@@ -43,17 +43,6 @@ enum
PROP_DATE
};
-struct _GcalWeekViewChild
-{
- GtkWidget *widget;
- gboolean hidden_by_me;
-
- /* vertical index */
- gint index;
-};
-
-typedef struct _GcalWeekViewChild GcalWeekViewChild;
-
struct _GcalWeekView
{
GtkBox parent;
@@ -125,52 +114,58 @@ G_DEFINE_TYPE_WITH_CODE (GcalWeekView, gcal_week_view, GTK_TYPE_BOX,
G_IMPLEMENT_INTERFACE (E_TYPE_CAL_DATA_MODEL_SUBSCRIBER,
gcal_data_model_subscriber_interface_init));
-/*
- * gcal_week_view_get_start_grid_y:
+/**
+ * gcal_week_view_get_initial_date:
*
- * In GcalMonthView this method returns the height of the headers of the view
- * and the grid. Here this points just the place where the grid_window hides
- * behind the header
- * Here this height includes:
- * - The big header of the view
- * - The grid header dislaying weekdays
- * - The cell containing all-day events.
- */
-gint
-gcal_week_view_get_start_grid_y (GtkWidget *widget)
+ * Since: 0.1
+ * Return value: the first day of the week
+ * Returns: (transfer full): Release with g_free()
+ **/
+static icaltimetype*
+gcal_week_view_get_initial_date (GcalView *view)
{
- GtkStyleContext *context;
- GtkStateFlags flags;
- GtkBorder padding;
-
- PangoLayout *layout;
- PangoFontDescription *font_desc;
- gint font_height;
- gdouble start_grid_y;
-
- context = gtk_widget_get_style_context (widget);
- flags = gtk_widget_get_state_flags (widget);
-
- layout = gtk_widget_create_pango_layout (widget, NULL);
-
- /* init header values */
- gtk_style_context_get_padding (context, flags, &padding);
-
- gtk_style_context_get (context, flags, "font", &font_desc, NULL);
-
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_SEMIBOLD);
- pango_layout_set_font_description (layout, font_desc);
- pango_layout_get_pixel_size (layout, NULL, &font_height);
- pango_font_description_free (font_desc);
+ GcalWeekView *self;
+ icaltimetype *new_date;
- /* 6: is padding around the header */
- start_grid_y = font_height + padding.bottom;
+ g_return_val_if_fail (GCAL_IS_WEEK_VIEW (view), NULL);
+ self = GCAL_WEEK_VIEW(view);
+ new_date = g_new0 (icaltimetype, 1);
+ *new_date = icaltime_from_day_of_year (icaltime_start_doy_week (*(self->date),
+ self->first_weekday + 1),
+ self->date->year);
+ new_date->is_date = 0;
+ new_date->hour = 0;
+ new_date->minute = 0;
+ new_date->second = 0;
+ *new_date = icaltime_set_timezone (new_date, self->date->zone);
+ return new_date;
+}
- /* for including the all-day cells */
- start_grid_y += ALL_DAY_CELLS_HEIGHT;
+/**
+ * gcal_week_view_get_final_date:
+ *
+ * Since: 0.1
+ * Return value: the last day of the week
+ * Returns: (transfer full): Release with g_free()
+ **/
+static icaltimetype*
+gcal_week_view_get_final_date (GcalView *view)
+{
+ GcalWeekView *self;
+ icaltimetype *new_date;
- g_object_unref (layout);
- return start_grid_y;
+ g_return_val_if_fail (GCAL_IS_WEEK_VIEW (view), NULL);
+ self = GCAL_WEEK_VIEW(view);
+ new_date = g_new0 (icaltimetype, 1);
+ *new_date = icaltime_from_day_of_year (icaltime_start_doy_week (*(self->date),
+ self->first_weekday + 1) + 6,
+ self->date->year);
+ new_date->is_date = 0;
+ new_date->hour = 23;
+ new_date->minute = 59;
+ new_date->second = 0;
+ *new_date = icaltime_set_timezone (new_date, self->date->zone);
+ return new_date;
}
gint
@@ -522,61 +517,6 @@ gcal_week_view_get_property (GObject *object,
}
}
-/* GcalView Interface API */
-/**
- * gcal_week_view_get_initial_date:
- *
- * Since: 0.1
- * Return value: the first day of the week
- * Returns: (transfer full): Release with g_free()
- **/
-icaltimetype*
-gcal_week_view_get_initial_date (GcalView *view)
-{
- GcalWeekView *self;
- icaltimetype *new_date;
-
- g_return_val_if_fail (GCAL_IS_WEEK_VIEW (view), NULL);
- self = GCAL_WEEK_VIEW(view);
- new_date = g_new0 (icaltimetype, 1);
- *new_date = icaltime_from_day_of_year (icaltime_start_doy_week (*(self->date),
- self->first_weekday + 1),
- self->date->year);
- new_date->is_date = 0;
- new_date->hour = 0;
- new_date->minute = 0;
- new_date->second = 0;
- *new_date = icaltime_set_timezone (new_date, self->date->zone);
- return new_date;
-}
-
-/**
- * gcal_week_view_get_final_date:
- *
- * Since: 0.1
- * Return value: the last day of the week
- * Returns: (transfer full): Release with g_free()
- **/
-static icaltimetype*
-gcal_week_view_get_final_date (GcalView *view)
-{
- GcalWeekView *self;
- icaltimetype *new_date;
-
- g_return_val_if_fail (GCAL_IS_WEEK_VIEW (view), NULL);
- self = GCAL_WEEK_VIEW(view);
- new_date = g_new0 (icaltimetype, 1);
- *new_date = icaltime_from_day_of_year (icaltime_start_doy_week (*(self->date),
- self->first_weekday + 1) + 6,
- self->date->year);
- new_date->is_date = 0;
- new_date->hour = 23;
- new_date->minute = 59;
- new_date->second = 0;
- *new_date = icaltime_set_timezone (new_date, self->date->zone);
- return new_date;
-}
-
/* Public API */
/**
* gcal_week_view_new:
diff --git a/src/views/gcal-week-view.h b/src/views/gcal-week-view.h
index a5384f9..14ef5d5 100644
--- a/src/views/gcal-week-view.h
+++ b/src/views/gcal-week-view.h
@@ -39,8 +39,6 @@ void gcal_week_view_set_use_24h_format (GcalWeekView *view,
void gcal_week_view_set_current_date (GcalWeekView *week_header,
icaltimetype *current_date);
gint gcal_week_view_get_sidebar_width (GtkWidget *widget);
-icaltimetype* gcal_week_view_get_initial_date (GcalView *view);
-gint gcal_week_view_get_start_grid_y (GtkWidget *widget);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]