From ab50a2bb3ec87c4ac01351368dc09df6fa369866 Mon Sep 17 00:00:00 2001 From: Kate Hsuan Date: Mon, 26 Feb 2024 16:59:48 +0800 Subject: up-history: Compare the history id with a given string up_history_is_device_id_equal() is used to compare the history device_id with a given string. --- src/up-history.c | 14 ++++++++++++++ src/up-history.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/up-history.c b/src/up-history.c index bed3b0e..2664fba 100644 --- a/src/up-history.c +++ b/src/up-history.c @@ -870,6 +870,20 @@ up_history_set_time_empty_data (UpHistory *history, gint64 time_s) return TRUE; } +/** + * up_history_is_device_id_equal: + **/ +gboolean +up_history_is_device_id_equal(UpHistory *history, const gchar *id) +{ + g_return_val_if_fail (UP_IS_HISTORY (history), FALSE); + + if (!g_strcmp0 (history->priv->id, id)) + return TRUE; + + return FALSE; +} + /** * up_history_class_init: * @klass: The UpHistoryClass diff --git a/src/up-history.h b/src/up-history.h index 87af5e3..7b0c2bd 100644 --- a/src/up-history.h +++ b/src/up-history.h @@ -60,6 +60,7 @@ typedef enum { GType up_history_get_type (void); +gboolean up_history_is_device_id_equal (UpHistory *history, const gchar *id); UpHistory *up_history_new (void); GPtrArray *up_history_get_data (UpHistory *history, -- cgit v1.2.3