From 29a2059e0eb2a7e232486f121f8ff981403b566d Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Mon, 10 Oct 2022 08:39:42 +0200 Subject: [PATCH] util: Rename function to calls_find_in_model() and adjust documentation Since it works for GListModel rename it appropriately. It used to provide an inline implementation for g_list_store_find() behind a glib version guard, but we bumped minimum version in cfd3c2a7fe418b678bfaffa58e87238128a11008 so the docstring was updated and made more succinct. --- src/calls-history-box.c | 2 +- src/calls-manager.c | 2 +- src/util.c | 7 +++---- src/util.h | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/calls-history-box.c b/src/calls-history-box.c index 3e81d26..85d89b7 100644 --- a/src/calls-history-box.c +++ b/src/calls-history-box.c @@ -94,7 +94,7 @@ delete_call_cb (CallsCallRecord *record, g_return_if_fail (CALLS_IS_CALL_RECORD (record)); - ok = calls_find_in_store (self->model, + ok = calls_find_in_model (self->model, record, &position); diff --git a/src/calls-manager.c b/src/calls-manager.c index 636f166..1e2012f 100644 --- a/src/calls-manager.c +++ b/src/calls-manager.c @@ -518,7 +518,7 @@ origin_found_in_any_provider (CallsManager *self, CallsProvider *provider = CALLS_PROVIDER (value); GListModel *origins = calls_provider_get_origins (provider); - if (origins && calls_find_in_store (origins, + if (origins && calls_find_in_model (origins, origin, &position)) return TRUE; diff --git a/src/util.c b/src/util.c index b831e4a..c7f27ea 100644 --- a/src/util.c +++ b/src/util.c @@ -95,16 +95,15 @@ calls_number_is_ussd (const char *number) } /** - * calls_find_in_store: + * calls_find_in_model: * @list: A #GListModel * @item: The #gpointer to find * @position: (out) (optional): The first position of @item, if it was found. * - * Returns: Whether @list contains @item. This is mainly a convenience function - * until we no longer support older glib versions. + * Returns: %TRUE if @list contains @item, %FALSE otherwise. */ gboolean -calls_find_in_store (GListModel *list, +calls_find_in_model (GListModel *list, gpointer item, guint *position) { diff --git a/src/util.h b/src/util.h index 8d83a06..4f4f88a 100644 --- a/src/util.h +++ b/src/util.h @@ -119,7 +119,7 @@ gboolean calls_date_time_is_same_year (GDateTime *a, GDateTime *b); gboolean calls_number_is_ussd (const char *number); -gboolean calls_find_in_store (GListModel *list, +gboolean calls_find_in_model (GListModel *list, gpointer item, guint *position);