summaryrefslogtreecommitdiff
path: root/lib/src
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-05-23 12:37:01 +0200
committerFelix Morgner <felix.morgner@gmail.com>2025-05-23 12:37:01 +0200
commit7572108d6774bd3b501e1dd3fab2a014ed164fcf (patch)
tree532c8948d89db0cd730be45112e8022af41df156 /lib/src
parentd1d171775f768be1dcdee194be5134f334c63347 (diff)
downloadturns-7572108d6774bd3b501e1dd3fab2a014ed164fcf.tar.xz
turns-7572108d6774bd3b501e1dd3fab2a014ed164fcf.zip
lib: add participant-count property to TurnOrder
Diffstat (limited to 'lib/src')
-rw-r--r--lib/src/turns-turn-order.c13
-rw-r--r--lib/src/turnsmm/turn-order.cpp4
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/src/turns-turn-order.c b/lib/src/turns-turn-order.c
index abc22c4..552b200 100644
--- a/lib/src/turns-turn-order.c
+++ b/lib/src/turns-turn-order.c
@@ -10,10 +10,12 @@
#include <gio/gio.h>
#include <glib-object.h>
#include <glib.h>
+#include <stdint.h>
enum
{
PROP_EMPTY = 1,
+ PROP_PARTICIPANT_COUNT,
PROP_RUNNING,
PROP_SORT_MODE,
N_PROPERTIES,
@@ -111,6 +113,9 @@ static void turns_turn_order_get_property(GObject * self, guint id, GValue * val
case PROP_EMPTY:
g_value_set_boolean(value, turns_turn_order_get_empty(instance));
return;
+ case PROP_PARTICIPANT_COUNT:
+ g_value_set_uint64(value, turns_turn_order_get_participant_count(instance));
+ return;
case PROP_RUNNING:
g_value_set_boolean(value, turns_turn_order_get_running(instance));
return;
@@ -166,6 +171,14 @@ static void turns_turn_order_class_init(TurnsTurnOrderClass * klass)
TRUE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+ properties[PROP_PARTICIPANT_COUNT] = g_param_spec_uint64("participant-count",
+ "Participant count",
+ "The number of participants in the turn order.",
+ 0,
+ UINT64_MAX,
+ 0,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY);
+
properties[PROP_RUNNING] = g_param_spec_boolean("running",
"Running",
"Whether or not the turn order is running (e.g. has been started)",
diff --git a/lib/src/turnsmm/turn-order.cpp b/lib/src/turnsmm/turn-order.cpp
index 5f38ded..d737679 100644
--- a/lib/src/turnsmm/turn-order.cpp
+++ b/lib/src/turnsmm/turn-order.cpp
@@ -141,12 +141,12 @@ namespace Turns
auto TurnOrder::property_sort_mode() noexcept -> Glib::PropertyProxy<SortMode>
{
- return {this, "sort_mode"};
+ return {this, "sort-mode"};
}
auto TurnOrder::property_sort_mode() const noexcept -> Glib::PropertyProxy_ReadOnly<SortMode>
{
- return {this, "sort_mode"};
+ return {this, "sort-mode"};
}
TurnOrder::TurnOrder(BaseObjectType * gobj)