aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-16 08:27:42 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-16 08:34:37 +0200
commitc0a094e4734a1a760681e75565af10bf86b68bee (patch)
treec207b3c99d821bc4975265ed4473749328624f6a /src/utils.h
parentf147b5439347e14bb8affc08ec9adbc3d25998fb (diff)
downloadtdv-c0a094e4734a1a760681e75565af10bf86b68bee.tar.gz
tdv-c0a094e4734a1a760681e75565af10bf86b68bee.tar.xz
tdv-c0a094e4734a1a760681e75565af10bf86b68bee.zip
sdgui: load dictionaries in parallel, as sdtui did
Also, resolve some use-after-frees in GTK+.
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h21
1 files changed, 20 insertions, 1 deletions
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 <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