Skip to content

Commit

Permalink
Init: add ensure type (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Feb 22, 2023
1 parent c487eae commit 2fa2311
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/Init.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@
*/

namespace Granite {
static bool initialized = false;
private static bool initialized = false;

internal void init () {
/*
* Initializes Granite.
* If Granite has already been initialized, the function will return.
* Makes sure translations and types for Granite are set up properly.
* @since 7.2.0
*/
public void init () {
if (initialized) {
return;
}

typeof (Granite.Settings).ensure ();

GLib.Intl.bindtextdomain (Granite.GETTEXT_PACKAGE, Granite.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (Granite.GETTEXT_PACKAGE, "UTF-8");
initialized = true;
Expand Down

0 comments on commit 2fa2311

Please sign in to comment.