| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* Copyright 2024 Jan-Michael Brummer <jan-michael.brummer1@volkswagen.de> | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU Lesser General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 3 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU Lesser General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU Lesser General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "user/msg-user-contact-folder.h" | ||
| 18 | #include "msg-error.h" | ||
| 19 | #include "msg-json-utils.h" | ||
| 20 | |||
| 21 | /** | ||
| 22 | * MsgUserContactFolder: | ||
| 23 | * | ||
| 24 | * Handling of user_contact folder specific functions. | ||
| 25 | */ | ||
| 26 | |||
| 27 | struct _MsgUserContactFolder { | ||
| 28 | GObject parent_instance; | ||
| 29 | |||
| 30 | char *id; | ||
| 31 | char *display_name; | ||
| 32 | }; | ||
| 33 | |||
| 34 |
5/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 1 times.
|
7 | G_DEFINE_TYPE (MsgUserContactFolder, msg_user_contact_folder, G_TYPE_OBJECT); |
| 35 | |||
| 36 | static void | ||
| 37 | 1 | msg_user_contact_folder_dispose (GObject *object) | |
| 38 | { | ||
| 39 | 1 | MsgUserContactFolder *self = MSG_USER_CONTACT_FOLDER (object); | |
| 40 | |||
| 41 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | g_clear_pointer (&self->id, g_free); |
| 42 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | g_clear_pointer (&self->display_name, g_free); |
| 43 | |||
| 44 | 1 | G_OBJECT_CLASS (msg_user_contact_folder_parent_class)->dispose (object); | |
| 45 | 1 | } | |
| 46 | |||
| 47 | static void | ||
| 48 | 1 | msg_user_contact_folder_init (__attribute__ ((unused)) MsgUserContactFolder *self) | |
| 49 | { | ||
| 50 | 1 | } | |
| 51 | |||
| 52 | static void | ||
| 53 | 2 | msg_user_contact_folder_class_init (MsgUserContactFolderClass *class) | |
| 54 | { | ||
| 55 | 2 | GObjectClass *object_class = G_OBJECT_CLASS (class); | |
| 56 | |||
| 57 | 2 | object_class->dispose = msg_user_contact_folder_dispose; | |
| 58 | 2 | } | |
| 59 | |||
| 60 | /** | ||
| 61 | * msg_user_contact_folder_new: | ||
| 62 | * | ||
| 63 | * Creates a new `MsgUserContactFolder`. | ||
| 64 | * | ||
| 65 | * Returns: the newly created `MsgUserContactFolder` | ||
| 66 | */ | ||
| 67 | MsgUserContactFolder * | ||
| 68 | 1 | msg_user_contact_folder_new (void) | |
| 69 | { | ||
| 70 | 1 | return g_object_new (MSG_TYPE_USER_CONTACT_FOLDER, NULL); | |
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * msg_user_contact_folder_new_from_json: | ||
| 75 | * @json_object: The json object to parse | ||
| 76 | * @error: a #GError | ||
| 77 | * | ||
| 78 | * Creates a new `MsgUserContactFolder` from json response object. | ||
| 79 | * | ||
| 80 | * Returns: the newly created `MsgUserContactFolder` | ||
| 81 | */ | ||
| 82 | MsgUserContactFolder * | ||
| 83 | ✗ | msg_user_contact_folder_new_from_json (JsonObject *json_object, | |
| 84 | __attribute__ ((unused)) GError **error) | ||
| 85 | { | ||
| 86 | MsgUserContactFolder *self; | ||
| 87 | |||
| 88 | ✗ | self = msg_user_contact_folder_new (); | |
| 89 | |||
| 90 | ✗ | self->id = g_strdup (msg_json_object_get_string (json_object, "id")); | |
| 91 | ✗ | self->display_name = g_strdup (msg_json_object_get_string (json_object, "displayName")); | |
| 92 | |||
| 93 | ✗ | return self; | |
| 94 | } | ||
| 95 | |||
| 96 | /** | ||
| 97 | * msg_user_contact_folder_get_display_name: | ||
| 98 | * @self: a user_contact folder | ||
| 99 | * | ||
| 100 | * Returns: (transfer none): display name of user_contact folder | ||
| 101 | */ | ||
| 102 | const char * | ||
| 103 | 1 | msg_user_contact_folder_get_display_name (MsgUserContactFolder *self) | |
| 104 | { | ||
| 105 | 1 | return self->display_name; | |
| 106 | } | ||
| 107 | |||
| 108 | /** | ||
| 109 | * msg_user_contact_folder_get_id: | ||
| 110 | * @self: a user_contact folder | ||
| 111 | * | ||
| 112 | * Returns: id of user_contact folder | ||
| 113 | */ | ||
| 114 | const char * | ||
| 115 | 1 | msg_user_contact_folder_get_id (MsgUserContactFolder *self) | |
| 116 | { | ||
| 117 | 1 | return self->id; | |
| 118 | } | ||
| 119 |