Commit 05d78591 authored by Guido Gunther's avatar Guido Gunther

Add hdy_init()

This initializes i18n.

Closes: #36
parent b7295be6
......@@ -49,6 +49,7 @@
<chapter id="helpers">
<title>Helpers</title>
<xi:include href="xml/hdy-version.xml"/>
<xi:include href="xml/hdy-main.xml"/>
<xi:include href="xml/hdy-string-utf8.xml"/>
<xi:include href="xml/hdy-fold.xml"/>
</chapter>
......
......@@ -34,6 +34,7 @@ G_BEGIN_DECLS
#include "hdy-fold.h"
#include "hdy-header-group.h"
#include "hdy-leaflet.h"
#include "hdy-main.h"
#include "hdy-string-utf8.h"
#include "hdy-title-bar.h"
......
/*
* Copyright (C) 2018 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#include "config.h"
#include "hdy-main.h"
#include <glib/gi18n.h>
static gint hdy_initialized = FALSE;
/**
* SECTION:hdy-main
* @Short_description: Library initialization
* @Title: hdy-main
*
* Before using the Handy libarary you should initialize it. This makes
* sure translations for the Handy library are set up properly.
*/
/**
* hdy_init:
* @argc: (inout): Address of the <parameter>argc</parameter> parameter of
* your main() function (or 0 if @argv is %NULL). This will be changed if
* any arguments were handled.
* @argv: (array length=argc) (inout) (allow-none): Address of the
* <parameter>argv</parameter> parameter of main(), or %NULL. Any options
* understood by Handy are stripped before return.
*
* Call this function before using any other Handy functions in your
* GUI applications.
*
* Returns: %TRUE if initialization was successful, %FALSE otherwise.
*/
gboolean
hdy_init (int *argc, char ***argv)
{
if (hdy_initialized)
return TRUE;
textdomain (GETTEXT_PACKAGE);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
hdy_initialized = TRUE;
return TRUE;
}
/*
* Copyright (C) 2018 Purism SPC
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <glib.h>
#if !defined(_HANDY_INSIDE) && !defined(HANDY_COMPILATION)
#error "Only <handy.h> can be included directly."
#endif
G_BEGIN_DECLS
gboolean hdy_init(int *argc, char ***argv);
G_END_DECLS
......@@ -56,6 +56,7 @@ src_headers = [
'hdy-fold.h',
'hdy-header-group.h',
'hdy-leaflet.h',
'hdy-main.h',
'hdy-string-utf8.h',
'hdy-title-bar.h',
]
......@@ -70,6 +71,7 @@ src_sources = [
'hdy-fold.c',
'hdy-header-group.c',
'hdy-leaflet.c',
'hdy-main.c',
'hdy-string-utf8.c',
'hdy-title-bar.c',
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment