utils: Prefix macros with GCAL_
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/842>
This commit is contained in:
@@ -199,7 +199,7 @@ gcal_date_chooser_day_set_date (GcalDateChooserDay *self,
|
||||
|
||||
now = g_date_time_new_now (g_date_time_get_timezone (date));
|
||||
today = gcal_date_time_compare_date (date, now) == 0;
|
||||
weekday = g_date_time_get_day_of_week (date) % N_WEEKDAYS;
|
||||
weekday = g_date_time_get_day_of_week (date) % GCAL_N_WEEKDAYS;
|
||||
|
||||
if (G_UNLIKELY (today))
|
||||
gtk_widget_add_css_class (widget, "today");
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ROWS 6
|
||||
#define DAYS ROWS * N_WEEKDAYS
|
||||
#define DAYS ROWS * GCAL_N_WEEKDAYS
|
||||
|
||||
struct _GcalDateChooser
|
||||
{
|
||||
@@ -51,9 +51,9 @@ struct _GcalDateChooser
|
||||
|
||||
GtkWidget *day_grid;
|
||||
GtkWidget *corner;
|
||||
GtkWidget *cols[N_WEEKDAYS];
|
||||
GtkWidget *cols[GCAL_N_WEEKDAYS];
|
||||
GtkWidget *rows[ROWS];
|
||||
GtkWidget *days[ROWS][N_WEEKDAYS];
|
||||
GtkWidget *days[ROWS][GCAL_N_WEEKDAYS];
|
||||
GtkWidget *week[ROWS];
|
||||
|
||||
GDateTime *date;
|
||||
@@ -221,9 +221,9 @@ calendar_compute_days (GcalDateChooser *self)
|
||||
first_day = g_date_time_get_day_of_week (date);
|
||||
g_date_time_unref (date);
|
||||
|
||||
first_day = (first_day + N_WEEKDAYS - self->week_start) % N_WEEKDAYS;
|
||||
first_day = (first_day + GCAL_N_WEEKDAYS - self->week_start) % GCAL_N_WEEKDAYS;
|
||||
if (first_day == 0)
|
||||
first_day = N_WEEKDAYS;
|
||||
first_day = GCAL_N_WEEKDAYS;
|
||||
|
||||
/* Compute days of previous month */
|
||||
if (month > 1)
|
||||
@@ -251,8 +251,8 @@ calendar_compute_days (GcalDateChooser *self)
|
||||
}
|
||||
|
||||
/* Compute days of current month */
|
||||
row = first_day / N_WEEKDAYS;
|
||||
col = first_day % N_WEEKDAYS;
|
||||
row = first_day / GCAL_N_WEEKDAYS;
|
||||
col = first_day % GCAL_N_WEEKDAYS;
|
||||
|
||||
for (day = 1; day <= ndays_in_month; day++)
|
||||
{
|
||||
@@ -263,7 +263,7 @@ calendar_compute_days (GcalDateChooser *self)
|
||||
g_date_time_unref (date);
|
||||
|
||||
col++;
|
||||
if (col == N_WEEKDAYS)
|
||||
if (col == GCAL_N_WEEKDAYS)
|
||||
{
|
||||
row++;
|
||||
col = 0;
|
||||
@@ -283,7 +283,7 @@ calendar_compute_days (GcalDateChooser *self)
|
||||
day = 1;
|
||||
for (; row < ROWS; row++)
|
||||
{
|
||||
for (; col < N_WEEKDAYS; col++)
|
||||
for (; col < GCAL_N_WEEKDAYS; col++)
|
||||
{
|
||||
d = GCAL_DATE_CHOOSER_DAY (self->days[row][col]);
|
||||
date = g_date_time_new_local (other_year, other_month, day, 0, 0, 0);
|
||||
@@ -300,7 +300,7 @@ calendar_compute_days (GcalDateChooser *self)
|
||||
{
|
||||
gchar *text;
|
||||
|
||||
d = GCAL_DATE_CHOOSER_DAY (self->days[row][N_WEEKDAYS - 1]);
|
||||
d = GCAL_DATE_CHOOSER_DAY (self->days[row][GCAL_N_WEEKDAYS - 1]);
|
||||
date = gcal_date_chooser_day_get_date (d);
|
||||
text = g_strdup_printf ("%d", g_date_time_get_week_of_year (date));
|
||||
gtk_label_set_label (GTK_LABEL (self->rows[row]), text);
|
||||
@@ -381,9 +381,9 @@ calendar_get_weekday_name (gint i)
|
||||
static void
|
||||
calendar_init_weekday_display (GcalDateChooser *self)
|
||||
{
|
||||
for (gint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (gint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
const char *text = calendar_get_weekday_name ((i + self->week_start) % N_WEEKDAYS);
|
||||
const char *text = calendar_get_weekday_name ((i + self->week_start) % GCAL_N_WEEKDAYS);
|
||||
gtk_label_set_label (GTK_LABEL (self->cols[i]), text);
|
||||
}
|
||||
}
|
||||
@@ -462,7 +462,7 @@ calendar_update_selected_day_display (GcalDateChooser *self)
|
||||
{
|
||||
gboolean row_selected = FALSE;
|
||||
|
||||
for (col = 0; col < N_WEEKDAYS; col++)
|
||||
for (col = 0; col < GCAL_N_WEEKDAYS; col++)
|
||||
{
|
||||
gboolean day_selected;
|
||||
|
||||
@@ -524,7 +524,7 @@ update_event_indicators (GcalDateChooser *self)
|
||||
|
||||
for (row = 0; row < ROWS; row++)
|
||||
{
|
||||
for (col = 0; col < N_WEEKDAYS; col++)
|
||||
for (col = 0; col < GCAL_N_WEEKDAYS; col++)
|
||||
{
|
||||
GcalDateChooserDay *day = GCAL_DATE_CHOOSER_DAY (self->days[row][col]);
|
||||
if (events_at_range)
|
||||
@@ -1042,7 +1042,7 @@ show_week_number_to_column_span_cb (GBinding *binding,
|
||||
GValue *to_value,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_value_set_int (to_value, g_value_get_boolean (from_value) ? N_WEEKDAYS + 1 : N_WEEKDAYS);
|
||||
g_value_set_int (to_value, g_value_get_boolean (from_value) ? GCAL_N_WEEKDAYS + 1 : GCAL_N_WEEKDAYS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1089,7 +1089,7 @@ gcal_date_chooser_init (GcalDateChooser *self)
|
||||
|
||||
gcal_gizmo_set_focus_func (self->gizmo, gcal_gizmo_focus, NULL);
|
||||
|
||||
for (col = 0; col < N_WEEKDAYS; col++)
|
||||
for (col = 0; col < GCAL_N_WEEKDAYS; col++)
|
||||
{
|
||||
self->cols[col] = gtk_label_new ("");
|
||||
|
||||
@@ -1170,11 +1170,11 @@ gcal_date_chooser_init (GcalDateChooser *self)
|
||||
"column-spacing", 2,
|
||||
"visible", TRUE,
|
||||
NULL);
|
||||
gtk_grid_attach (GTK_GRID (self->grid), self->day_grid, 0, 0, N_WEEKDAYS, ROWS);
|
||||
gtk_grid_attach (GTK_GRID (self->grid), self->day_grid, 0, 0, GCAL_N_WEEKDAYS, ROWS);
|
||||
|
||||
for (row = 0; row < ROWS; row++)
|
||||
{
|
||||
for (col = 0; col < N_WEEKDAYS; col++)
|
||||
for (col = 0; col < GCAL_N_WEEKDAYS; col++)
|
||||
{
|
||||
self->days[row][col] = gcal_date_chooser_day_new ();
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ format_alarm_duration (ICalDuration *duration)
|
||||
guint hours;
|
||||
guint days;
|
||||
|
||||
days = i_cal_duration_get_weeks (duration) * N_WEEKDAYS + i_cal_duration_get_days (duration);
|
||||
days = i_cal_duration_get_weeks (duration) * GCAL_N_WEEKDAYS + i_cal_duration_get_days (duration);
|
||||
hours = i_cal_duration_get_hours (duration);
|
||||
minutes = i_cal_duration_get_minutes (duration);
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ struct _GcalWindow
|
||||
GtkWidget *quick_add_popover;
|
||||
|
||||
/* day, week, month, year, list */
|
||||
GtkWidget *views[N_WEEKDAYS - 1];
|
||||
GtkWidget *views[GCAL_N_WEEKDAYS - 1];
|
||||
gboolean subscribed;
|
||||
|
||||
GcalWindowView active_view;
|
||||
|
||||
@@ -144,7 +144,7 @@ update_grid_scroll_position (GcalAgendaView *self)
|
||||
page = gtk_adjustment_get_page_size (vadjustment);
|
||||
max = gtk_adjustment_get_upper (vadjustment);
|
||||
|
||||
real_value = max / MINUTES_PER_DAY * minutes - (page / 2.0);
|
||||
real_value = max / GCAL_MINUTES_PER_DAY * minutes - (page / 2.0);
|
||||
page_increment = gtk_adjustment_get_page_increment (vadjustment);
|
||||
value = gtk_adjustment_get_value (vadjustment);
|
||||
|
||||
@@ -451,7 +451,7 @@ gcal_agenda_view_init (GcalAgendaView *self)
|
||||
self->date = g_date_time_new_now_local ();
|
||||
self->days_model = g_list_store_new (GCAL_TYPE_AGENDA_VIEW_DAY);
|
||||
|
||||
for (size_t i = 0; i < N_WEEKDAYS; i++)
|
||||
for (size_t i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
g_autoptr (GcalAgendaViewDay) day = NULL;
|
||||
g_autoptr (GDateTime) date = NULL;
|
||||
|
||||
@@ -111,7 +111,7 @@ add_month_separators (GcalMonthCell *self)
|
||||
gtk_widget_remove_css_class (GTK_WIDGET (self), "separator-side");
|
||||
|
||||
day_of_month = g_date_time_get_day_of_month (self->date);
|
||||
if (day_of_month > 1 && day_of_month <= N_WEEKDAYS)
|
||||
if (day_of_month > 1 && day_of_month <= GCAL_N_WEEKDAYS)
|
||||
{
|
||||
gtk_widget_add_css_class (GTK_WIDGET (self), "separator-top");
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ struct _GcalMonthViewRow
|
||||
{
|
||||
GtkWidget parent;
|
||||
|
||||
GtkWidget *day_cells[N_WEEKDAYS];
|
||||
GtkWidget *day_cells[GCAL_N_WEEKDAYS];
|
||||
|
||||
GcalRange *range;
|
||||
gboolean ceiled_height;
|
||||
@@ -418,7 +418,7 @@ focus_vertical_cell (GcalMonthViewRow *self,
|
||||
if (gtk_widget_is_ancestor (focused_cell, GTK_WIDGET (self)))
|
||||
return FALSE;
|
||||
|
||||
cell_width = (gdouble) gtk_widget_get_width (GTK_WIDGET (self)) / (float) N_WEEKDAYS;
|
||||
cell_width = (gdouble) gtk_widget_get_width (GTK_WIDGET (self)) / (float) GCAL_N_WEEKDAYS;
|
||||
row = gtk_widget_get_ancestor (focused_cell, GCAL_TYPE_MONTH_VIEW_ROW);
|
||||
|
||||
g_assert (GTK_WIDGET (self) != row);
|
||||
@@ -476,7 +476,7 @@ static void
|
||||
setup_child_widget (GcalMonthViewRow *self,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_insert_after (widget, GTK_WIDGET (self), self->day_cells[N_WEEKDAYS - 1]);
|
||||
gtk_widget_insert_after (widget, GTK_WIDGET (self), self->day_cells[GCAL_N_WEEKDAYS - 1]);
|
||||
|
||||
g_signal_connect_object (widget, "activate", G_CALLBACK (on_event_widget_activated_cb), self, 0);
|
||||
}
|
||||
@@ -512,7 +512,7 @@ calculate_event_cells (GcalMonthViewRow *self,
|
||||
{
|
||||
g_autoptr (GDateTime) range_start = NULL;
|
||||
g_autoptr (GDateTime) end_date = NULL;
|
||||
gint last_cell = N_WEEKDAYS - 1;
|
||||
gint last_cell = GCAL_N_WEEKDAYS - 1;
|
||||
|
||||
range_start = gcal_range_get_start (self->range);
|
||||
end_date = gcal_event_get_date_end (event);
|
||||
@@ -532,26 +532,26 @@ calculate_event_cells (GcalMonthViewRow *self,
|
||||
if (all_day)
|
||||
last_cell--;
|
||||
|
||||
*out_last_cell = CLAMP (last_cell, first_cell, N_WEEKDAYS - 1);
|
||||
*out_last_cell = CLAMP (last_cell, first_cell, GCAL_N_WEEKDAYS - 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_layout_blocks (GcalMonthViewRow *self,
|
||||
guint overflows[N_WEEKDAYS])
|
||||
guint overflows[GCAL_N_WEEKDAYS])
|
||||
{
|
||||
GPtrArray *blocks_per_day[N_WEEKDAYS];
|
||||
gboolean cell_will_overflow[N_WEEKDAYS] = { FALSE, };
|
||||
guint combined_height[N_WEEKDAYS] = { 0, };
|
||||
guint content_height[N_WEEKDAYS] = { 0, };
|
||||
guint weekday_heights[N_WEEKDAYS] = { 0, };
|
||||
GPtrArray *blocks_per_day[GCAL_N_WEEKDAYS];
|
||||
gboolean cell_will_overflow[GCAL_N_WEEKDAYS] = { FALSE, };
|
||||
guint combined_height[GCAL_N_WEEKDAYS] = { 0, };
|
||||
guint content_height[GCAL_N_WEEKDAYS] = { 0, };
|
||||
guint weekday_heights[GCAL_N_WEEKDAYS] = { 0, };
|
||||
guint n_events;
|
||||
|
||||
g_assert (self->layout_blocks_valid);
|
||||
|
||||
n_events = g_list_model_get_n_items (self->events);
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
gint overflow_height;
|
||||
gint content_space;
|
||||
@@ -607,7 +607,7 @@ prepare_layout_blocks (GcalMonthViewRow *self,
|
||||
}
|
||||
|
||||
/* Figure out which blocks will be visible */
|
||||
for (guint cell = 0; cell < N_WEEKDAYS; cell++)
|
||||
for (guint cell = 0; cell < GCAL_N_WEEKDAYS; cell++)
|
||||
{
|
||||
for (guint block_index = 0;
|
||||
block_index < blocks_per_day[cell]->len;
|
||||
@@ -646,7 +646,7 @@ prepare_layout_blocks (GcalMonthViewRow *self,
|
||||
}
|
||||
}
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
g_clear_pointer (&blocks_per_day[i], g_ptr_array_unref);
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ recalculate_layout_blocks (GcalMonthViewRow *self)
|
||||
{
|
||||
g_autoptr (GHashTable) event_widgets = NULL;
|
||||
g_autoptr (GDateTime) range_start = NULL;
|
||||
guint events_at_weekday[N_WEEKDAYS] = { 0, };
|
||||
guint events_at_weekday[GCAL_N_WEEKDAYS] = { 0, };
|
||||
guint n_events;
|
||||
|
||||
GCAL_ENTRY;
|
||||
@@ -1049,7 +1049,7 @@ gcal_month_view_row_measure (GtkWidget *widget,
|
||||
gint minimum = 0;
|
||||
gint natural = 0;
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
gint child_minimum;
|
||||
gint child_natural;
|
||||
@@ -1099,10 +1099,10 @@ gcal_month_view_row_size_allocate (GtkWidget *widget,
|
||||
gdouble cell_width;
|
||||
|
||||
is_ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
|
||||
cell_width = width / (float) N_WEEKDAYS;
|
||||
cell_width = width / (float) GCAL_N_WEEKDAYS;
|
||||
|
||||
/* Month cells */
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GtkWidget *cell;
|
||||
@@ -1112,15 +1112,15 @@ gcal_month_view_row_size_allocate (GtkWidget *widget,
|
||||
allocation.width = round (cell_width * (i + 1)) - allocation.x;
|
||||
allocation.height = height;
|
||||
|
||||
cell = is_ltr ? self->day_cells[i] : self->day_cells[N_WEEKDAYS - i - 1];
|
||||
cell = is_ltr ? self->day_cells[i] : self->day_cells[GCAL_N_WEEKDAYS - i - 1];
|
||||
gtk_widget_size_allocate (cell, &allocation, baseline);
|
||||
}
|
||||
|
||||
/* Event widgets */
|
||||
if (self->layout_blocks_valid)
|
||||
{
|
||||
gdouble cell_y[N_WEEKDAYS] = { 0, };
|
||||
guint overflows[N_WEEKDAYS] = { 0, };
|
||||
gdouble cell_y[GCAL_N_WEEKDAYS] = { 0, };
|
||||
guint overflows[GCAL_N_WEEKDAYS] = { 0, };
|
||||
guint n_events;
|
||||
|
||||
prepare_layout_blocks (self, overflows);
|
||||
@@ -1151,7 +1151,7 @@ gcal_month_view_row_size_allocate (GtkWidget *widget,
|
||||
|
||||
block = g_ptr_array_index (blocks, block_index);
|
||||
|
||||
start_cell = is_ltr ? block->cell : N_WEEKDAYS - block->cell - block->length;
|
||||
start_cell = is_ltr ? block->cell : GCAL_N_WEEKDAYS - block->cell - block->length;
|
||||
end_cell = start_cell + block->length;
|
||||
header_height = gcal_month_cell_get_header_height (GCAL_MONTH_CELL (self->day_cells[block->cell]));
|
||||
spacing = (cell_y[block->cell] / block->height - 1) * EVENT_VERTICAL_GAP;
|
||||
@@ -1169,7 +1169,7 @@ gcal_month_view_row_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
gcal_month_cell_set_overflow (GCAL_MONTH_CELL (self->day_cells[i]), overflows[i]);
|
||||
}
|
||||
}
|
||||
@@ -1184,7 +1184,7 @@ gcal_month_view_row_dispose (GObject *object)
|
||||
{
|
||||
GcalMonthViewRow *self = (GcalMonthViewRow *)object;
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
g_clear_pointer (&self->day_cells[i], gtk_widget_unparent);
|
||||
|
||||
g_clear_pointer (&self->layout_blocks, g_hash_table_destroy);
|
||||
@@ -1320,7 +1320,7 @@ gcal_month_view_row_init (GcalMonthViewRow *self)
|
||||
self->layout_blocks = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) g_ptr_array_unref);
|
||||
self->layout_blocks_valid = TRUE;
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
self->day_cells[i] = gcal_month_cell_new ();
|
||||
gcal_month_cell_set_overflow (GCAL_MONTH_CELL (self->day_cells[i]), 0);
|
||||
@@ -1373,7 +1373,7 @@ gcal_month_view_row_set_range (GcalMonthViewRow *self,
|
||||
self->range = gcal_range_ref (range);
|
||||
|
||||
start = gcal_range_get_start (range);
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
g_autoptr (GDateTime) day = g_date_time_add_days (start, i);
|
||||
gcal_month_cell_set_date (GCAL_MONTH_CELL (self->day_cells[i]), day);
|
||||
@@ -1421,12 +1421,12 @@ gcal_month_view_row_get_cell_at_x (GcalMonthViewRow *self,
|
||||
if (x < 0.0 || x > width)
|
||||
return NULL;
|
||||
|
||||
column = floor ((float) N_WEEKDAYS * x / (gdouble) width);
|
||||
column = floor ((float) GCAL_N_WEEKDAYS * x / (gdouble) width);
|
||||
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (self)) != GTK_TEXT_DIR_RTL)
|
||||
return self->day_cells[column];
|
||||
else
|
||||
return self->day_cells[N_WEEKDAYS - column - 1];
|
||||
return self->day_cells[GCAL_N_WEEKDAYS - column - 1];
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1435,7 +1435,7 @@ gcal_month_view_row_update_selection (GcalMonthViewRow *self,
|
||||
{
|
||||
g_assert (GCAL_IS_MONTH_VIEW_ROW (self));
|
||||
|
||||
for (guint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (guint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
GcalMonthCell *month_cell;
|
||||
GDateTime *cell_date;
|
||||
|
||||
@@ -52,7 +52,7 @@ struct _GcalMonthView
|
||||
GtkWidget parent;
|
||||
|
||||
GtkWidget *header;
|
||||
GtkWidget *weekday_label[N_WEEKDAYS];
|
||||
GtkWidget *weekday_label[GCAL_N_WEEKDAYS];
|
||||
|
||||
GtkEventController *motion_controller;
|
||||
|
||||
@@ -196,11 +196,11 @@ update_weekday_labels (GcalMonthView *self)
|
||||
{
|
||||
const gint first_weekday = gcal_util_get_first_weekday ();
|
||||
|
||||
for (gint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (gint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
g_autofree gchar *weekday_name = NULL;
|
||||
|
||||
weekday_name = g_utf8_strup (gcal_util_get_weekday ((i + first_weekday) % N_WEEKDAYS), -1);
|
||||
weekday_name = g_utf8_strup (gcal_util_get_weekday ((i + first_weekday) % GCAL_N_WEEKDAYS), -1);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (self->weekday_label[i]), weekday_name);
|
||||
}
|
||||
@@ -2086,7 +2086,7 @@ gcal_month_view_init (GcalMonthView *self)
|
||||
update_weekday_labels (self);
|
||||
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_RELATION_COL_COUNT, N_WEEKDAYS,
|
||||
GTK_ACCESSIBLE_RELATION_COL_COUNT, GCAL_N_WEEKDAYS,
|
||||
GTK_ACCESSIBLE_RELATION_ROW_COUNT, N_ROWS_PER_PAGE,
|
||||
-1);
|
||||
|
||||
|
||||
@@ -538,13 +538,13 @@ on_click_gesture_pressed_cb (GtkGestureClick *click_gesture,
|
||||
g_assert (self->selection.start == -1);
|
||||
g_assert (self->selection.end == -1);
|
||||
|
||||
minute_height = (gdouble) gtk_widget_get_height (GTK_WIDGET (self)) / MINUTES_PER_DAY;
|
||||
column_width = floor (gtk_widget_get_width (GTK_WIDGET (self)) / N_WEEKDAYS);
|
||||
minute_height = (gdouble) gtk_widget_get_height (GTK_WIDGET (self)) / GCAL_MINUTES_PER_DAY;
|
||||
column_width = floor (gtk_widget_get_width (GTK_WIDGET (self)) / GCAL_N_WEEKDAYS);
|
||||
column = (gint) x / column_width;
|
||||
minute = y / minute_height;
|
||||
minute = minute - (minute % 30);
|
||||
|
||||
self->selection.start = (column * MINUTES_PER_DAY + minute) / 30;
|
||||
self->selection.start = (column * GCAL_MINUTES_PER_DAY + minute) / 30;
|
||||
self->selection.end = self->selection.start;
|
||||
|
||||
gtk_widget_set_visible (self->selection.widget, TRUE);
|
||||
@@ -569,12 +569,12 @@ on_motion_controller_motion_cb (GtkEventControllerMotion *motion_controller,
|
||||
gint column;
|
||||
gint minute;
|
||||
|
||||
minute_height = (gdouble) gtk_widget_get_height (GTK_WIDGET (self)) / MINUTES_PER_DAY;
|
||||
column = self->selection.start * 30 / MINUTES_PER_DAY;
|
||||
minute_height = (gdouble) gtk_widget_get_height (GTK_WIDGET (self)) / GCAL_MINUTES_PER_DAY;
|
||||
column = self->selection.start * 30 / GCAL_MINUTES_PER_DAY;
|
||||
minute = y / minute_height;
|
||||
minute = minute - (minute % 30);
|
||||
|
||||
self->selection.end = (column * MINUTES_PER_DAY + minute) / 30;
|
||||
self->selection.end = (column * GCAL_MINUTES_PER_DAY + minute) / 30;
|
||||
|
||||
gtk_widget_queue_allocate (GTK_WIDGET (self));
|
||||
}
|
||||
@@ -603,12 +603,12 @@ on_click_gesture_released_cb (GtkGestureClick *click_gesture,
|
||||
|
||||
ltr = gtk_widget_get_direction (GTK_WIDGET (self)) != GTK_TEXT_DIR_RTL;
|
||||
|
||||
minute_height = (gdouble) gtk_widget_get_height (GTK_WIDGET (self)) / MINUTES_PER_DAY;
|
||||
column = self->selection.start * 30 / MINUTES_PER_DAY;
|
||||
minute_height = (gdouble) gtk_widget_get_height (GTK_WIDGET (self)) / GCAL_MINUTES_PER_DAY;
|
||||
column = self->selection.start * 30 / GCAL_MINUTES_PER_DAY;
|
||||
minute = y / minute_height;
|
||||
minute = minute - (minute % 30);
|
||||
|
||||
self->selection.end = (column * MINUTES_PER_DAY + minute) / 30;
|
||||
self->selection.end = (column * GCAL_MINUTES_PER_DAY + minute) / 30;
|
||||
|
||||
start_cell = self->selection.start;
|
||||
end_cell = self->selection.end;
|
||||
@@ -636,15 +636,15 @@ on_click_gesture_released_cb (GtkGestureClick *click_gesture,
|
||||
guint rtl_start_cell, rtl_end_cell, rtl_column;
|
||||
|
||||
/* Fix the minute */
|
||||
rtl_column = N_WEEKDAYS - 1 - column;
|
||||
rtl_column = GCAL_N_WEEKDAYS - 1 - column;
|
||||
rtl_start_cell = start_cell + (rtl_column - column) * 48;
|
||||
rtl_end_cell = (rtl_column * MINUTES_PER_DAY + minute) / 30;
|
||||
rtl_end_cell = (rtl_column * GCAL_MINUTES_PER_DAY + minute) / 30;
|
||||
|
||||
start = gcal_date_time_add_floating_minutes (week_start, rtl_start_cell * 30);
|
||||
end = gcal_date_time_add_floating_minutes (week_start, (rtl_end_cell + 1) * 30);
|
||||
}
|
||||
|
||||
local_x = round ((column + 0.5) * (gtk_widget_get_width (GTK_WIDGET (self)) / (float) N_WEEKDAYS));
|
||||
local_x = round ((column + 0.5) * (gtk_widget_get_width (GTK_WIDGET (self)) / (float) GCAL_N_WEEKDAYS));
|
||||
local_y = (minute + 15) * minute_height;
|
||||
|
||||
if (!gtk_widget_compute_point (GTK_WIDGET (self),
|
||||
@@ -667,7 +667,7 @@ get_dnd_cell (GcalWeekGrid *self,
|
||||
gdouble column_width, cell_height;
|
||||
gint column, row;
|
||||
|
||||
column_width = gtk_widget_get_width (GTK_WIDGET (self)) / (float) N_WEEKDAYS;
|
||||
column_width = gtk_widget_get_width (GTK_WIDGET (self)) / (float) GCAL_N_WEEKDAYS;
|
||||
cell_height = gtk_widget_get_height (GTK_WIDGET (self)) / 48.0;
|
||||
column = floor (x / column_width);
|
||||
row = y / cell_height;
|
||||
@@ -693,10 +693,10 @@ move_event_to_cell (GcalWeekGrid *self,
|
||||
{
|
||||
gint column, row;
|
||||
|
||||
column = cell / (MINUTES_PER_DAY / 30);
|
||||
column = cell / (GCAL_MINUTES_PER_DAY / 30);
|
||||
row = cell - column * 48;
|
||||
|
||||
cell = (N_WEEKDAYS - 1 - column) * 48 + row;
|
||||
cell = (GCAL_N_WEEKDAYS - 1 - column) * 48 + row;
|
||||
}
|
||||
|
||||
changed_event = gcal_event_new_from_event (event);
|
||||
@@ -888,7 +888,7 @@ get_today_column (GcalWeekGrid *self)
|
||||
days_diff = g_date_time_difference (today, week_start) / G_TIME_SPAN_DAY;
|
||||
|
||||
/* Today is out of range */
|
||||
if (g_date_time_compare (today, week_start) < 0 || days_diff > N_WEEKDAYS)
|
||||
if (g_date_time_compare (today, week_start) < 0 || days_diff > GCAL_N_WEEKDAYS)
|
||||
return -1;
|
||||
|
||||
return days_diff;
|
||||
@@ -974,8 +974,8 @@ gcal_week_grid_size_allocate (GtkWidget *widget,
|
||||
ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
|
||||
|
||||
/* Preliminary calculations */
|
||||
minutes_height = (gdouble) height / MINUTES_PER_DAY;
|
||||
column_width = (gdouble) width / (float) N_WEEKDAYS;
|
||||
minutes_height = (gdouble) height / GCAL_MINUTES_PER_DAY;
|
||||
column_width = (gdouble) width / (float) GCAL_N_WEEKDAYS;
|
||||
|
||||
/* Selection */
|
||||
if (gtk_widget_should_layout (self->selection.widget))
|
||||
@@ -1003,7 +1003,7 @@ gcal_week_grid_size_allocate (GtkWidget *widget,
|
||||
start = start - end;
|
||||
}
|
||||
|
||||
column = (int) floor (start * 30 / (double) MINUTES_PER_DAY);
|
||||
column = (int) floor (start * 30 / (double) GCAL_MINUTES_PER_DAY);
|
||||
|
||||
#define Y_POSITION(row_) ((gint) round (((row_) * 30) * minutes_height))
|
||||
|
||||
@@ -1035,7 +1035,7 @@ gcal_week_grid_size_allocate (GtkWidget *widget,
|
||||
|
||||
cell_height = minutes_height * 30;
|
||||
event_height = minutes_height * self->dnd.event_minutes;
|
||||
column = self->dnd.cell / (MINUTES_PER_DAY / 30);
|
||||
column = self->dnd.cell / (GCAL_MINUTES_PER_DAY / 30);
|
||||
row = self->dnd.cell - column * 48;
|
||||
|
||||
gtk_widget_size_allocate (self->dnd.widget,
|
||||
@@ -1159,7 +1159,7 @@ gcal_week_grid_size_allocate (GtkWidget *widget,
|
||||
x = width - (today_column * column_width) - column_width;
|
||||
|
||||
allocation.x = x;
|
||||
allocation.y = round (minutes_from_midnight * ((gdouble) height / MINUTES_PER_DAY));
|
||||
allocation.y = round (minutes_from_midnight * ((gdouble) height / GCAL_MINUTES_PER_DAY));
|
||||
allocation.width = column_width;
|
||||
allocation.height = MAX (1, now_strip_height);
|
||||
|
||||
|
||||
@@ -96,9 +96,9 @@ struct _GcalWeekHeader
|
||||
* The list will later be iterated after the active date is changed
|
||||
* and the events will be placed
|
||||
*/
|
||||
GPtrArray *events[N_WEEKDAYS];
|
||||
GtkWidget *overflow_label[N_WEEKDAYS];
|
||||
WeekdayHeader weekday_header[N_WEEKDAYS];
|
||||
GPtrArray *events[GCAL_N_WEEKDAYS];
|
||||
GtkWidget *overflow_label[GCAL_N_WEEKDAYS];
|
||||
WeekdayHeader weekday_header[GCAL_N_WEEKDAYS];
|
||||
|
||||
gint first_weekday;
|
||||
|
||||
@@ -123,7 +123,7 @@ struct _GcalWeekHeader
|
||||
} dnd;
|
||||
|
||||
/* Array of nullable weather infos for each day, starting with Sunday. */
|
||||
WeatherInfoDay weather_infos[N_WEEKDAYS];
|
||||
WeatherInfoDay weather_infos[GCAL_N_WEEKDAYS];
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -281,8 +281,8 @@ on_button_pressed (GtkGestureClick *click_gesture,
|
||||
|
||||
ltr = gtk_widget_get_direction (GTK_WIDGET (self)) != GTK_TEXT_DIR_RTL;
|
||||
width = gtk_widget_get_width (self->scrolledwindow);
|
||||
column_width = width / (float) N_WEEKDAYS;
|
||||
column = ltr ? (x / column_width) : (N_WEEKDAYS - x / column_width);
|
||||
column_width = width / (float) GCAL_N_WEEKDAYS;
|
||||
column = ltr ? (x / column_width) : (GCAL_N_WEEKDAYS - x / column_width);
|
||||
|
||||
self->selection.start = column;
|
||||
self->selection.end = column;
|
||||
@@ -306,8 +306,8 @@ on_motion_notify (GtkEventControllerMotion *motion_event,
|
||||
|
||||
ltr = gtk_widget_get_direction (GTK_WIDGET (self)) != GTK_TEXT_DIR_RTL;
|
||||
width = gtk_widget_get_width (self->scrolledwindow);
|
||||
column_width = width / (float) N_WEEKDAYS;
|
||||
column = ltr ? (x / column_width) : (N_WEEKDAYS - x / column_width);
|
||||
column_width = width / (float) GCAL_N_WEEKDAYS;
|
||||
column = ltr ? (x / column_width) : (GCAL_N_WEEKDAYS - x / column_width);
|
||||
|
||||
self->selection.end = column;
|
||||
|
||||
@@ -337,8 +337,8 @@ on_button_released (GtkGestureClick *click_gesture,
|
||||
|
||||
ltr = gtk_widget_get_direction (GTK_WIDGET (self)) != GTK_TEXT_DIR_RTL;
|
||||
width = gtk_widget_get_width (self->scrolledwindow);
|
||||
column_width = width / (float) N_WEEKDAYS;
|
||||
column = ltr ? (x / column_width) : (N_WEEKDAYS - x / column_width);
|
||||
column_width = width / (float) GCAL_N_WEEKDAYS;
|
||||
column = ltr ? (x / column_width) : (GCAL_N_WEEKDAYS - x / column_width);
|
||||
|
||||
self->selection.end = column;
|
||||
gtk_widget_queue_allocate (GTK_WIDGET (self));
|
||||
@@ -396,7 +396,7 @@ get_today_column (GcalWeekHeader *self)
|
||||
days_diff = g_date_time_difference (today, week_start) / G_TIME_SPAN_DAY;
|
||||
|
||||
/* Today is out of range */
|
||||
if (g_date_time_compare (today, week_start) < 0 || days_diff > N_WEEKDAYS)
|
||||
if (g_date_time_compare (today, week_start) < 0 || days_diff > GCAL_N_WEEKDAYS)
|
||||
return -1;
|
||||
|
||||
return days_diff;
|
||||
@@ -454,7 +454,7 @@ update_overflow (GcalWeekHeader *self)
|
||||
|
||||
show_expand = FALSE;
|
||||
|
||||
for (i = 0; i < N_WEEKDAYS; i++)
|
||||
for (i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
GtkWidget *label;
|
||||
gboolean show_label;
|
||||
@@ -536,11 +536,11 @@ merge_events (GcalWeekHeader *self,
|
||||
static void
|
||||
check_mergeable_events (GcalWeekHeader *self)
|
||||
{
|
||||
GList *checked_events[N_WEEKDAYS] = { NULL, };
|
||||
GList *checked_events[GCAL_N_WEEKDAYS] = { NULL, };
|
||||
gint weekday;
|
||||
|
||||
/* We don't need to check the last column */
|
||||
for (weekday = 0; weekday < N_WEEKDAYS - 1; weekday++)
|
||||
for (weekday = 0; weekday < GCAL_N_WEEKDAYS - 1; weekday++)
|
||||
{
|
||||
gint index = 0;
|
||||
|
||||
@@ -566,7 +566,7 @@ check_mergeable_events (GcalWeekHeader *self)
|
||||
* Horizontally check if the next cells have the same event
|
||||
* than the current cell.
|
||||
*/
|
||||
for (gsize j = 1; j < N_WEEKDAYS - weekday; j++)
|
||||
for (gsize j = 1; j < GCAL_N_WEEKDAYS - weekday; j++)
|
||||
{
|
||||
GcalEvent *next_event;
|
||||
|
||||
@@ -646,7 +646,7 @@ split_event_widget_at_column (GcalWeekHeader *self,
|
||||
old_width = gtk_grid_layout_child_get_column_span (GTK_GRID_LAYOUT_CHILD (layout_child));
|
||||
|
||||
create_before = column > 0 && left_attach < column;
|
||||
create_after = column < N_WEEKDAYS - 1 && old_width > 1 && left_attach + old_width > column + 1;
|
||||
create_after = column < GCAL_N_WEEKDAYS - 1 && old_width > 1 && left_attach + old_width > column + 1;
|
||||
|
||||
event = gcal_event_widget_get_event (GCAL_EVENT_WIDGET (widget));
|
||||
|
||||
@@ -961,10 +961,10 @@ add_event (GcalWeekHeader *self,
|
||||
if (g_date_time_compare (event_end, week_end) < 0)
|
||||
end = floor (g_date_time_difference (event_end, week_start) / G_TIME_SPAN_DAY) - all_day;
|
||||
else
|
||||
end = N_WEEKDAYS - 1;
|
||||
end = GCAL_N_WEEKDAYS - 1;
|
||||
|
||||
/* Sanity checks */
|
||||
if (start > end || start > N_WEEKDAYS - 1 || end < 0)
|
||||
if (start > end || start > GCAL_N_WEEKDAYS - 1 || end < 0)
|
||||
{
|
||||
g_warning ("Error adding event '%s' to the week header", gcal_event_get_summary (event));
|
||||
return;
|
||||
@@ -1006,7 +1006,7 @@ remove_event (GcalWeekHeader *self,
|
||||
}
|
||||
|
||||
/* Remove from the weekday's GList */
|
||||
for (weekday = 0; weekday < N_WEEKDAYS; weekday++)
|
||||
for (weekday = 0; weekday < GCAL_N_WEEKDAYS; weekday++)
|
||||
{
|
||||
guint event_position;
|
||||
|
||||
@@ -1048,9 +1048,9 @@ update_unchanged_events (GcalWeekHeader *self,
|
||||
g_date_time_get_month (new_week_start),
|
||||
g_date_time_get_day_of_month (new_week_start),
|
||||
0, 0, 0);
|
||||
utc_week_end = g_date_time_add_days (utc_week_start, N_WEEKDAYS);
|
||||
utc_week_end = g_date_time_add_days (utc_week_start, GCAL_N_WEEKDAYS);
|
||||
|
||||
for (weekday = 0; weekday < N_WEEKDAYS; weekday++)
|
||||
for (weekday = 0; weekday < GCAL_N_WEEKDAYS; weekday++)
|
||||
{
|
||||
for (gsize i = 0; i < self->events[weekday]->len; i++)
|
||||
{
|
||||
@@ -1120,7 +1120,7 @@ update_title (GcalWeekHeader *self)
|
||||
week_start = gcal_date_time_get_start_of_week (self->active_date);
|
||||
today_column = get_today_column (self);
|
||||
|
||||
for (gint i = 0; i < N_WEEKDAYS; i++)
|
||||
for (gint i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
g_autoptr (GDateTime) day = NULL;
|
||||
g_autofree gchar *weekday_date = NULL;
|
||||
@@ -1261,7 +1261,7 @@ get_dnd_cell (GcalWeekHeader *self,
|
||||
{
|
||||
gdouble column_width;
|
||||
|
||||
column_width = gtk_widget_get_width (GTK_WIDGET (self)) / (float) N_WEEKDAYS;
|
||||
column_width = gtk_widget_get_width (GTK_WIDGET (self)) / (float) GCAL_N_WEEKDAYS;
|
||||
|
||||
return x / column_width;
|
||||
}
|
||||
@@ -1286,7 +1286,7 @@ move_event_to_cell (GcalWeekHeader *self,
|
||||
|
||||
/* RTL languages swap the drop cell column */
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL)
|
||||
cell = N_WEEKDAYS - 1 - cell;
|
||||
cell = GCAL_N_WEEKDAYS - 1 - cell;
|
||||
|
||||
changed_event = gcal_event_new_from_event (event);
|
||||
start_date = gcal_event_get_date_start (changed_event);
|
||||
@@ -1518,7 +1518,7 @@ gcal_week_header_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_allocate (self->main_box, width, height, baseline, NULL);
|
||||
|
||||
ltr = gtk_widget_get_direction (widget) != GTK_TEXT_DIR_RTL;
|
||||
cell_width = width / (float) N_WEEKDAYS;
|
||||
cell_width = width / (float) GCAL_N_WEEKDAYS;
|
||||
|
||||
if (gtk_widget_should_layout (self->selection.widget))
|
||||
{
|
||||
@@ -1545,9 +1545,9 @@ gcal_week_header_size_allocate (GtkWidget *widget,
|
||||
|
||||
gtk_widget_size_allocate (self->selection.widget,
|
||||
&(GtkAllocation) {
|
||||
.x = ALIGNED (selection_x),
|
||||
.x = GCAL_ALIGNED (selection_x),
|
||||
.y = -6,
|
||||
.width = ALIGNED (selection_width + 1),
|
||||
.width = GCAL_ALIGNED (selection_width + 1),
|
||||
.height = height + 6,
|
||||
},
|
||||
baseline);
|
||||
@@ -1582,7 +1582,7 @@ gcal_week_header_snapshot (GtkWidget *widget,
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
x = ALIGNED (ltr ? 0 : width);
|
||||
x = GCAL_ALIGNED (ltr ? 0 : width);
|
||||
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, 0));
|
||||
@@ -1627,7 +1627,7 @@ gcal_week_header_finalize (GObject *object)
|
||||
|
||||
gcal_clear_date_time (&self->active_date);
|
||||
|
||||
for (i = 0; i < N_WEEKDAYS; i++)
|
||||
for (i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
g_clear_pointer (&self->events[i], g_ptr_array_unref);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (self->weather_infos); i++)
|
||||
@@ -1746,7 +1746,7 @@ gcal_week_header_init (GcalWeekHeader *self)
|
||||
|
||||
g_signal_connect (self->events_model, "items-changed", G_CALLBACK (events_changed_cb), self);
|
||||
|
||||
for (gsize i = 0; i < N_WEEKDAYS; i++)
|
||||
for (gsize i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
self->events[i] = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
self->expanded = FALSE;
|
||||
@@ -1766,7 +1766,7 @@ gcal_week_header_init (GcalWeekHeader *self)
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
for (i = 0; i < N_WEEKDAYS; i++)
|
||||
for (i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
WeekdayHeader *header = &self->weekday_header[i];
|
||||
GtkWidget *box;
|
||||
@@ -1790,7 +1790,7 @@ gcal_week_header_init (GcalWeekHeader *self)
|
||||
|
||||
gtk_box_append (self->weekdays_box, box);
|
||||
|
||||
/* Add N_WEEKDAYS empty widget to the grid to ensure proper spacing */
|
||||
/* Add GCAL_N_WEEKDAYS empty widget to the grid to ensure proper spacing */
|
||||
gtk_grid_attach (self->grid, gtk_box_new (GTK_ORIENTATION_VERTICAL, 0), i, 0, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ gcal_week_view_common_snapshot_hour_lines (GtkWidget *widget,
|
||||
color.alpha = is_high_contrast ? 0.65 : 0.15;
|
||||
gtk_snapshot_restore (snapshot);
|
||||
|
||||
column_width = width / (float) N_WEEKDAYS;
|
||||
column_width = width / (float) GCAL_N_WEEKDAYS;
|
||||
|
||||
switch (orientation)
|
||||
{
|
||||
case GTK_ORIENTATION_HORIZONTAL:
|
||||
for (i = 0; i < N_WEEKDAYS; i++)
|
||||
for (i = 0; i < GCAL_N_WEEKDAYS; i++)
|
||||
{
|
||||
gdouble x;
|
||||
|
||||
@@ -74,7 +74,7 @@ gcal_week_view_common_snapshot_hour_lines (GtkWidget *widget,
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
&color,
|
||||
&GRAPHENE_RECT_INIT (0.f,
|
||||
ALIGNED ((height / 24.0) * i),
|
||||
GCAL_ALIGNED ((height / 24.0) * i),
|
||||
width,
|
||||
1.0));
|
||||
}
|
||||
@@ -87,7 +87,7 @@ gcal_week_view_common_snapshot_hour_lines (GtkWidget *widget,
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
&color,
|
||||
&GRAPHENE_RECT_INIT (0.f,
|
||||
ALIGNED ((height / 24.0) * i + half_cell_height),
|
||||
GCAL_ALIGNED ((height / 24.0) * i + half_cell_height),
|
||||
width,
|
||||
1.0));
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ update_grid_scroll_position (GcalWeekView *self)
|
||||
page = gtk_adjustment_get_page_size (vadjustment);
|
||||
max = gtk_adjustment_get_upper (vadjustment);
|
||||
|
||||
real_value = max / MINUTES_PER_DAY * minutes - (page / 2.0);
|
||||
real_value = max / GCAL_MINUTES_PER_DAY * minutes - (page / 2.0);
|
||||
page_increment = gtk_adjustment_get_page_increment (vadjustment);
|
||||
value = gtk_adjustment_get_value (vadjustment);
|
||||
|
||||
|
||||
@@ -163,8 +163,8 @@ gcal_search_engine_search (GcalSearchEngine *self,
|
||||
context = gcal_application_get_context (GCAL_DEFAULT_APPLICATION);
|
||||
timezone = gcal_context_get_timezone (context);
|
||||
now = g_date_time_new_now (timezone);
|
||||
range_start = g_date_time_add_months (now, -N_WEEKDAYS - 1);
|
||||
range_end = g_date_time_add_months (now, N_WEEKDAYS - 1);
|
||||
range_start = g_date_time_add_months (now, -GCAL_N_WEEKDAYS - 1);
|
||||
range_end = g_date_time_add_months (now, GCAL_N_WEEKDAYS - 1);
|
||||
model = gcal_search_model_new (cancellable, range_start, range_end);
|
||||
|
||||
gcal_timeline_set_filter (self->timeline, search_query);
|
||||
|
||||
@@ -84,8 +84,8 @@ gcal_date_time_get_start_of_week (GDateTime *date)
|
||||
g_assert (date != NULL);
|
||||
|
||||
first_weekday = gcal_util_get_first_weekday ();
|
||||
weekday = g_date_time_get_day_of_week (date) % N_WEEKDAYS;
|
||||
n_days_after_week_start = (N_WEEKDAYS + weekday - first_weekday) % N_WEEKDAYS;
|
||||
weekday = g_date_time_get_day_of_week (date) % GCAL_N_WEEKDAYS;
|
||||
n_days_after_week_start = (GCAL_N_WEEKDAYS + weekday - first_weekday) % GCAL_N_WEEKDAYS;
|
||||
|
||||
start_of_week = g_date_time_add_days (date, -n_days_after_week_start);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
static const gint
|
||||
ab_day[N_WEEKDAYS] =
|
||||
ab_day[GCAL_N_WEEKDAYS] =
|
||||
{
|
||||
ABDAY_1,
|
||||
ABDAY_2,
|
||||
@@ -327,7 +327,7 @@ gcal_util_get_first_weekday (void)
|
||||
else
|
||||
g_warning ("Unknown value of _NL_TIME_WEEK_1STDAY.\n");
|
||||
|
||||
week_start = (week_1stday + first_weekday - 1) % N_WEEKDAYS;
|
||||
week_start = (week_1stday + first_weekday - 1) % GCAL_N_WEEKDAYS;
|
||||
|
||||
#else
|
||||
|
||||
@@ -343,7 +343,7 @@ gcal_util_get_first_weekday (void)
|
||||
else
|
||||
week_start = -1;
|
||||
|
||||
if (week_start < 0 || week_start > N_WEEKDAYS - 1)
|
||||
if (week_start < 0 || week_start > GCAL_N_WEEKDAYS - 1)
|
||||
{
|
||||
g_warning ("Whoever translated calendar:week_start:0 for GTK+ "
|
||||
"did so wrongly.\n");
|
||||
@@ -500,7 +500,7 @@ gcal_util_get_alarm_trigger_minutes (GcalEvent *event,
|
||||
alarm_dt = g_date_time_add_full (gcal_event_get_date_start (event),
|
||||
0,
|
||||
0,
|
||||
- (i_cal_duration_get_days (duration) + i_cal_duration_get_weeks (duration) * N_WEEKDAYS),
|
||||
- (i_cal_duration_get_days (duration) + i_cal_duration_get_weeks (duration) * GCAL_N_WEEKDAYS),
|
||||
- i_cal_duration_get_hours (duration),
|
||||
- i_cal_duration_get_minutes (duration),
|
||||
- i_cal_duration_get_seconds (duration));
|
||||
@@ -563,7 +563,7 @@ gcal_util_is_workday (guint day)
|
||||
gchar territory[3] = { 0, };
|
||||
guint i;
|
||||
|
||||
if (day > N_WEEKDAYS - 1)
|
||||
if (day > GCAL_N_WEEKDAYS - 1)
|
||||
return FALSE;
|
||||
|
||||
no_work_days = GCAL_WEEK_DAY_SATURDAY | GCAL_WEEK_DAY_SUNDAY;
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#include <libecal/libecal.h>
|
||||
#include <libgweather/gweather.h>
|
||||
|
||||
#define N_WEEKDAYS 7
|
||||
#define ALIGNED(x) (round (x) + 0.5)
|
||||
#define MINUTES_PER_DAY 1440
|
||||
#define MAX_MINUTES (N_WEEKDAYS * MINUTES_PER_DAY)
|
||||
#define GCAL_N_WEEKDAYS 7
|
||||
#define GCAL_ALIGNED(x) (round (x) + 0.5)
|
||||
#define GCAL_MINUTES_PER_DAY 1440
|
||||
#define GCAL_MAX_MINUTES (GCAL_N_WEEKDAYS * GCAL_MINUTES_PER_DAY)
|
||||
|
||||
#define GCAL_DEFAULT_APPLICATION GCAL_APPLICATION (g_application_get_default ())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user