1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 /* 3 * Copyright (C) 2017 Red Hat, Inc. (www.redhat.com) 4 * 5 * This library is free software: you can redistribute it and/or modify it 6 * under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation. 8 * 9 * This library is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 12 * for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this library. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION) 19 #error "Only <e-util/e-util.h> should be included directly." 20 #endif 21 22 #ifndef E_CONFIG_LOOKUP_H 23 #define E_CONFIG_LOOKUP_H 24 25 #include <libedataserver/libedataserver.h> 26 27 #include <e-util/e-util-enums.h> 28 #include <e-util/e-config-lookup-result.h> 29 #include <e-util/e-config-lookup-worker.h> 30 31 /* Standard GObject macros */ 32 #define E_TYPE_CONFIG_LOOKUP \ 33 (e_config_lookup_get_type ()) 34 #define E_CONFIG_LOOKUP(obj) \ 35 (G_TYPE_CHECK_INSTANCE_CAST \ 36 ((obj), E_TYPE_CONFIG_LOOKUP, EConfigLookup)) 37 #define E_CONFIG_LOOKUP_CLASS(cls) \ 38 (G_TYPE_CHECK_CLASS_CAST \ 39 ((cls), E_TYPE_CONFIG_LOOKUP, EConfigLookupClass)) 40 #define E_IS_CONFIG_LOOKUP(obj) \ 41 (G_TYPE_CHECK_INSTANCE_TYPE \ 42 ((obj), E_TYPE_CONFIG_LOOKUP)) 43 #define E_IS_CONFIG_LOOKUP_CLASS(cls) \ 44 (G_TYPE_CHECK_CLASS_TYPE \ 45 ((cls), E_TYPE_CONFIG_LOOKUP)) 46 #define E_CONFIG_LOOKUP_GET_CLASS(obj) \ 47 (G_TYPE_INSTANCE_GET_CLASS \ 48 ((obj), E_TYPE_CONFIG_LOOKUP, EConfigLookupClass)) 49 50 #define E_CONFIG_LOOKUP_PARAM_USER "user" 51 #define E_CONFIG_LOOKUP_PARAM_PASSWORD "password" 52 #define E_CONFIG_LOOKUP_PARAM_REMEMBER_PASSWORD "remember-password" /* Is part of params, if can remember, otherwise not in params */ 53 #define E_CONFIG_LOOKUP_PARAM_EMAIL_ADDRESS "email-address" 54 #define E_CONFIG_LOOKUP_PARAM_SERVERS "servers" 55 #define E_CONFIG_LOOKUP_PARAM_CERTIFICATE_PEM "certificate-pem" 56 #define E_CONFIG_LOOKUP_PARAM_CERTIFICATE_HOST "certificate-host" 57 #define E_CONFIG_LOOKUP_PARAM_CERTIFICATE_TRUST "certificate-trust" 58 59 G_BEGIN_DECLS 60 61 typedef struct _EConfigLookup EConfigLookup; 62 typedef struct _EConfigLookupClass EConfigLookupClass; 63 typedef struct _EConfigLookupPrivate EConfigLookupPrivate; 64 65 /** 66 * EConfigLookup: 67 * 68 * Contains only private data that should be read and manipulated using 69 * the functions below. 70 * 71 * Since: 3.26 72 **/ 73 struct _EConfigLookup { 74 /*< private >*/ 75 GObject parent; 76 EConfigLookupPrivate *priv; 77 }; 78 79 struct _EConfigLookupClass { 80 /*< private >*/ 81 GObjectClass parent_class; 82 83 /* Signals */ 84 ESource * (* get_source) (EConfigLookup *config_lookup, 85 EConfigLookupSourceKind kind); 86 void (* worker_started) (EConfigLookup *config_lookup, 87 EConfigLookupWorker *worker, 88 GCancellable *cancellable); 89 void (* worker_finished) (EConfigLookup *config_lookup, 90 EConfigLookupWorker *worker, 91 const ENamedParameters *restart_params, 92 const GError *error); 93 void (* result_added) (EConfigLookup *config_lookup, 94 EConfigLookupResult *result); 95 }; 96 97 GType e_config_lookup_get_type (void) G_GNUC_CONST; 98 EConfigLookup * e_config_lookup_new (ESourceRegistry *registry); 99 ESourceRegistry * 100 e_config_lookup_get_registry (EConfigLookup *config_lookup); 101 ESource * e_config_lookup_get_source (EConfigLookup *config_lookup, 102 EConfigLookupSourceKind kind); 103 gboolean e_config_lookup_get_busy (EConfigLookup *config_lookup); 104 void e_config_lookup_cancel_all (EConfigLookup *config_lookup); 105 void e_config_lookup_register_worker (EConfigLookup *config_lookup, 106 EConfigLookupWorker *worker); 107 void e_config_lookup_unregister_worker (EConfigLookup *config_lookup, 108 EConfigLookupWorker *worker); 109 GSList * e_config_lookup_dup_registered_workers (EConfigLookup *config_lookup); 110 void e_config_lookup_run (EConfigLookup *config_lookup, 111 const ENamedParameters *params, 112 GCancellable *cancellable, 113 GAsyncReadyCallback callback, 114 gpointer user_data); 115 void e_config_lookup_run_finish (EConfigLookup *config_lookup, 116 GAsyncResult *result); 117 void e_config_lookup_run_worker (EConfigLookup *config_lookup, 118 EConfigLookupWorker *worker, 119 const ENamedParameters *params, 120 GCancellable *cancellable); 121 void e_config_lookup_add_result (EConfigLookup *config_lookup, 122 EConfigLookupResult *result); 123 gint e_config_lookup_count_results (EConfigLookup *config_lookup); 124 GSList * e_config_lookup_dup_results (EConfigLookup *config_lookup, 125 EConfigLookupResultKind kind, 126 const gchar *protocol); 127 void e_config_lookup_clear_results (EConfigLookup *config_lookup); 128 129 const gchar * e_config_lookup_encode_certificate_trust(ETrustPromptResponse response); 130 ETrustPromptResponse 131 e_config_lookup_decode_certificate_trust(const gchar *value); 132 133 G_END_DECLS 134 135 #endif /* E_CONFIG_LOOKUP_H */ 136