anastasis-gtk.h (3117B)
1 /* 2 This file is part of anastasis-gtk. 3 Copyright (C) 2020-2022 Anastasis SARL 4 5 Anastasis is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published 7 by the Free Software Foundation; either version 3, or (at your 8 option) any later version. 9 10 Anastasis 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 General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with Anastasis; see the file COPYING. If not, write to the 17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 Boston, MA 02110-1301, USA. 19 */ 20 21 /** 22 * @file src/anastasis/anastasis-gtk.h 23 * @brief Definitions of the main Gtk GUI. 24 * @author Christian Grothoff 25 * @author Dennis Neufeld 26 */ 27 #ifndef ANASTASIS_GTK_H 28 #define ANASTASIS_GTK_H 29 30 #include "anastasis_gtk_util.h" 31 #include <gtk/gtk.h> 32 #include <anastasis/anastasis_service.h> 33 #include <anastasis/anastasis_redux.h> 34 35 /** 36 * Handle to our main loop. 37 */ 38 extern struct ANASTASIS_GTK_MainLoop *AG_ml; 39 40 /** 41 * Active policy discovery job, or NULL. 42 */ 43 extern struct ANASTASIS_PolicyDiscovery *AG_pd; 44 45 /** 46 * Application ID to include in the user attributes. 47 */ 48 extern char *AG_application_id; 49 50 /** 51 * Our configuration. 52 */ 53 extern const struct GNUNET_CONFIGURATION_Handle *AG_cfg; 54 55 /** 56 * Hash map from UUID hashes to GtkWidgets. 57 */ 58 extern struct GNUNET_CONTAINER_MultiHashMap *AG_entry_attributes; 59 60 /** 61 * Actual state. 62 */ 63 extern json_t *AG_redux_state; 64 65 /** 66 * Handle to an ongoing action. 67 */ 68 extern struct ANASTASIS_ReduxAction *AG_ra; 69 70 /** 71 * Curl context for communication with taler backend 72 */ 73 extern struct GNUNET_CURL_Context *AG_ctx; 74 75 /** 76 * State associated with a background long action. 77 */ 78 struct ANASTASIS_LongAction 79 { 80 /** 81 * Action handle of the background action. 82 */ 83 struct ANASTASIS_ReduxAction *ra; 84 85 /** 86 * Handle to task to reschedule the action. 87 */ 88 struct GNUNET_SCHEDULER_Task *task; 89 90 /** 91 * Next time we schedule the task. 92 */ 93 struct GNUNET_TIME_Absolute next_time; 94 95 }; 96 97 98 /** 99 * Enumeration for long poll actions we have. 100 */ 101 enum ANASTASIS_LongActionKind 102 { 103 /** 104 * Poll on async challenge completion. 105 */ 106 ANASTASIS_LP_POLL_CHALLENGES, 107 108 /** 109 * Poll for /config on all known providers. 110 */ 111 ANASTASIS_LP_SYNC_PROVIDERS, 112 113 /** 114 * Wait for challenge-specific providers being ready. 115 */ 116 ANASTASIS_LP_POLL_PROVIDERS, 117 118 /** 119 * Number of pollers we have. 120 */ 121 ANASTASIS_LP_CNT /* must be last! */ 122 }; 123 124 /** 125 * Handle to an ongoing background action. 126 */ 127 extern struct ANASTASIS_LongAction AG_lacs[ANASTASIS_LP_CNT]; 128 129 130 /** 131 * Stop long polling action in the background. 132 * Should be called whenever we leave the 133 * challenge-selecting state. 134 */ 135 void 136 AG_stop_long_action (void); 137 138 139 /** 140 * Load #AG_redux_state from @a filename. 141 * 142 * @param filename to load 143 */ 144 void 145 AG_load (const char *filename); 146 147 #endif