/* importer.c generated by valac 0.36.1.19-ef50a4, the Vala compiler
 * generated from importer.vala, do not modify */

/* -*- Mode: vala; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * Copyright © 2016 Michael Catanzaro <mcatanzaro@gnome.org>
 *
 * This file is part of libgnome-games-support.
 *
 * libgnome-games-support is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * libgnome-games-support 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with libgnome-games-support.  If not, see <http://www.gnu.org/licenses/>.
 */

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


#define GAMES_SCORES_TYPE_IMPORTER (games_scores_importer_get_type ())
#define GAMES_SCORES_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_SCORES_TYPE_IMPORTER, GamesScoresImporter))
#define GAMES_SCORES_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_SCORES_TYPE_IMPORTER, GamesScoresImporterClass))
#define GAMES_SCORES_IS_IMPORTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_SCORES_TYPE_IMPORTER))
#define GAMES_SCORES_IS_IMPORTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_SCORES_TYPE_IMPORTER))
#define GAMES_SCORES_IMPORTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_SCORES_TYPE_IMPORTER, GamesScoresImporterClass))

typedef struct _GamesScoresImporter GamesScoresImporter;
typedef struct _GamesScoresImporterClass GamesScoresImporterClass;
typedef struct _GamesScoresImporterPrivate GamesScoresImporterPrivate;

#define GAMES_SCORES_TYPE_CONTEXT (games_scores_context_get_type ())
#define GAMES_SCORES_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_SCORES_TYPE_CONTEXT, GamesScoresContext))
#define GAMES_SCORES_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_SCORES_TYPE_CONTEXT, GamesScoresContextClass))
#define GAMES_SCORES_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_SCORES_TYPE_CONTEXT))
#define GAMES_SCORES_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_SCORES_TYPE_CONTEXT))
#define GAMES_SCORES_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_SCORES_TYPE_CONTEXT, GamesScoresContextClass))

typedef struct _GamesScoresContext GamesScoresContext;
typedef struct _GamesScoresContextClass GamesScoresContextClass;
enum  {
	GAMES_SCORES_IMPORTER_DUMMY_PROPERTY,
	GAMES_SCORES_IMPORTER_LAST_PROPERTY
};
static GParamSpec* games_scores_importer_properties[GAMES_SCORES_IMPORTER_LAST_PROPERTY];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

struct _GamesScoresImporter {
	GObject parent_instance;
	GamesScoresImporterPrivate * priv;
};

struct _GamesScoresImporterClass {
	GObjectClass parent_class;
	void (*importOldScores) (GamesScoresImporter* self, GamesScoresContext* context, GFile* new_scores_dir, GError** error);
};


static gpointer games_scores_importer_parent_class = NULL;

GType games_scores_importer_get_type (void) G_GNUC_CONST;
GType games_scores_context_get_type (void) G_GNUC_CONST;
void games_scores_importer_importOldScores (GamesScoresImporter* self, GamesScoresContext* context, GFile* new_scores_dir, GError** error);
static void games_scores_importer_real_importOldScores (GamesScoresImporter* self, GamesScoresContext* context, GFile* new_scores_dir, GError** error);
void games_scores_importer_run (GamesScoresImporter* self, GamesScoresContext* context, const gchar* new_scores_dir);
GamesScoresImporter* games_scores_importer_construct (GType object_type);


static void games_scores_importer_real_importOldScores (GamesScoresImporter* self, GamesScoresContext* context, GFile* new_scores_dir, GError** error) {
#line 68 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	g_critical ("Type `%s' does not implement abstract method `games_scores_importer_importOldScores'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
#line 68 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	return;
#line 86 "importer.c"
}


void games_scores_importer_importOldScores (GamesScoresImporter* self, GamesScoresContext* context, GFile* new_scores_dir, GError** error) {
#line 68 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	g_return_if_fail (self != NULL);
#line 68 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	GAMES_SCORES_IMPORTER_GET_CLASS (self)->importOldScores (self, context, new_scores_dir, error);
#line 95 "importer.c"
}


void games_scores_importer_run (GamesScoresImporter* self, GamesScoresContext* context, const gchar* new_scores_dir) {
	GFile* new_dir;
	const gchar* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	gboolean _tmp3_;
	GError * _inner_error_ = NULL;
#line 70 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	g_return_if_fail (self != NULL);
#line 70 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	g_return_if_fail (context != NULL);
#line 70 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	g_return_if_fail (new_scores_dir != NULL);
#line 72 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	_tmp0_ = new_scores_dir;
#line 72 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	_tmp1_ = g_file_new_for_path (_tmp0_);
#line 72 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	new_dir = _tmp1_;
#line 73 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	_tmp2_ = new_dir;
#line 73 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	_tmp3_ = g_file_query_exists (_tmp2_, NULL);
#line 73 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	if (_tmp3_) {
#line 74 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_g_object_unref0 (new_dir);
#line 74 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		return;
#line 128 "importer.c"
	}
	{
		GFile* _tmp4_;
		GamesScoresContext* _tmp5_;
		GFile* _tmp6_;
#line 78 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_tmp4_ = new_dir;
#line 78 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		g_file_make_directory_with_parents (_tmp4_, NULL, &_inner_error_);
#line 78 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 140 "importer.c"
			goto __catch2_g_error;
		}
#line 79 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_tmp5_ = context;
#line 79 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_tmp6_ = new_dir;
#line 79 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		games_scores_importer_importOldScores (self, _tmp5_, _tmp6_, &_inner_error_);
#line 79 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 151 "importer.c"
			goto __catch2_g_error;
		}
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* e = NULL;
		GError* _tmp7_;
		const gchar* _tmp8_;
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		e = _inner_error_;
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_inner_error_ = NULL;
#line 83 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_tmp7_ = e;
#line 83 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_tmp8_ = _tmp7_->message;
#line 83 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		g_warning ("importer.vala:83: Failed to import scores: %s", _tmp8_);
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_g_error_free0 (e);
#line 173 "importer.c"
	}
	__finally2:
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	if (G_UNLIKELY (_inner_error_ != NULL)) {
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		_g_object_unref0 (new_dir);
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		g_clear_error (&_inner_error_);
#line 76 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
		return;
#line 186 "importer.c"
	}
#line 70 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	_g_object_unref0 (new_dir);
#line 190 "importer.c"
}


GamesScoresImporter* games_scores_importer_construct (GType object_type) {
	GamesScoresImporter * self = NULL;
#line 66 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	self = (GamesScoresImporter*) g_object_new (object_type, NULL);
#line 66 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	return self;
#line 200 "importer.c"
}


static void games_scores_importer_class_init (GamesScoresImporterClass * klass) {
#line 66 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	games_scores_importer_parent_class = g_type_class_peek_parent (klass);
#line 66 "/home/mcatanzaro/Projects/GNOME/libgnome-games-support/games/scores/importer.vala"
	((GamesScoresImporterClass *) klass)->importOldScores = (void (*) (GamesScoresImporter *, GamesScoresContext*, GFile*, GError**)) games_scores_importer_real_importOldScores;
#line 209 "importer.c"
}


static void games_scores_importer_instance_init (GamesScoresImporter * self) {
}


GType games_scores_importer_get_type (void) {
	static volatile gsize games_scores_importer_type_id__volatile = 0;
	if (g_once_init_enter (&games_scores_importer_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (GamesScoresImporterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_scores_importer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesScoresImporter), 0, (GInstanceInitFunc) games_scores_importer_instance_init, NULL };
		GType games_scores_importer_type_id;
		games_scores_importer_type_id = g_type_register_static (G_TYPE_OBJECT, "GamesScoresImporter", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&games_scores_importer_type_id__volatile, games_scores_importer_type_id);
	}
	return games_scores_importer_type_id__volatile;
}



