aboutsummaryrefslogtreecommitdiff
path: root/src/ui/account_entry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/account_entry.c')
-rw-r--r--src/ui/account_entry.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/ui/account_entry.c b/src/ui/account_entry.c
index 7a9ccdb..89c7c7a 100644
--- a/src/ui/account_entry.c
+++ b/src/ui/account_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--2022 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,22 +30,24 @@
30UI_ACCOUNT_ENTRY_Handle* 30UI_ACCOUNT_ENTRY_Handle*
31ui_account_entry_new(MESSENGER_Application *app) 31ui_account_entry_new(MESSENGER_Application *app)
32{ 32{
33 g_assert(app);
34
33 UI_ACCOUNT_ENTRY_Handle* handle = g_malloc(sizeof(UI_ACCOUNT_ENTRY_Handle)); 35 UI_ACCOUNT_ENTRY_Handle* handle = g_malloc(sizeof(UI_ACCOUNT_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/account_entry.ui") 38 application_get_resource_path(app, "ui/account_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->entry_label = GTK_LABEL( 49 handle->entry_label = GTK_LABEL(
48 gtk_builder_get_object(handle->builder, "entry_label") 50 gtk_builder_get_object(handle->builder, "entry_label")
49 ); 51 );
50 52
51 return handle; 53 return handle;
@@ -53,8 +55,10 @@ ui_account_entry_new(MESSENGER_Application *app)
53 55
54void 56void
55ui_account_entry_set_account(UI_ACCOUNT_ENTRY_Handle* handle, 57ui_account_entry_set_account(UI_ACCOUNT_ENTRY_Handle* handle,
56 const struct GNUNET_CHAT_Account *account) 58 const struct GNUNET_CHAT_Account *account)
57{ 59{
60 g_assert((handle) && (account));
61
58 const char *name = GNUNET_CHAT_account_get_name(account); 62 const char *name = GNUNET_CHAT_account_get_name(account);
59 63
60 ui_avatar_set_text(handle->entry_avatar, name); 64 ui_avatar_set_text(handle->entry_avatar, name);
@@ -63,8 +67,10 @@ ui_account_entry_set_account(UI_ACCOUNT_ENTRY_Handle* handle,
63 67
64void 68void
65ui_account_entry_set_contact(UI_ACCOUNT_ENTRY_Handle* handle, 69ui_account_entry_set_contact(UI_ACCOUNT_ENTRY_Handle* handle,
66 const struct GNUNET_CHAT_Contact *contact) 70 const struct GNUNET_CHAT_Contact *contact)
67{ 71{
72 g_assert((handle) && (contact));
73
68 const char *name = GNUNET_CHAT_contact_get_name(contact); 74 const char *name = GNUNET_CHAT_contact_get_name(contact);
69 75
70 ui_avatar_set_text(handle->entry_avatar, name); 76 ui_avatar_set_text(handle->entry_avatar, name);
@@ -74,6 +80,8 @@ ui_account_entry_set_contact(UI_ACCOUNT_ENTRY_Handle* handle,
74void 80void
75ui_account_entry_delete(UI_ACCOUNT_ENTRY_Handle *handle) 81ui_account_entry_delete(UI_ACCOUNT_ENTRY_Handle *handle)
76{ 82{
83 g_assert(handle);
84
77 g_object_unref(handle->builder); 85 g_object_unref(handle->builder);
78 86
79 g_free(handle); 87 g_free(handle);