From f76659c7066deb71a7ff1a3ede94a56aa4828e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Fortin=20Tam?= Date: Thu, 29 Feb 2024 15:54:45 -0500 Subject: [PATCH] import-dialog: Move parent source name color code Reading the `get_source_parent_name_color` call after `color_paintable`, one gets the impression they are somehow related, but they are not. Furthermore, this unfortunate location complicates my upcoming changes. Let's relocate that code next to the context where it is actually used. This improves clarity and maintainability. --- src/gui/importer/gcal-import-dialog.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/importer/gcal-import-dialog.c b/src/gui/importer/gcal-import-dialog.c index 725e3c49..029fd2a5 100644 --- a/src/gui/importer/gcal-import-dialog.c +++ b/src/gui/importer/gcal-import-dialog.c @@ -307,10 +307,6 @@ on_combo_row_signal_factory_bind_cb (GtkSignalListItemFactory *factory, grid = gtk_list_item_get_child (item); color_paintable = get_circle_paintable_from_color (gcal_calendar_get_color (calendar), 16); - get_source_parent_name_color (gcal_context_get_manager (self->context), - gcal_calendar_get_source (calendar), - &parent_name, - NULL); icon = g_object_get_data (G_OBJECT (grid), "icon"); gtk_image_set_from_paintable (GTK_IMAGE (icon), color_paintable); @@ -318,6 +314,12 @@ on_combo_row_signal_factory_bind_cb (GtkSignalListItemFactory *factory, label = g_object_get_data (G_OBJECT (grid), "title"); gtk_label_set_label (GTK_LABEL (label), gcal_calendar_get_name (calendar)); + /* Get a colored version of the calendar source's name, to use as a subtitle */ + get_source_parent_name_color (gcal_context_get_manager (self->context), + gcal_calendar_get_source (calendar), + &parent_name, + NULL); + label = g_object_get_data (G_OBJECT (grid), "subtitle"); gtk_label_set_label (GTK_LABEL (label), parent_name);