From c0a094e4734a1a760681e75565af10bf86b68bee Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 16 Oct 2021 08:27:42 +0200 Subject: sdgui: load dictionaries in parallel, as sdtui did Also, resolve some use-after-frees in GTK+. --- src/utils.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/utils.h') diff --git a/src/utils.h b/src/utils.h index 1394f08..bc5775b 100644 --- a/src/utils.h +++ b/src/utils.h @@ -19,6 +19,11 @@ #ifndef UTILS_H #define UTILS_H +#include +#include + +#include "stardict.h" + /// After this statement, the element has been found and its index is stored /// in the variable "imid". #define BINARY_SEARCH_BEGIN(max, compare) \ @@ -44,10 +49,24 @@ gboolean xstrtoul (unsigned long *out, const char *s, int base); void fatal (const gchar *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN; gchar *resolve_relative_filename_generic - (gchar **paths, const gchar *tail, const gchar *filename); + (const gchar **paths, const gchar *tail, const gchar *filename); gchar *resolve_relative_config_filename (const gchar *filename); gchar *resolve_filename (const gchar *filename, gchar *(*relative_cb) (const char *)); GKeyFile *load_project_config_file (GError **error); +// --- Loading ----------------------------------------------------------------- + +typedef struct dictionary Dictionary; + +struct dictionary +{ + gchar *filename; ///< Path to the dictionary + StardictDict *dict; ///< StarDict dictionary data + gchar *name; ///< Name to show +}; + +void dictionary_destroy (Dictionary *self); +gboolean load_dictionaries (GPtrArray *dictionaries, GError **e); + #endif // ! UTILS_H -- cgit v1.2.3-70-g09d2