utils: Prefix macros with GCAL_

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/842>
This commit is contained in:
Hari Rana
2026-09-20 12:44:24 +00:00
committed by Marge Bot
parent 117c032d95
commit 65896c6ece
16 changed files with 128 additions and 128 deletions
+29 -29
View File
@@ -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;