many structural changes

This commit is contained in:
Chris Cromer 2018-11-01 21:52:30 -03:00
parent 430864f06b
commit d506be7b4f
Signed by: cromer
GPG Key ID: 39CC813FF3C8708A
27 changed files with 477 additions and 92 deletions

View File

@ -3,7 +3,7 @@
curdir=`pwd`
rm -rf buildtmp
mkdir buildtmp
LDFLAGS=-static-libstdc++ meson buildtmp --buildtype=release --prefix=/tmp/sernatur --libdir=lib --strip
LDFLAGS=-static-libstdc++ meson buildtmp -D bundle_libs=true --buildtype=release --prefix=/tmp/sernatur --libdir=lib --strip
ninja -C buildtmp install
rm -rf buildtmp
cp README.md /tmp/sernatur

1
data/desktop/meson.build Normal file
View File

@ -0,0 +1 @@
install_data('sernatur.desktop', install_dir: join_paths(get_option('datadir'), 'applications'))

1
data/etc/meson.build Normal file
View File

@ -0,0 +1 @@
install_data('sernatur.conf', install_dir: join_paths(get_option('prefix'), get_option('sysconfdir'), 'sernatur'))

9
data/etc/sernatur.conf Normal file
View File

@ -0,0 +1,9 @@
database : {
host = "localhost";
port = 5432;
options = "";
gtty = "";
db_name = "bdd";
login = "bdd";
pwd = "bdd";
};

View File

@ -0,0 +1,18 @@
<schemalist>
<schema id="cl.cromer.ubb.sernatur" path="/cl/cromer/ubb/sernatur/" gettext-domain="sernatur">
<key name="host" type="s">
<default>"localhost"</default>
<summary>Host to connect to</summary>
<description>
Host to connect to
</description>
</key>
<key name="port" type="s">
<default>"5432"</default>
<summary>Port number to use</summary>
<description>
Port number to use
</description>
</key>
</schema>
</schemalist>

1
data/gschema/meson.build Normal file
View File

@ -0,0 +1 @@
install_data('cl.cromer.ubb.sernatur.gschema.xml', install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'glib-2.0', 'schemas'))

17
data/icons/meson.build Normal file
View File

@ -0,0 +1,17 @@
install_data('8x8/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/8x8/apps'))
install_data('16x16/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/16x16/apps'))
install_data('22x22/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/22x22/apps'))
install_data('24x24/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/24x24/apps'))
install_data('32x32/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/32x32/apps'))
install_data('36x36/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/36x36/apps'))
install_data('42x42/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/42x42/apps'))
install_data('48x48/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/48x48/apps'))
install_data('64x64/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/64x64/apps'))
install_data('72x72/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/72x72/apps'))
install_data('96x96/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/96x96/apps'))
install_data('128x128/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/128x128/apps'))
install_data('192x192/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/192x192/apps'))
install_data('256x256/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/256x256/apps'))
install_data('480x480/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/480x480/apps'))
install_data('512x512/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/512x512/apps'))
install_data('512x512/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons'))

View File

@ -1,19 +1,5 @@
install_data('sernatur.desktop', install_dir: join_paths(get_option('datadir'), 'applications'))
install_data('icons/8x8/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/8x8/apps'))
install_data('icons/16x16/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/16x16/apps'))
install_data('icons/22x22/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/22x22/apps'))
install_data('icons/24x24/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/24x24/apps'))
install_data('icons/32x32/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/32x32/apps'))
install_data('icons/36x36/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/36x36/apps'))
install_data('icons/42x42/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/42x42/apps'))
install_data('icons/48x48/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/48x48/apps'))
install_data('icons/64x64/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/64x64/apps'))
install_data('icons/72x72/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/72x72/apps'))
install_data('icons/96x96/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/96x96/apps'))
install_data('icons/128x128/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/128x128/apps'))
install_data('icons/192x192/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/192x192/apps'))
install_data('icons/256x256/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/256x256/apps'))
install_data('icons/480x480/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/480x480/apps'))
install_data('icons/512x512/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons/hicolor/512x512/apps'))
install_data('icons/512x512/apps/sernatur.png', install_dir: join_paths(get_option('datadir'), 'icons'))
subdir('ui')
subdir('etc')
subdir('gschema')
subdir('desktop')
subdir('icons')

36
doc/meson.build Normal file
View File

@ -0,0 +1,36 @@
docs_enabled = get_option('valadocs')
valadoc = find_program('valadoc', required: docs_enabled)
vala_doc_sources = vala_sources
if docs_enabled
valadocs_deps = get_option('valadocs_deps')
docs_deps = ['--pkg=gtk+-3.0']
docs_deps += ['--pkg=libpq']
docs_deps += ['--pkg=libconfig']
docs_deps += ['--pkg=posix']
if valadocs_deps
docs_deps += ['--deps']
endif
custom_target('valadoc',
input: vala_doc_sources,
output: 'valadoc',
command: [ valadoc,
docs_deps,
'--use-svg-images',
'--doclet=html',
'--force',
'--package-name=@0@'.format(meson.project_name()),
'--package-version=@0@'.format(meson.project_version()),
'--vapidir=@0@'.format(join_paths(meson.source_root(), 'src/vapi')),
'--directory=@OUTDIR@/valadoc',
vala_doc_sources,
],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name())
)
endif
install_data('trabajoSemestral(E1).pdf', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))
install_data('MER.dia', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))
install_data('../LICENSE', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))
install_data('../README.md', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))

View File

@ -1,50 +0,0 @@
docs_enabled = get_option('valadocs')
valadoc = find_program('valadoc', required: docs_enabled)
if docs_enabled
docs_deps = get_option('valadocs_deps')
if docs_deps
custom_target('valadoc',
input: vala_sources,
output: 'valadoc',
command: [ valadoc,
'--deps',
'--use-svg-images',
'--doclet=html',
'--force',
'--package-name=@0@'.format(meson.project_name()),
'--package-version=@0@'.format(meson.project_version()),
'--pkg=gtk+-3.0',
'--pkg=libpq',
'--vapidir=@0@'.format(join_paths(meson.source_root(), 'src/vapi')),
'--directory=@OUTDIR@/valadoc',
vala_sources,
],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name())
)
else
custom_target('valadoc',
input: vala_sources,
output: 'valadoc',
command: [ valadoc,
'--use-svg-images',
'--doclet=html',
'--force',
'--package-name=@0@'.format(meson.project_name()),
'--package-version=@0@'.format(meson.project_version()),
'--pkg=gtk+-3.0',
'--pkg=libpq',
'--vapidir=@0@'.format(join_paths(meson.source_root(), 'src/vapi')),
'--directory=@OUTDIR@/valadoc',
vala_sources,
],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name())
)
endif
endif
install_data('trabajoSemestral(E1).pdf', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))
install_data('MER.dia', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))

0
git-1.4.0.tar.gz Normal file
View File

View File

@ -10,11 +10,12 @@ project('sernatur',
)
add_global_arguments('-DGETTEXT_PACKAGE="sernatur"', language: 'c')
subdir('po')
add_project_arguments(['--vapidir',
join_paths(meson.current_source_dir(), 'src/vapi')],
language: 'vala')
#subdir('po')
subdir('data')
subdir('src')
#subdir('doc')
subdir('script')
subdir('docs')
install_data('LICENSE', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))
install_data('README.md', install_dir: join_paths(get_option('datadir'), 'doc', meson.project_name()))

View File

@ -6,3 +6,7 @@ option('valadocs_deps',
type: 'boolean',
value: false,
description: 'Build the valadocs of the deps of sernatur')
option('bundle_libs',
type: 'boolean',
value: false,
description: 'Bundle the libs that the executable is linked against')

View File

@ -1,3 +1,4 @@
src/sernatur.vala
src/sernatur-window.vala
data/ui/sernatur.window.ui
data/cl.cromer.ubb.sernatur.gschema.xml

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-23 21:06-0300\n"
"PO-Revision-Date: 2018-10-18 14:58-0300\n"
"POT-Creation-Date: 2018-11-01 18:21-0300\n"
"PO-Revision-Date: 2018-10-31 18:05-0300\n"
"Last-Translator: Chris Cromer <chris@cromer.cl>\n"
"Language-Team: none\n"
"Language: es\n"
@ -18,6 +18,40 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.0.6\n"
#: src/sernatur-window.vala:65
#: src/sernatur-window.vala:84
msgid "Error"
msgstr "Error"
#: src/sernatur-window.vala:96
msgid "Connection failed"
msgstr "Conexión falló"
#: src/sernatur-window.vala:124
msgid "Server version:"
msgstr "Versión del servidor:"
#: data/ui/sernatur.window.ui:37
msgid "_File"
msgstr ""
#: data/ui/sernatur.window.ui:102
msgid "_Edit"
msgstr ""
#: data/ui/sernatur.window.ui:152
msgid "_View"
msgstr ""
#: data/ui/sernatur.window.ui:160
msgid "_Help"
msgstr ""
#: data/cl.cromer.ubb.sernatur.gschema.xml:5
#: data/cl.cromer.ubb.sernatur.gschema.xml:6
msgid "Host to connect to"
msgstr ""
#: data/cl.cromer.ubb.sernatur.gschema.xml:12
#: data/cl.cromer.ubb.sernatur.gschema.xml:13
msgid "Port number to use"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: sernatur\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-23 21:06-0300\n"
"POT-Creation-Date: 2018-11-01 18:21-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,6 +17,40 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/sernatur-window.vala:65
#: src/sernatur-window.vala:84
msgid "Error"
msgstr ""
#: src/sernatur-window.vala:96
msgid "Connection failed"
msgstr ""
#: src/sernatur-window.vala:124
msgid "Server version:"
msgstr ""
#: data/ui/sernatur.window.ui:37
msgid "_File"
msgstr ""
#: data/ui/sernatur.window.ui:102
msgid "_Edit"
msgstr ""
#: data/ui/sernatur.window.ui:152
msgid "_View"
msgstr ""
#: data/ui/sernatur.window.ui:160
msgid "_Help"
msgstr ""
#: data/cl.cromer.ubb.sernatur.gschema.xml:5
#: data/cl.cromer.ubb.sernatur.gschema.xml:6
msgid "Host to connect to"
msgstr ""
#: data/cl.cromer.ubb.sernatur.gschema.xml:12
#: data/cl.cromer.ubb.sernatur.gschema.xml:13
msgid "Port number to use"
msgstr ""

4
script/compile_schemas.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh -eu
echo "Compiling gsettings schemas..."
glib-compile-schemas "${MESON_INSTALL_DESTDIR_PREFIX}/share/glib-2.0/schemas"

View File

@ -1,8 +1,15 @@
#!/bin/sh -eu
libdir="${MESON_INSTALL_PREFIX}/lib"
libdir="${MESON_INSTALL_DESTDIR_PREFIX}/lib"
mkdir -p $libdir
libfile=`ldd ${MESON_INSTALL_PREFIX}/bin/sernatur | grep libpq | cut -d ' ' -f 3`
cp $libfile "${libdir}"
strip "${libdir}/libpq"*
#libfile=`ldd ${MESON_INSTALL_DESTDIR_PREFIX}/bin/sernatur | grep libpq | cut -d ' ' -f 3`
#cp $libfile "${libdir}"
#strip "${libdir}/libpq"*
if [ -f "${MESON_INSTALL_DESTDIR_PREFIX}"/bin/sernatur ]; then
echo "Copying linked dynamic libs..."
ldd "${MESON_INSTALL_DESTDIR_PREFIX}"/bin/sernatur | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' "${libdir}"
fi
echo "Stripping libs..."
strip --strip-debug "${libdir}/"*

View File

@ -1,2 +1,7 @@
install_data('sernatur.sh', install_dir: '.')
meson.add_install_script('linux_bundler.sh')
bundle_libs = get_option('bundle_libs')
if bundle_libs
install_data('sernatur.sh', install_dir: '.')
meson.add_install_script('linux_bundler.sh')
endif
valadoc = find_program('glib-compile-schemas')
meson.add_install_script('compile_schemas.sh')

View File

@ -3,4 +3,5 @@
cd "${0%/*}"
export LD_LIBRARY_PATH="`pwd`/lib"
export GSETTINGS_SCHEMA_DIR="`pwd`/share/glib-2.0/schemas"
bin/sernatur

View File

@ -1,13 +1,19 @@
glib_dep = dependency('glib-2.0')
gobject_dep = dependency('gobject-2.0')
gtk_dep = dependency('gtk+-3.0', version: '>=3.0.0')
# gmodule-export-2.0 is needed to connect the handlers
gmodule_dep = dependency('gmodule-2.0', version: '>=2.0')
libpq_dep = dependency('libpq', version: '>=10.0')
pq_dep = dependency('libpq', version: '>=10.0')
posix_dep = meson.get_compiler('vala').find_library('posix')
libconfig_lib = meson.get_compiler('c').find_library('libconfig')
libconfig_vapi = meson.get_compiler('vala').find_library('libconfig', dirs: join_paths(meson.current_source_dir(), 'vapi'))
libconfig_dep = declare_dependency(dependencies: [libconfig_lib, libconfig_vapi], version: '1.5')
# this is how to link against a c lib
#libsystemd_lib = meson.get_compiler('c').find_library('libsystemd')
cc = meson.get_compiler('c')
#cc = meson.get_compiler('c')
# -no-pie so that the executable is double clickable in gui
#if cc.get_id() == 'gcc'
# c_args = ['-no-pie']
@ -33,5 +39,5 @@ vala_args += ['--gresources='+join_paths(meson.source_root(),'data/ui/sernatur.g
exe = executable('sernatur',
sources,
vala_args: vala_args,
dependencies: [gtk_dep, gmodule_dep, libpq_dep],
dependencies: [glib_dep, gobject_dep, gtk_dep, gmodule_dep, pq_dep, libconfig_dep, posix_dep],
install: true)

View File

@ -17,6 +17,7 @@
*/
namespace Sernatur {
using Postgres;
using LibConfig;
/**
* The MainWindow class
@ -32,10 +33,53 @@ namespace Sernatur {
GLib.Object (application: application);
Database conn;
conn = set_db_login ("localhost", "", "", "", "postgres", "bdd", "bdd");
Config config = Config();
if (!config.read_file ("/etc/sernatur/sernatur.conf")) {
stderr.printf ("%s\n", config.error_message ());
application.quit ();
return;
}
Setting setting = config.lookup("database");
string* host;
int port;
string* options;
string* gtty;
string* db_name;
string* login;
string* pwd;
setting.lookup_string("host", out host);
setting.lookup_int("port", out port);
setting.lookup_string("options", out options);
setting.lookup_string("gtty", out gtty);
setting.lookup_string("db_name", out db_name);
setting.lookup_string("login", out login);
setting.lookup_string("pwd", out pwd);
Settings settings = new Settings ("cl.cromer.ubb.sernatur");
var host2 = settings.get_string ("host");
conn = set_db_login (host2, port.to_string (), options, gtty, db_name, login, pwd);
if (conn.get_status () != ConnectionStatus.OK) {
stderr.printf ("%s\n", conn.get_error_message ());
application.quit ();
Gtk.MessageDialog msg = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.ERROR,
Gtk.ButtonsType.CLOSE,
conn.get_error_message ());
msg.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.CLOSE:
application.quit ();
break;
case Gtk.ResponseType.DELETE_EVENT:
application.quit ();
break;
}
msg.destroy();
});
msg.set_title (dgettext (null, "Error"));
msg.show ();
return;
}

View File

@ -37,7 +37,7 @@ namespace Sernatur {
*/
public override void activate () {
window = new MainWindow (this);
window.maximize ();
//window.maximize ();
window.present ();
}
@ -54,6 +54,7 @@ namespace Sernatur {
/**
* The main function
* @param args Arguments passed from the command line
* @return success of the application
*/
public static int main (string[] args) {
var application = new Application ();

224
src/vapi/libconfig.vapi Normal file
View File

@ -0,0 +1,224 @@
/*
* Copyright 2018 Chris Cromer
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "libconfig.h")]
namespace LibConfig {
using Posix; // Needed for Posix.FILE
[CCode (cname = "uint", cprefix = "LIBCONFIG_VER_", has_type_id = false)]
public enum Version {
MAJOR,
MINOR,
REVISION;
/**
* Convert the enum value into a string with a version number
* This method is here to override default enum to_string which will print the enum variable name by default
* @return string with version number
*/
public string to_string () {
int x_value = this;
return x_value.to_string();
}
}
[CCode (cname = "int", cprefix = "CONFIG_ERR_", has_type_id = false)]
public enum ConfigError {
NONE = 0,
FILE_IO = 1,
PARSE = 2
}
[CCode (cname = "int", cprefix = "CONFIG_OPTION_", has_type_id = false)]
[Flags]
public enum ConfigOption {
AUTOCONVERT = 0x01,
SEMICOLON_SEPARATORS = 0x02,
COLON_ASSIGNMENT_FOR_GROUPS = 0x04,
COLON_ASSIGNMENT_FOR_NON_GROUPS = 0x08,
OPEN_BRACE_ON_SEPARATE_LINE = 0x10,
[Version (since = "1.7")]
ALLOW_SCIENTIFIC_NOTATION = 0x20,
[Version (since = "1.7.1")]
FSYNC = 0x40
}
[CCode (cname = "int", cprefix = "CONFIG_TYPE_", has_type_id = false)]
public enum ConfigType {
NONE = 0,
GROUP = 1,
INT = 2,
INT64 = 3,
FLOAT = 4,
STRING = 5,
BOOL = 6,
ARRAY = 7,
LIST = 8
}
[CCode (cname = "int", cprefix = "CONFIG_FORMAT_", has_type_id = false)]
public enum ConfigFormat {
DEFAULT = 0,
HEX = 1
}
[CCode (cname = "config_t", cprefix = "config_", destroy_function = "config_destroy", has_type_id = false)]
public struct Config {
[CCode (cname = "config_init")]
public Config();
[Version (since = "1.7")]
public void clear ();
public bool read (FILE stream);
public bool read_file (string filename);
public bool read_string (string str);
public void write (FILE stream);
public bool write_file (string filename);
public void set_include_dir (string include_dir);
public string get_include_dir ();
//[Version (since = "1.7")]
//void config_set_include_func (config_include_fn_t func)
[Version (since = "1.6")]
public ushort get_float_precision ();
[Version (since = "1.6")]
public void set_float_precision (ushort digits);
public ConfigOption get_options ();
public void set_options (ConfigOption options);
[Version (since = "1.7")]
public ConfigOption get_option (int option);
[Version (since = "1.7")]
public void set_option (ConfigOption option, int flag);
[Version (deprecated = true, replacement = "get_option")]
public int get_auto_convert ();
[Version (deprecated = true, replacement = "set_option")]
public void set_auto_convert (int flag);
public ConfigFormat get_default_format ();
public void set_default_format (ConfigFormat format);
public ushort get_tab_width ();
public void set_tab_width (ushort width);
public bool lookup_int (string path, out int x_value);
public bool lookup_int64 (string path, out int64 x_value);
public bool lookup_float (string path, out float x_value);
public bool lookup_bool (string path, out bool x_value);
public bool lookup_string (string path, out string x_value);
public Setting? lookup (string path);
public Setting root_setting ();
[CCode (simple_generics = true)]
[Version (since = "1.7")]
public void set_hook<T> (T hook);
[CCode (simple_generics = true)]
[Version (since = "1.7")]
public T get_hook<T> ();
//[CCode (simple_generics = true)]
//public void set_destructor<T> (T void (* destructor));
public unowned string error_text ();
public unowned string? error_file ();
public int error_line ();
public ConfigError error_type ();
public string error_message () {
return this.error_file () + ":" + this.error_line ().to_string() + " - " + this.error_text ();
}
public string version() {
return Version.MAJOR.to_string () + "." + Version.MINOR.to_string () + "." + Version.REVISION.to_string ();
}
}
[CCode (cname = "config_setting_t", cprefix = "config_setting_", free_function = "", has_type_id = false, has_target = false)]
[Compact]
public class Setting {
public Setting? lookup (string path);
public int? get_int ();
public int64? get_int64 ();
public float? get_float ();
public bool? get_bool ();
public unowned string? get_string ();
public bool set_int (int x_value);
public bool set_int64 (int64 x_value);
public bool set_float (float x_value);
public bool set_bool (bool x_value);
public bool set_string (string x_value);
public bool lookup_int (string name, out int x_value);
public bool lookup_int64 (string name, out int64 x_value);
public bool lookup_float (string name, out float x_value);
public bool lookup_bool (string name, out bool x_value);
public bool lookup_string (string name, out string x_value);
public ConfigFormat get_format ();
public bool set_format (ConfigFormat format);
public Setting? get_member (string name);
public Setting? get_elem (uint index);
public int? get_int_elem (int index);
public int64? get_int64_elem (int index);
public float? get_float_elem (int index);
public bool? get_bool_elem (int index);
public unowned string? get_string_elem (int index);
public Setting? set_int_elem (int index, int x_value);
public Setting? set_int64_elem (int index, int64 x_value);
public Setting? set_float_elem (int index, float x_value);
public Setting? set_bool_elem (int index, bool x_value);
public Setting? set_string_elem (int index, string x_value);
public Setting? add (Setting parent, string? name, ConfigType type);
public bool remove (Setting parent, string name);
public int remove_elem (Setting parent, uint index);
public unowned string? name ();
public Setting? parent ();
public bool is_root ();
public int index ();
public int length ();
public ConfigType type ();
public bool is_group ();
public bool is_array ();
public bool is_list ();
public bool is_aggregate ();
public bool is_scalar ();
public bool is_number ();
public unowned string? source_file ();
public uint source_line ();
}
}