aboutsummaryrefslogtreecommitdiff
path: root/src/ui/contact_entry.c
diff options
context:
space:
mode:
authorJacki <jacki@thejackimonster.de>2024-02-14 13:44:06 +0100
committerJacki <jacki@thejackimonster.de>2024-02-14 13:44:06 +0100
commit17392fe6169d39a75645728f44aa117f67b5331d (patch)
treecd9df10fc8a58c8104a494dcc6e1e44c09ccf8ca /src/ui/contact_entry.c
parent9ff0f0e2e8d554f465d7aad51ce7fb33e61a749c (diff)
downloadmessenger-gtk-17392fe6169d39a75645728f44aa117f67b5331d.tar.gz
messenger-gtk-17392fe6169d39a75645728f44aa117f67b5331d.zip
Add asserts to verify reliability
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'src/ui/contact_entry.c')
-rw-r--r--src/ui/contact_entry.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ui/contact_entry.c b/src/ui/contact_entry.c
index b9789da..5c39df2 100644
--- a/src/ui/contact_entry.c
+++ b/src/ui/contact_entry.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2021 GNUnet e.V. 3 Copyright (C) 2021--2024 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -30,26 +30,28 @@
30UI_CONTACT_ENTRY_Handle* 30UI_CONTACT_ENTRY_Handle*
31ui_contact_entry_new(MESSENGER_Application *app) 31ui_contact_entry_new(MESSENGER_Application *app)
32{ 32{
33 g_assert(app);
34
33 UI_CONTACT_ENTRY_Handle* handle = g_malloc(sizeof(UI_CONTACT_ENTRY_Handle)); 35 UI_CONTACT_ENTRY_Handle* handle = g_malloc(sizeof(UI_CONTACT_ENTRY_Handle));
34 36
35 handle->builder = gtk_builder_new_from_resource( 37 handle->builder = gtk_builder_new_from_resource(
36 application_get_resource_path(app, "ui/contact_entry.ui") 38 application_get_resource_path(app, "ui/contact_entry.ui")
37 ); 39 );
38 40
39 handle->entry_box = GTK_WIDGET( 41 handle->entry_box = GTK_WIDGET(
40 gtk_builder_get_object(handle->builder, "entry_box") 42 gtk_builder_get_object(handle->builder, "entry_box")
41 ); 43 );
42 44
43 handle->entry_avatar = HDY_AVATAR( 45 handle->entry_avatar = HDY_AVATAR(
44 gtk_builder_get_object(handle->builder, "entry_avatar") 46 gtk_builder_get_object(handle->builder, "entry_avatar")
45 ); 47 );
46 48
47 handle->title_label = GTK_LABEL( 49 handle->title_label = GTK_LABEL(
48 gtk_builder_get_object(handle->builder, "title_label") 50 gtk_builder_get_object(handle->builder, "title_label")
49 ); 51 );
50 52
51 handle->subtitle_label = GTK_LABEL( 53 handle->subtitle_label = GTK_LABEL(
52 gtk_builder_get_object(handle->builder, "subtitle_label") 54 gtk_builder_get_object(handle->builder, "subtitle_label")
53 ); 55 );
54 56
55 return handle; 57 return handle;
@@ -57,8 +59,9 @@ ui_contact_entry_new(MESSENGER_Application *app)
57 59
58void 60void
59ui_contact_entry_set_contact(UI_CONTACT_ENTRY_Handle* handle, 61ui_contact_entry_set_contact(UI_CONTACT_ENTRY_Handle* handle,
60 const struct GNUNET_CHAT_Contact *contact) 62 const struct GNUNET_CHAT_Contact *contact)
61{ 63{
64 g_assert((handle) && (contact));
62 65
63 const char *name = GNUNET_CHAT_contact_get_name(contact); 66 const char *name = GNUNET_CHAT_contact_get_name(contact);
64 const char *key = GNUNET_CHAT_contact_get_key(contact); 67 const char *key = GNUNET_CHAT_contact_get_key(contact);
@@ -71,6 +74,8 @@ ui_contact_entry_set_contact(UI_CONTACT_ENTRY_Handle* handle,
71void 74void
72ui_contact_entry_delete(UI_CONTACT_ENTRY_Handle *handle) 75ui_contact_entry_delete(UI_CONTACT_ENTRY_Handle *handle)
73{ 76{
77 g_assert(handle);
78
74 g_object_unref(handle->builder); 79 g_object_unref(handle->builder);
75 80
76 g_free(handle); 81 g_free(handle);