accounts.h (2079B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2022--2024, 2026 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/accounts.h 23 */ 24 25 #ifndef UI_ACCOUNTS_H_ 26 #define UI_ACCOUNTS_H_ 27 28 #include <curses.h> 29 30 #include <gnunet/gnunet_chat_lib.h> 31 #include <gnunet/gnunet_util_lib.h> 32 33 #include "account_create_dialog.h" 34 35 struct MESSENGER_Application; 36 37 /** 38 * @struct UI_ACCOUNTS_Handle 39 */ 40 typedef struct UI_ACCOUNTS_Handle 41 { 42 WINDOW *window; 43 44 int line_prev; 45 int line_next; 46 47 int line_index; 48 int line_offset; 49 int line_selected; 50 51 struct GNUNET_CHAT_Account *selected; 52 53 UI_ACCOUNT_CREATE_DIALOG_Handle create_dialog; 54 } UI_ACCOUNTS_Handle; 55 56 #define UI_ACCOUNTS_ROWS_MIN 5 57 #define UI_ACCOUNTS_COLS_MIN 30 58 59 /** 60 * Processes the current key event by the view 61 * to show the list of chat accounts. 62 * 63 * @param[in,out] accounts Chat accounts view 64 * @param[in,out] app Application handle 65 * @param[in] key Key 66 */ 67 void 68 accounts_event(UI_ACCOUNTS_Handle *accounts, 69 struct MESSENGER_Application *app, 70 int key); 71 72 /** 73 * Prints the content of the view to show 74 * the list of chat accounts to its selected 75 * window view on screen. 76 * 77 * @param[in,out] accounts Chat accounts view 78 * @param[in] app Application handle 79 */ 80 void 81 accounts_print(UI_ACCOUNTS_Handle *accounts, 82 struct MESSENGER_Application *app); 83 84 #endif /* UI_ACCOUNTS_H_ */