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.
This commit is contained in:
Jean-François Fortin Tam
2024-08-27 14:45:49 -04:00
parent 876e802f59
commit f76659c706
+6 -4
View File
@@ -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);