/* Init.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from Init.vala, do not modify */

/*
 * Copyright 2021 elementary, Inc. (https://elementary.io)
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#include <glib.h>
#include "granite-7.h"
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <glib/gi18n-lib.h>
#include <stdlib.h>
#include <string.h>

#define GRANITE_GETTEXT_PACKAGE "granite-7"
#define GRANITE_LOCALEDIR "/usr/share/locale"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

VALA_EXTERN gboolean granite_initialized;
gboolean granite_initialized = FALSE;

 G_GNUC_INTERNAL void granite_style_manager_init_for_display (GdkDisplay* display);
static void _granite_style_manager_init_for_display_gdk_display_manager_display_opened (GdkDisplayManager* _sender,
                                                                                 GdkDisplay* display,
                                                                                 gpointer self);

/**
     * 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
     */
static void
_granite_style_manager_init_for_display_gdk_display_manager_display_opened (GdkDisplayManager* _sender,
                                                                            GdkDisplay* display,
                                                                            gpointer self)
{
	granite_style_manager_init_for_display (display);
}

void
granite_init (void)
{
	GdkDisplayManager* display_manager = NULL;
	GdkDisplayManager* _tmp0_;
	GdkDisplayManager* _tmp1_;
	GdkDisplayManager* _tmp2_;
	GSList* _tmp3_;
	if (granite_initialized) {
		return;
	}
	g_type_ensure (GRANITE_TYPE_SETTINGS);
	gtk_init ();
	_tmp0_ = gdk_display_manager_get ();
	display_manager = _tmp0_;
	_tmp1_ = display_manager;
	g_signal_connect (_tmp1_, "display-opened", (GCallback) _granite_style_manager_init_for_display_gdk_display_manager_display_opened, NULL);
	_tmp2_ = display_manager;
	_tmp3_ = gdk_display_manager_list_displays (_tmp2_);
	{
		GSList* display_collection = NULL;
		GSList* display_it = NULL;
		display_collection = _tmp3_;
		for (display_it = display_collection; display_it != NULL; display_it = display_it->next) {
			GdkDisplay* display = NULL;
			display = (GdkDisplay*) display_it->data;
			{
				GdkDisplay* _tmp4_;
				_tmp4_ = display;
				granite_style_manager_init_for_display (_tmp4_);
			}
		}
		(display_collection == NULL) ? NULL : (display_collection = (g_slist_free (display_collection), NULL));
	}
	bindtextdomain (GRANITE_GETTEXT_PACKAGE, GRANITE_LOCALEDIR);
	bind_textdomain_codeset (GRANITE_GETTEXT_PACKAGE, "UTF-8");
	granite_initialized = TRUE;
}

