sdgui: load dictionaries in parallel, as sdtui did

Also, resolve some use-after-frees in GTK+.
This commit is contained in:
2021-10-16 08:27:42 +02:00
parent f147b54393
commit c0a094e473
4 changed files with 178 additions and 175 deletions

View File

@@ -19,6 +19,11 @@
#ifndef UTILS_H
#define UTILS_H
#include <glib.h>
#include <gio/gio.h>
#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