1 | |
---|---|
2 | #include "action-holder.h" |
3 | |
4 | struct _ActionHolder { |
5 | GObject instance; |
6 | |
7 | GObject *owner; |
8 | char *name; |
9 | }; |
10 | |
11 | G_DEFINE_TYPE (ActionHolder, action_holder, G_TYPE_OBJECT) |
12 | |
13 | static void |
14 | action_holder_init (ActionHolder *holder) |
15 | { |
16 | } |
17 | |
18 | static void |
19 | action_holder_finalize (GObject *object) |
20 | { |
21 | ActionHolder *holder = ACTION_HOLDER (ptr: object); |
22 | |
23 | g_object_unref (object: holder->owner); |
24 | g_free (mem: holder->name); |
25 | |
26 | G_OBJECT_CLASS (action_holder_parent_class)->finalize (object); |
27 | } |
28 | |
29 | static void |
30 | action_holder_class_init (ActionHolderClass *class) |
31 | { |
32 | GObjectClass *object_class = G_OBJECT_CLASS (class); |
33 | |
34 | object_class->finalize = action_holder_finalize; |
35 | } |
36 | |
37 | ActionHolder * |
38 | action_holder_new (GObject *owner, |
39 | const char *name) |
40 | { |
41 | ActionHolder *holder; |
42 | |
43 | holder = g_object_new (ACTION_TYPE_HOLDER, NULL); |
44 | |
45 | holder->owner = g_object_ref (owner); |
46 | holder->name = g_strdup (str: name); |
47 | |
48 | return holder; |
49 | } |
50 | |
51 | GObject * |
52 | action_holder_get_owner (ActionHolder *holder) |
53 | { |
54 | return holder->owner; |
55 | } |
56 | |
57 | const char * |
58 | action_holder_get_name (ActionHolder *holder) |
59 | { |
60 | return holder->name; |
61 | } |
62 |