diff --git a/src/gui/importer/gcal-import-dialog.c b/src/gui/importer/gcal-import-dialog.c index 05f71d54..af436d6d 100644 --- a/src/gui/importer/gcal-import-dialog.c +++ b/src/gui/importer/gcal-import-dialog.c @@ -143,7 +143,7 @@ setup_files (GcalImportDialog *self, AdwPreferencesGroup *group; GtkWidget *row; - row = gcal_import_file_row_new (files[i], self->title_sizegroup); + row = gcal_import_file_row_new (self->context, files[i], self->title_sizegroup); g_signal_connect (row, "file-loaded", G_CALLBACK (on_import_row_file_loaded_cb), self); group = ADW_PREFERENCES_GROUP (adw_preferences_group_new ()); diff --git a/src/gui/importer/gcal-import-file-row.c b/src/gui/importer/gcal-import-file-row.c index 7905b61f..f61c9a2b 100644 --- a/src/gui/importer/gcal-import-file-row.c +++ b/src/gui/importer/gcal-import-file-row.c @@ -38,6 +38,8 @@ struct _GcalImportFileRow GFile *file; GPtrArray *ical_components; GPtrArray *ical_timezones; + + GcalContext *context; }; static void read_calendar_finished_cb (GObject *source_object, @@ -49,6 +51,7 @@ G_DEFINE_TYPE (GcalImportFileRow, gcal_import_file_row, ADW_TYPE_BIN) enum { PROP_0, + PROP_CONTEXT, PROP_FILE, N_PROPS, }; @@ -298,6 +301,7 @@ gcal_import_file_row_finalize (GObject *object) g_cancellable_cancel (self->cancellable); g_clear_object (&self->cancellable); + g_clear_object (&self->context); g_clear_object (&self->file); g_clear_pointer (&self->ical_components, g_ptr_array_unref); g_clear_pointer (&self->ical_timezones, g_ptr_array_unref); @@ -315,6 +319,10 @@ gcal_import_file_row_get_property (GObject *object, switch (prop_id) { + case PROP_CONTEXT: + g_value_set_object (value, self->context); + break; + case PROP_FILE: g_value_set_object (value, self->file); break; @@ -334,6 +342,11 @@ gcal_import_file_row_set_property (GObject *object, switch (prop_id) { + case PROP_CONTEXT: + g_assert (self->context == NULL); + self->context = g_value_dup_object (value); + break; + case PROP_FILE: g_assert (self->file == NULL); self->file = g_value_dup_object (value); @@ -364,6 +377,12 @@ gcal_import_file_row_class_init (GcalImportFileRowClass *klass) 1, G_TYPE_PTR_ARRAY); + properties[PROP_CONTEXT] = g_param_spec_object ("context", + "Context", + "Context", + GCAL_TYPE_CONTEXT, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); + properties[PROP_FILE] = g_param_spec_object ("file", "An ICS file", "An ICS file", @@ -386,12 +405,14 @@ gcal_import_file_row_init (GcalImportFileRow *self) } GtkWidget* -gcal_import_file_row_new (GFile *file, +gcal_import_file_row_new (GcalContext *context, + GFile *file, GtkSizeGroup *title_sizegroup) { GcalImportFileRow *self; self = g_object_new (GCAL_TYPE_IMPORT_FILE_ROW, + "context", context, "file", file, NULL); self->title_sizegroup = title_sizegroup; diff --git a/src/gui/importer/gcal-import-file-row.h b/src/gui/importer/gcal-import-file-row.h index d98fa145..91aa0a9d 100644 --- a/src/gui/importer/gcal-import-file-row.h +++ b/src/gui/importer/gcal-import-file-row.h @@ -22,12 +22,15 @@ #include +#include "gcal-context.h" + G_BEGIN_DECLS #define GCAL_TYPE_IMPORT_FILE_ROW (gcal_import_file_row_get_type()) G_DECLARE_FINAL_TYPE (GcalImportFileRow, gcal_import_file_row, GCAL, IMPORT_FILE_ROW, AdwBin) -GtkWidget* gcal_import_file_row_new (GFile *file, +GtkWidget* gcal_import_file_row_new (GcalContext *context, + GFile *file, GtkSizeGroup *title_sizegroup); GPtrArray* gcal_import_file_row_get_ical_components (GcalImportFileRow *self);