summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-01-01 23:20:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-01-01 23:20:42 (GMT)
commitdcd5e0b104143b110997029aa0728731f4087ad8 (patch)
tree141a79ade5eae6e469ba9e5255882039e9c29a3e /src/core
parent7b320516abf871eefe009ff6fe4fb86ed921fed9 (diff)
Managed GObject references each time a configuration parameter is accessed.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/params.c98
1 files changed, 50 insertions, 48 deletions
diff --git a/src/core/params.c b/src/core/params.c
index 25f8991..c05ce68 100644
--- a/src/core/params.c
+++ b/src/core/params.c
@@ -38,87 +38,89 @@
bool load_main_config_parameters(void)
{
+ bool result; /* Bilan à retourner */
GGenConfig *config; /* Configuration à charger */
- GCfgParam *param; /* Paramètre chargé */
config = g_generic_config_new_from_file("main");
set_main_configuration(config);
- param = g_generic_config_create_param(config, MPK_FORMAT_NO_NAME, CPT_BOOLEAN, false);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_FORMAT_NO_NAME, CPT_BOOLEAN, false);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_INTERNAL_THEME, CPT_STRING, "Adwaita");
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_INTERNAL_THEME, CPT_STRING, "Adwaita");
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_TITLE_BAR, CPT_BOOLEAN, true);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_TITLE_BAR, CPT_BOOLEAN, true);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_LAST_PROJECT, CPT_STRING, NULL);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_LAST_PROJECT, CPT_STRING, NULL);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_SKIP_EXIT_MSG, CPT_BOOLEAN, false);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_SKIP_EXIT_MSG, CPT_BOOLEAN, false);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_MAXIMIZED, CPT_BOOLEAN, true);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_MAXIMIZED, CPT_BOOLEAN, true);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_ELLIPSIS_HEADER, CPT_INTEGER, 54);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_ELLIPSIS_HEADER, CPT_INTEGER, 54);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_ELLIPSIS_TAB, CPT_INTEGER, 35);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_ELLIPSIS_TAB, CPT_INTEGER, 35);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_WELCOME_STARTUP, CPT_BOOLEAN, true);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_WELCOME_STARTUP, CPT_BOOLEAN, true);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_WELCOME_CHECK, CPT_BOOLEAN, false);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_WELCOME_CHECK, CPT_BOOLEAN, false);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_LABEL_OFFSET, CPT_INTEGER, 10);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_LABEL_OFFSET, CPT_INTEGER, 10);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_HEX_PADDING, CPT_INTEGER, 10);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_HEX_PADDING, CPT_INTEGER, 10);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_SELECTION_LINE, CPT_BOOLEAN, true);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_SELECTION_LINE, CPT_BOOLEAN, true);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_TOOLTIP_MAX_CALLS, CPT_INTEGER, 5);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_TOOLTIP_MAX_CALLS, CPT_INTEGER, 5);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_TOOLTIP_MAX_STRINGS, CPT_INTEGER, 5);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_TOOLTIP_MAX_STRINGS, CPT_INTEGER, 5);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_HEX_UPPER_CASE, CPT_BOOLEAN, true);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_HEX_UPPER_CASE, CPT_BOOLEAN, true);
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_LINK_DEFAULT, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0, 1.0 } }));
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_LINK_DEFAULT, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0, 1.0 } }));
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_LINK_BRANCH_TRUE, CPT_COLOR, ((GdkRGBA []) { { 0, 0.6, 0, 1.0 } }));
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_LINK_BRANCH_TRUE, CPT_COLOR, ((GdkRGBA []) { { 0, 0.6, 0, 1.0 } }));
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_LINK_BRANCH_FALSE, CPT_COLOR, ((GdkRGBA []) { { 0.8, 0, 0, 1.0 } }));
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_LINK_BRANCH_FALSE, CPT_COLOR, ((GdkRGBA []) { { 0.8, 0, 0, 1.0 } }));
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_LINK_LOOP, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0.8, 1.0 } }));
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_LINK_LOOP, CPT_COLOR, ((GdkRGBA []) { { 0, 0, 0.8, 1.0 } }));
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_KEYBINDINGS_EDIT, CPT_STRING, "<Shift>F2");
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_KEYBINDINGS_EDIT, CPT_STRING, "<Shift>F2");
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_TMPDIR, CPT_STRING, "/tmp/chrysalide");
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_TMPDIR, CPT_STRING, "/tmp/chrysalide");
+ if (!result) goto exit;
- param = g_generic_config_create_param(config, MPK_AUTO_SAVE, CPT_BOOLEAN, true);
- if (param == NULL) return false;
+ result = g_generic_config_create_param(config, MPK_AUTO_SAVE, CPT_BOOLEAN, true);
+ if (!result) goto exit;
g_generic_config_create_group(config, "gui.panels.positions", CPT_INTEGER);
g_generic_config_create_group(config, "gui.panels.dock_at_startup", CPT_BOOLEAN);
g_generic_config_create_group(config, "gui.panels.path", CPT_STRING);
- return true;
+ exit:
+
+ return result;
}