views/month: Implement get_children_by_uuid

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1057
This commit is contained in:
Georges Basile Stavracas Neto
2023-08-14 14:57:51 -03:00
parent 1fd984306f
commit f1f9d83943
3 changed files with 34 additions and 1 deletions
+11
View File
@@ -28,6 +28,7 @@
#include "gcal-month-cell.h"
#include "gcal-month-view-row.h"
#include "gcal-range-tree.h"
#include "gcal-utils.h"
typedef struct
{
@@ -764,3 +765,13 @@ gcal_month_view_row_update_style_for_date (GcalMonthViewRow *self,
gcal_month_cell_set_different_month (GCAL_MONTH_CELL (self->day_cells[i]), different_month);
}
}
GList*
gcal_month_view_row_get_children_by_uuid (GcalMonthViewRow *self,
GcalRecurrenceModType mod,
const gchar *uuid)
{
g_assert (GCAL_IS_MONTH_VIEW_ROW (self));
return filter_children_by_uid_and_modtype (GTK_WIDGET (self), mod, uuid);
}
+4
View File
@@ -53,4 +53,8 @@ void gcal_month_view_row_remove_event (GcalMonthViewR
void gcal_month_view_row_update_style_for_date (GcalMonthViewRow *self,
GDateTime *date);
GList* gcal_month_view_row_get_children_by_uuid (GcalMonthViewRow *self,
GcalRecurrenceModType mod,
const gchar *uuid);
G_END_DECLS
+19 -1
View File
@@ -1045,7 +1045,25 @@ gcal_month_view_get_children_by_uuid (GcalView *view,
GcalRecurrenceModType mod,
const gchar *uuid)
{
return filter_children_by_uid_and_modtype (GTK_WIDGET (view), mod, uuid);
g_autoptr (GList) children = NULL;
GcalMonthView *self;
GCAL_ENTRY;
self = GCAL_MONTH_VIEW (view);
for (guint i = 0; i < self->week_rows->len; i++)
{
g_autoptr (GList) row_children = NULL;
GcalMonthViewRow *row;
row = g_ptr_array_index (self->week_rows, i);
row_children = gcal_month_view_row_get_children_by_uuid (row, mod, uuid);
children = g_list_concat (children, g_steal_pointer (&row_children));
}
GCAL_RETURN (g_steal_pointer (&children));
}
static GDateTime*