From 7522b5e9881e7e14207d78b0e741f52b42b723e4 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 12 May 2025 16:41:24 +0200 Subject: lib: sort functions --- lib/src/turns-participant.cpp | 32 ++++++++++++++++---------------- lib/src/turns-participant.h | 22 +++++++++++----------- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'lib/src') diff --git a/lib/src/turns-participant.cpp b/lib/src/turns-participant.cpp index a820f3f..233d058 100644 --- a/lib/src/turns-participant.cpp +++ b/lib/src/turns-participant.cpp @@ -142,6 +142,12 @@ TurnsParticipant * turns_participant_new_with(gchar const * name, gfloat priorit g_object_new(TURNS_TYPE_PARTICIPANT, "name", name, "priority", priority, "disposition", static_cast(disposition), nullptr)); } +TurnsDisposition turns_participant_get_disposition(TurnsParticipant const * self) +{ + g_return_val_if_fail(TURNS_IS_PARTICIPANT(const_cast(self)), TurnsDisposition::TURNS_DISPOSITION_NEUTRAL); + return self->disposition; +} + gchar const * turns_participant_get_name(TurnsParticipant const * self) { g_return_val_if_fail(TURNS_IS_PARTICIPANT(const_cast(self)), nullptr); @@ -154,10 +160,17 @@ gfloat turns_participant_get_priority(TurnsParticipant const * self) return self->priority; } -TurnsDisposition turns_participant_get_disposition(TurnsParticipant const * self) +void turns_participant_set_disposition(TurnsParticipant * self, TurnsDisposition value) { - g_return_val_if_fail(TURNS_IS_PARTICIPANT(const_cast(self)), TurnsDisposition::TURNS_DISPOSITION_NEUTRAL); - return self->disposition; + g_return_if_fail(TURNS_IS_PARTICIPANT(self)); + + if (value == self->disposition) + { + return; + } + + self->disposition = value; + g_object_notify_by_pspec(G_OBJECT(self), properties[static_cast(property::Disposition)]); } void turns_participant_set_name(TurnsParticipant * self, gchar const * value) @@ -186,17 +199,4 @@ void turns_participant_set_priority(TurnsParticipant * self, gfloat value) g_object_notify_by_pspec(G_OBJECT(self), properties[static_cast(property::Priority)]); } -void turns_participant_set_disposition(TurnsParticipant * self, TurnsDisposition value) -{ - g_return_if_fail(TURNS_IS_PARTICIPANT(self)); - - if (value == self->disposition) - { - return; - } - - self->disposition = value; - g_object_notify_by_pspec(G_OBJECT(self), properties[static_cast(property::Disposition)]); -} - G_END_DECLS diff --git a/lib/src/turns-participant.h b/lib/src/turns-participant.h index 502de32..a2af8d6 100644 --- a/lib/src/turns-participant.h +++ b/lib/src/turns-participant.h @@ -31,6 +31,14 @@ TurnsParticipant * turns_participant_new() G_GNUC_WARN_UNUSED_RESULT; */ TurnsParticipant * turns_participant_new_with(gchar const * name, gfloat priority, TurnsDisposition disposition) G_GNUC_WARN_UNUSED_RESULT; +/** + * @brief Get the disposition of a participant. + * + * @param self A Participant instance. The value *must not* be NULL. + * @return The disposition of the instance. + */ +TurnsDisposition turns_participant_get_disposition(TurnsParticipant const * self); + /** * @brief Get the name of a participant. * @@ -48,12 +56,12 @@ gchar const * turns_participant_get_name(TurnsParticipant const * self); gfloat turns_participant_get_priority(TurnsParticipant const * self); /** - * @brief Get the disposition of a participant. + * @brief Set the disposition of a participant. * * @param self A Participant instance. The value *must not* be NULL. - * @return The disposition of the instance. + * @param value The new disposition. */ -TurnsDisposition turns_participant_get_disposition(TurnsParticipant const * self); +void turns_participant_set_disposition(TurnsParticipant * self, TurnsDisposition value); /** * @brief Set the name of a participant. @@ -71,14 +79,6 @@ void turns_participant_set_name(TurnsParticipant * self, gchar const * value); */ void turns_participant_set_priority(TurnsParticipant * self, gfloat value); -/** - * @brief Set the disposition of a participant. - * - * @param self A Participant instance. The value *must not* be NULL. - * @param value The new disposition. - */ -void turns_participant_set_disposition(TurnsParticipant * self, TurnsDisposition value); - G_END_DECLS #endif \ No newline at end of file -- cgit v1.2.3