/* IOHelper.c generated by valac 0.56.19, the Vala compiler
 * generated from IOHelper.vala, do not modify */

/*-
 * Copyright (c) 2017-2018 elementary LLC.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "desktop.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib-object.h>

#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

enum  {
	PANTHEON_SHELL_IO_HELPER_0_PROPERTY,
	PANTHEON_SHELL_IO_HELPER_NUM_PROPERTIES
};
static GParamSpec* pantheon_shell_io_helper_properties[PANTHEON_SHELL_IO_HELPER_NUM_PROPERTIES];

static gpointer pantheon_shell_io_helper_parent_class = NULL;

static GType pantheon_shell_io_helper_get_type_once (void);

static const gchar* PANTHEON_SHELL_IO_HELPER_ACCEPTED_TYPES[6] = {"image/gif", "image/heic", "image/jpeg", "image/png", "image/svg+xml", "image/tiff"};

gboolean
pantheon_shell_io_helper_is_valid_file_type (GFileInfo* file_info)
{
	gboolean result;
	g_return_val_if_fail (file_info != NULL, FALSE);
	if (g_file_info_get_file_type (file_info) != G_FILE_TYPE_REGULAR) {
		result = FALSE;
		return result;
	}
	{
		const gchar** type_collection = NULL;
		gint type_collection_length1 = 0;
		gint _type_collection_size_ = 0;
		gint type_it = 0;
		type_collection = PANTHEON_SHELL_IO_HELPER_ACCEPTED_TYPES;
		type_collection_length1 = G_N_ELEMENTS (PANTHEON_SHELL_IO_HELPER_ACCEPTED_TYPES);
		for (type_it = 0; type_it < type_collection_length1; type_it = type_it + 1) {
			const gchar* type = NULL;
			type = type_collection[type_it];
			{
				const gchar* _tmp0_;
				const gchar* _tmp1_;
				_tmp0_ = g_file_info_get_content_type (file_info);
				_tmp1_ = type;
				if (g_content_type_equals (_tmp0_, _tmp1_)) {
					result = TRUE;
					return result;
				}
			}
		}
	}
	result = FALSE;
	return result;
}

PantheonShellIOHelper*
pantheon_shell_io_helper_construct (GType object_type)
{
	PantheonShellIOHelper * self = NULL;
	self = (PantheonShellIOHelper*) g_object_new (object_type, NULL);
	return self;
}

PantheonShellIOHelper*
pantheon_shell_io_helper_new (void)
{
	return pantheon_shell_io_helper_construct (PANTHEON_SHELL_TYPE_IO_HELPER);
}

static void
pantheon_shell_io_helper_class_init (PantheonShellIOHelperClass * klass,
                                     gpointer klass_data)
{
	pantheon_shell_io_helper_parent_class = g_type_class_peek_parent (klass);
}

static void
pantheon_shell_io_helper_instance_init (PantheonShellIOHelper * self,
                                        gpointer klass)
{
}

static GType
pantheon_shell_io_helper_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PantheonShellIOHelperClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pantheon_shell_io_helper_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PantheonShellIOHelper), 0, (GInstanceInitFunc) pantheon_shell_io_helper_instance_init, NULL };
	GType pantheon_shell_io_helper_type_id;
	pantheon_shell_io_helper_type_id = g_type_register_static (G_TYPE_OBJECT, "PantheonShellIOHelper", &g_define_type_info, 0);
	return pantheon_shell_io_helper_type_id;
}

GType
pantheon_shell_io_helper_get_type (void)
{
	static volatile gsize pantheon_shell_io_helper_type_id__once = 0;
	if (g_once_init_enter (&pantheon_shell_io_helper_type_id__once)) {
		GType pantheon_shell_io_helper_type_id;
		pantheon_shell_io_helper_type_id = pantheon_shell_io_helper_get_type_once ();
		g_once_init_leave (&pantheon_shell_io_helper_type_id__once, pantheon_shell_io_helper_type_id);
	}
	return pantheon_shell_io_helper_type_id__once;
}

