[evolution] e_week_view_layout_get_day_position: Use new "work-day" settings.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] e_week_view_layout_get_day_position: Use new "work-day" settings.
- Date: Sun, 17 Mar 2013 13:42:11 +0000 (UTC)
commit 2aa3541ea3b984df0073da3682c02cff5827c2d5
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Mar 9 09:36:16 2013 -0500
e_week_view_layout_get_day_position: Use new "work-day" settings.
calendar/gui/e-week-view-layout.c | 48 +++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 18 deletions(-)
---
diff --git a/calendar/gui/e-week-view-layout.c b/calendar/gui/e-week-view-layout.c
index 67f3943..d725ec0 100644
--- a/calendar/gui/e-week-view-layout.c
+++ b/calendar/gui/e-week-view-layout.c
@@ -338,29 +338,41 @@ e_week_view_layout_get_day_position (gint day,
*day_x = col;
}
} else {
- #define wk(x) \
- ((working_days & \
- (days[((x) + display_start_day) % 7])) ? 1 : 0)
- CalWeekdays days[] = {
- CAL_MONDAY,
- CAL_TUESDAY,
- CAL_WEDNESDAY,
- CAL_THURSDAY,
- CAL_FRIDAY,
- CAL_SATURDAY,
- CAL_SUNDAY };
- CalWeekdays working_days;
+ GSettings *settings;
gint arr[4] = {1, 1, 1, 1};
gint edge, i, wd, m, M;
gboolean any = TRUE;
+ gint n_work_days_mon_wed = 0;
+ gint n_work_days_thu_sun = 0;
- g_return_if_fail (day < 7);
+ /* 0 = Monday, 6 = Sunday */
+ gint work_days[7] = { 0, 0, 0, 0, 0, 0, 0 };
- working_days = calendar_config_get_working_days ();
- edge = 3;
+ g_return_if_fail (day < 7);
- if (wk (0) + wk (1) + wk (2) < wk (3) + wk (4) + wk (5) + wk (6))
- edge++;
+ settings = g_settings_new ("org.gnome.evolution.calendar");
+
+ if (g_settings_get_boolean (settings, "work-day-monday"))
+ work_days[0] = 1, n_work_days_mon_wed++;
+ if (g_settings_get_boolean (settings, "work-day-tuesday"))
+ work_days[1] = 1, n_work_days_mon_wed++;
+ if (g_settings_get_boolean (settings, "work-day-wednesday"))
+ work_days[2] = 1, n_work_days_mon_wed++;
+ if (g_settings_get_boolean (settings, "work-day-thursday"))
+ work_days[3] = 1, n_work_days_thu_sun++;
+ if (g_settings_get_boolean (settings, "work-day-friday"))
+ work_days[4] = 1, n_work_days_thu_sun++;
+ if (g_settings_get_boolean (settings, "work-day-saturday"))
+ work_days[5] = 1, n_work_days_thu_sun++;
+ if (g_settings_get_boolean (settings, "work-day-sunday"))
+ work_days[6] = 1, n_work_days_thu_sun++;
+
+ g_object_unref (settings);
+
+ if (n_work_days_mon_wed < n_work_days_thu_sun)
+ edge = 4; /* Friday */
+ else
+ edge = 3; /* Thursday */
if (day < edge) {
*day_x = 0;
@@ -374,7 +386,7 @@ e_week_view_layout_get_day_position (gint day,
wd = 0; /* number of used rows in column */
for (i = m; i < M; i++) {
- arr[i - m] += wk (i);
+ arr[i - m] += work_days[i];
wd += arr[i - m];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]