chat_entry.h (2550B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2021--2024 GNUnet e.V. 4 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 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 /* 21 * @author Tobias Frisch 22 * @file ui/chat_entry.h 23 */ 24 25 #ifndef UI_CHAT_ENTRY_H_ 26 #define UI_CHAT_ENTRY_H_ 27 28 #include "chat.h" 29 30 #include <gnunet/gnunet_chat_lib.h> 31 32 typedef struct UI_CHAT_ENTRY_Handle 33 { 34 guint update; 35 36 time_t timestamp; 37 struct GNUNET_CHAT_Context *context; 38 39 UI_CHAT_Handle *chat; 40 GtkBuilder *builder; 41 42 GtkWidget *entry_box; 43 44 HdyAvatar *entry_avatar; 45 46 GtkLabel *title_label; 47 GtkLabel *timestamp_label; 48 49 GtkLabel *text_label; 50 GtkImage *read_receipt_image; 51 } UI_CHAT_ENTRY_Handle; 52 53 /** 54 * Allocates and creates a new chat entry 55 * handle to manage a chat in a list for 56 * a given messenger application. 57 * 58 * @param app Messenger application 59 * @param context Chat context 60 * @return New chat entry handle 61 */ 62 UI_CHAT_ENTRY_Handle* 63 ui_chat_entry_new(MESSENGER_Application *app, 64 struct GNUNET_CHAT_Context *context); 65 66 /** 67 * Updates a given chat entry handle with the 68 * current state of a messenger application and 69 * the chat context the chat entry is 70 * representing. 71 * 72 * @param handle Chat entry handle 73 * @param app Messenger application 74 */ 75 void 76 ui_chat_entry_update(UI_CHAT_ENTRY_Handle *handle, 77 MESSENGER_Application *app); 78 79 /** 80 * Frees its resources and destroys a given 81 * chat entry handle. 82 * 83 * @param handle Chat entry handle 84 */ 85 void 86 ui_chat_entry_delete(UI_CHAT_ENTRY_Handle *handle); 87 88 /** 89 * Fully disposes all resources and handles 90 * which are linked to a given chat entry 91 * handle by a messenger application. The chat 92 * entry handle will be deleted as well. 93 * 94 * @param handle Chat entry handle 95 * @param app Messenger application 96 */ 97 void 98 ui_chat_entry_dispose(UI_CHAT_ENTRY_Handle *handle, 99 MESSENGER_Application *app); 100 101 #endif /* UI_CHAT_ENTRY_H_ */