common/date-chooser: Replace "context" method with context getter method
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
This commit is contained in:
@@ -54,7 +54,6 @@ struct _GcalDateChooser
|
|||||||
GtkWidget *week[ROWS];
|
GtkWidget *week[ROWS];
|
||||||
|
|
||||||
GDateTime *date;
|
GDateTime *date;
|
||||||
GcalContext *context;
|
|
||||||
|
|
||||||
gint this_year;
|
gint this_year;
|
||||||
gint week_start;
|
gint week_start;
|
||||||
@@ -100,7 +99,6 @@ enum
|
|||||||
PROP_SHOW_EVENTS,
|
PROP_SHOW_EVENTS,
|
||||||
PROP_SPLIT_MONTH_YEAR,
|
PROP_SPLIT_MONTH_YEAR,
|
||||||
PROP_DATE,
|
PROP_DATE,
|
||||||
PROP_CONTEXT,
|
|
||||||
PROP_TIME_DIRECTION,
|
PROP_TIME_DIRECTION,
|
||||||
NUM_PROPERTIES = PROP_SPLIT_MONTH_YEAR + 1,
|
NUM_PROPERTIES = PROP_SPLIT_MONTH_YEAR + 1,
|
||||||
};
|
};
|
||||||
@@ -722,17 +720,6 @@ calendar_set_property (GObject *obj,
|
|||||||
gcal_date_chooser_set_date (GCAL_VIEW (self), g_value_get_boxed (value));
|
gcal_date_chooser_set_date (GCAL_VIEW (self), g_value_get_boxed (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_CONTEXT:
|
|
||||||
g_assert (self->context == NULL);
|
|
||||||
self->context = g_value_dup_object (value);
|
|
||||||
|
|
||||||
g_signal_connect_object (gcal_context_get_clock (self->context),
|
|
||||||
"day-changed",
|
|
||||||
G_CALLBACK (on_clock_day_changed_cb),
|
|
||||||
self,
|
|
||||||
G_CONNECT_SWAPPED);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_SHOW_HEADING:
|
case PROP_SHOW_HEADING:
|
||||||
gcal_date_chooser_set_show_heading (self, g_value_get_boolean (value));
|
gcal_date_chooser_set_show_heading (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
@@ -777,10 +764,6 @@ calendar_get_property (GObject *obj,
|
|||||||
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_SHOW_HEADING:
|
case PROP_SHOW_HEADING:
|
||||||
g_value_set_boolean (value, self->show_heading);
|
g_value_set_boolean (value, self->show_heading);
|
||||||
break;
|
break;
|
||||||
@@ -893,7 +876,6 @@ gcal_date_chooser_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
GcalDateChooser *self = GCAL_DATE_CHOOSER (object);
|
GcalDateChooser *self = GCAL_DATE_CHOOSER (object);
|
||||||
|
|
||||||
g_clear_object (&self->context);
|
|
||||||
g_clear_pointer (&self->date, g_date_time_unref);
|
g_clear_pointer (&self->date, g_date_time_unref);
|
||||||
g_clear_pointer (&self->events, gcal_range_tree_unref);
|
g_clear_pointer (&self->events, gcal_range_tree_unref);
|
||||||
|
|
||||||
@@ -1024,7 +1006,6 @@ gcal_date_chooser_class_init (GcalDateChooserClass *class)
|
|||||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
signals[DAY_SELECTED] = g_signal_new ("day-selected",
|
signals[DAY_SELECTED] = g_signal_new ("day-selected",
|
||||||
@@ -1079,6 +1060,7 @@ show_week_number_to_column_span_cb (GBinding *binding,
|
|||||||
static void
|
static void
|
||||||
gcal_date_chooser_init (GcalDateChooser *self)
|
gcal_date_chooser_init (GcalDateChooser *self)
|
||||||
{
|
{
|
||||||
|
GcalContext *context = gcal_application_get_context (GCAL_DEFAULT_APPLICATION);
|
||||||
GtkDropTarget *drop_target;
|
GtkDropTarget *drop_target;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
gint row, col;
|
gint row, col;
|
||||||
@@ -1225,6 +1207,12 @@ gcal_date_chooser_init (GcalDateChooser *self)
|
|||||||
gtk_drop_target_set_preload (drop_target, TRUE);
|
gtk_drop_target_set_preload (drop_target, TRUE);
|
||||||
g_signal_connect (drop_target, "drop", G_CALLBACK (on_drop_target_drop_cb), NULL);
|
g_signal_connect (drop_target, "drop", G_CALLBACK (on_drop_target_drop_cb), NULL);
|
||||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drop_target));
|
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (drop_target));
|
||||||
|
|
||||||
|
g_signal_connect_object (gcal_context_get_clock (context),
|
||||||
|
"day-changed",
|
||||||
|
G_CALLBACK (on_clock_day_changed_cb),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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->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);
|
||||||
g_object_bind_property (self, "context", self->sync_indicator, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
g_object_bind_property (self, "context", self->sync_indicator, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
|
||||||
|
|||||||
Reference in New Issue
Block a user