/* desktop-title.c generated by valac 0.36.9, the Vala compiler
 * generated from desktop-title.vala, do not modify */

/* This file is part of GNOME Games. License: GPL-3.0+.*/

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


#define GAMES_TYPE_DESKTOP_TITLE (games_desktop_title_get_type ())
#define GAMES_DESKTOP_TITLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_DESKTOP_TITLE, GamesDesktopTitle))
#define GAMES_DESKTOP_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_DESKTOP_TITLE, GamesDesktopTitleClass))
#define GAMES_IS_DESKTOP_TITLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_DESKTOP_TITLE))
#define GAMES_IS_DESKTOP_TITLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_DESKTOP_TITLE))
#define GAMES_DESKTOP_TITLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_DESKTOP_TITLE, GamesDesktopTitleClass))

typedef struct _GamesDesktopTitle GamesDesktopTitle;
typedef struct _GamesDesktopTitleClass GamesDesktopTitleClass;
typedef struct _GamesDesktopTitlePrivate GamesDesktopTitlePrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _GamesDesktopTitle {
	GObject parent_instance;
	GamesDesktopTitlePrivate * priv;
};

struct _GamesDesktopTitleClass {
	GObjectClass parent_class;
};

struct _GamesDesktopTitlePrivate {
	GDesktopAppInfo* app_info;
};


static gpointer games_desktop_title_parent_class = NULL;
static GamesTitleIface * games_desktop_title_games_title_parent_iface = NULL;
static GType games_desktop_title_type_id = 0;

GType games_desktop_title_get_type (void) G_GNUC_CONST;
#define GAMES_DESKTOP_TITLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GAMES_TYPE_DESKTOP_TITLE, GamesDesktopTitlePrivate))
enum  {
	GAMES_DESKTOP_TITLE_0_PROPERTY
};
GamesDesktopTitle* games_desktop_title_new (GDesktopAppInfo* app_info);
GamesDesktopTitle* games_desktop_title_construct (GType object_type, GDesktopAppInfo* app_info);
static gchar* games_desktop_title_real_get_title (GamesTitle* base, GError** error);
static void games_desktop_title_finalize (GObject * obj);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


GamesDesktopTitle* games_desktop_title_construct (GType object_type, GDesktopAppInfo* app_info) {
	GamesDesktopTitle * self = NULL;
	GDesktopAppInfo* _tmp0_;
	GDesktopAppInfo* _tmp1_;
	g_return_val_if_fail (app_info != NULL, NULL);
	self = (GamesDesktopTitle*) g_object_new (object_type, NULL);
	_tmp0_ = app_info;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->app_info);
	self->priv->app_info = _tmp1_;
	return self;
}


GamesDesktopTitle* games_desktop_title_new (GDesktopAppInfo* app_info) {
	return games_desktop_title_construct (GAMES_TYPE_DESKTOP_TITLE, app_info);
}


static gchar* games_desktop_title_real_get_title (GamesTitle* base, GError** error) {
	GamesDesktopTitle * self;
	gchar* result = NULL;
	GDesktopAppInfo* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (GamesDesktopTitle*) base;
	_tmp0_ = self->priv->app_info;
	_tmp1_ = g_app_info_get_name ((GAppInfo*) _tmp0_);
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}


static void games_desktop_title_class_init (GamesDesktopTitleClass * klass) {
	games_desktop_title_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (GamesDesktopTitlePrivate));
	G_OBJECT_CLASS (klass)->finalize = games_desktop_title_finalize;
}


static void games_desktop_title_games_title_interface_init (GamesTitleIface * iface) {
	games_desktop_title_games_title_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_title = (gchar* (*) (GamesTitle *, GError**)) games_desktop_title_real_get_title;
}


static void games_desktop_title_instance_init (GamesDesktopTitle * self) {
	self->priv = GAMES_DESKTOP_TITLE_GET_PRIVATE (self);
}


static void games_desktop_title_finalize (GObject * obj) {
	GamesDesktopTitle * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GAMES_TYPE_DESKTOP_TITLE, GamesDesktopTitle);
	_g_object_unref0 (self->priv->app_info);
	G_OBJECT_CLASS (games_desktop_title_parent_class)->finalize (obj);
}


GType games_desktop_title_get_type (void) {
	return games_desktop_title_type_id;
}


GType games_desktop_title_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (GamesDesktopTitleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) games_desktop_title_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GamesDesktopTitle), 0, (GInstanceInitFunc) games_desktop_title_instance_init, NULL };
	static const GInterfaceInfo games_title_info = { (GInterfaceInitFunc) games_desktop_title_games_title_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	games_desktop_title_type_id = g_type_module_register_type (module, G_TYPE_OBJECT, "GamesDesktopTitle", &g_define_type_info, 0);
	g_type_module_add_interface (module, games_desktop_title_type_id, GAMES_TYPE_TITLE, &games_title_info);
	return games_desktop_title_type_id;
}



