views/agenda-view: Replace "context" property with context getter method

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
This commit is contained in:
Hari Rana
2026-03-23 19:30:00 +00:00
committed by Marge Bot
parent cebd3cd84d
commit 5616ba2c03
2 changed files with 4 additions and 18 deletions
-1
View File
@@ -1225,7 +1225,6 @@ gcal_window_constructed (GObject *object)
* FIXME: this is a hack around the issue that happens when trying to bind * FIXME: this is a hack around the issue that happens when trying to bind
* these properties using the GtkBuilder .ui file. * these properties using the GtkBuilder .ui file.
*/ */
g_object_bind_property (self, "context", self->agenda_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (self, "context", self->date_chooser, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->date_chooser, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (self, "context", self->event_editor, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->event_editor, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (self, "context", self->quick_add_popover, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->quick_add_popover, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
+4 -17
View File
@@ -49,7 +49,6 @@ struct _GcalAgendaView
/* property */ /* property */
GDateTime *date; GDateTime *date;
GcalContext *context;
GcalRangeTree *events; GcalRangeTree *events;
guint scroll_grid_timeout_id; guint scroll_grid_timeout_id;
@@ -69,7 +68,6 @@ enum
{ {
PROP_0, PROP_0,
PROP_DATE, PROP_DATE,
PROP_CONTEXT,
PROP_TIME_DIRECTION, PROP_TIME_DIRECTION,
N_PROPS, N_PROPS,
}; };
@@ -603,6 +601,7 @@ gcal_agenda_view_add_event (GcalTimelineSubscriber *subscriber,
g_autoptr (GDateTime) event_date = gcal_event_get_date_start (event); g_autoptr (GDateTime) event_date = gcal_event_get_date_start (event);
GtkWidget *widget, *row; GtkWidget *widget, *row;
GcalTimestampPolicy timestamp_policy; GcalTimestampPolicy timestamp_policy;
GcalContext *context;
GCAL_ENTRY; GCAL_ENTRY;
@@ -624,8 +623,10 @@ gcal_agenda_view_add_event (GcalTimelineSubscriber *subscriber,
else else
timestamp_policy = GCAL_TIMESTAMP_POLICY_START; timestamp_policy = GCAL_TIMESTAMP_POLICY_START;
context = gcal_application_get_context (GCAL_DEFAULT_APPLICATION);
widget = g_object_new (GCAL_TYPE_EVENT_WIDGET, widget = g_object_new (GCAL_TYPE_EVENT_WIDGET,
"context", self->context, "context", context,
"event", event, "event", event,
"orientation", GTK_ORIENTATION_VERTICAL, "orientation", GTK_ORIENTATION_VERTICAL,
"timestamp-policy", timestamp_policy, "timestamp-policy", timestamp_policy,
@@ -752,8 +753,6 @@ gcal_agenda_view_finalize (GObject *object)
g_clear_pointer (&self->date, g_date_time_unref); g_clear_pointer (&self->date, g_date_time_unref);
g_clear_object (&self->context);
/* Chain up to parent's finalize() method. */ /* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (gcal_agenda_view_parent_class)->finalize (object); G_OBJECT_CLASS (gcal_agenda_view_parent_class)->finalize (object);
} }
@@ -764,19 +763,12 @@ gcal_agenda_view_set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GcalAgendaView *self = (GcalAgendaView *) object;
switch (property_id) switch (property_id)
{ {
case PROP_DATE: case PROP_DATE:
gcal_view_set_date (GCAL_VIEW (object), g_value_get_boxed (value)); gcal_view_set_date (GCAL_VIEW (object), g_value_get_boxed (value));
break; break;
case PROP_CONTEXT:
g_assert (self->context == NULL);
self->context = g_value_dup_object (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break; break;
@@ -800,10 +792,6 @@ gcal_agenda_view_get_property (GObject *object,
g_value_set_boxed (value, self->date); g_value_set_boxed (value, self->date);
break; break;
case PROP_CONTEXT:
g_value_set_object (value, self->context);
break;
case PROP_TIME_DIRECTION: case PROP_TIME_DIRECTION:
g_value_set_enum (value, GTK_ORIENTATION_VERTICAL); g_value_set_enum (value, GTK_ORIENTATION_VERTICAL);
break; break;
@@ -826,7 +814,6 @@ gcal_agenda_view_class_init (GcalAgendaViewClass *klass)
object_class->get_property = gcal_agenda_view_get_property; object_class->get_property = gcal_agenda_view_get_property;
g_object_class_override_property (object_class, PROP_DATE, "active-date"); g_object_class_override_property (object_class, PROP_DATE, "active-date");
g_object_class_override_property (object_class, PROP_CONTEXT, "context");
g_object_class_override_property (object_class, PROP_TIME_DIRECTION, "time-direction"); g_object_class_override_property (object_class, PROP_TIME_DIRECTION, "time-direction");
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/views/gcal-agenda-view.ui"); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/views/gcal-agenda-view.ui");