/
mms_lib_util.c
80 lines (72 loc) · 1.66 KB
/
mms_lib_util.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include "mms_lib_util.h"
#include "mms_settings.h"
#ifdef MMS_RESIZE_IMAGEMAGICK
# include <magick/api.h>
#endif
/**
* MMS error domain
*/
GQuark
mms_lib_error_quark()
{
return g_quark_from_static_string("mms-lib-error-quark");
}
/**
* One-time initialization
*/
void
mms_lib_init(
const char* path)
{
/* g_type_init has been deprecated since version 2.36
* the type system is initialised automagically since then */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_type_init();
G_GNUC_END_IGNORE_DEPRECATIONS;
#ifdef MMS_RESIZE_IMAGEMAGICK
MagickCoreGenesis(path, MagickFalse);
#endif
}
/**
* Deinitialization
*/
void
mms_lib_deinit()
{
#ifdef MMS_RESIZE_IMAGEMAGICK
MagickCoreTerminus();
#endif
}
/**
* Reset configuration to default
*/
void
mms_lib_default_config(
MMSConfig* config)
{
config->root_dir = MMS_CONFIG_DEFAULT_ROOT_DIR;
config->retry_secs = MMS_CONFIG_DEFAULT_RETRY_SECS;
config->idle_secs = MMS_CONFIG_DEFAULT_IDLE_SECS;
config->keep_temp_files = FALSE;
config->attic_enabled = FALSE;
}
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/