ews-I#153 - ECompEditor: Add API to get property parts

That can be used to modify the parts as needed by the extensions.

Related to https://gitlab.gnome.org/GNOME/evolution-ews/-/issues/153
This commit is contained in:
Milan Crha
2022-09-16 09:18:10 +02:00
parent 5d85d67405
commit a328e9eff8
4 changed files with 61 additions and 0 deletions

View File

@ -286,6 +286,39 @@ e_comp_editor_page_add_property_part (ECompEditorPage *page,
page->priv->parts = g_slist_append (page->priv->parts, ppd);
}
ECompEditorPropertyPart *
e_comp_editor_page_get_property_part (ECompEditorPage *page,
ICalPropertyKind prop_kind)
{
GSList *link;
g_return_val_if_fail (E_IS_COMP_EDITOR_PAGE (page), NULL);
for (link = page->priv->parts; link; link = g_slist_next (link)) {
PropertyPartData *ppd = link->data;
if (E_IS_COMP_EDITOR_PROPERTY_PART_STRING (ppd->part)) {
ECompEditorPropertyPartStringClass *klass = E_COMP_EDITOR_PROPERTY_PART_STRING_GET_CLASS (ppd->part);
if (klass->prop_kind == prop_kind)
return ppd->part;
}
if (E_IS_COMP_EDITOR_PROPERTY_PART_DATETIME (ppd->part)) {
ECompEditorPropertyPartDatetimeClass *klass = E_COMP_EDITOR_PROPERTY_PART_DATETIME_GET_CLASS (ppd->part);
if (klass->prop_kind == prop_kind)
return ppd->part;
}
if (E_IS_COMP_EDITOR_PROPERTY_PART_SPIN (ppd->part)) {
ECompEditorPropertyPartSpinClass *klass = E_COMP_EDITOR_PROPERTY_PART_SPIN_GET_CLASS (ppd->part);
if (klass->prop_kind == prop_kind)
return ppd->part;
}
}
return NULL;
}
void
e_comp_editor_page_sensitize_widgets (ECompEditorPage *page,
gboolean force_insensitive)

View File

@ -82,6 +82,9 @@ void e_comp_editor_page_add_property_part (ECompEditorPage *page,
gint attach_top,
gint attach_width,
gint attach_height);
ECompEditorPropertyPart *
e_comp_editor_page_get_property_part (ECompEditorPage *page,
ICalPropertyKind prop_kind);
void e_comp_editor_page_sensitize_widgets (ECompEditorPage *page,
gboolean force_insensitive);
void e_comp_editor_page_fill_widgets (ECompEditorPage *page,

View File

@ -3413,6 +3413,28 @@ e_comp_editor_get_page (ECompEditor *comp_editor,
return NULL;
}
/* The returned pointer is owned by the @comp_editor; returns the first found part,
in order of the addition. */
ECompEditorPropertyPart *
e_comp_editor_get_property_part (ECompEditor *comp_editor,
ICalPropertyKind prop_kind)
{
GSList *link;
g_return_val_if_fail (E_IS_COMP_EDITOR (comp_editor), NULL);
for (link = comp_editor->priv->pages; link; link = g_slist_next (link)) {
ECompEditorPage *page = link->data;
ECompEditorPropertyPart *part;
part = e_comp_editor_page_get_property_part (page, prop_kind);
if (part)
return part;
}
return NULL;
}
/* Free the returned GSList with g_slist_free(), the memebers are owned by the comp_editor */
GSList *
e_comp_editor_get_pages (ECompEditor *comp_editor)

View File

@ -155,6 +155,9 @@ void e_comp_editor_add_page (ECompEditor *comp_editor,
ECompEditorPage *
e_comp_editor_get_page (ECompEditor *comp_editor,
GType page_type);
ECompEditorPropertyPart *
e_comp_editor_get_property_part (ECompEditor *comp_editor,
ICalPropertyKind prop_kind);
GSList * e_comp_editor_get_pages (ECompEditor *comp_editor);
void e_comp_editor_select_page (ECompEditor *comp_editor,
ECompEditorPage *page);